Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5716397a authored by James Simmons's avatar James Simmons Committed by Greg Kroah-Hartman
Browse files

staging: lustre: lnet: change lnet_peer_t to proper structure



Change lnet_peer_t from typedef to proper structure.

Signed-off-by: default avatarJames Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/20831


Reviewed-by: default avatarOlaf Weber <olaf@sgi.com>
Reviewed-by: default avatarDoug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: default avatarDmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ff67f7f6
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -364,16 +364,16 @@ lnet_handle2me(struct lnet_handle_me *handle)
}

static inline void
lnet_peer_addref_locked(lnet_peer_t *lp)
lnet_peer_addref_locked(struct lnet_peer *lp)
{
	LASSERT(lp->lp_refcount > 0);
	lp->lp_refcount++;
}

void lnet_destroy_peer_locked(lnet_peer_t *lp);
void lnet_destroy_peer_locked(struct lnet_peer *lp);

static inline void
lnet_peer_decref_locked(lnet_peer_t *lp)
lnet_peer_decref_locked(struct lnet_peer *lp)
{
	LASSERT(lp->lp_refcount > 0);
	lp->lp_refcount--;
@@ -382,7 +382,7 @@ lnet_peer_decref_locked(lnet_peer_t *lp)
}

static inline int
lnet_isrouter(lnet_peer_t *lp)
lnet_isrouter(struct lnet_peer *lp)
{
	return lp->lp_rtr_refcount ? 1 : 0;
}
@@ -454,7 +454,7 @@ int lnet_lib_init(void);
void lnet_lib_exit(void);

int lnet_notify(struct lnet_ni *ni, lnet_nid_t peer, int alive, unsigned long when);
void lnet_notify_locked(lnet_peer_t *lp, int notifylnd, int alive,
void lnet_notify_locked(struct lnet_peer *lp, int notifylnd, int alive,
			unsigned long when);
int lnet_add_route(__u32 net, __u32 hops, lnet_nid_t gateway_nid,
		   unsigned int priority);
@@ -666,7 +666,7 @@ int lnet_peer_buffer_credits(struct lnet_ni *ni);

int lnet_router_checker_start(void);
void lnet_router_checker_stop(void);
void lnet_router_ni_update_locked(lnet_peer_t *gw, __u32 net);
void lnet_router_ni_update_locked(struct lnet_peer *gw, __u32 net);
void lnet_swap_pinginfo(struct lnet_ping_info *info);

int lnet_parse_ip2nets(char **networksp, char *ip2nets);
@@ -674,8 +674,8 @@ int lnet_parse_routes(char *route_str, int *im_a_router);
int lnet_parse_networks(struct list_head *nilist, char *networks);
int lnet_net_unique(__u32 net, struct list_head *nilist);

int lnet_nid2peer_locked(lnet_peer_t **lpp, lnet_nid_t nid, int cpt);
lnet_peer_t *lnet_find_peer_locked(struct lnet_peer_table *ptable,
int lnet_nid2peer_locked(struct lnet_peer **lpp, lnet_nid_t nid, int cpt);
struct lnet_peer *lnet_find_peer_locked(struct lnet_peer_table *ptable,
					lnet_nid_t nid);
void lnet_peer_tables_cleanup(struct lnet_ni *ni);
void lnet_peer_tables_destroy(void);
@@ -689,7 +689,7 @@ int lnet_get_peer_info(__u32 peer_index, __u64 *nid,
		       __u32 *peer_tx_qnob);

static inline void
lnet_peer_set_alive(lnet_peer_t *lp)
lnet_peer_set_alive(struct lnet_peer *lp)
{
	lp->lp_last_query = jiffies;
	lp->lp_last_alive = jiffies;
+3 −3
Original line number Diff line number Diff line
@@ -305,7 +305,7 @@ struct lnet_rc_data {
	struct lnet_ping_info	*rcd_pinginfo;	/* ping buffer */
};

typedef struct lnet_peer {
struct lnet_peer {
	struct list_head	 lp_hashlist;	/* chain on peer hash */
	struct list_head	 lp_txq;	/* messages blocking for
						   tx credits */
@@ -346,7 +346,7 @@ typedef struct lnet_peer {
	unsigned int		 lp_ping_feats;
	struct list_head	 lp_routes;	/* routers on this peer */
	struct lnet_rc_data	*lp_rcd;	/* router checker state */
} lnet_peer_t;
};

/* peer hash size */
#define LNET_PEER_HASH_BITS	9
@@ -372,7 +372,7 @@ struct lnet_peer_table {
typedef struct {
	struct list_head	 lr_list;	/* chain on net */
	struct list_head	 lr_gwlist;	/* chain on gateway */
	lnet_peer_t		*lr_gateway;	/* router node */
	struct lnet_peer	*lr_gateway;	/* router node */
	__u32			 lr_net;	/* remote network number */
	int			 lr_seq;	/* sequence for round-robin */
	unsigned int		 lr_downis;	/* number of down NIs */
+10 −10
Original line number Diff line number Diff line
@@ -489,7 +489,7 @@ lnet_ni_eager_recv(struct lnet_ni *ni, struct lnet_msg *msg)

/* NB: caller shall hold a ref on 'lp' as I'd drop lnet_net_lock */
static void
lnet_ni_query_locked(struct lnet_ni *ni, lnet_peer_t *lp)
lnet_ni_query_locked(struct lnet_ni *ni, struct lnet_peer *lp)
{
	unsigned long last_alive = 0;

@@ -508,7 +508,7 @@ lnet_ni_query_locked(struct lnet_ni *ni, lnet_peer_t *lp)

/* NB: always called with lnet_net_lock held */
static inline int
lnet_peer_is_alive(lnet_peer_t *lp, unsigned long now)
lnet_peer_is_alive(struct lnet_peer *lp, unsigned long now)
{
	int alive;
	unsigned long deadline;
@@ -542,7 +542,7 @@ lnet_peer_is_alive(lnet_peer_t *lp, unsigned long now)
 *     may drop the lnet_net_lock
 */
static int
lnet_peer_alive_locked(lnet_peer_t *lp)
lnet_peer_alive_locked(struct lnet_peer *lp)
{
	unsigned long now = cfs_time_current();

@@ -598,7 +598,7 @@ lnet_peer_alive_locked(lnet_peer_t *lp)
static int
lnet_post_send_locked(struct lnet_msg *msg, int do_send)
{
	lnet_peer_t *lp = msg->msg_txpeer;
	struct lnet_peer *lp = msg->msg_txpeer;
	struct lnet_ni *ni = lp->lp_ni;
	int cpt = msg->msg_tx_cpt;
	struct lnet_tx_queue *tq = ni->ni_tx_queues[cpt];
@@ -709,7 +709,7 @@ lnet_post_routed_recv_locked(struct lnet_msg *msg, int do_recv)
	 * I return LNET_CREDIT_WAIT if msg blocked and LNET_CREDIT_OK if
	 * received or OK to receive
	 */
	lnet_peer_t *lp = msg->msg_rxpeer;
	struct lnet_peer *lp = msg->msg_rxpeer;
	lnet_rtrbufpool_t *rbp;
	lnet_rtrbuf_t *rb;

@@ -779,7 +779,7 @@ lnet_post_routed_recv_locked(struct lnet_msg *msg, int do_recv)
void
lnet_return_tx_credits_locked(struct lnet_msg *msg)
{
	lnet_peer_t *txpeer = msg->msg_txpeer;
	struct lnet_peer *txpeer = msg->msg_txpeer;
	struct lnet_msg *msg2;

	if (msg->msg_txcredit) {
@@ -874,7 +874,7 @@ lnet_drop_routed_msgs_locked(struct list_head *list, int cpt)
void
lnet_return_rx_credits_locked(struct lnet_msg *msg)
{
	lnet_peer_t *rxpeer = msg->msg_rxpeer;
	struct lnet_peer *rxpeer = msg->msg_rxpeer;
	struct lnet_msg *msg2;

	if (msg->msg_rtrcredit) {
@@ -959,8 +959,8 @@ lnet_return_rx_credits_locked(struct lnet_msg *msg)
static int
lnet_compare_routes(lnet_route_t *r1, lnet_route_t *r2)
{
	lnet_peer_t *p1 = r1->lr_gateway;
	lnet_peer_t *p2 = r2->lr_gateway;
	struct lnet_peer *p1 = r1->lr_gateway;
	struct lnet_peer *p2 = r2->lr_gateway;
	int r1_hops = (r1->lr_hops == LNET_UNDEFINED_HOPS) ? 1 : r1->lr_hops;
	int r2_hops = (r2->lr_hops == LNET_UNDEFINED_HOPS) ? 1 : r2->lr_hops;

@@ -994,7 +994,7 @@ lnet_compare_routes(lnet_route_t *r1, lnet_route_t *r2)
	return -ERANGE;
}

static lnet_peer_t *
static struct lnet_peer *
lnet_find_route_locked(struct lnet_ni *ni, lnet_nid_t target,
		       lnet_nid_t rtr_nid)
{
+15 −15
Original line number Diff line number Diff line
@@ -105,8 +105,8 @@ lnet_peer_table_cleanup_locked(struct lnet_ni *ni,
			       struct lnet_peer_table *ptable)
{
	int i;
	lnet_peer_t *lp;
	lnet_peer_t *tmp;
	struct lnet_peer *lp;
	struct lnet_peer *tmp;

	for (i = 0; i < LNET_PEER_HASH_SIZE; i++) {
		list_for_each_entry_safe(lp, tmp, &ptable->pt_hash[i],
@@ -146,8 +146,8 @@ lnet_peer_table_del_rtrs_locked(struct lnet_ni *ni,
				struct lnet_peer_table *ptable,
				int cpt_locked)
{
	lnet_peer_t *lp;
	lnet_peer_t *tmp;
	struct lnet_peer *lp;
	struct lnet_peer *tmp;
	lnet_nid_t lp_nid;
	int i;

@@ -174,8 +174,8 @@ lnet_peer_tables_cleanup(struct lnet_ni *ni)
{
	struct lnet_peer_table *ptable;
	struct list_head deathrow;
	lnet_peer_t *lp;
	lnet_peer_t *temp;
	struct lnet_peer *lp;
	struct lnet_peer *temp;
	int i;

	INIT_LIST_HEAD(&deathrow);
@@ -216,7 +216,7 @@ lnet_peer_tables_cleanup(struct lnet_ni *ni)
}

void
lnet_destroy_peer_locked(lnet_peer_t *lp)
lnet_destroy_peer_locked(struct lnet_peer *lp)
{
	struct lnet_peer_table *ptable;

@@ -238,11 +238,11 @@ lnet_destroy_peer_locked(lnet_peer_t *lp)
	ptable->pt_zombies--;
}

lnet_peer_t *
struct lnet_peer *
lnet_find_peer_locked(struct lnet_peer_table *ptable, lnet_nid_t nid)
{
	struct list_head *peers;
	lnet_peer_t *lp;
	struct lnet_peer *lp;

	LASSERT(!the_lnet.ln_shutdown);

@@ -258,11 +258,11 @@ lnet_find_peer_locked(struct lnet_peer_table *ptable, lnet_nid_t nid)
}

int
lnet_nid2peer_locked(lnet_peer_t **lpp, lnet_nid_t nid, int cpt)
lnet_nid2peer_locked(struct lnet_peer **lpp, lnet_nid_t nid, int cpt)
{
	struct lnet_peer_table *ptable;
	lnet_peer_t *lp = NULL;
	lnet_peer_t *lp2;
	struct lnet_peer *lp = NULL;
	struct lnet_peer *lp2;
	int cpt2;
	int rc = 0;

@@ -282,7 +282,7 @@ lnet_nid2peer_locked(lnet_peer_t **lpp, lnet_nid_t nid, int cpt)

	if (!list_empty(&ptable->pt_deathrow)) {
		lp = list_entry(ptable->pt_deathrow.next,
				lnet_peer_t, lp_hashlist);
				struct lnet_peer, lp_hashlist);
		list_del(&lp->lp_hashlist);
	}

@@ -364,7 +364,7 @@ void
lnet_debug_peer(lnet_nid_t nid)
{
	char *aliveness = "NA";
	lnet_peer_t *lp;
	struct lnet_peer *lp;
	int rc;
	int cpt;

@@ -401,7 +401,7 @@ lnet_get_peer_info(__u32 peer_index, __u64 *nid,
		   __u32 *peer_tx_qnob)
{
	struct lnet_peer_table *peer_table;
	lnet_peer_t *lp;
	struct lnet_peer *lp;
	bool found = false;
	int lncpt, j;

+15 −15
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@ lnet_peers_start_down(void)
}

void
lnet_notify_locked(lnet_peer_t *lp, int notifylnd, int alive,
lnet_notify_locked(struct lnet_peer *lp, int notifylnd, int alive,
		   unsigned long when)
{
	if (time_before(when, lp->lp_timestamp)) { /* out of date information */
@@ -128,7 +128,7 @@ lnet_notify_locked(lnet_peer_t *lp, int notifylnd, int alive,
}

static void
lnet_ni_notify_locked(struct lnet_ni *ni, lnet_peer_t *lp)
lnet_ni_notify_locked(struct lnet_ni *ni, struct lnet_peer *lp)
{
	int alive;
	int notifylnd;
@@ -167,7 +167,7 @@ lnet_ni_notify_locked(struct lnet_ni *ni, lnet_peer_t *lp)
}

static void
lnet_rtr_addref_locked(lnet_peer_t *lp)
lnet_rtr_addref_locked(struct lnet_peer *lp)
{
	LASSERT(lp->lp_refcount > 0);
	LASSERT(lp->lp_rtr_refcount >= 0);
@@ -179,9 +179,9 @@ lnet_rtr_addref_locked(lnet_peer_t *lp)

		/* a simple insertion sort */
		list_for_each_prev(pos, &the_lnet.ln_routers) {
			lnet_peer_t *rtr = list_entry(pos, lnet_peer_t,
						      lp_rtr_list);
			struct lnet_peer *rtr;

			rtr = list_entry(pos, struct lnet_peer, lp_rtr_list);
			if (rtr->lp_nid < lp->lp_nid)
				break;
		}
@@ -194,7 +194,7 @@ lnet_rtr_addref_locked(lnet_peer_t *lp)
}

static void
lnet_rtr_decref_locked(lnet_peer_t *lp)
lnet_rtr_decref_locked(struct lnet_peer *lp)
{
	LASSERT(lp->lp_refcount > 0);
	LASSERT(lp->lp_rtr_refcount > 0);
@@ -791,7 +791,7 @@ lnet_router_checker_event(lnet_event_t *event)
static void
lnet_wait_known_routerstate(void)
{
	lnet_peer_t *rtr;
	struct lnet_peer *rtr;
	struct list_head *entry;
	int all_known;

@@ -802,7 +802,7 @@ lnet_wait_known_routerstate(void)

		all_known = 1;
		list_for_each(entry, &the_lnet.ln_routers) {
			rtr = list_entry(entry, lnet_peer_t, lp_rtr_list);
			rtr = list_entry(entry,struct lnet_peer, lp_rtr_list);

			if (!rtr->lp_alive_count) {
				all_known = 0;
@@ -821,7 +821,7 @@ lnet_wait_known_routerstate(void)
}

void
lnet_router_ni_update_locked(lnet_peer_t *gw, __u32 net)
lnet_router_ni_update_locked(struct lnet_peer *gw, __u32 net)
{
	lnet_route_t *rte;

@@ -899,7 +899,7 @@ lnet_destroy_rc_data(struct lnet_rc_data *rcd)
}

static struct lnet_rc_data *
lnet_create_rc_data_locked(lnet_peer_t *gateway)
lnet_create_rc_data_locked(struct lnet_peer *gateway)
{
	struct lnet_rc_data *rcd = NULL;
	struct lnet_ping_info *pi;
@@ -969,7 +969,7 @@ lnet_create_rc_data_locked(lnet_peer_t *gateway)
}

static int
lnet_router_check_interval(lnet_peer_t *rtr)
lnet_router_check_interval(struct lnet_peer *rtr)
{
	int secs;

@@ -982,7 +982,7 @@ lnet_router_check_interval(lnet_peer_t *rtr)
}

static void
lnet_ping_router_locked(lnet_peer_t *rtr)
lnet_ping_router_locked(struct lnet_peer *rtr)
{
	struct lnet_rc_data *rcd = NULL;
	unsigned long now = cfs_time_current();
@@ -1126,7 +1126,7 @@ lnet_prune_rc_data(int wait_unlink)
{
	struct lnet_rc_data *rcd;
	struct lnet_rc_data *tmp;
	lnet_peer_t *lp;
	struct lnet_peer *lp;
	struct list_head head;
	int i = 2;

@@ -1232,7 +1232,7 @@ lnet_router_checker_active(void)
static int
lnet_router_checker(void *arg)
{
	lnet_peer_t *rtr;
	struct lnet_peer *rtr;
	struct list_head *entry;

	cfs_block_allsigs();
@@ -1247,7 +1247,7 @@ lnet_router_checker(void *arg)
		version = the_lnet.ln_routers_version;

		list_for_each(entry, &the_lnet.ln_routers) {
			rtr = list_entry(entry, lnet_peer_t, lp_rtr_list);
			rtr = list_entry(entry, struct lnet_peer, lp_rtr_list);

			cpt2 = lnet_cpt_of_nid_locked(rtr->lp_nid);
			if (cpt != cpt2) {
Loading