Commit 7e7ab095 authored by Mike Shuey's avatar Mike Shuey Committed by Greg Kroah-Hartman

staging: lustre: lnet: lnet: code cleanups - variable declarations

Unify variable declarations to use a single space, and any other obvious
spacing flaws.
Signed-off-by: default avatarMike Shuey <shuey@purdue.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4f445e63
...@@ -143,10 +143,10 @@ lnet_connect(struct socket **sockp, lnet_nid_t peer_nid, ...@@ -143,10 +143,10 @@ lnet_connect(struct socket **sockp, lnet_nid_t peer_nid,
__u32 local_ip, __u32 peer_ip, int peer_port) __u32 local_ip, __u32 peer_ip, int peer_port)
{ {
lnet_acceptor_connreq_t cr; lnet_acceptor_connreq_t cr;
struct socket *sock; struct socket *sock;
int rc; int rc;
int port; int port;
int fatal; int fatal;
CLASSERT(sizeof(cr) <= 16); /* not too big to be on the stack */ CLASSERT(sizeof(cr) <= 16); /* not too big to be on the stack */
...@@ -211,12 +211,12 @@ static int ...@@ -211,12 +211,12 @@ static int
lnet_accept(struct socket *sock, __u32 magic) lnet_accept(struct socket *sock, __u32 magic)
{ {
lnet_acceptor_connreq_t cr; lnet_acceptor_connreq_t cr;
__u32 peer_ip; __u32 peer_ip;
int peer_port; int peer_port;
int rc; int rc;
int flip; int flip;
lnet_ni_t *ni; lnet_ni_t *ni;
char *str; char *str;
LASSERT(sizeof(cr) <= 16); /* not too big for the stack */ LASSERT(sizeof(cr) <= 16); /* not too big for the stack */
...@@ -333,11 +333,11 @@ static int ...@@ -333,11 +333,11 @@ static int
lnet_acceptor(void *arg) lnet_acceptor(void *arg)
{ {
struct socket *newsock; struct socket *newsock;
int rc; int rc;
__u32 magic; __u32 magic;
__u32 peer_ip; __u32 peer_ip;
int peer_port; int peer_port;
int secure = (int)((long_ptr_t)arg); int secure = (int)((long_ptr_t)arg);
LASSERT(lnet_acceptor_state.pta_sock == NULL); LASSERT(lnet_acceptor_state.pta_sock == NULL);
...@@ -444,7 +444,7 @@ accept2secure(const char *acc, long *sec) ...@@ -444,7 +444,7 @@ accept2secure(const char *acc, long *sec)
int int
lnet_acceptor_start(void) lnet_acceptor_start(void)
{ {
int rc; int rc;
long rc2; long rc2;
long secure; long secure;
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#define D_LNI D_CONSOLE #define D_LNI D_CONSOLE
lnet_t the_lnet; /* THE state of the network */ lnet_t the_lnet; /* THE state of the network */
EXPORT_SYMBOL(the_lnet); EXPORT_SYMBOL(the_lnet);
...@@ -70,8 +70,8 @@ lnet_get_routes(void) ...@@ -70,8 +70,8 @@ lnet_get_routes(void)
static char * static char *
lnet_get_networks(void) lnet_get_networks(void)
{ {
char *nets; char *nets;
int rc; int rc;
if (*networks != 0 && *ip2nets != 0) { if (*networks != 0 && *ip2nets != 0) {
LCONSOLE_ERROR_MSG(0x101, "Please specify EITHER 'networks' or 'ip2nets' but not both at once\n"); LCONSOLE_ERROR_MSG(0x101, "Please specify EITHER 'networks' or 'ip2nets' but not both at once\n");
...@@ -107,8 +107,8 @@ lnet_fini_locks(void) ...@@ -107,8 +107,8 @@ lnet_fini_locks(void)
static int static int
lnet_create_remote_nets_table(void) lnet_create_remote_nets_table(void)
{ {
int i; int i;
struct list_head *hash; struct list_head *hash;
LASSERT(the_lnet.ln_remote_nets_hash == NULL); LASSERT(the_lnet.ln_remote_nets_hash == NULL);
LASSERT(the_lnet.ln_remote_nets_hbits > 0); LASSERT(the_lnet.ln_remote_nets_hbits > 0);
...@@ -273,8 +273,8 @@ static void lnet_assert_wire_constants(void) ...@@ -273,8 +273,8 @@ static void lnet_assert_wire_constants(void)
static lnd_t * static lnd_t *
lnet_find_lnd_by_type(int type) lnet_find_lnd_by_type(int type)
{ {
lnd_t *lnd; lnd_t *lnd;
struct list_head *tmp; struct list_head *tmp;
/* holding lnd mutex */ /* holding lnd mutex */
list_for_each(tmp, &the_lnet.ln_lnds) { list_for_each(tmp, &the_lnet.ln_lnds) {
...@@ -325,7 +325,7 @@ void ...@@ -325,7 +325,7 @@ void
lnet_counters_get(lnet_counters_t *counters) lnet_counters_get(lnet_counters_t *counters)
{ {
lnet_counters_t *ctr; lnet_counters_t *ctr;
int i; int i;
memset(counters, 0, sizeof(*counters)); memset(counters, 0, sizeof(*counters));
...@@ -353,7 +353,7 @@ void ...@@ -353,7 +353,7 @@ void
lnet_counters_reset(void) lnet_counters_reset(void)
{ {
lnet_counters_t *counters; lnet_counters_t *counters;
int i; int i;
lnet_net_lock(LNET_LOCK_EX); lnet_net_lock(LNET_LOCK_EX);
...@@ -396,8 +396,8 @@ lnet_freelist_init(lnet_freelist_t *fl, int n, int size) ...@@ -396,8 +396,8 @@ lnet_freelist_init(lnet_freelist_t *fl, int n, int size)
void void
lnet_freelist_fini(lnet_freelist_t *fl) lnet_freelist_fini(lnet_freelist_t *fl)
{ {
struct list_head *el; struct list_head *el;
int count; int count;
if (fl->fl_nobjs == 0) if (fl->fl_nobjs == 0)
return; return;
...@@ -441,7 +441,7 @@ lnet_res_type2str(int type) ...@@ -441,7 +441,7 @@ lnet_res_type2str(int type)
static void static void
lnet_res_container_cleanup(struct lnet_res_container *rec) lnet_res_container_cleanup(struct lnet_res_container *rec)
{ {
int count = 0; int count = 0;
if (rec->rec_type == 0) /* not set yet, it's uninitialized */ if (rec->rec_type == 0) /* not set yet, it's uninitialized */
return; return;
...@@ -486,8 +486,8 @@ static int ...@@ -486,8 +486,8 @@ static int
lnet_res_container_setup(struct lnet_res_container *rec, lnet_res_container_setup(struct lnet_res_container *rec,
int cpt, int type, int objnum, int objsz) int cpt, int type, int objnum, int objsz)
{ {
int rc = 0; int rc = 0;
int i; int i;
LASSERT(rec->rec_type == 0); LASSERT(rec->rec_type == 0);
...@@ -525,8 +525,8 @@ lnet_res_container_setup(struct lnet_res_container *rec, ...@@ -525,8 +525,8 @@ lnet_res_container_setup(struct lnet_res_container *rec,
static void static void
lnet_res_containers_destroy(struct lnet_res_container **recs) lnet_res_containers_destroy(struct lnet_res_container **recs)
{ {
struct lnet_res_container *rec; struct lnet_res_container *rec;
int i; int i;
cfs_percpt_for_each(rec, i, recs) cfs_percpt_for_each(rec, i, recs)
lnet_res_container_cleanup(rec); lnet_res_container_cleanup(rec);
...@@ -537,10 +537,10 @@ lnet_res_containers_destroy(struct lnet_res_container **recs) ...@@ -537,10 +537,10 @@ lnet_res_containers_destroy(struct lnet_res_container **recs)
static struct lnet_res_container ** static struct lnet_res_container **
lnet_res_containers_create(int type, int objnum, int objsz) lnet_res_containers_create(int type, int objnum, int objsz)
{ {
struct lnet_res_container **recs; struct lnet_res_container **recs;
struct lnet_res_container *rec; struct lnet_res_container *rec;
int rc; int rc;
int i; int i;
recs = cfs_percpt_alloc(lnet_cpt_table(), sizeof(*rec)); recs = cfs_percpt_alloc(lnet_cpt_table(), sizeof(*rec));
if (recs == NULL) { if (recs == NULL) {
...@@ -564,9 +564,9 @@ lnet_libhandle_t * ...@@ -564,9 +564,9 @@ lnet_libhandle_t *
lnet_res_lh_lookup(struct lnet_res_container *rec, __u64 cookie) lnet_res_lh_lookup(struct lnet_res_container *rec, __u64 cookie)
{ {
/* ALWAYS called with lnet_res_lock held */ /* ALWAYS called with lnet_res_lock held */
struct list_head *head; struct list_head *head;
lnet_libhandle_t *lh; lnet_libhandle_t *lh;
unsigned int hash; unsigned int hash;
if ((cookie & LNET_COOKIE_MASK) != rec->rec_type) if ((cookie & LNET_COOKIE_MASK) != rec->rec_type)
return NULL; return NULL;
...@@ -586,8 +586,8 @@ void ...@@ -586,8 +586,8 @@ void
lnet_res_lh_initialize(struct lnet_res_container *rec, lnet_libhandle_t *lh) lnet_res_lh_initialize(struct lnet_res_container *rec, lnet_libhandle_t *lh)
{ {
/* ALWAYS called with lnet_res_lock held */ /* ALWAYS called with lnet_res_lock held */
unsigned int ibits = LNET_COOKIE_TYPE_BITS + LNET_CPT_BITS; unsigned int ibits = LNET_COOKIE_TYPE_BITS + LNET_CPT_BITS;
unsigned int hash; unsigned int hash;
lh->lh_cookie = rec->rec_lh_cookie; lh->lh_cookie = rec->rec_lh_cookie;
rec->rec_lh_cookie += 1 << ibits; rec->rec_lh_cookie += 1 << ibits;
...@@ -605,7 +605,7 @@ lnet_prepare(lnet_pid_t requested_pid) ...@@ -605,7 +605,7 @@ lnet_prepare(lnet_pid_t requested_pid)
{ {
/* Prepare to bring up the network */ /* Prepare to bring up the network */
struct lnet_res_container **recs; struct lnet_res_container **recs;
int rc = 0; int rc = 0;
LASSERT(the_lnet.ln_refcount == 0); LASSERT(the_lnet.ln_refcount == 0);
...@@ -725,8 +725,8 @@ lnet_unprepare(void) ...@@ -725,8 +725,8 @@ lnet_unprepare(void)
lnet_ni_t * lnet_ni_t *
lnet_net2ni_locked(__u32 net, int cpt) lnet_net2ni_locked(__u32 net, int cpt)
{ {
struct list_head *tmp; struct list_head *tmp;
lnet_ni_t *ni; lnet_ni_t *ni;
LASSERT(cpt != LNET_LOCK_EX); LASSERT(cpt != LNET_LOCK_EX);
...@@ -758,8 +758,8 @@ EXPORT_SYMBOL(lnet_net2ni); ...@@ -758,8 +758,8 @@ EXPORT_SYMBOL(lnet_net2ni);
static unsigned int static unsigned int
lnet_nid_cpt_hash(lnet_nid_t nid, unsigned int number) lnet_nid_cpt_hash(lnet_nid_t nid, unsigned int number)
{ {
__u64 key = nid; __u64 key = nid;
unsigned int val; unsigned int val;
LASSERT(number >= 1 && number <= LNET_CPT_NUMBER); LASSERT(number >= 1 && number <= LNET_CPT_NUMBER);
...@@ -801,8 +801,8 @@ lnet_cpt_of_nid_locked(lnet_nid_t nid) ...@@ -801,8 +801,8 @@ lnet_cpt_of_nid_locked(lnet_nid_t nid)
int int
lnet_cpt_of_nid(lnet_nid_t nid) lnet_cpt_of_nid(lnet_nid_t nid)
{ {
int cpt; int cpt;
int cpt2; int cpt2;
if (LNET_CPT_NUMBER == 1) if (LNET_CPT_NUMBER == 1)
return 0; /* the only one */ return 0; /* the only one */
...@@ -821,8 +821,8 @@ EXPORT_SYMBOL(lnet_cpt_of_nid); ...@@ -821,8 +821,8 @@ EXPORT_SYMBOL(lnet_cpt_of_nid);
int int
lnet_islocalnet(__u32 net) lnet_islocalnet(__u32 net)
{ {
struct lnet_ni *ni; struct lnet_ni *ni;
int cpt; int cpt;
cpt = lnet_net_lock_current(); cpt = lnet_net_lock_current();
...@@ -838,8 +838,8 @@ lnet_islocalnet(__u32 net) ...@@ -838,8 +838,8 @@ lnet_islocalnet(__u32 net)
lnet_ni_t * lnet_ni_t *
lnet_nid2ni_locked(lnet_nid_t nid, int cpt) lnet_nid2ni_locked(lnet_nid_t nid, int cpt)
{ {
struct lnet_ni *ni; struct lnet_ni *ni;
struct list_head *tmp; struct list_head *tmp;
LASSERT(cpt != LNET_LOCK_EX); LASSERT(cpt != LNET_LOCK_EX);
...@@ -858,8 +858,8 @@ lnet_nid2ni_locked(lnet_nid_t nid, int cpt) ...@@ -858,8 +858,8 @@ lnet_nid2ni_locked(lnet_nid_t nid, int cpt)
int int
lnet_islocalnid(lnet_nid_t nid) lnet_islocalnid(lnet_nid_t nid)
{ {
struct lnet_ni *ni; struct lnet_ni *ni;
int cpt; int cpt;
cpt = lnet_net_lock_current(); cpt = lnet_net_lock_current();
ni = lnet_nid2ni_locked(nid, cpt); ni = lnet_nid2ni_locked(nid, cpt);
...@@ -874,10 +874,10 @@ int ...@@ -874,10 +874,10 @@ int
lnet_count_acceptor_nis(void) lnet_count_acceptor_nis(void)
{ {
/* Return the # of NIs that need the acceptor. */ /* Return the # of NIs that need the acceptor. */
int count = 0; int count = 0;
struct list_head *tmp; struct list_head *tmp;
struct lnet_ni *ni; struct lnet_ni *ni;
int cpt; int cpt;
cpt = lnet_net_lock_current(); cpt = lnet_net_lock_current();
list_for_each(tmp, &the_lnet.ln_nis) { list_for_each(tmp, &the_lnet.ln_nis) {
...@@ -895,7 +895,7 @@ lnet_count_acceptor_nis(void) ...@@ -895,7 +895,7 @@ lnet_count_acceptor_nis(void)
static int static int
lnet_ni_tq_credits(lnet_ni_t *ni) lnet_ni_tq_credits(lnet_ni_t *ni)
{ {
int credits; int credits;
LASSERT(ni->ni_ncpts >= 1); LASSERT(ni->ni_ncpts >= 1);
...@@ -912,9 +912,9 @@ lnet_ni_tq_credits(lnet_ni_t *ni) ...@@ -912,9 +912,9 @@ lnet_ni_tq_credits(lnet_ni_t *ni)
static void static void
lnet_shutdown_lndnis(void) lnet_shutdown_lndnis(void)
{ {
int i; int i;
int islo; int islo;
lnet_ni_t *ni; lnet_ni_t *ni;
/* NB called holding the global mutex */ /* NB called holding the global mutex */
...@@ -968,8 +968,8 @@ lnet_shutdown_lndnis(void) ...@@ -968,8 +968,8 @@ lnet_shutdown_lndnis(void)
* and shut them down in guaranteed thread context */ * and shut them down in guaranteed thread context */
i = 2; i = 2;
while (!list_empty(&the_lnet.ln_nis_zombie)) { while (!list_empty(&the_lnet.ln_nis_zombie)) {
int *ref; int *ref;
int j; int j;
ni = list_entry(the_lnet.ln_nis_zombie.next, ni = list_entry(the_lnet.ln_nis_zombie.next,
lnet_ni_t, ni_list); lnet_ni_t, ni_list);
...@@ -1029,15 +1029,15 @@ lnet_shutdown_lndnis(void) ...@@ -1029,15 +1029,15 @@ lnet_shutdown_lndnis(void)
static int static int
lnet_startup_lndnis(void) lnet_startup_lndnis(void)
{ {
lnd_t *lnd; lnd_t *lnd;
struct lnet_ni *ni; struct lnet_ni *ni;
struct lnet_tx_queue *tq; struct lnet_tx_queue *tq;
struct list_head nilist; struct list_head nilist;
int i; int i;
int rc = 0; int rc = 0;
int lnd_type; int lnd_type;
int nicount = 0; int nicount = 0;
char *nets = lnet_get_networks(); char *nets = lnet_get_networks();
INIT_LIST_HEAD(&nilist); INIT_LIST_HEAD(&nilist);
...@@ -1181,7 +1181,7 @@ lnet_startup_lndnis(void) ...@@ -1181,7 +1181,7 @@ lnet_startup_lndnis(void)
int int
LNetInit(void) LNetInit(void)
{ {
int rc; int rc;
lnet_assert_wire_constants(); lnet_assert_wire_constants();
LASSERT(!the_lnet.ln_init); LASSERT(!the_lnet.ln_init);
...@@ -1277,8 +1277,8 @@ EXPORT_SYMBOL(LNetFini); ...@@ -1277,8 +1277,8 @@ EXPORT_SYMBOL(LNetFini);
int int
LNetNIInit(lnet_pid_t requested_pid) LNetNIInit(lnet_pid_t requested_pid)
{ {
int im_a_router = 0; int im_a_router = 0;
int rc; int rc;
LNET_MUTEX_LOCK(&the_lnet.ln_api_mutex); LNET_MUTEX_LOCK(&the_lnet.ln_api_mutex);
...@@ -1413,9 +1413,9 @@ int ...@@ -1413,9 +1413,9 @@ int
LNetCtl(unsigned int cmd, void *arg) LNetCtl(unsigned int cmd, void *arg)
{ {
struct libcfs_ioctl_data *data = arg; struct libcfs_ioctl_data *data = arg;
lnet_process_id_t id = {0}; lnet_process_id_t id = {0};
lnet_ni_t *ni; lnet_ni_t *ni;
int rc; int rc;
LASSERT(the_lnet.ln_init); LASSERT(the_lnet.ln_init);
LASSERT(the_lnet.ln_refcount > 0); LASSERT(the_lnet.ln_refcount > 0);
...@@ -1531,10 +1531,10 @@ EXPORT_SYMBOL(LNetCtl); ...@@ -1531,10 +1531,10 @@ EXPORT_SYMBOL(LNetCtl);
int int
LNetGetId(unsigned int index, lnet_process_id_t *id) LNetGetId(unsigned int index, lnet_process_id_t *id)
{ {
struct lnet_ni *ni; struct lnet_ni *ni;
struct list_head *tmp; struct list_head *tmp;
int cpt; int cpt;
int rc = -ENOENT; int rc = -ENOENT;
LASSERT(the_lnet.ln_init); LASSERT(the_lnet.ln_init);
...@@ -1575,11 +1575,11 @@ EXPORT_SYMBOL(LNetSnprintHandle); ...@@ -1575,11 +1575,11 @@ EXPORT_SYMBOL(LNetSnprintHandle);
static int static int
lnet_create_ping_info(void) lnet_create_ping_info(void)
{ {
int i; int i;
int n; int n;
int rc; int rc;
unsigned int infosz; unsigned int infosz;
lnet_ni_t *ni; lnet_ni_t *ni;
lnet_process_id_t id; lnet_process_id_t id;
lnet_ping_info_t *pinfo; lnet_ping_info_t *pinfo;
...@@ -1633,7 +1633,7 @@ lnet_create_ping_info(void) ...@@ -1633,7 +1633,7 @@ lnet_create_ping_info(void)
static void static void
lnet_destroy_ping_info(void) lnet_destroy_ping_info(void)
{ {
struct lnet_ni *ni; struct lnet_ni *ni;
lnet_net_lock(0); lnet_net_lock(0);
...@@ -1654,12 +1654,12 @@ lnet_destroy_ping_info(void) ...@@ -1654,12 +1654,12 @@ lnet_destroy_ping_info(void)
int int
lnet_ping_target_init(void) lnet_ping_target_init(void)
{ {
lnet_md_t md = { NULL }; lnet_md_t md = { NULL };
lnet_handle_me_t meh; lnet_handle_me_t meh;
lnet_process_id_t id; lnet_process_id_t id;
int rc; int rc;
int rc2; int rc2;
int infosz; int infosz;
rc = lnet_create_ping_info(); rc = lnet_create_ping_info();
if (rc != 0) if (rc != 0)
...@@ -1722,11 +1722,11 @@ lnet_ping_target_init(void) ...@@ -1722,11 +1722,11 @@ lnet_ping_target_init(void)
void void
lnet_ping_target_fini(void) lnet_ping_target_fini(void)
{ {
lnet_event_t event; lnet_event_t event;
int rc; int rc;
int which; int which;
int timeout_ms = 1000; int timeout_ms = 1000;
sigset_t blocked = cfs_block_allsigs(); sigset_t blocked = cfs_block_allsigs();
LNetMDUnlink(the_lnet.ln_ping_target_md); LNetMDUnlink(the_lnet.ln_ping_target_md);
/* NB md could be busy; this just starts the unlink */ /* NB md could be busy; this just starts the unlink */
...@@ -1759,22 +1759,22 @@ lnet_ping_target_fini(void) ...@@ -1759,22 +1759,22 @@ lnet_ping_target_fini(void)
int int
lnet_ping(lnet_process_id_t id, int timeout_ms, lnet_process_id_t *ids, int n_ids) lnet_ping(lnet_process_id_t id, int timeout_ms, lnet_process_id_t *ids, int n_ids)
{ {
lnet_handle_eq_t eqh; lnet_handle_eq_t eqh;
lnet_handle_md_t mdh; lnet_handle_md_t mdh;
lnet_event_t event; lnet_event_t event;
lnet_md_t md = { NULL }; lnet_md_t md = { NULL };
int which; int which;
int unlinked = 0; int unlinked = 0;
int replied = 0; int replied = 0;
const int a_long_time = 60000; /* mS */ const int a_long_time = 60000; /* mS */
int infosz = offsetof(lnet_ping_info_t, pi_ni[n_ids]); int infosz = offsetof(lnet_ping_info_t, pi_ni[n_ids]);
lnet_ping_info_t *info; lnet_ping_info_t *info;
lnet_process_id_t tmpid; lnet_process_id_t tmpid;
int i; int i;
int nob; int nob;
int rc; int rc;
int rc2; int rc2;
sigset_t blocked; sigset_t blocked;
if (n_ids <= 0 || if (n_ids <= 0 ||
id.nid == LNET_NID_ANY || id.nid == LNET_NID_ANY ||
......
...@@ -38,9 +38,9 @@ ...@@ -38,9 +38,9 @@
#include "../../include/linux/lnet/lib-lnet.h" #include "../../include/linux/lnet/lib-lnet.h"
struct lnet_text_buf_t { /* tmp struct for parsing routes */ struct lnet_text_buf_t { /* tmp struct for parsing routes */
struct list_head ltb_list; /* stash on lists */ struct list_head ltb_list; /* stash on lists */
int ltb_size; /* allocated size */ int ltb_size; /* allocated size */
char ltb_text[0]; /* text buffer */ char ltb_text[0]; /* text buffer */
}; };
static int lnet_tbnob; /* track text buf allocation */ static int lnet_tbnob; /* track text buf allocation */
...@@ -80,8 +80,8 @@ lnet_issep(char c) ...@@ -80,8 +80,8 @@ lnet_issep(char c)
static int static int
lnet_net_unique(__u32 net, struct list_head *nilist) lnet_net_unique(__u32 net, struct list_head *nilist)
{ {
struct list_head *tmp; struct list_head *tmp;
lnet_ni_t *ni; lnet_ni_t *ni;
list_for_each(tmp, nilist) { list_for_each(tmp, nilist) {
ni = list_entry(tmp, lnet_ni_t, ni_list); ni = list_entry(tmp, lnet_ni_t, ni_list);
...@@ -111,10 +111,10 @@ lnet_ni_free(struct lnet_ni *ni) ...@@ -111,10 +111,10 @@ lnet_ni_free(struct lnet_ni *ni)
static lnet_ni_t * static lnet_ni_t *
lnet_ni_alloc(__u32 net, struct cfs_expr_list *el, struct list_head *nilist) lnet_ni_alloc(__u32 net, struct cfs_expr_list *el, struct list_head *nilist)
{ {
struct lnet_tx_queue *tq; struct lnet_tx_queue *tq;
struct lnet_ni *ni; struct lnet_ni *ni;
int rc; int rc;
int i; int i;
if (!lnet_net_unique(net, nilist)) { if (!lnet_net_unique(net, nilist)) {
LCONSOLE_ERROR_MSG(0x111, "Duplicate network specified: %s\n", LCONSOLE_ERROR_MSG(0x111, "Duplicate network specified: %s\n",
...@@ -178,13 +178,13 @@ int ...@@ -178,13 +178,13 @@ int
lnet_parse_networks(struct list_head *nilist, char *networks) lnet_parse_networks(struct list_head *nilist, char *networks)
{ {
struct cfs_expr_list *el = NULL; struct cfs_expr_list *el = NULL;
int tokensize = strlen(networks) + 1; int tokensize = strlen(networks) + 1;
char *tokens; char *tokens;
char *str; char *str;
char *tmp; char *tmp;
struct lnet_ni *ni; struct lnet_ni *ni;
__u32 net; __u32 net;
int nnets = 0; int nnets = 0;
if (strlen(networks) > LNET_SINGLE_TEXTBUF_NOB) { if (strlen(networks) > LNET_SINGLE_TEXTBUF_NOB) {
/* _WAY_ conservative */ /* _WAY_ conservative */
...@@ -210,12 +210,12 @@ lnet_parse_networks(struct list_head *nilist, char *networks) ...@@ -210,12 +210,12 @@ lnet_parse_networks(struct list_head *nilist, char *networks)
goto failed; goto failed;
while (str != NULL && *str != 0) { while (str != NULL && *str != 0) {
char *comma = strchr(str, ','); char *comma = strchr(str, ',');
char *bracket = strchr(str, '('); char *bracket = strchr(str, '(');
char *square = strchr(str, '['); char *square = strchr(str, '[');
char *iface; char *iface;
int niface; int niface;
int rc; int rc;
/* NB we don't check interface conflicts here; it's the LNDs /* NB we don't check interface conflicts here; it's the LNDs
* responsibility (if it cares at all) */ * responsibility (if it cares at all) */
...@@ -369,7 +369,7 @@ static struct lnet_text_buf_t * ...@@ -369,7 +369,7 @@ static struct lnet_text_buf_t *
lnet_new_text_buf(int str_len) lnet_new_text_buf(int str_len)
{ {
struct lnet_text_buf_t *ltb; struct lnet_text_buf_t *ltb;
int nob; int nob;
/* NB allocate space for the terminating 0 */ /* NB allocate space for the terminating 0 */
nob = offsetof(struct lnet_text_buf_t, ltb_text[str_len + 1]); nob = offsetof(struct lnet_text_buf_t, ltb_text[str_len + 1]);
...@@ -404,7 +404,7 @@ lnet_free_text_buf(struct lnet_text_buf_t *ltb) ...@@ -404,7 +404,7 @@ lnet_free_text_buf(struct lnet_text_buf_t *ltb)
static void static void
lnet_free_text_bufs(struct list_head *tbs) lnet_free_text_bufs(struct list_head *tbs)
{ {
struct lnet_text_buf_t *ltb; struct lnet_text_buf_t *ltb;
while (!list_empty(tbs)) { while (!list_empty(tbs)) {
ltb = list_entry(tbs->next, struct lnet_text_buf_t, ltb_list); ltb = list_entry(tbs->next, struct lnet_text_buf_t, ltb_list);
...@@ -417,11 +417,11 @@ lnet_free_text_bufs(struct list_head *tbs) ...@@ -417,11 +417,11 @@ lnet_free_text_bufs(struct list_head *tbs)
static int static int
lnet_str2tbs_sep(struct list_head *tbs, char *str) lnet_str2tbs_sep(struct list_head *tbs, char *str)
{ {
struct list_head pending; struct list_head pending;
char *sep; char *sep;
int nob; int nob;
int i; int i;
struct lnet_text_buf_t *ltb; struct lnet_text_buf_t *ltb;
INIT_LIST_HEAD(&pending); INIT_LIST_HEAD(&pending);
...@@ -477,8 +477,8 @@ lnet_expand1tb(struct list_head *list, ...@@ -477,8 +477,8 @@ lnet_expand1tb(struct list_head *list,
char *str, char *sep1, char *sep2, char *str, char *sep1, char *sep2,
char *item, int itemlen) char *item, int itemlen)
{ {
int len1 = (int)(sep1 - str); int len1 = (int)(sep1 - str);
int len2 = strlen(sep2 + 1); int len2 = strlen(sep2 + 1);
struct lnet_text_buf_t *ltb; struct lnet_text_buf_t *ltb;
LASSERT(*sep1 == '['); LASSERT(*sep1 == '[');
...@@ -500,18 +500,18 @@ lnet_expand1tb(struct list_head *list, ...@@ -500,18 +500,18 @@ lnet_expand1tb(struct list_head *list,
static int static int
lnet_str2tbs_expand(struct list_head *tbs, char *str) lnet_str2tbs_expand(struct list_head *tbs, char *str)
{ {
char num[16]; char num[16];
struct list_head pending; struct list_head pending;
char *sep; char *sep;
char *sep2; char *sep2;
char *parsed; char *parsed;
char *enditem; char *enditem;
int lo; int lo;
int hi; int hi;
int stride; int stride;
int i; int i;
int nob; int nob;
int scanned; int scanned;
INIT_LIST_HEAD(&pending); INIT_LIST_HEAD(&pending);
...@@ -584,8 +584,8 @@ lnet_str2tbs_expand(struct list_head *tbs, char *str) ...@@ -584,8 +584,8 @@ lnet_str2tbs_expand(struct list_head *tbs, char *str)
static int static int
lnet_parse_hops(char *str, unsigned int *hops) lnet_parse_hops(char *str, unsigned int *hops)
{ {
int len = strlen(str); int len = strlen(str);
int nob = len; int nob = len;
return (sscanf(str, "%u%n", hops, &nob) >= 1 && return (sscanf(str, "%u%n", hops, &nob) >= 1 &&
nob == len && nob == len &&
...@@ -597,9 +597,9 @@ lnet_parse_hops(char *str, unsigned int *hops) ...@@ -597,9 +597,9 @@ lnet_parse_hops(char *str, unsigned int *hops)
static int static int
lnet_parse_priority(char *str, unsigned int *priority, char **token) lnet_parse_priority(char *str, unsigned int *priority, char **token)
{ {
int nob; int nob;
char *sep; char *sep;
int len; int len;
sep = strchr(str, LNET_PRIORITY_SEPARATOR); sep = strchr(str, LNET_PRIORITY_SEPARATOR);
if (sep == NULL) { if (sep == NULL) {
...@@ -628,23 +628,23 @@ static int ...@@ -628,23 +628,23 @@ static int
lnet_parse_route(char *str, int *im_a_router) lnet_parse_route(char *str, int *im_a_router)
{ {
/* static scratch buffer OK (single threaded) */ /* static scratch buffer OK (single threaded) */
static char cmd[LNET_SINGLE_TEXTBUF_NOB]; static char cmd[LNET_SINGLE_TEXTBUF_NOB];
struct list_head nets; struct list_head nets;
struct list_head gateways; struct list_head gateways;
struct list_head *tmp1; struct list_head *tmp1;
struct list_head *tmp2; struct list_head *tmp2;
__u32 net; __u32 net;
lnet_nid_t nid; lnet_nid_t nid;
struct lnet_text_buf_t *ltb; struct lnet_text_buf_t *ltb;
int rc; int rc;
char *sep; char *sep;
char *token = str; char *token = str;
int ntokens = 0; int ntokens = 0;
int myrc = -1; int myrc = -1;
unsigned int hops; unsigned int hops;
int got_hops = 0; int got_hops = 0;
unsigned int priority = 0; unsigned int priority = 0;
INIT_LIST_HEAD(&gateways); INIT_LIST_HEAD(&gateways);
INIT_LIST_HEAD(&nets); INIT_LIST_HEAD(&nets);
...@@ -772,7 +772,7 @@ lnet_parse_route(char *str, int *im_a_router) ...@@ -772,7 +772,7 @@ lnet_parse_route(char *str, int *im_a_router)
static int static int
lnet_parse_route_tbs(struct list_head *tbs, int *im_a_router) lnet_parse_route_tbs(struct list_head *tbs, int *im_a_router)
{ {
struct lnet_text_buf_t *ltb; struct lnet_text_buf_t *ltb;
while (!list_empty(tbs)) { while (!list_empty(tbs)) {
ltb = list_entry(tbs->next, struct lnet_text_buf_t, ltb_list); ltb = list_entry(tbs->next, struct lnet_text_buf_t, ltb_list);
...@@ -792,8 +792,8 @@ lnet_parse_route_tbs(struct list_head *tbs, int *im_a_router) ...@@ -792,8 +792,8 @@ lnet_parse_route_tbs(struct list_head *tbs, int *im_a_router)
int int
lnet_parse_routes(char *routes, int *im_a_router) lnet_parse_routes(char *routes, int *im_a_router)
{ {
struct list_head tbs; struct list_head tbs;
int rc = 0; int rc = 0;
*im_a_router = 0; *im_a_router = 0;
...@@ -814,8 +814,8 @@ static int ...@@ -814,8 +814,8 @@ static int
lnet_match_network_token(char *token, int len, __u32 *ipaddrs, int nip) lnet_match_network_token(char *token, int len, __u32 *ipaddrs, int nip)
{ {
LIST_HEAD(list); LIST_HEAD(list);
int rc; int rc;
int i; int i;
rc = cfs_ip_addr_parse(token, len, &list); rc = cfs_ip_addr_parse(token, len, &list);
if (rc != 0) if (rc != 0)
...@@ -834,13 +834,13 @@ lnet_match_network_tokens(char *net_entry, __u32 *ipaddrs, int nip) ...@@ -834,13 +834,13 @@ lnet_match_network_tokens(char *net_entry, __u32 *ipaddrs, int nip)
{ {
static char tokens[LNET_SINGLE_TEXTBUF_NOB]; static char tokens[LNET_SINGLE_TEXTBUF_NOB];
int matched = 0; int matched = 0;
int ntokens = 0; int ntokens = 0;
int len; int len;
char *net = NULL; char *net = NULL;
char *sep; char *sep;
char *token; char *token;
int rc; int rc;
LASSERT(strlen(net_entry) < sizeof(tokens)); LASSERT(strlen(net_entry) < sizeof(tokens));
...@@ -889,8 +889,8 @@ lnet_match_network_tokens(char *net_entry, __u32 *ipaddrs, int nip) ...@@ -889,8 +889,8 @@ lnet_match_network_tokens(char *net_entry, __u32 *ipaddrs, int nip)
static __u32 static __u32
lnet_netspec2net(char *netspec) lnet_netspec2net(char *netspec)
{ {
char *bracket = strchr(netspec, '('); char *bracket = strchr(netspec, '(');
__u32 net; __u32 net;
if (bracket != NULL) if (bracket != NULL)
*bracket = 0; *bracket = 0;
...@@ -906,15 +906,15 @@ lnet_netspec2net(char *netspec) ...@@ -906,15 +906,15 @@ lnet_netspec2net(char *netspec)
static int static int
lnet_splitnets(char *source, struct list_head *nets) lnet_splitnets(char *source, struct list_head *nets)
{ {
int offset = 0; int offset = 0;
int offset2; int offset2;
int len; int len;
struct lnet_text_buf_t *tb; struct lnet_text_buf_t *tb;
struct lnet_text_buf_t *tb2; struct lnet_text_buf_t *tb2;
struct list_head *t; struct list_head *t;
char *sep; char *sep;
char *bracket; char *bracket;
__u32 net; __u32 net;
LASSERT(!list_empty(nets)); LASSERT(!list_empty(nets));
LASSERT(nets->next == nets->prev); /* single entry */ LASSERT(nets->next == nets->prev); /* single entry */
...@@ -986,22 +986,22 @@ lnet_splitnets(char *source, struct list_head *nets) ...@@ -986,22 +986,22 @@ lnet_splitnets(char *source, struct list_head *nets)
static int static int
lnet_match_networks(char **networksp, char *ip2nets, __u32 *ipaddrs, int nip) lnet_match_networks(char **networksp, char *ip2nets, __u32 *ipaddrs, int nip)
{ {
static char networks[LNET_SINGLE_TEXTBUF_NOB]; static char networks[LNET_SINGLE_TEXTBUF_NOB];
static char source[LNET_SINGLE_TEXTBUF_NOB]; static char source[LNET_SINGLE_TEXTBUF_NOB];
struct list_head raw_entries; struct list_head raw_entries;
struct list_head matched_nets; struct list_head matched_nets;
struct list_head current_nets; struct list_head current_nets;
struct list_head *t; struct list_head *t;
struct list_head *t2; struct list_head *t2;
struct lnet_text_buf_t *tb; struct lnet_text_buf_t *tb;
struct lnet_text_buf_t *tb2; struct lnet_text_buf_t *tb2;
__u32 net1; __u32 net1;
__u32 net2; __u32 net2;
int len; int len;
int count; int count;
int dup; int dup;
int rc; int rc;
INIT_LIST_HEAD(&raw_entries); INIT_LIST_HEAD(&raw_entries);
if (lnet_str2tbs_sep(&raw_entries, ip2nets) < 0) { if (lnet_str2tbs_sep(&raw_entries, ip2nets) < 0) {
...@@ -1112,15 +1112,15 @@ lnet_ipaddr_free_enumeration(__u32 *ipaddrs, int nip) ...@@ -1112,15 +1112,15 @@ lnet_ipaddr_free_enumeration(__u32 *ipaddrs, int nip)
static int static int
lnet_ipaddr_enumerate(__u32 **ipaddrsp) lnet_ipaddr_enumerate(__u32 **ipaddrsp)
{ {
int up; int up;
__u32 netmask; __u32 netmask;
__u32 *ipaddrs; __u32 *ipaddrs;
__u32 *ipaddrs2; __u32 *ipaddrs2;
int nip; int nip;
char **ifnames; char **ifnames;
int nif = libcfs_ipif_enumerate(&ifnames); int nif = libcfs_ipif_enumerate(&ifnames);
int i; int i;
int rc; int rc;
if (nif <= 0) if (nif <= 0)
return nif; return nif;
...@@ -1178,9 +1178,9 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp) ...@@ -1178,9 +1178,9 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp)
int int
lnet_parse_ip2nets(char **networksp, char *ip2nets) lnet_parse_ip2nets(char **networksp, char *ip2nets)
{ {
__u32 *ipaddrs = NULL; __u32 *ipaddrs = NULL;
int nip = lnet_ipaddr_enumerate(&ipaddrs); int nip = lnet_ipaddr_enumerate(&ipaddrs);
int rc; int rc;
if (nip < 0) { if (nip < 0) {
LCONSOLE_ERROR_MSG(0x117, LCONSOLE_ERROR_MSG(0x117,
...@@ -1215,14 +1215,14 @@ lnet_parse_ip2nets(char **networksp, char *ip2nets) ...@@ -1215,14 +1215,14 @@ lnet_parse_ip2nets(char **networksp, char *ip2nets)
int int
lnet_set_ip_niaddr(lnet_ni_t *ni) lnet_set_ip_niaddr(lnet_ni_t *ni)
{ {
__u32 net = LNET_NIDNET(ni->ni_nid); __u32 net = LNET_NIDNET(ni->ni_nid);
char **names; char **names;
int n; int n;
__u32 ip; __u32 ip;
__u32 netmask; __u32 netmask;
int up; int up;
int i; int i;
int rc; int rc;
/* Convenience for LNDs that use the IP address of a local interface as /* Convenience for LNDs that use the IP address of a local interface as
* the local address part of their NID */ * the local address part of their NID */
......
...@@ -70,7 +70,7 @@ int ...@@ -70,7 +70,7 @@ int
LNetEQAlloc(unsigned int count, lnet_eq_handler_t callback, LNetEQAlloc(unsigned int count, lnet_eq_handler_t callback,
lnet_handle_eq_t *handle) lnet_handle_eq_t *handle)
{ {
lnet_eq_t *eq; lnet_eq_t *eq;
LASSERT(the_lnet.ln_init); LASSERT(the_lnet.ln_init);
LASSERT(the_lnet.ln_refcount > 0); LASSERT(the_lnet.ln_refcount > 0);
...@@ -151,13 +151,13 @@ EXPORT_SYMBOL(LNetEQAlloc); ...@@ -151,13 +151,13 @@ EXPORT_SYMBOL(LNetEQAlloc);
int int
LNetEQFree(lnet_handle_eq_t eqh) LNetEQFree(lnet_handle_eq_t eqh)
{ {
struct lnet_eq *eq; struct lnet_eq *eq;
lnet_event_t *events = NULL; lnet_event_t *events = NULL;
int **refs = NULL; int **refs = NULL;
int *ref; int *ref;
int rc = 0; int rc = 0;
int size = 0; int size = 0;
int i; int i;
LASSERT(the_lnet.ln_init); LASSERT(the_lnet.ln_init);
LASSERT(the_lnet.ln_refcount > 0); LASSERT(the_lnet.ln_refcount > 0);
...@@ -185,9 +185,9 @@ LNetEQFree(lnet_handle_eq_t eqh) ...@@ -185,9 +185,9 @@ LNetEQFree(lnet_handle_eq_t eqh)
} }
/* stash for free after lock dropped */ /* stash for free after lock dropped */
events = eq->eq_events; events = eq->eq_events;
size = eq->eq_size; size = eq->eq_size;
refs = eq->eq_refs; refs = eq->eq_refs;
lnet_res_lh_invalidate(&eq->eq_lh); lnet_res_lh_invalidate(&eq->eq_lh);
list_del(&eq->eq_list); list_del(&eq->eq_list);
...@@ -237,9 +237,9 @@ lnet_eq_enqueue_event(lnet_eq_t *eq, lnet_event_t *ev) ...@@ -237,9 +237,9 @@ lnet_eq_enqueue_event(lnet_eq_t *eq, lnet_event_t *ev)
static int static int
lnet_eq_dequeue_event(lnet_eq_t *eq, lnet_event_t *ev) lnet_eq_dequeue_event(lnet_eq_t *eq, lnet_event_t *ev)
{ {
int new_index = eq->eq_deq_seq & (eq->eq_size - 1); int new_index = eq->eq_deq_seq & (eq->eq_size - 1);
lnet_event_t *new_event = &eq->eq_events[new_index]; lnet_event_t *new_event = &eq->eq_events[new_index];
int rc; int rc;
/* must called with lnet_eq_wait_lock hold */ /* must called with lnet_eq_wait_lock hold */
if (LNET_SEQ_GT(eq->eq_deq_seq, new_event->sequence)) if (LNET_SEQ_GT(eq->eq_deq_seq, new_event->sequence))
...@@ -323,10 +323,10 @@ static int ...@@ -323,10 +323,10 @@ static int
lnet_eq_wait_locked(int *timeout_ms) lnet_eq_wait_locked(int *timeout_ms)
__must_hold(&the_lnet.ln_eq_wait_lock) __must_hold(&the_lnet.ln_eq_wait_lock)
{ {
int tms = *timeout_ms; int tms = *timeout_ms;
int wait; int wait;
wait_queue_t wl; wait_queue_t wl;
unsigned long now; unsigned long now;
if (tms == 0) if (tms == 0)
return -1; /* don't want to wait and no new event */ return -1; /* don't want to wait and no new event */
...@@ -392,9 +392,9 @@ int ...@@ -392,9 +392,9 @@ int
LNetEQPoll(lnet_handle_eq_t *eventqs, int neq, int timeout_ms, LNetEQPoll(lnet_handle_eq_t *eventqs, int neq, int timeout_ms,
lnet_event_t *event, int *which) lnet_event_t *event, int *which)
{ {
int wait = 1; int wait = 1;
int rc; int rc;
int i; int i;
LASSERT(the_lnet.ln_init); LASSERT(the_lnet.ln_init);
LASSERT(the_lnet.ln_refcount > 0); LASSERT(the_lnet.ln_refcount > 0);
......
...@@ -74,7 +74,7 @@ lnet_md_unlink(lnet_libmd_t *md) ...@@ -74,7 +74,7 @@ lnet_md_unlink(lnet_libmd_t *md)
CDEBUG(D_NET, "Unlinking md %p\n", md); CDEBUG(D_NET, "Unlinking md %p\n", md);
if (md->md_eq != NULL) { if (md->md_eq != NULL) {
int cpt = lnet_cpt_of_cookie(md->md_lh.lh_cookie); int cpt = lnet_cpt_of_cookie(md->md_lh.lh_cookie);
LASSERT(*md->md_eq->eq_refs[cpt] > 0); LASSERT(*md->md_eq->eq_refs[cpt] > 0);
(*md->md_eq->eq_refs[cpt])--; (*md->md_eq->eq_refs[cpt])--;
...@@ -88,9 +88,9 @@ lnet_md_unlink(lnet_libmd_t *md) ...@@ -88,9 +88,9 @@ lnet_md_unlink(lnet_libmd_t *md)
static int static int
lnet_md_build(lnet_libmd_t *lmd, lnet_md_t *umd, int unlink) lnet_md_build(lnet_libmd_t *lmd, lnet_md_t *umd, int unlink)
{ {
int i; int i;
unsigned int niov; unsigned int niov;
int total_length = 0; int total_length = 0;
lmd->md_me = NULL; lmd->md_me = NULL;
lmd->md_start = umd->start; lmd->md_start = umd->start;
...@@ -268,10 +268,10 @@ LNetMDAttach(lnet_handle_me_t meh, lnet_md_t umd, ...@@ -268,10 +268,10 @@ LNetMDAttach(lnet_handle_me_t meh, lnet_md_t umd,
{ {
LIST_HEAD(matches); LIST_HEAD(matches);
LIST_HEAD(drops); LIST_HEAD(drops);
struct lnet_me *me; struct lnet_me *me;
struct lnet_libmd *md; struct lnet_libmd *md;
int cpt; int cpt;
int rc; int rc;
LASSERT(the_lnet.ln_init); LASSERT(the_lnet.ln_init);
LASSERT(the_lnet.ln_refcount > 0); LASSERT(the_lnet.ln_refcount > 0);
...@@ -346,9 +346,9 @@ EXPORT_SYMBOL(LNetMDAttach); ...@@ -346,9 +346,9 @@ EXPORT_SYMBOL(LNetMDAttach);
int int
LNetMDBind(lnet_md_t umd, lnet_unlink_t unlink, lnet_handle_md_t *handle) LNetMDBind(lnet_md_t umd, lnet_unlink_t unlink, lnet_handle_md_t *handle)
{ {
lnet_libmd_t *md; lnet_libmd_t *md;
int cpt; int cpt;
int rc; int rc;
LASSERT(the_lnet.ln_init); LASSERT(the_lnet.ln_init);
LASSERT(the_lnet.ln_refcount > 0); LASSERT(the_lnet.ln_refcount > 0);
...@@ -421,9 +421,9 @@ EXPORT_SYMBOL(LNetMDBind); ...@@ -421,9 +421,9 @@ EXPORT_SYMBOL(LNetMDBind);
int int
LNetMDUnlink(lnet_handle_md_t mdh) LNetMDUnlink(lnet_handle_md_t mdh)
{ {
lnet_event_t ev; lnet_event_t ev;
lnet_libmd_t *md; lnet_libmd_t *md;
int cpt; int cpt;
LASSERT(the_lnet.ln_init); LASSERT(the_lnet.ln_init);
LASSERT(the_lnet.ln_refcount > 0); LASSERT(the_lnet.ln_refcount > 0);
......
...@@ -80,8 +80,8 @@ LNetMEAttach(unsigned int portal, ...@@ -80,8 +80,8 @@ LNetMEAttach(unsigned int portal,
lnet_handle_me_t *handle) lnet_handle_me_t *handle)
{ {
struct lnet_match_table *mtable; struct lnet_match_table *mtable;
struct lnet_me *me; struct lnet_me *me;
struct list_head *head; struct list_head *head;
LASSERT(the_lnet.ln_init); LASSERT(the_lnet.ln_init);
LASSERT(the_lnet.ln_refcount > 0); LASSERT(the_lnet.ln_refcount > 0);
...@@ -151,10 +151,10 @@ LNetMEInsert(lnet_handle_me_t current_meh, ...@@ -151,10 +151,10 @@ LNetMEInsert(lnet_handle_me_t current_meh,
lnet_unlink_t unlink, lnet_ins_pos_t pos, lnet_unlink_t unlink, lnet_ins_pos_t pos,
lnet_handle_me_t *handle) lnet_handle_me_t *handle)
{ {
struct lnet_me *current_me; struct lnet_me *current_me;
struct lnet_me *new_me; struct lnet_me *new_me;
struct lnet_portal *ptl; struct lnet_portal *ptl;
int cpt; int cpt;
LASSERT(the_lnet.ln_init); LASSERT(the_lnet.ln_init);
LASSERT(the_lnet.ln_refcount > 0); LASSERT(the_lnet.ln_refcount > 0);
...@@ -228,10 +228,10 @@ EXPORT_SYMBOL(LNetMEInsert); ...@@ -228,10 +228,10 @@ EXPORT_SYMBOL(LNetMEInsert);
int int
LNetMEUnlink(lnet_handle_me_t meh) LNetMEUnlink(lnet_handle_me_t meh)
{ {
lnet_me_t *me; lnet_me_t *me;
lnet_libmd_t *md; lnet_libmd_t *md;
lnet_event_t ev; lnet_event_t ev;
int cpt; int cpt;
LASSERT(the_lnet.ln_init); LASSERT(the_lnet.ln_init);
LASSERT(the_lnet.ln_refcount > 0); LASSERT(the_lnet.ln_refcount > 0);
......
...@@ -49,10 +49,10 @@ MODULE_PARM_DESC(local_nid_dist_zero, "Reserved"); ...@@ -49,10 +49,10 @@ MODULE_PARM_DESC(local_nid_dist_zero, "Reserved");
int int
lnet_fail_nid(lnet_nid_t nid, unsigned int threshold) lnet_fail_nid(lnet_nid_t nid, unsigned int threshold)
{ {
lnet_test_peer_t *tp; lnet_test_peer_t *tp;
struct list_head *el; struct list_head *el;
struct list_head *next; struct list_head *next;
struct list_head cull; struct list_head cull;
LASSERT(the_lnet.ln_init); LASSERT(the_lnet.ln_init);
...@@ -103,10 +103,10 @@ static int ...@@ -103,10 +103,10 @@ static int
fail_peer(lnet_nid_t nid, int outgoing) fail_peer(lnet_nid_t nid, int outgoing)
{ {
lnet_test_peer_t *tp; lnet_test_peer_t *tp;
struct list_head *el; struct list_head *el;
struct list_head *next; struct list_head *next;
struct list_head cull; struct list_head cull;
int fail = 0; int fail = 0;
INIT_LIST_HEAD(&cull); INIT_LIST_HEAD(&cull);
...@@ -175,7 +175,7 @@ lnet_copy_iov2iov(unsigned int ndiov, struct kvec *diov, unsigned int doffset, ...@@ -175,7 +175,7 @@ lnet_copy_iov2iov(unsigned int ndiov, struct kvec *diov, unsigned int doffset,
unsigned int nob) unsigned int nob)
{ {
/* NB diov, siov are READ-ONLY */ /* NB diov, siov are READ-ONLY */
unsigned int this_nob; unsigned int this_nob;
if (nob == 0) if (nob == 0)
return; return;
...@@ -236,8 +236,8 @@ lnet_extract_iov(int dst_niov, struct kvec *dst, ...@@ -236,8 +236,8 @@ lnet_extract_iov(int dst_niov, struct kvec *dst,
/* Initialise 'dst' to the subset of 'src' starting at 'offset', /* Initialise 'dst' to the subset of 'src' starting at 'offset',
* for exactly 'len' bytes, and return the number of entries. * for exactly 'len' bytes, and return the number of entries.
* NB not destructive to 'src' */ * NB not destructive to 'src' */
unsigned int frag_len; unsigned int frag_len;
unsigned int niov; unsigned int niov;
if (len == 0) /* no data => */ if (len == 0) /* no data => */
return 0; /* no frags */ return 0; /* no frags */
...@@ -279,7 +279,7 @@ EXPORT_SYMBOL(lnet_extract_iov); ...@@ -279,7 +279,7 @@ EXPORT_SYMBOL(lnet_extract_iov);
unsigned int unsigned int
lnet_kiov_nob(unsigned int niov, lnet_kiov_t *kiov) lnet_kiov_nob(unsigned int niov, lnet_kiov_t *kiov)
{ {
unsigned int nob = 0; unsigned int nob = 0;
while (niov-- > 0) while (niov-- > 0)
nob += (kiov++)->kiov_len; nob += (kiov++)->kiov_len;
...@@ -294,9 +294,9 @@ lnet_copy_kiov2kiov(unsigned int ndiov, lnet_kiov_t *diov, unsigned int doffset, ...@@ -294,9 +294,9 @@ lnet_copy_kiov2kiov(unsigned int ndiov, lnet_kiov_t *diov, unsigned int doffset,
unsigned int nob) unsigned int nob)
{ {
/* NB diov, siov are READ-ONLY */ /* NB diov, siov are READ-ONLY */
unsigned int this_nob; unsigned int this_nob;
char *daddr = NULL; char *daddr = NULL;
char *saddr = NULL; char *saddr = NULL;
if (nob == 0) if (nob == 0)
return; return;
...@@ -376,8 +376,8 @@ lnet_copy_kiov2iov(unsigned int niov, struct kvec *iov, unsigned int iovoffset, ...@@ -376,8 +376,8 @@ lnet_copy_kiov2iov(unsigned int niov, struct kvec *iov, unsigned int iovoffset,
unsigned int kiovoffset, unsigned int nob) unsigned int kiovoffset, unsigned int nob)
{ {
/* NB iov, kiov are READ-ONLY */ /* NB iov, kiov are READ-ONLY */
unsigned int this_nob; unsigned int this_nob;
char *addr = NULL; char *addr = NULL;
if (nob == 0) if (nob == 0)
return; return;
...@@ -447,8 +447,8 @@ lnet_copy_iov2kiov(unsigned int nkiov, lnet_kiov_t *kiov, ...@@ -447,8 +447,8 @@ lnet_copy_iov2kiov(unsigned int nkiov, lnet_kiov_t *kiov,
unsigned int nob) unsigned int nob)
{ {
/* NB kiov, iov are READ-ONLY */ /* NB kiov, iov are READ-ONLY */
unsigned int this_nob; unsigned int this_nob;
char *addr = NULL; char *addr = NULL;
if (nob == 0) if (nob == 0)
return; return;
...@@ -518,8 +518,8 @@ lnet_extract_kiov(int dst_niov, lnet_kiov_t *dst, ...@@ -518,8 +518,8 @@ lnet_extract_kiov(int dst_niov, lnet_kiov_t *dst,
/* Initialise 'dst' to the subset of 'src' starting at 'offset', /* Initialise 'dst' to the subset of 'src' starting at 'offset',
* for exactly 'len' bytes, and return the number of entries. * for exactly 'len' bytes, and return the number of entries.
* NB not destructive to 'src' */ * NB not destructive to 'src' */
unsigned int frag_len; unsigned int frag_len;
unsigned int niov; unsigned int niov;
if (len == 0) /* no data => */ if (len == 0) /* no data => */
return 0; /* no frags */ return 0; /* no frags */
...@@ -565,10 +565,10 @@ static void ...@@ -565,10 +565,10 @@ static void
lnet_ni_recv(lnet_ni_t *ni, void *private, lnet_msg_t *msg, int delayed, lnet_ni_recv(lnet_ni_t *ni, void *private, lnet_msg_t *msg, int delayed,
unsigned int offset, unsigned int mlen, unsigned int rlen) unsigned int offset, unsigned int mlen, unsigned int rlen)
{ {
unsigned int niov = 0; unsigned int niov = 0;
struct kvec *iov = NULL; struct kvec *iov = NULL;
lnet_kiov_t *kiov = NULL; lnet_kiov_t *kiov = NULL;
int rc; int rc;
LASSERT(!in_interrupt()); LASSERT(!in_interrupt());
LASSERT(mlen == 0 || msg != NULL); LASSERT(mlen == 0 || msg != NULL);
...@@ -642,8 +642,8 @@ lnet_prep_send(lnet_msg_t *msg, int type, lnet_process_id_t target, ...@@ -642,8 +642,8 @@ lnet_prep_send(lnet_msg_t *msg, int type, lnet_process_id_t target,
static void static void
lnet_ni_send(lnet_ni_t *ni, lnet_msg_t *msg) lnet_ni_send(lnet_ni_t *ni, lnet_msg_t *msg)
{ {
void *priv = msg->msg_private; void *priv = msg->msg_private;
int rc; int rc;
LASSERT(!in_interrupt()); LASSERT(!in_interrupt());
LASSERT(LNET_NETTYP(LNET_NIDNET(ni->ni_nid)) == LOLND || LASSERT(LNET_NETTYP(LNET_NIDNET(ni->ni_nid)) == LOLND ||
...@@ -657,7 +657,7 @@ lnet_ni_send(lnet_ni_t *ni, lnet_msg_t *msg) ...@@ -657,7 +657,7 @@ lnet_ni_send(lnet_ni_t *ni, lnet_msg_t *msg)
static int static int
lnet_ni_eager_recv(lnet_ni_t *ni, lnet_msg_t *msg) lnet_ni_eager_recv(lnet_ni_t *ni, lnet_msg_t *msg)
{ {
int rc; int rc;
LASSERT(!msg->msg_sending); LASSERT(!msg->msg_sending);
LASSERT(msg->msg_receiving); LASSERT(msg->msg_receiving);
...@@ -700,7 +700,7 @@ lnet_ni_query_locked(lnet_ni_t *ni, lnet_peer_t *lp) ...@@ -700,7 +700,7 @@ lnet_ni_query_locked(lnet_ni_t *ni, lnet_peer_t *lp)
static inline int static inline int
lnet_peer_is_alive(lnet_peer_t *lp, unsigned long now) lnet_peer_is_alive(lnet_peer_t *lp, unsigned long now)
{ {
int alive; int alive;
unsigned long deadline; unsigned long deadline;
LASSERT(lnet_peer_aliveness_enabled(lp)); LASSERT(lnet_peer_aliveness_enabled(lp));
...@@ -785,10 +785,10 @@ lnet_peer_alive_locked(lnet_peer_t *lp) ...@@ -785,10 +785,10 @@ lnet_peer_alive_locked(lnet_peer_t *lp)
static int static int
lnet_post_send_locked(lnet_msg_t *msg, int do_send) lnet_post_send_locked(lnet_msg_t *msg, int do_send)
{ {
lnet_peer_t *lp = msg->msg_txpeer; lnet_peer_t *lp = msg->msg_txpeer;
lnet_ni_t *ni = lp->lp_ni; lnet_ni_t *ni = lp->lp_ni;
int cpt = msg->msg_tx_cpt; int cpt = msg->msg_tx_cpt;
struct lnet_tx_queue *tq = ni->ni_tx_queues[cpt]; struct lnet_tx_queue *tq = ni->ni_tx_queues[cpt];
/* non-lnet_send() callers have checked before */ /* non-lnet_send() callers have checked before */
LASSERT(!do_send || msg->msg_tx_delayed); LASSERT(!do_send || msg->msg_tx_delayed);
...@@ -871,8 +871,8 @@ lnet_post_send_locked(lnet_msg_t *msg, int do_send) ...@@ -871,8 +871,8 @@ lnet_post_send_locked(lnet_msg_t *msg, int do_send)
static lnet_rtrbufpool_t * static lnet_rtrbufpool_t *
lnet_msg2bufpool(lnet_msg_t *msg) lnet_msg2bufpool(lnet_msg_t *msg)
{ {
lnet_rtrbufpool_t *rbp; lnet_rtrbufpool_t *rbp;
int cpt; int cpt;
LASSERT(msg->msg_rx_committed); LASSERT(msg->msg_rx_committed);
...@@ -894,9 +894,9 @@ lnet_post_routed_recv_locked(lnet_msg_t *msg, int do_recv) ...@@ -894,9 +894,9 @@ lnet_post_routed_recv_locked(lnet_msg_t *msg, int do_recv)
/* lnet_parse is going to lnet_net_unlock immediately after this, so it /* lnet_parse is going to lnet_net_unlock immediately after this, so it
* sets do_recv FALSE and I don't do the unlock/send/lock bit. I * sets do_recv FALSE and I don't do the unlock/send/lock bit. I
* return EAGAIN if msg blocked and 0 if received or OK to receive */ * return EAGAIN if msg blocked and 0 if received or OK to receive */
lnet_peer_t *lp = msg->msg_rxpeer; lnet_peer_t *lp = msg->msg_rxpeer;
lnet_rtrbufpool_t *rbp; lnet_rtrbufpool_t *rbp;
lnet_rtrbuf_t *rb; lnet_rtrbuf_t *rb;
LASSERT(msg->msg_iov == NULL); LASSERT(msg->msg_iov == NULL);
LASSERT(msg->msg_kiov == NULL); LASSERT(msg->msg_kiov == NULL);
...@@ -967,11 +967,11 @@ lnet_post_routed_recv_locked(lnet_msg_t *msg, int do_recv) ...@@ -967,11 +967,11 @@ lnet_post_routed_recv_locked(lnet_msg_t *msg, int do_recv)
void void
lnet_return_tx_credits_locked(lnet_msg_t *msg) lnet_return_tx_credits_locked(lnet_msg_t *msg)
{ {
lnet_peer_t *txpeer = msg->msg_txpeer; lnet_peer_t *txpeer = msg->msg_txpeer;
lnet_msg_t *msg2; lnet_msg_t *msg2;
if (msg->msg_txcredit) { if (msg->msg_txcredit) {
struct lnet_ni *ni = txpeer->lp_ni; struct lnet_ni *ni = txpeer->lp_ni;
struct lnet_tx_queue *tq = ni->ni_tx_queues[msg->msg_tx_cpt]; struct lnet_tx_queue *tq = ni->ni_tx_queues[msg->msg_tx_cpt];
/* give back NI txcredits */ /* give back NI txcredits */
...@@ -1025,12 +1025,12 @@ lnet_return_tx_credits_locked(lnet_msg_t *msg) ...@@ -1025,12 +1025,12 @@ lnet_return_tx_credits_locked(lnet_msg_t *msg)
void void
lnet_return_rx_credits_locked(lnet_msg_t *msg) lnet_return_rx_credits_locked(lnet_msg_t *msg)
{ {
lnet_peer_t *rxpeer = msg->msg_rxpeer; lnet_peer_t *rxpeer = msg->msg_rxpeer;
lnet_msg_t *msg2; lnet_msg_t *msg2;
if (msg->msg_rtrcredit) { if (msg->msg_rtrcredit) {
/* give back global router credits */ /* give back global router credits */
lnet_rtrbuf_t *rb; lnet_rtrbuf_t *rb;
lnet_rtrbufpool_t *rbp; lnet_rtrbufpool_t *rbp;
/* NB If a msg ever blocks for a buffer in rbp_msgs, it stays /* NB If a msg ever blocks for a buffer in rbp_msgs, it stays
...@@ -1122,13 +1122,13 @@ lnet_compare_routes(lnet_route_t *r1, lnet_route_t *r2) ...@@ -1122,13 +1122,13 @@ lnet_compare_routes(lnet_route_t *r1, lnet_route_t *r2)
static lnet_peer_t * static lnet_peer_t *
lnet_find_route_locked(lnet_ni_t *ni, lnet_nid_t target, lnet_nid_t rtr_nid) lnet_find_route_locked(lnet_ni_t *ni, lnet_nid_t target, lnet_nid_t rtr_nid)
{ {
lnet_remotenet_t *rnet; lnet_remotenet_t *rnet;
lnet_route_t *rtr; lnet_route_t *rtr;
lnet_route_t *rtr_best; lnet_route_t *rtr_best;
lnet_route_t *rtr_last; lnet_route_t *rtr_last;
struct lnet_peer *lp_best; struct lnet_peer *lp_best;
struct lnet_peer *lp; struct lnet_peer *lp;
int rc; int rc;
/* If @rtr_nid is not LNET_NID_ANY, return the gateway with /* If @rtr_nid is not LNET_NID_ANY, return the gateway with
* rtr_nid nid, otherwise find the best gateway I can use */ * rtr_nid nid, otherwise find the best gateway I can use */
...@@ -1182,13 +1182,13 @@ lnet_find_route_locked(lnet_ni_t *ni, lnet_nid_t target, lnet_nid_t rtr_nid) ...@@ -1182,13 +1182,13 @@ lnet_find_route_locked(lnet_ni_t *ni, lnet_nid_t target, lnet_nid_t rtr_nid)
int int
lnet_send(lnet_nid_t src_nid, lnet_msg_t *msg, lnet_nid_t rtr_nid) lnet_send(lnet_nid_t src_nid, lnet_msg_t *msg, lnet_nid_t rtr_nid)
{ {
lnet_nid_t dst_nid = msg->msg_target.nid; lnet_nid_t dst_nid = msg->msg_target.nid;
struct lnet_ni *src_ni; struct lnet_ni *src_ni;
struct lnet_ni *local_ni; struct lnet_ni *local_ni;
struct lnet_peer *lp; struct lnet_peer *lp;
int cpt; int cpt;
int cpt2; int cpt2;
int rc; int rc;
/* NB: rtr_nid is set to LNET_NID_ANY for all current use-cases, /* NB: rtr_nid is set to LNET_NID_ANY for all current use-cases,
* but we might want to use pre-determined router for ACK/REPLY * but we might want to use pre-determined router for ACK/REPLY
...@@ -1364,7 +1364,7 @@ lnet_drop_message(lnet_ni_t *ni, int cpt, void *private, unsigned int nob) ...@@ -1364,7 +1364,7 @@ lnet_drop_message(lnet_ni_t *ni, int cpt, void *private, unsigned int nob)
static void static void
lnet_recv_put(lnet_ni_t *ni, lnet_msg_t *msg) lnet_recv_put(lnet_ni_t *ni, lnet_msg_t *msg)
{ {
lnet_hdr_t *hdr = &msg->msg_hdr; lnet_hdr_t *hdr = &msg->msg_hdr;
if (msg->msg_wanted != 0) if (msg->msg_wanted != 0)
lnet_setpayloadbuffer(msg); lnet_setpayloadbuffer(msg);
...@@ -1383,9 +1383,9 @@ lnet_recv_put(lnet_ni_t *ni, lnet_msg_t *msg) ...@@ -1383,9 +1383,9 @@ lnet_recv_put(lnet_ni_t *ni, lnet_msg_t *msg)
static int static int
lnet_parse_put(lnet_ni_t *ni, lnet_msg_t *msg) lnet_parse_put(lnet_ni_t *ni, lnet_msg_t *msg)
{ {
lnet_hdr_t *hdr = &msg->msg_hdr; lnet_hdr_t *hdr = &msg->msg_hdr;
struct lnet_match_info info; struct lnet_match_info info;
int rc; int rc;
/* Convert put fields to host byte order */ /* Convert put fields to host byte order */
hdr->msg.put.match_bits = le64_to_cpu(hdr->msg.put.match_bits); hdr->msg.put.match_bits = le64_to_cpu(hdr->msg.put.match_bits);
...@@ -1433,24 +1433,24 @@ lnet_parse_put(lnet_ni_t *ni, lnet_msg_t *msg) ...@@ -1433,24 +1433,24 @@ lnet_parse_put(lnet_ni_t *ni, lnet_msg_t *msg)
static int static int
lnet_parse_get(lnet_ni_t *ni, lnet_msg_t *msg, int rdma_get) lnet_parse_get(lnet_ni_t *ni, lnet_msg_t *msg, int rdma_get)
{ {
struct lnet_match_info info; struct lnet_match_info info;
lnet_hdr_t *hdr = &msg->msg_hdr; lnet_hdr_t *hdr = &msg->msg_hdr;
lnet_handle_wire_t reply_wmd; lnet_handle_wire_t reply_wmd;
int rc; int rc;
/* Convert get fields to host byte order */ /* Convert get fields to host byte order */
hdr->msg.get.match_bits = le64_to_cpu(hdr->msg.get.match_bits); hdr->msg.get.match_bits = le64_to_cpu(hdr->msg.get.match_bits);
hdr->msg.get.ptl_index = le32_to_cpu(hdr->msg.get.ptl_index); hdr->msg.get.ptl_index = le32_to_cpu(hdr->msg.get.ptl_index);
hdr->msg.get.sink_length = le32_to_cpu(hdr->msg.get.sink_length); hdr->msg.get.sink_length = le32_to_cpu(hdr->msg.get.sink_length);
hdr->msg.get.src_offset = le32_to_cpu(hdr->msg.get.src_offset); hdr->msg.get.src_offset = le32_to_cpu(hdr->msg.get.src_offset);
info.mi_id.nid = hdr->src_nid; info.mi_id.nid = hdr->src_nid;
info.mi_id.pid = hdr->src_pid; info.mi_id.pid = hdr->src_pid;
info.mi_opc = LNET_MD_OP_GET; info.mi_opc = LNET_MD_OP_GET;
info.mi_portal = hdr->msg.get.ptl_index; info.mi_portal = hdr->msg.get.ptl_index;
info.mi_rlength = hdr->msg.get.sink_length; info.mi_rlength = hdr->msg.get.sink_length;
info.mi_roffset = hdr->msg.get.src_offset; info.mi_roffset = hdr->msg.get.src_offset;
info.mi_mbits = hdr->msg.get.match_bits; info.mi_mbits = hdr->msg.get.match_bits;
rc = lnet_ptl_match_md(&info, msg); rc = lnet_ptl_match_md(&info, msg);
if (rc == LNET_MATCHMD_DROP) { if (rc == LNET_MATCHMD_DROP) {
...@@ -1497,13 +1497,13 @@ lnet_parse_get(lnet_ni_t *ni, lnet_msg_t *msg, int rdma_get) ...@@ -1497,13 +1497,13 @@ lnet_parse_get(lnet_ni_t *ni, lnet_msg_t *msg, int rdma_get)
static int static int
lnet_parse_reply(lnet_ni_t *ni, lnet_msg_t *msg) lnet_parse_reply(lnet_ni_t *ni, lnet_msg_t *msg)
{ {
void *private = msg->msg_private; void *private = msg->msg_private;
lnet_hdr_t *hdr = &msg->msg_hdr; lnet_hdr_t *hdr = &msg->msg_hdr;
lnet_process_id_t src = {0}; lnet_process_id_t src = {0};
lnet_libmd_t *md; lnet_libmd_t *md;
int rlength; int rlength;
int mlength; int mlength;
int cpt; int cpt;
cpt = lnet_cpt_of_cookie(hdr->msg.reply.dst_wmd.wh_object_cookie); cpt = lnet_cpt_of_cookie(hdr->msg.reply.dst_wmd.wh_object_cookie);
lnet_res_lock(cpt); lnet_res_lock(cpt);
...@@ -1562,10 +1562,10 @@ lnet_parse_reply(lnet_ni_t *ni, lnet_msg_t *msg) ...@@ -1562,10 +1562,10 @@ lnet_parse_reply(lnet_ni_t *ni, lnet_msg_t *msg)
static int static int
lnet_parse_ack(lnet_ni_t *ni, lnet_msg_t *msg) lnet_parse_ack(lnet_ni_t *ni, lnet_msg_t *msg)
{ {
lnet_hdr_t *hdr = &msg->msg_hdr; lnet_hdr_t *hdr = &msg->msg_hdr;
lnet_process_id_t src = {0}; lnet_process_id_t src = {0};
lnet_libmd_t *md; lnet_libmd_t *md;
int cpt; int cpt;
src.nid = hdr->src_nid; src.nid = hdr->src_nid;
src.pid = hdr->src_pid; src.pid = hdr->src_pid;
...@@ -1612,7 +1612,7 @@ lnet_parse_ack(lnet_ni_t *ni, lnet_msg_t *msg) ...@@ -1612,7 +1612,7 @@ lnet_parse_ack(lnet_ni_t *ni, lnet_msg_t *msg)
static int static int
lnet_parse_forward_locked(lnet_ni_t *ni, lnet_msg_t *msg) lnet_parse_forward_locked(lnet_ni_t *ni, lnet_msg_t *msg)
{ {
int rc = 0; int rc = 0;
if (msg->msg_rxpeer->lp_rtrcredits <= 0 || if (msg->msg_rxpeer->lp_rtrcredits <= 0 ||
lnet_msg2bufpool(msg)->rbp_credits <= 0) { lnet_msg2bufpool(msg)->rbp_credits <= 0) {
...@@ -1713,15 +1713,15 @@ int ...@@ -1713,15 +1713,15 @@ int
lnet_parse(lnet_ni_t *ni, lnet_hdr_t *hdr, lnet_nid_t from_nid, lnet_parse(lnet_ni_t *ni, lnet_hdr_t *hdr, lnet_nid_t from_nid,
void *private, int rdma_req) void *private, int rdma_req)
{ {
int rc = 0; int rc = 0;
int cpt; int cpt;
int for_me; int for_me;
struct lnet_msg *msg; struct lnet_msg *msg;
lnet_pid_t dest_pid; lnet_pid_t dest_pid;
lnet_nid_t dest_nid; lnet_nid_t dest_nid;
lnet_nid_t src_nid; lnet_nid_t src_nid;
__u32 payload_length; __u32 payload_length;
__u32 type; __u32 type;
LASSERT(!in_interrupt()); LASSERT(!in_interrupt());
...@@ -1945,8 +1945,8 @@ void ...@@ -1945,8 +1945,8 @@ void
lnet_drop_delayed_msg_list(struct list_head *head, char *reason) lnet_drop_delayed_msg_list(struct list_head *head, char *reason)
{ {
while (!list_empty(head)) { while (!list_empty(head)) {
lnet_process_id_t id = {0}; lnet_process_id_t id = {0};
lnet_msg_t *msg; lnet_msg_t *msg;
msg = list_entry(head->next, lnet_msg_t, msg_list); msg = list_entry(head->next, lnet_msg_t, msg_list);
list_del(&msg->msg_list); list_del(&msg->msg_list);
...@@ -1986,8 +1986,8 @@ void ...@@ -1986,8 +1986,8 @@ void
lnet_recv_delayed_msg_list(struct list_head *head) lnet_recv_delayed_msg_list(struct list_head *head)
{ {
while (!list_empty(head)) { while (!list_empty(head)) {
lnet_msg_t *msg; lnet_msg_t *msg;
lnet_process_id_t id; lnet_process_id_t id;
msg = list_entry(head->next, lnet_msg_t, msg_list); msg = list_entry(head->next, lnet_msg_t, msg_list);
list_del(&msg->msg_list); list_del(&msg->msg_list);
...@@ -2063,10 +2063,10 @@ LNetPut(lnet_nid_t self, lnet_handle_md_t mdh, lnet_ack_req_t ack, ...@@ -2063,10 +2063,10 @@ LNetPut(lnet_nid_t self, lnet_handle_md_t mdh, lnet_ack_req_t ack,
__u64 match_bits, unsigned int offset, __u64 match_bits, unsigned int offset,
__u64 hdr_data) __u64 hdr_data)
{ {
struct lnet_msg *msg; struct lnet_msg *msg;
struct lnet_libmd *md; struct lnet_libmd *md;
int cpt; int cpt;
int rc; int rc;
LASSERT(the_lnet.ln_init); LASSERT(the_lnet.ln_init);
LASSERT(the_lnet.ln_refcount > 0); LASSERT(the_lnet.ln_refcount > 0);
...@@ -2153,10 +2153,10 @@ lnet_create_reply_msg(lnet_ni_t *ni, lnet_msg_t *getmsg) ...@@ -2153,10 +2153,10 @@ lnet_create_reply_msg(lnet_ni_t *ni, lnet_msg_t *getmsg)
* CAVEAT EMPTOR: 'getmsg' is the original GET, which is freed when * CAVEAT EMPTOR: 'getmsg' is the original GET, which is freed when
* lnet_finalize() is called on it, so the LND must call this first */ * lnet_finalize() is called on it, so the LND must call this first */
struct lnet_msg *msg = lnet_msg_alloc(); struct lnet_msg *msg = lnet_msg_alloc();
struct lnet_libmd *getmd = getmsg->msg_md; struct lnet_libmd *getmd = getmsg->msg_md;
lnet_process_id_t peer_id = getmsg->msg_target; lnet_process_id_t peer_id = getmsg->msg_target;
int cpt; int cpt;
LASSERT(!getmsg->msg_target_is_router); LASSERT(!getmsg->msg_target_is_router);
LASSERT(!getmsg->msg_routing); LASSERT(!getmsg->msg_routing);
...@@ -2263,10 +2263,10 @@ LNetGet(lnet_nid_t self, lnet_handle_md_t mdh, ...@@ -2263,10 +2263,10 @@ LNetGet(lnet_nid_t self, lnet_handle_md_t mdh,
lnet_process_id_t target, unsigned int portal, lnet_process_id_t target, unsigned int portal,
__u64 match_bits, unsigned int offset) __u64 match_bits, unsigned int offset)
{ {
struct lnet_msg *msg; struct lnet_msg *msg;
struct lnet_libmd *md; struct lnet_libmd *md;
int cpt; int cpt;
int rc; int rc;
LASSERT(the_lnet.ln_init); LASSERT(the_lnet.ln_init);
LASSERT(the_lnet.ln_refcount > 0); LASSERT(the_lnet.ln_refcount > 0);
...@@ -2353,14 +2353,14 @@ EXPORT_SYMBOL(LNetGet); ...@@ -2353,14 +2353,14 @@ EXPORT_SYMBOL(LNetGet);
int int
LNetDist(lnet_nid_t dstnid, lnet_nid_t *srcnidp, __u32 *orderp) LNetDist(lnet_nid_t dstnid, lnet_nid_t *srcnidp, __u32 *orderp)
{ {
struct list_head *e; struct list_head *e;
struct lnet_ni *ni; struct lnet_ni *ni;
lnet_remotenet_t *rnet; lnet_remotenet_t *rnet;
__u32 dstnet = LNET_NIDNET(dstnid); __u32 dstnet = LNET_NIDNET(dstnid);
int hops; int hops;
int cpt; int cpt;
__u32 order = 2; __u32 order = 2;
struct list_head *rn_list; struct list_head *rn_list;
/* if !local_nid_dist_zero, I don't return a distance of 0 ever /* if !local_nid_dist_zero, I don't return a distance of 0 ever
* (when lustre sees a distance of 0, it substitutes 0@lo), so I * (when lustre sees a distance of 0, it substitutes 0@lo), so I
......
...@@ -60,8 +60,8 @@ lnet_build_unlink_event(lnet_libmd_t *md, lnet_event_t *ev) ...@@ -60,8 +60,8 @@ lnet_build_unlink_event(lnet_libmd_t *md, lnet_event_t *ev)
void void
lnet_build_msg_event(lnet_msg_t *msg, lnet_event_kind_t ev_type) lnet_build_msg_event(lnet_msg_t *msg, lnet_event_kind_t ev_type)
{ {
lnet_hdr_t *hdr = &msg->msg_hdr; lnet_hdr_t *hdr = &msg->msg_hdr;
lnet_event_t *ev = &msg->msg_ev; lnet_event_t *ev = &msg->msg_ev;
LASSERT(!msg->msg_routing); LASSERT(!msg->msg_routing);
...@@ -73,7 +73,7 @@ lnet_build_msg_event(lnet_msg_t *msg, lnet_event_kind_t ev_type) ...@@ -73,7 +73,7 @@ lnet_build_msg_event(lnet_msg_t *msg, lnet_event_kind_t ev_type)
ev->target.pid = le32_to_cpu(hdr->dest_pid); ev->target.pid = le32_to_cpu(hdr->dest_pid);
ev->initiator.nid = LNET_NID_ANY; ev->initiator.nid = LNET_NID_ANY;
ev->initiator.pid = the_lnet.ln_pid; ev->initiator.pid = the_lnet.ln_pid;
ev->sender = LNET_NID_ANY; ev->sender = LNET_NID_ANY;
} else { } else {
/* event for passive message */ /* event for passive message */
...@@ -82,9 +82,9 @@ lnet_build_msg_event(lnet_msg_t *msg, lnet_event_kind_t ev_type) ...@@ -82,9 +82,9 @@ lnet_build_msg_event(lnet_msg_t *msg, lnet_event_kind_t ev_type)
ev->initiator.pid = hdr->src_pid; ev->initiator.pid = hdr->src_pid;
ev->initiator.nid = hdr->src_nid; ev->initiator.nid = hdr->src_nid;
ev->rlength = hdr->payload_length; ev->rlength = hdr->payload_length;
ev->sender = msg->msg_from; ev->sender = msg->msg_from;
ev->mlength = msg->msg_wanted; ev->mlength = msg->msg_wanted;
ev->offset = msg->msg_offset; ev->offset = msg->msg_offset;
} }
switch (ev_type) { switch (ev_type) {
...@@ -137,7 +137,7 @@ void ...@@ -137,7 +137,7 @@ void
lnet_msg_commit(lnet_msg_t *msg, int cpt) lnet_msg_commit(lnet_msg_t *msg, int cpt)
{ {
struct lnet_msg_container *container = the_lnet.ln_msg_containers[cpt]; struct lnet_msg_container *container = the_lnet.ln_msg_containers[cpt];
lnet_counters_t *counters = the_lnet.ln_counters[cpt]; lnet_counters_t *counters = the_lnet.ln_counters[cpt];
/* routed message can be committed for both receiving and sending */ /* routed message can be committed for both receiving and sending */
LASSERT(!msg->msg_tx_committed); LASSERT(!msg->msg_tx_committed);
...@@ -170,7 +170,7 @@ static void ...@@ -170,7 +170,7 @@ static void
lnet_msg_decommit_tx(lnet_msg_t *msg, int status) lnet_msg_decommit_tx(lnet_msg_t *msg, int status)
{ {
lnet_counters_t *counters; lnet_counters_t *counters;
lnet_event_t *ev = &msg->msg_ev; lnet_event_t *ev = &msg->msg_ev;
LASSERT(msg->msg_tx_committed); LASSERT(msg->msg_tx_committed);
if (status != 0) if (status != 0)
...@@ -219,8 +219,8 @@ lnet_msg_decommit_tx(lnet_msg_t *msg, int status) ...@@ -219,8 +219,8 @@ lnet_msg_decommit_tx(lnet_msg_t *msg, int status)
static void static void
lnet_msg_decommit_rx(lnet_msg_t *msg, int status) lnet_msg_decommit_rx(lnet_msg_t *msg, int status)
{ {
lnet_counters_t *counters; lnet_counters_t *counters;
lnet_event_t *ev = &msg->msg_ev; lnet_event_t *ev = &msg->msg_ev;
LASSERT(!msg->msg_tx_committed); /* decommitted or never committed */ LASSERT(!msg->msg_tx_committed); /* decommitted or never committed */
LASSERT(msg->msg_rx_committed); LASSERT(msg->msg_rx_committed);
...@@ -273,7 +273,7 @@ lnet_msg_decommit_rx(lnet_msg_t *msg, int status) ...@@ -273,7 +273,7 @@ lnet_msg_decommit_rx(lnet_msg_t *msg, int status)
void void
lnet_msg_decommit(lnet_msg_t *msg, int cpt, int status) lnet_msg_decommit(lnet_msg_t *msg, int cpt, int status)
{ {
int cpt2 = cpt; int cpt2 = cpt;
LASSERT(msg->msg_tx_committed || msg->msg_rx_committed); LASSERT(msg->msg_tx_committed || msg->msg_rx_committed);
LASSERT(msg->msg_onactivelist); LASSERT(msg->msg_onactivelist);
...@@ -335,8 +335,8 @@ lnet_msg_attach_md(lnet_msg_t *msg, lnet_libmd_t *md, ...@@ -335,8 +335,8 @@ lnet_msg_attach_md(lnet_msg_t *msg, lnet_libmd_t *md,
void void
lnet_msg_detach_md(lnet_msg_t *msg, int status) lnet_msg_detach_md(lnet_msg_t *msg, int status)
{ {
lnet_libmd_t *md = msg->msg_md; lnet_libmd_t *md = msg->msg_md;
int unlink; int unlink;
/* Now it's safe to drop my caller's ref */ /* Now it's safe to drop my caller's ref */
md->md_refcount--; md->md_refcount--;
...@@ -359,8 +359,8 @@ static int ...@@ -359,8 +359,8 @@ static int
lnet_complete_msg_locked(lnet_msg_t *msg, int cpt) lnet_complete_msg_locked(lnet_msg_t *msg, int cpt)
{ {
lnet_handle_wire_t ack_wmd; lnet_handle_wire_t ack_wmd;
int rc; int rc;
int status = msg->msg_ev.status; int status = msg->msg_ev.status;
LASSERT(msg->msg_onactivelist); LASSERT(msg->msg_onactivelist);
...@@ -434,11 +434,11 @@ lnet_complete_msg_locked(lnet_msg_t *msg, int cpt) ...@@ -434,11 +434,11 @@ lnet_complete_msg_locked(lnet_msg_t *msg, int cpt)
void void
lnet_finalize(lnet_ni_t *ni, lnet_msg_t *msg, int status) lnet_finalize(lnet_ni_t *ni, lnet_msg_t *msg, int status)
{ {
struct lnet_msg_container *container; struct lnet_msg_container *container;
int my_slot; int my_slot;
int cpt; int cpt;
int rc; int rc;
int i; int i;
LASSERT(!in_interrupt()); LASSERT(!in_interrupt());
...@@ -534,7 +534,7 @@ EXPORT_SYMBOL(lnet_finalize); ...@@ -534,7 +534,7 @@ EXPORT_SYMBOL(lnet_finalize);
void void
lnet_msg_container_cleanup(struct lnet_msg_container *container) lnet_msg_container_cleanup(struct lnet_msg_container *container)
{ {
int count = 0; int count = 0;
if (container->msc_init == 0) if (container->msc_init == 0)
return; return;
...@@ -568,7 +568,7 @@ lnet_msg_container_cleanup(struct lnet_msg_container *container) ...@@ -568,7 +568,7 @@ lnet_msg_container_cleanup(struct lnet_msg_container *container)
int int
lnet_msg_container_setup(struct lnet_msg_container *container, int cpt) lnet_msg_container_setup(struct lnet_msg_container *container, int cpt)
{ {
int rc; int rc;
container->msc_init = 1; container->msc_init = 1;
...@@ -608,7 +608,7 @@ void ...@@ -608,7 +608,7 @@ void
lnet_msg_containers_destroy(void) lnet_msg_containers_destroy(void)
{ {
struct lnet_msg_container *container; struct lnet_msg_container *container;
int i; int i;
if (the_lnet.ln_msg_containers == NULL) if (the_lnet.ln_msg_containers == NULL)
return; return;
...@@ -624,8 +624,8 @@ int ...@@ -624,8 +624,8 @@ int
lnet_msg_containers_create(void) lnet_msg_containers_create(void)
{ {
struct lnet_msg_container *container; struct lnet_msg_container *container;
int rc; int rc;
int i; int i;
the_lnet.ln_msg_containers = cfs_percpt_alloc(lnet_cpt_table(), the_lnet.ln_msg_containers = cfs_percpt_alloc(lnet_cpt_table(),
sizeof(*container)); sizeof(*container));
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#include "../../include/linux/lnet/lib-lnet.h" #include "../../include/linux/lnet/lib-lnet.h"
/* NB: add /proc interfaces in upcoming patches */ /* NB: add /proc interfaces in upcoming patches */
int portal_rotor = LNET_PTL_ROTOR_HASH_RT; int portal_rotor = LNET_PTL_ROTOR_HASH_RT;
module_param(portal_rotor, int, 0644); module_param(portal_rotor, int, 0644);
MODULE_PARM_DESC(portal_rotor, "redirect PUTs to different cpu-partitions"); MODULE_PARM_DESC(portal_rotor, "redirect PUTs to different cpu-partitions");
...@@ -47,8 +47,8 @@ static int ...@@ -47,8 +47,8 @@ static int
lnet_ptl_match_type(unsigned int index, lnet_process_id_t match_id, lnet_ptl_match_type(unsigned int index, lnet_process_id_t match_id,
__u64 mbits, __u64 ignore_bits) __u64 mbits, __u64 ignore_bits)
{ {
struct lnet_portal *ptl = the_lnet.ln_portals[index]; struct lnet_portal *ptl = the_lnet.ln_portals[index];
int unique; int unique;
unique = ignore_bits == 0 && unique = ignore_bits == 0 &&
match_id.nid != LNET_NID_ANY && match_id.nid != LNET_NID_ANY &&
...@@ -89,7 +89,7 @@ static void ...@@ -89,7 +89,7 @@ static void
lnet_ptl_enable_mt(struct lnet_portal *ptl, int cpt) lnet_ptl_enable_mt(struct lnet_portal *ptl, int cpt)
{ {
struct lnet_match_table *mtable = ptl->ptl_mtables[cpt]; struct lnet_match_table *mtable = ptl->ptl_mtables[cpt];
int i; int i;
/* with hold of both lnet_res_lock(cpt) and lnet_ptl_lock */ /* with hold of both lnet_res_lock(cpt) and lnet_ptl_lock */
LASSERT(lnet_ptl_is_wildcard(ptl)); LASSERT(lnet_ptl_is_wildcard(ptl));
...@@ -114,7 +114,7 @@ static void ...@@ -114,7 +114,7 @@ static void
lnet_ptl_disable_mt(struct lnet_portal *ptl, int cpt) lnet_ptl_disable_mt(struct lnet_portal *ptl, int cpt)
{ {
struct lnet_match_table *mtable = ptl->ptl_mtables[cpt]; struct lnet_match_table *mtable = ptl->ptl_mtables[cpt];
int i; int i;
/* with hold of both lnet_res_lock(cpt) and lnet_ptl_lock */ /* with hold of both lnet_res_lock(cpt) and lnet_ptl_lock */
LASSERT(lnet_ptl_is_wildcard(ptl)); LASSERT(lnet_ptl_is_wildcard(ptl));
...@@ -141,9 +141,9 @@ lnet_try_match_md(lnet_libmd_t *md, ...@@ -141,9 +141,9 @@ lnet_try_match_md(lnet_libmd_t *md,
{ {
/* ALWAYS called holding the lnet_res_lock, and can't lnet_res_unlock; /* ALWAYS called holding the lnet_res_lock, and can't lnet_res_unlock;
* lnet_match_blocked_msg() relies on this to avoid races */ * lnet_match_blocked_msg() relies on this to avoid races */
unsigned int offset; unsigned int offset;
unsigned int mlength; unsigned int mlength;
lnet_me_t *me = md->md_me; lnet_me_t *me = md->md_me;
/* MD exhausted */ /* MD exhausted */
if (lnet_md_exhausted(md)) if (lnet_md_exhausted(md))
...@@ -227,7 +227,7 @@ struct lnet_match_table * ...@@ -227,7 +227,7 @@ struct lnet_match_table *
lnet_mt_of_attach(unsigned int index, lnet_process_id_t id, lnet_mt_of_attach(unsigned int index, lnet_process_id_t id,
__u64 mbits, __u64 ignore_bits, lnet_ins_pos_t pos) __u64 mbits, __u64 ignore_bits, lnet_ins_pos_t pos)
{ {
struct lnet_portal *ptl; struct lnet_portal *ptl;
struct lnet_match_table *mtable; struct lnet_match_table *mtable;
/* NB: called w/o lock */ /* NB: called w/o lock */
...@@ -261,11 +261,11 @@ static struct lnet_match_table * ...@@ -261,11 +261,11 @@ static struct lnet_match_table *
lnet_mt_of_match(struct lnet_match_info *info, struct lnet_msg *msg) lnet_mt_of_match(struct lnet_match_info *info, struct lnet_msg *msg)
{ {
struct lnet_match_table *mtable; struct lnet_match_table *mtable;
struct lnet_portal *ptl; struct lnet_portal *ptl;
unsigned int nmaps; unsigned int nmaps;
unsigned int rotor; unsigned int rotor;
unsigned int cpt; unsigned int cpt;
bool routed; bool routed;
/* NB: called w/o lock */ /* NB: called w/o lock */
LASSERT(info->mi_portal < the_lnet.ln_nportals); LASSERT(info->mi_portal < the_lnet.ln_nportals);
...@@ -312,8 +312,8 @@ lnet_mt_of_match(struct lnet_match_info *info, struct lnet_msg *msg) ...@@ -312,8 +312,8 @@ lnet_mt_of_match(struct lnet_match_info *info, struct lnet_msg *msg)
static int static int
lnet_mt_test_exhausted(struct lnet_match_table *mtable, int pos) lnet_mt_test_exhausted(struct lnet_match_table *mtable, int pos)
{ {
__u64 *bmap; __u64 *bmap;
int i; int i;
if (!lnet_ptl_is_wildcard(the_lnet.ln_portals[mtable->mt_portal])) if (!lnet_ptl_is_wildcard(the_lnet.ln_portals[mtable->mt_portal]))
return 0; return 0;
...@@ -337,7 +337,7 @@ lnet_mt_test_exhausted(struct lnet_match_table *mtable, int pos) ...@@ -337,7 +337,7 @@ lnet_mt_test_exhausted(struct lnet_match_table *mtable, int pos)
static void static void
lnet_mt_set_exhausted(struct lnet_match_table *mtable, int pos, int exhausted) lnet_mt_set_exhausted(struct lnet_match_table *mtable, int pos, int exhausted)
{ {
__u64 *bmap; __u64 *bmap;
LASSERT(lnet_ptl_is_wildcard(the_lnet.ln_portals[mtable->mt_portal])); LASSERT(lnet_ptl_is_wildcard(the_lnet.ln_portals[mtable->mt_portal]));
LASSERT(pos <= LNET_MT_HASH_IGNORE); LASSERT(pos <= LNET_MT_HASH_IGNORE);
...@@ -373,11 +373,11 @@ int ...@@ -373,11 +373,11 @@ int
lnet_mt_match_md(struct lnet_match_table *mtable, lnet_mt_match_md(struct lnet_match_table *mtable,
struct lnet_match_info *info, struct lnet_msg *msg) struct lnet_match_info *info, struct lnet_msg *msg)
{ {
struct list_head *head; struct list_head *head;
lnet_me_t *me; lnet_me_t *me;
lnet_me_t *tmp; lnet_me_t *tmp;
int exhausted = 0; int exhausted = 0;
int rc; int rc;
/* any ME with ignore bits? */ /* any ME with ignore bits? */
if (!list_empty(&mtable->mt_mhash[LNET_MT_HASH_IGNORE])) if (!list_empty(&mtable->mt_mhash[LNET_MT_HASH_IGNORE]))
...@@ -428,7 +428,7 @@ lnet_mt_match_md(struct lnet_match_table *mtable, ...@@ -428,7 +428,7 @@ lnet_mt_match_md(struct lnet_match_table *mtable,
static int static int
lnet_ptl_match_early(struct lnet_portal *ptl, struct lnet_msg *msg) lnet_ptl_match_early(struct lnet_portal *ptl, struct lnet_msg *msg)
{ {
int rc; int rc;
/* message arrived before any buffer posting on this portal, /* message arrived before any buffer posting on this portal,
* simply delay or drop this message */ * simply delay or drop this message */
...@@ -461,9 +461,9 @@ static int ...@@ -461,9 +461,9 @@ static int
lnet_ptl_match_delay(struct lnet_portal *ptl, lnet_ptl_match_delay(struct lnet_portal *ptl,
struct lnet_match_info *info, struct lnet_msg *msg) struct lnet_match_info *info, struct lnet_msg *msg)
{ {
int first = ptl->ptl_mt_maps[0]; /* read w/o lock */ int first = ptl->ptl_mt_maps[0]; /* read w/o lock */
int rc = 0; int rc = 0;
int i; int i;
/* steal buffer from other CPTs, and delay it if nothing to steal, /* steal buffer from other CPTs, and delay it if nothing to steal,
* this function is more expensive than a regular match, but we * this function is more expensive than a regular match, but we
...@@ -472,7 +472,7 @@ lnet_ptl_match_delay(struct lnet_portal *ptl, ...@@ -472,7 +472,7 @@ lnet_ptl_match_delay(struct lnet_portal *ptl,
for (i = 0; i < LNET_CPT_NUMBER; i++) { for (i = 0; i < LNET_CPT_NUMBER; i++) {
struct lnet_match_table *mtable; struct lnet_match_table *mtable;
int cpt; int cpt;
cpt = (first + i) % LNET_CPT_NUMBER; cpt = (first + i) % LNET_CPT_NUMBER;
mtable = ptl->ptl_mtables[cpt]; mtable = ptl->ptl_mtables[cpt];
...@@ -536,8 +536,8 @@ int ...@@ -536,8 +536,8 @@ int
lnet_ptl_match_md(struct lnet_match_info *info, struct lnet_msg *msg) lnet_ptl_match_md(struct lnet_match_info *info, struct lnet_msg *msg)
{ {
struct lnet_match_table *mtable; struct lnet_match_table *mtable;
struct lnet_portal *ptl; struct lnet_portal *ptl;
int rc; int rc;
CDEBUG(D_NET, "Request from %s of length %d into portal %d MB=%#llx\n", CDEBUG(D_NET, "Request from %s of length %d into portal %d MB=%#llx\n",
libcfs_id2str(info->mi_id), info->mi_rlength, info->mi_portal, libcfs_id2str(info->mi_id), info->mi_rlength, info->mi_portal,
...@@ -622,13 +622,13 @@ void ...@@ -622,13 +622,13 @@ void
lnet_ptl_attach_md(lnet_me_t *me, lnet_libmd_t *md, lnet_ptl_attach_md(lnet_me_t *me, lnet_libmd_t *md,
struct list_head *matches, struct list_head *drops) struct list_head *matches, struct list_head *drops)
{ {
struct lnet_portal *ptl = the_lnet.ln_portals[me->me_portal]; struct lnet_portal *ptl = the_lnet.ln_portals[me->me_portal];
struct lnet_match_table *mtable; struct lnet_match_table *mtable;
struct list_head *head; struct list_head *head;
lnet_msg_t *tmp; lnet_msg_t *tmp;
lnet_msg_t *msg; lnet_msg_t *msg;
int exhausted = 0; int exhausted = 0;
int cpt; int cpt;
LASSERT(md->md_refcount == 0); /* a brand new MD */ LASSERT(md->md_refcount == 0); /* a brand new MD */
...@@ -647,20 +647,20 @@ lnet_ptl_attach_md(lnet_me_t *me, lnet_libmd_t *md, ...@@ -647,20 +647,20 @@ lnet_ptl_attach_md(lnet_me_t *me, lnet_libmd_t *md,
head = &ptl->ptl_msg_stealing; head = &ptl->ptl_msg_stealing;
again: again:
list_for_each_entry_safe(msg, tmp, head, msg_list) { list_for_each_entry_safe(msg, tmp, head, msg_list) {
struct lnet_match_info info; struct lnet_match_info info;
lnet_hdr_t *hdr; lnet_hdr_t *hdr;
int rc; int rc;
LASSERT(msg->msg_rx_delayed || head == &ptl->ptl_msg_stealing); LASSERT(msg->msg_rx_delayed || head == &ptl->ptl_msg_stealing);
hdr = &msg->msg_hdr; hdr = &msg->msg_hdr;
info.mi_id.nid = hdr->src_nid; info.mi_id.nid = hdr->src_nid;
info.mi_id.pid = hdr->src_pid; info.mi_id.pid = hdr->src_pid;
info.mi_opc = LNET_MD_OP_PUT; info.mi_opc = LNET_MD_OP_PUT;
info.mi_portal = hdr->msg.put.ptl_index; info.mi_portal = hdr->msg.put.ptl_index;
info.mi_rlength = hdr->payload_length; info.mi_rlength = hdr->payload_length;
info.mi_roffset = hdr->msg.put.offset; info.mi_roffset = hdr->msg.put.offset;
info.mi_mbits = hdr->msg.put.match_bits; info.mi_mbits = hdr->msg.put.match_bits;
rc = lnet_try_match_md(md, &info, msg); rc = lnet_try_match_md(md, &info, msg);
...@@ -715,7 +715,7 @@ static void ...@@ -715,7 +715,7 @@ static void
lnet_ptl_cleanup(struct lnet_portal *ptl) lnet_ptl_cleanup(struct lnet_portal *ptl)
{ {
struct lnet_match_table *mtable; struct lnet_match_table *mtable;
int i; int i;
if (ptl->ptl_mtables == NULL) /* uninitialized portal */ if (ptl->ptl_mtables == NULL) /* uninitialized portal */
return; return;
...@@ -723,9 +723,9 @@ lnet_ptl_cleanup(struct lnet_portal *ptl) ...@@ -723,9 +723,9 @@ lnet_ptl_cleanup(struct lnet_portal *ptl)
LASSERT(list_empty(&ptl->ptl_msg_delayed)); LASSERT(list_empty(&ptl->ptl_msg_delayed));
LASSERT(list_empty(&ptl->ptl_msg_stealing)); LASSERT(list_empty(&ptl->ptl_msg_stealing));
cfs_percpt_for_each(mtable, i, ptl->ptl_mtables) { cfs_percpt_for_each(mtable, i, ptl->ptl_mtables) {
struct list_head *mhash; struct list_head *mhash;
lnet_me_t *me; lnet_me_t *me;
int j; int j;
if (mtable->mt_mhash == NULL) /* uninitialized match-table */ if (mtable->mt_mhash == NULL) /* uninitialized match-table */
continue; continue;
...@@ -753,9 +753,9 @@ static int ...@@ -753,9 +753,9 @@ static int
lnet_ptl_setup(struct lnet_portal *ptl, int index) lnet_ptl_setup(struct lnet_portal *ptl, int index)
{ {
struct lnet_match_table *mtable; struct lnet_match_table *mtable;
struct list_head *mhash; struct list_head *mhash;
int i; int i;
int j; int j;
ptl->ptl_mtables = cfs_percpt_alloc(lnet_cpt_table(), ptl->ptl_mtables = cfs_percpt_alloc(lnet_cpt_table(),
sizeof(struct lnet_match_table)); sizeof(struct lnet_match_table));
...@@ -798,7 +798,7 @@ lnet_ptl_setup(struct lnet_portal *ptl, int index) ...@@ -798,7 +798,7 @@ lnet_ptl_setup(struct lnet_portal *ptl, int index)
void void
lnet_portals_destroy(void) lnet_portals_destroy(void)
{ {
int i; int i;
if (the_lnet.ln_portals == NULL) if (the_lnet.ln_portals == NULL)
return; return;
...@@ -813,8 +813,8 @@ lnet_portals_destroy(void) ...@@ -813,8 +813,8 @@ lnet_portals_destroy(void)
int int
lnet_portals_create(void) lnet_portals_create(void)
{ {
int size; int size;
int i; int i;
size = offsetof(struct lnet_portal, ptl_mt_maps[LNET_CPT_NUMBER]); size = offsetof(struct lnet_portal, ptl_mt_maps[LNET_CPT_NUMBER]);
...@@ -898,8 +898,8 @@ EXPORT_SYMBOL(LNetSetLazyPortal); ...@@ -898,8 +898,8 @@ EXPORT_SYMBOL(LNetSetLazyPortal);
int int
LNetClearLazyPortal(int portal) LNetClearLazyPortal(int portal)
{ {
struct lnet_portal *ptl; struct lnet_portal *ptl;
LIST_HEAD (zombies); LIST_HEAD(zombies);
if (portal < 0 || portal >= the_lnet.ln_nportals) if (portal < 0 || portal >= the_lnet.ln_nportals)
return -EINVAL; return -EINVAL;
......
...@@ -111,7 +111,7 @@ lnd_t the_lolnd = { ...@@ -111,7 +111,7 @@ lnd_t the_lolnd = {
/* .lnd_type = */ LOLND, /* .lnd_type = */ LOLND,
/* .lnd_startup = */ lolnd_startup, /* .lnd_startup = */ lolnd_startup,
/* .lnd_shutdown = */ lolnd_shutdown, /* .lnd_shutdown = */ lolnd_shutdown,
/* .lnt_ctl = */ NULL, /* .lnt_ctl = */ NULL,
/* .lnd_send = */ lolnd_send, /* .lnd_send = */ lolnd_send,
/* .lnd_recv = */ lolnd_recv, /* .lnd_recv = */ lolnd_recv,
/* .lnd_eager_recv = */ NULL, /* .lnd_eager_recv = */ NULL,
......
...@@ -47,7 +47,7 @@ static int ...@@ -47,7 +47,7 @@ static int
lnet_configure(void *arg) lnet_configure(void *arg)
{ {
/* 'arg' only there so I can be passed to cfs_create_thread() */ /* 'arg' only there so I can be passed to cfs_create_thread() */
int rc = 0; int rc = 0;
LNET_MUTEX_LOCK(&lnet_config_mutex); LNET_MUTEX_LOCK(&lnet_config_mutex);
...@@ -66,7 +66,7 @@ lnet_configure(void *arg) ...@@ -66,7 +66,7 @@ lnet_configure(void *arg)
static int static int
lnet_unconfigure(void) lnet_unconfigure(void)
{ {
int refcount; int refcount;
LNET_MUTEX_LOCK(&lnet_config_mutex); LNET_MUTEX_LOCK(&lnet_config_mutex);
...@@ -86,7 +86,7 @@ lnet_unconfigure(void) ...@@ -86,7 +86,7 @@ lnet_unconfigure(void)
static int static int
lnet_ioctl(unsigned int cmd, struct libcfs_ioctl_data *data) lnet_ioctl(unsigned int cmd, struct libcfs_ioctl_data *data)
{ {
int rc; int rc;
switch (cmd) { switch (cmd) {
case IOC_LIBCFS_CONFIGURE: case IOC_LIBCFS_CONFIGURE:
...@@ -113,7 +113,7 @@ static DECLARE_IOCTL_HANDLER(lnet_ioctl_handler, lnet_ioctl); ...@@ -113,7 +113,7 @@ static DECLARE_IOCTL_HANDLER(lnet_ioctl_handler, lnet_ioctl);
static int __init static int __init
init_lnet(void) init_lnet(void)
{ {
int rc; int rc;
mutex_init(&lnet_config_mutex); mutex_init(&lnet_config_mutex);
......
...@@ -43,10 +43,10 @@ ...@@ -43,10 +43,10 @@
int int
lnet_peer_tables_create(void) lnet_peer_tables_create(void)
{ {
struct lnet_peer_table *ptable; struct lnet_peer_table *ptable;
struct list_head *hash; struct list_head *hash;
int i; int i;
int j; int j;
the_lnet.ln_peer_tables = cfs_percpt_alloc(lnet_cpt_table(), the_lnet.ln_peer_tables = cfs_percpt_alloc(lnet_cpt_table(),
sizeof(*ptable)); sizeof(*ptable));
...@@ -77,10 +77,10 @@ lnet_peer_tables_create(void) ...@@ -77,10 +77,10 @@ lnet_peer_tables_create(void)
void void
lnet_peer_tables_destroy(void) lnet_peer_tables_destroy(void)
{ {
struct lnet_peer_table *ptable; struct lnet_peer_table *ptable;
struct list_head *hash; struct list_head *hash;
int i; int i;
int j; int j;
if (the_lnet.ln_peer_tables == NULL) if (the_lnet.ln_peer_tables == NULL)
return; return;
...@@ -106,9 +106,9 @@ lnet_peer_tables_destroy(void) ...@@ -106,9 +106,9 @@ lnet_peer_tables_destroy(void)
void void
lnet_peer_tables_cleanup(void) lnet_peer_tables_cleanup(void)
{ {
struct lnet_peer_table *ptable; struct lnet_peer_table *ptable;
int i; int i;
int j; int j;
LASSERT(the_lnet.ln_shutdown); /* i.e. no new peers */ LASSERT(the_lnet.ln_shutdown); /* i.e. no new peers */
...@@ -133,7 +133,7 @@ lnet_peer_tables_cleanup(void) ...@@ -133,7 +133,7 @@ lnet_peer_tables_cleanup(void)
cfs_percpt_for_each(ptable, i, the_lnet.ln_peer_tables) { cfs_percpt_for_each(ptable, i, the_lnet.ln_peer_tables) {
LIST_HEAD(deathrow); LIST_HEAD(deathrow);
lnet_peer_t *lp; lnet_peer_t *lp;
lnet_net_lock(i); lnet_net_lock(i);
...@@ -186,8 +186,8 @@ lnet_destroy_peer_locked(lnet_peer_t *lp) ...@@ -186,8 +186,8 @@ lnet_destroy_peer_locked(lnet_peer_t *lp)
lnet_peer_t * lnet_peer_t *
lnet_find_peer_locked(struct lnet_peer_table *ptable, lnet_nid_t nid) lnet_find_peer_locked(struct lnet_peer_table *ptable, lnet_nid_t nid)
{ {
struct list_head *peers; struct list_head *peers;
lnet_peer_t *lp; lnet_peer_t *lp;
LASSERT(!the_lnet.ln_shutdown); LASSERT(!the_lnet.ln_shutdown);
...@@ -205,11 +205,11 @@ lnet_find_peer_locked(struct lnet_peer_table *ptable, lnet_nid_t nid) ...@@ -205,11 +205,11 @@ lnet_find_peer_locked(struct lnet_peer_table *ptable, lnet_nid_t nid)
int int
lnet_nid2peer_locked(lnet_peer_t **lpp, lnet_nid_t nid, int cpt) lnet_nid2peer_locked(lnet_peer_t **lpp, lnet_nid_t nid, int cpt)
{ {
struct lnet_peer_table *ptable; struct lnet_peer_table *ptable;
lnet_peer_t *lp = NULL; lnet_peer_t *lp = NULL;
lnet_peer_t *lp2; lnet_peer_t *lp2;
int cpt2; int cpt2;
int rc = 0; int rc = 0;
*lpp = NULL; *lpp = NULL;
if (the_lnet.ln_shutdown) /* it's shutting down */ if (the_lnet.ln_shutdown) /* it's shutting down */
...@@ -287,8 +287,8 @@ lnet_nid2peer_locked(lnet_peer_t **lpp, lnet_nid_t nid, int cpt) ...@@ -287,8 +287,8 @@ lnet_nid2peer_locked(lnet_peer_t **lpp, lnet_nid_t nid, int cpt)
goto out; goto out;
} }
lp->lp_txcredits = lp->lp_txcredits =
lp->lp_mintxcredits = lp->lp_ni->ni_peertxcredits; lp->lp_mintxcredits = lp->lp_ni->ni_peertxcredits;
lp->lp_rtrcredits = lp->lp_rtrcredits =
lp->lp_minrtrcredits = lnet_peer_buffer_credits(lp->lp_ni); lp->lp_minrtrcredits = lnet_peer_buffer_credits(lp->lp_ni);
...@@ -308,10 +308,10 @@ lnet_nid2peer_locked(lnet_peer_t **lpp, lnet_nid_t nid, int cpt) ...@@ -308,10 +308,10 @@ lnet_nid2peer_locked(lnet_peer_t **lpp, lnet_nid_t nid, int cpt)
void void
lnet_debug_peer(lnet_nid_t nid) lnet_debug_peer(lnet_nid_t nid)
{ {
char *aliveness = "NA"; char *aliveness = "NA";
lnet_peer_t *lp; lnet_peer_t *lp;
int rc; int rc;
int cpt; int cpt;
cpt = lnet_cpt_of_nid(nid); cpt = lnet_cpt_of_nid(nid);
lnet_net_lock(cpt); lnet_net_lock(cpt);
......
...@@ -139,8 +139,8 @@ lnet_notify_locked(lnet_peer_t *lp, int notifylnd, int alive, ...@@ -139,8 +139,8 @@ lnet_notify_locked(lnet_peer_t *lp, int notifylnd, int alive,
static void static void
lnet_ni_notify_locked(lnet_ni_t *ni, lnet_peer_t *lp) lnet_ni_notify_locked(lnet_ni_t *ni, lnet_peer_t *lp)
{ {
int alive; int alive;
int notifylnd; int notifylnd;
/* Notify only in 1 thread at any time to ensure ordered notification. /* Notify only in 1 thread at any time to ensure ordered notification.
* NB individual events can be missed; the only guarantee is that you * NB individual events can be missed; the only guarantee is that you
...@@ -152,7 +152,7 @@ lnet_ni_notify_locked(lnet_ni_t *ni, lnet_peer_t *lp) ...@@ -152,7 +152,7 @@ lnet_ni_notify_locked(lnet_ni_t *ni, lnet_peer_t *lp)
lp->lp_notifying = 1; lp->lp_notifying = 1;
while (lp->lp_notify) { while (lp->lp_notify) {
alive = lp->lp_alive; alive = lp->lp_alive;
notifylnd = lp->lp_notifylnd; notifylnd = lp->lp_notifylnd;
lp->lp_notifylnd = 0; lp->lp_notifylnd = 0;
...@@ -228,9 +228,9 @@ lnet_rtr_decref_locked(lnet_peer_t *lp) ...@@ -228,9 +228,9 @@ lnet_rtr_decref_locked(lnet_peer_t *lp)
lnet_remotenet_t * lnet_remotenet_t *
lnet_find_net_locked(__u32 net) lnet_find_net_locked(__u32 net)
{ {
lnet_remotenet_t *rnet; lnet_remotenet_t *rnet;
struct list_head *tmp; struct list_head *tmp;
struct list_head *rn_list; struct list_head *rn_list;
LASSERT(!the_lnet.ln_shutdown); LASSERT(!the_lnet.ln_shutdown);
...@@ -276,9 +276,9 @@ static void lnet_shuffle_seed(void) ...@@ -276,9 +276,9 @@ static void lnet_shuffle_seed(void)
static void static void
lnet_add_route_to_rnet(lnet_remotenet_t *rnet, lnet_route_t *route) lnet_add_route_to_rnet(lnet_remotenet_t *rnet, lnet_route_t *route)
{ {
unsigned int len = 0; unsigned int len = 0;
unsigned int offset = 0; unsigned int offset = 0;
struct list_head *e; struct list_head *e;
lnet_shuffle_seed(); lnet_shuffle_seed();
...@@ -304,13 +304,13 @@ int ...@@ -304,13 +304,13 @@ int
lnet_add_route(__u32 net, unsigned int hops, lnet_nid_t gateway, lnet_add_route(__u32 net, unsigned int hops, lnet_nid_t gateway,
unsigned int priority) unsigned int priority)
{ {
struct list_head *e; struct list_head *e;
lnet_remotenet_t *rnet; lnet_remotenet_t *rnet;
lnet_remotenet_t *rnet2; lnet_remotenet_t *rnet2;
lnet_route_t *route; lnet_route_t *route;
lnet_ni_t *ni; lnet_ni_t *ni;
int add_route; int add_route;
int rc; int rc;
CDEBUG(D_NET, "Add route: net %s hops %u priority %u gw %s\n", CDEBUG(D_NET, "Add route: net %s hops %u priority %u gw %s\n",
libcfs_net2str(net), hops, priority, libcfs_nid2str(gateway)); libcfs_net2str(net), hops, priority, libcfs_nid2str(gateway));
...@@ -416,14 +416,14 @@ lnet_add_route(__u32 net, unsigned int hops, lnet_nid_t gateway, ...@@ -416,14 +416,14 @@ lnet_add_route(__u32 net, unsigned int hops, lnet_nid_t gateway,
int int
lnet_check_routes(void) lnet_check_routes(void)
{ {
lnet_remotenet_t *rnet; lnet_remotenet_t *rnet;
lnet_route_t *route; lnet_route_t *route;
lnet_route_t *route2; lnet_route_t *route2;
struct list_head *e1; struct list_head *e1;
struct list_head *e2; struct list_head *e2;
int cpt; int cpt;
struct list_head *rn_list; struct list_head *rn_list;
int i; int i;
cpt = lnet_net_lock_current(); cpt = lnet_net_lock_current();
...@@ -434,9 +434,9 @@ lnet_check_routes(void) ...@@ -434,9 +434,9 @@ lnet_check_routes(void)
route2 = NULL; route2 = NULL;
list_for_each(e2, &rnet->lrn_routes) { list_for_each(e2, &rnet->lrn_routes) {
lnet_nid_t nid1; lnet_nid_t nid1;
lnet_nid_t nid2; lnet_nid_t nid2;
int net; int net;
route = list_entry(e2, lnet_route_t, route = list_entry(e2, lnet_route_t,
lr_list); lr_list);
...@@ -472,14 +472,14 @@ lnet_check_routes(void) ...@@ -472,14 +472,14 @@ lnet_check_routes(void)
int int
lnet_del_route(__u32 net, lnet_nid_t gw_nid) lnet_del_route(__u32 net, lnet_nid_t gw_nid)
{ {
struct lnet_peer *gateway; struct lnet_peer *gateway;
lnet_remotenet_t *rnet; lnet_remotenet_t *rnet;
lnet_route_t *route; lnet_route_t *route;
struct list_head *e1; struct list_head *e1;
struct list_head *e2; struct list_head *e2;
int rc = -ENOENT; int rc = -ENOENT;
struct list_head *rn_list; struct list_head *rn_list;
int idx = 0; int idx = 0;
CDEBUG(D_NET, "Del route: net %s : gw %s\n", CDEBUG(D_NET, "Del route: net %s : gw %s\n",
libcfs_net2str(net), libcfs_nid2str(gw_nid)); libcfs_net2str(net), libcfs_nid2str(gw_nid));
...@@ -554,13 +554,13 @@ int ...@@ -554,13 +554,13 @@ int
lnet_get_route(int idx, __u32 *net, __u32 *hops, lnet_get_route(int idx, __u32 *net, __u32 *hops,
lnet_nid_t *gateway, __u32 *alive, __u32 *priority) lnet_nid_t *gateway, __u32 *alive, __u32 *priority)
{ {
struct list_head *e1; struct list_head *e1;
struct list_head *e2; struct list_head *e2;
lnet_remotenet_t *rnet; lnet_remotenet_t *rnet;
lnet_route_t *route; lnet_route_t *route;
int cpt; int cpt;
int i; int i;
struct list_head *rn_list; struct list_head *rn_list;
cpt = lnet_net_lock_current(); cpt = lnet_net_lock_current();
...@@ -574,11 +574,11 @@ lnet_get_route(int idx, __u32 *net, __u32 *hops, ...@@ -574,11 +574,11 @@ lnet_get_route(int idx, __u32 *net, __u32 *hops,
lr_list); lr_list);
if (idx-- == 0) { if (idx-- == 0) {
*net = rnet->lrn_net; *net = rnet->lrn_net;
*hops = route->lr_hops; *hops = route->lr_hops;
*priority = route->lr_priority; *priority = route->lr_priority;
*gateway = route->lr_gateway->lp_nid; *gateway = route->lr_gateway->lp_nid;
*alive = route->lr_gateway->lp_alive; *alive = route->lr_gateway->lp_alive;
lnet_net_unlock(cpt); lnet_net_unlock(cpt);
return 0; return 0;
} }
...@@ -593,7 +593,7 @@ lnet_get_route(int idx, __u32 *net, __u32 *hops, ...@@ -593,7 +593,7 @@ lnet_get_route(int idx, __u32 *net, __u32 *hops,
void void
lnet_swap_pinginfo(lnet_ping_info_t *info) lnet_swap_pinginfo(lnet_ping_info_t *info)
{ {
int i; int i;
lnet_ni_status_t *stat; lnet_ni_status_t *stat;
__swab32s(&info->pi_magic); __swab32s(&info->pi_magic);
...@@ -614,9 +614,9 @@ lnet_swap_pinginfo(lnet_ping_info_t *info) ...@@ -614,9 +614,9 @@ lnet_swap_pinginfo(lnet_ping_info_t *info)
static void static void
lnet_parse_rc_info(lnet_rc_data_t *rcd) lnet_parse_rc_info(lnet_rc_data_t *rcd)
{ {
lnet_ping_info_t *info = rcd->rcd_pinginfo; lnet_ping_info_t *info = rcd->rcd_pinginfo;
struct lnet_peer *gw = rcd->rcd_gateway; struct lnet_peer *gw = rcd->rcd_gateway;
lnet_route_t *rtr; lnet_route_t *rtr;
if (!gw->lp_alive) if (!gw->lp_alive)
return; return;
...@@ -643,14 +643,14 @@ lnet_parse_rc_info(lnet_rc_data_t *rcd) ...@@ -643,14 +643,14 @@ lnet_parse_rc_info(lnet_rc_data_t *rcd)
return; /* can't carry NI status info */ return; /* can't carry NI status info */
list_for_each_entry(rtr, &gw->lp_routes, lr_gwlist) { list_for_each_entry(rtr, &gw->lp_routes, lr_gwlist) {
int ptl_status = LNET_NI_STATUS_INVALID; int ptl_status = LNET_NI_STATUS_INVALID;
int down = 0; int down = 0;
int up = 0; int up = 0;
int i; int i;
for (i = 0; i < info->pi_nnis && i < LNET_MAX_RTR_NIS; i++) { for (i = 0; i < info->pi_nnis && i < LNET_MAX_RTR_NIS; i++) {
lnet_ni_status_t *stat = &info->pi_ni[i]; lnet_ni_status_t *stat = &info->pi_ni[i];
lnet_nid_t nid = stat->ns_nid; lnet_nid_t nid = stat->ns_nid;
if (nid == LNET_NID_ANY) { if (nid == LNET_NID_ANY) {
CDEBUG(D_NET, "%s: unexpected LNET_NID_ANY\n", CDEBUG(D_NET, "%s: unexpected LNET_NID_ANY\n",
...@@ -699,8 +699,8 @@ lnet_parse_rc_info(lnet_rc_data_t *rcd) ...@@ -699,8 +699,8 @@ lnet_parse_rc_info(lnet_rc_data_t *rcd)
static void static void
lnet_router_checker_event(lnet_event_t *event) lnet_router_checker_event(lnet_event_t *event)
{ {
lnet_rc_data_t *rcd = event->md.user_ptr; lnet_rc_data_t *rcd = event->md.user_ptr;
struct lnet_peer *lp; struct lnet_peer *lp;
LASSERT(rcd != NULL); LASSERT(rcd != NULL);
...@@ -752,14 +752,14 @@ lnet_router_checker_event(lnet_event_t *event) ...@@ -752,14 +752,14 @@ lnet_router_checker_event(lnet_event_t *event)
static void static void
lnet_wait_known_routerstate(void) lnet_wait_known_routerstate(void)
{ {
lnet_peer_t *rtr; lnet_peer_t *rtr;
struct list_head *entry; struct list_head *entry;
int all_known; int all_known;
LASSERT(the_lnet.ln_rc_state == LNET_RC_STATE_RUNNING); LASSERT(the_lnet.ln_rc_state == LNET_RC_STATE_RUNNING);
for (;;) { for (;;) {
int cpt = lnet_net_lock_current(); int cpt = lnet_net_lock_current();
all_known = 1; all_known = 1;
list_for_each(entry, &the_lnet.ln_routers) { list_for_each(entry, &the_lnet.ln_routers) {
...@@ -799,9 +799,9 @@ lnet_router_ni_update_locked(lnet_peer_t *gw, __u32 net) ...@@ -799,9 +799,9 @@ lnet_router_ni_update_locked(lnet_peer_t *gw, __u32 net)
static void static void
lnet_update_ni_status_locked(void) lnet_update_ni_status_locked(void)
{ {
lnet_ni_t *ni; lnet_ni_t *ni;
long now; long now;
int timeout; int timeout;
LASSERT(the_lnet.ln_routing); LASSERT(the_lnet.ln_routing);
...@@ -860,10 +860,10 @@ lnet_destroy_rc_data(lnet_rc_data_t *rcd) ...@@ -860,10 +860,10 @@ lnet_destroy_rc_data(lnet_rc_data_t *rcd)
static lnet_rc_data_t * static lnet_rc_data_t *
lnet_create_rc_data_locked(lnet_peer_t *gateway) lnet_create_rc_data_locked(lnet_peer_t *gateway)
{ {
lnet_rc_data_t *rcd = NULL; lnet_rc_data_t *rcd = NULL;
lnet_ping_info_t *pi; lnet_ping_info_t *pi;
int rc; int rc;
int i; int i;
lnet_net_unlock(gateway->lp_cpt); lnet_net_unlock(gateway->lp_cpt);
...@@ -943,8 +943,8 @@ static void ...@@ -943,8 +943,8 @@ static void
lnet_ping_router_locked(lnet_peer_t *rtr) lnet_ping_router_locked(lnet_peer_t *rtr)
{ {
lnet_rc_data_t *rcd = NULL; lnet_rc_data_t *rcd = NULL;
unsigned long now = cfs_time_current(); unsigned long now = cfs_time_current();
int secs; int secs;
lnet_peer_addref_locked(rtr); lnet_peer_addref_locked(rtr);
...@@ -979,9 +979,9 @@ lnet_ping_router_locked(lnet_peer_t *rtr) ...@@ -979,9 +979,9 @@ lnet_ping_router_locked(lnet_peer_t *rtr)
if (secs != 0 && !rtr->lp_ping_notsent && if (secs != 0 && !rtr->lp_ping_notsent &&
cfs_time_after(now, cfs_time_add(rtr->lp_ping_timestamp, cfs_time_after(now, cfs_time_add(rtr->lp_ping_timestamp,
cfs_time_seconds(secs)))) { cfs_time_seconds(secs)))) {
int rc; int rc;
lnet_process_id_t id; lnet_process_id_t id;
lnet_handle_md_t mdh; lnet_handle_md_t mdh;
id.nid = rtr->lp_nid; id.nid = rtr->lp_nid;
id.pid = LUSTRE_SRV_LNET_PID; id.pid = LUSTRE_SRV_LNET_PID;
...@@ -1013,8 +1013,8 @@ lnet_ping_router_locked(lnet_peer_t *rtr) ...@@ -1013,8 +1013,8 @@ lnet_ping_router_locked(lnet_peer_t *rtr)
int int
lnet_router_checker_start(void) lnet_router_checker_start(void)
{ {
int rc; int rc;
int eqsz; int eqsz;
LASSERT(the_lnet.ln_rc_state == LNET_RC_STATE_SHUTDOWN); LASSERT(the_lnet.ln_rc_state == LNET_RC_STATE_SHUTDOWN);
...@@ -1085,11 +1085,11 @@ lnet_router_checker_stop(void) ...@@ -1085,11 +1085,11 @@ lnet_router_checker_stop(void)
static void static void
lnet_prune_rc_data(int wait_unlink) lnet_prune_rc_data(int wait_unlink)
{ {
lnet_rc_data_t *rcd; lnet_rc_data_t *rcd;
lnet_rc_data_t *tmp; lnet_rc_data_t *tmp;
lnet_peer_t *lp; lnet_peer_t *lp;
struct list_head head; struct list_head head;
int i = 2; int i = 2;
if (likely(the_lnet.ln_rc_state == LNET_RC_STATE_RUNNING && if (likely(the_lnet.ln_rc_state == LNET_RC_STATE_RUNNING &&
list_empty(&the_lnet.ln_rcd_deathrow) && list_empty(&the_lnet.ln_rcd_deathrow) &&
...@@ -1169,17 +1169,17 @@ lnet_prune_rc_data(int wait_unlink) ...@@ -1169,17 +1169,17 @@ lnet_prune_rc_data(int wait_unlink)
static int static int
lnet_router_checker(void *arg) lnet_router_checker(void *arg)
{ {
lnet_peer_t *rtr; lnet_peer_t *rtr;
struct list_head *entry; struct list_head *entry;
cfs_block_allsigs(); cfs_block_allsigs();
LASSERT(the_lnet.ln_rc_state == LNET_RC_STATE_RUNNING); LASSERT(the_lnet.ln_rc_state == LNET_RC_STATE_RUNNING);
while (the_lnet.ln_rc_state == LNET_RC_STATE_RUNNING) { while (the_lnet.ln_rc_state == LNET_RC_STATE_RUNNING) {
__u64 version; __u64 version;
int cpt; int cpt;
int cpt2; int cpt2;
cpt = lnet_net_lock_current(); cpt = lnet_net_lock_current();
rescan: rescan:
...@@ -1245,11 +1245,11 @@ lnet_destroy_rtrbuf(lnet_rtrbuf_t *rb, int npages) ...@@ -1245,11 +1245,11 @@ lnet_destroy_rtrbuf(lnet_rtrbuf_t *rb, int npages)
static lnet_rtrbuf_t * static lnet_rtrbuf_t *
lnet_new_rtrbuf(lnet_rtrbufpool_t *rbp, int cpt) lnet_new_rtrbuf(lnet_rtrbufpool_t *rbp, int cpt)
{ {
int npages = rbp->rbp_npages; int npages = rbp->rbp_npages;
int sz = offsetof(lnet_rtrbuf_t, rb_kiov[npages]); int sz = offsetof(lnet_rtrbuf_t, rb_kiov[npages]);
struct page *page; struct page *page;
lnet_rtrbuf_t *rb; lnet_rtrbuf_t *rb;
int i; int i;
LIBCFS_CPT_ALLOC(rb, lnet_cpt_table(), cpt, sz); LIBCFS_CPT_ALLOC(rb, lnet_cpt_table(), cpt, sz);
if (rb == NULL) if (rb == NULL)
...@@ -1280,9 +1280,9 @@ lnet_new_rtrbuf(lnet_rtrbufpool_t *rbp, int cpt) ...@@ -1280,9 +1280,9 @@ lnet_new_rtrbuf(lnet_rtrbufpool_t *rbp, int cpt)
static void static void
lnet_rtrpool_free_bufs(lnet_rtrbufpool_t *rbp) lnet_rtrpool_free_bufs(lnet_rtrbufpool_t *rbp)
{ {
int npages = rbp->rbp_npages; int npages = rbp->rbp_npages;
int nbuffers = 0; int nbuffers = 0;
lnet_rtrbuf_t *rb; lnet_rtrbuf_t *rb;
if (rbp->rbp_nbuffers == 0) /* not initialized or already freed */ if (rbp->rbp_nbuffers == 0) /* not initialized or already freed */
return; return;
...@@ -1310,7 +1310,7 @@ static int ...@@ -1310,7 +1310,7 @@ static int
lnet_rtrpool_alloc_bufs(lnet_rtrbufpool_t *rbp, int nbufs, int cpt) lnet_rtrpool_alloc_bufs(lnet_rtrbufpool_t *rbp, int nbufs, int cpt)
{ {
lnet_rtrbuf_t *rb; lnet_rtrbuf_t *rb;
int i; int i;
if (rbp->rbp_nbuffers != 0) { if (rbp->rbp_nbuffers != 0) {
LASSERT(rbp->rbp_nbuffers == nbufs); LASSERT(rbp->rbp_nbuffers == nbufs);
...@@ -1355,7 +1355,7 @@ void ...@@ -1355,7 +1355,7 @@ void
lnet_rtrpools_free(void) lnet_rtrpools_free(void)
{ {
lnet_rtrbufpool_t *rtrp; lnet_rtrbufpool_t *rtrp;
int i; int i;
if (the_lnet.ln_rtrpools == NULL) /* uninitialized or freed */ if (the_lnet.ln_rtrpools == NULL) /* uninitialized or freed */
return; return;
...@@ -1373,7 +1373,7 @@ lnet_rtrpools_free(void) ...@@ -1373,7 +1373,7 @@ lnet_rtrpools_free(void)
static int static int
lnet_nrb_tiny_calculate(int npages) lnet_nrb_tiny_calculate(int npages)
{ {
int nrbs = LNET_NRB_TINY; int nrbs = LNET_NRB_TINY;
if (tiny_router_buffers < 0) { if (tiny_router_buffers < 0) {
LCONSOLE_ERROR_MSG(0x10c, LCONSOLE_ERROR_MSG(0x10c,
...@@ -1392,7 +1392,7 @@ lnet_nrb_tiny_calculate(int npages) ...@@ -1392,7 +1392,7 @@ lnet_nrb_tiny_calculate(int npages)
static int static int
lnet_nrb_small_calculate(int npages) lnet_nrb_small_calculate(int npages)
{ {
int nrbs = LNET_NRB_SMALL; int nrbs = LNET_NRB_SMALL;
if (small_router_buffers < 0) { if (small_router_buffers < 0) {
LCONSOLE_ERROR_MSG(0x10c, LCONSOLE_ERROR_MSG(0x10c,
...@@ -1411,7 +1411,7 @@ lnet_nrb_small_calculate(int npages) ...@@ -1411,7 +1411,7 @@ lnet_nrb_small_calculate(int npages)
static int static int
lnet_nrb_large_calculate(int npages) lnet_nrb_large_calculate(int npages)
{ {
int nrbs = LNET_NRB_LARGE; int nrbs = LNET_NRB_LARGE;
if (large_router_buffers < 0) { if (large_router_buffers < 0) {
LCONSOLE_ERROR_MSG(0x10c, LCONSOLE_ERROR_MSG(0x10c,
...@@ -1431,13 +1431,13 @@ int ...@@ -1431,13 +1431,13 @@ int
lnet_rtrpools_alloc(int im_a_router) lnet_rtrpools_alloc(int im_a_router)
{ {
lnet_rtrbufpool_t *rtrp; lnet_rtrbufpool_t *rtrp;
int large_pages; int large_pages;
int small_pages = 1; int small_pages = 1;
int nrb_tiny; int nrb_tiny;
int nrb_small; int nrb_small;
int nrb_large; int nrb_large;
int rc; int rc;
int i; int i;
large_pages = (LNET_MTU + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; large_pages = (LNET_MTU + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
...@@ -1507,9 +1507,9 @@ lnet_rtrpools_alloc(int im_a_router) ...@@ -1507,9 +1507,9 @@ lnet_rtrpools_alloc(int im_a_router)
int int
lnet_notify(lnet_ni_t *ni, lnet_nid_t nid, int alive, unsigned long when) lnet_notify(lnet_ni_t *ni, lnet_nid_t nid, int alive, unsigned long when)
{ {
struct lnet_peer *lp = NULL; struct lnet_peer *lp = NULL;
unsigned long now = cfs_time_current(); unsigned long now = cfs_time_current();
int cpt = lnet_cpt_of_nid(nid); int cpt = lnet_cpt_of_nid(nid);
LASSERT(!in_interrupt ()); LASSERT(!in_interrupt ());
...@@ -1591,13 +1591,13 @@ void ...@@ -1591,13 +1591,13 @@ void
lnet_router_checker(void) lnet_router_checker(void)
{ {
static time_t last; static time_t last;
static int running; static int running;
time_t now = get_seconds(); time_t now = get_seconds();
int interval = now - last; int interval = now - last;
int rc; int rc;
__u64 version; __u64 version;
lnet_peer_t *rtr; lnet_peer_t *rtr;
/* It's no use to call me again within a sec - all intervals and /* It's no use to call me again within a sec - all intervals and
* timeouts are measured in seconds */ * timeouts are measured in seconds */
...@@ -1625,7 +1625,7 @@ lnet_router_checker(void) ...@@ -1625,7 +1625,7 @@ lnet_router_checker(void)
/* consume all pending events */ /* consume all pending events */
while (1) { while (1) {
int i; int i;
lnet_event_t ev; lnet_event_t ev;
/* NB ln_rc_eqh must be the 1st in 'eventqs' otherwise the /* NB ln_rc_eqh must be the 1st in 'eventqs' otherwise the
......
...@@ -112,11 +112,11 @@ static int proc_call_handler(void *data, int write, loff_t *ppos, ...@@ -112,11 +112,11 @@ static int proc_call_handler(void *data, int write, loff_t *ppos,
static int __proc_lnet_stats(void *data, int write, static int __proc_lnet_stats(void *data, int write,
loff_t pos, void __user *buffer, int nob) loff_t pos, void __user *buffer, int nob)
{ {
int rc; int rc;
lnet_counters_t *ctrs; lnet_counters_t *ctrs;
int len; int len;
char *tmpstr; char *tmpstr;
const int tmpsiz = 256; /* 7 %u and 4 %llu */ const int tmpsiz = 256; /* 7 %u and 4 %llu */
if (write) { if (write) {
lnet_counters_reset(); lnet_counters_reset();
...@@ -167,13 +167,13 @@ static int proc_lnet_stats(struct ctl_table *table, int write, ...@@ -167,13 +167,13 @@ static int proc_lnet_stats(struct ctl_table *table, int write,
static int proc_lnet_routes(struct ctl_table *table, int write, static int proc_lnet_routes(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos) void __user *buffer, size_t *lenp, loff_t *ppos)
{ {
const int tmpsiz = 256; const int tmpsiz = 256;
char *tmpstr; char *tmpstr;
char *s; char *s;
int rc = 0; int rc = 0;
int len; int len;
int ver; int ver;
int off; int off;
CLASSERT(sizeof(loff_t) >= 4); CLASSERT(sizeof(loff_t) >= 4);
...@@ -205,13 +205,13 @@ static int proc_lnet_routes(struct ctl_table *table, int write, ...@@ -205,13 +205,13 @@ static int proc_lnet_routes(struct ctl_table *table, int write,
lnet_net_unlock(0); lnet_net_unlock(0);
*ppos = LNET_PROC_POS_MAKE(0, ver, 0, off); *ppos = LNET_PROC_POS_MAKE(0, ver, 0, off);
} else { } else {
struct list_head *n; struct list_head *n;
struct list_head *r; struct list_head *r;
lnet_route_t *route = NULL; lnet_route_t *route = NULL;
lnet_remotenet_t *rnet = NULL; lnet_remotenet_t *rnet = NULL;
int skip = off - 1; int skip = off - 1;
struct list_head *rn_list; struct list_head *rn_list;
int i; int i;
lnet_net_lock(0); lnet_net_lock(0);
...@@ -251,11 +251,11 @@ static int proc_lnet_routes(struct ctl_table *table, int write, ...@@ -251,11 +251,11 @@ static int proc_lnet_routes(struct ctl_table *table, int write,
} }
if (route != NULL) { if (route != NULL) {
__u32 net = rnet->lrn_net; __u32 net = rnet->lrn_net;
unsigned int hops = route->lr_hops; unsigned int hops = route->lr_hops;
unsigned int priority = route->lr_priority; unsigned int priority = route->lr_priority;
lnet_nid_t nid = route->lr_gateway->lp_nid; lnet_nid_t nid = route->lr_gateway->lp_nid;
int alive = route->lr_gateway->lp_alive; int alive = route->lr_gateway->lp_alive;
s += snprintf(s, tmpstr + tmpsiz - s, s += snprintf(s, tmpstr + tmpsiz - s,
"%-8s %4u %8u %7s %s\n", "%-8s %4u %8u %7s %s\n",
...@@ -293,13 +293,13 @@ static int proc_lnet_routes(struct ctl_table *table, int write, ...@@ -293,13 +293,13 @@ static int proc_lnet_routes(struct ctl_table *table, int write,
static int proc_lnet_routers(struct ctl_table *table, int write, static int proc_lnet_routers(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos) void __user *buffer, size_t *lenp, loff_t *ppos)
{ {
int rc = 0; int rc = 0;
char *tmpstr; char *tmpstr;
char *s; char *s;
const int tmpsiz = 256; const int tmpsiz = 256;
int len; int len;
int ver; int ver;
int off; int off;
off = LNET_PROC_HOFF_GET(*ppos); off = LNET_PROC_HOFF_GET(*ppos);
ver = LNET_PROC_VER_GET(*ppos); ver = LNET_PROC_VER_GET(*ppos);
...@@ -328,9 +328,9 @@ static int proc_lnet_routers(struct ctl_table *table, int write, ...@@ -328,9 +328,9 @@ static int proc_lnet_routers(struct ctl_table *table, int write,
lnet_net_unlock(0); lnet_net_unlock(0);
*ppos = LNET_PROC_POS_MAKE(0, ver, 0, off); *ppos = LNET_PROC_POS_MAKE(0, ver, 0, off);
} else { } else {
struct list_head *r; struct list_head *r;
struct lnet_peer *peer = NULL; struct lnet_peer *peer = NULL;
int skip = off - 1; int skip = off - 1;
lnet_net_lock(0); lnet_net_lock(0);
...@@ -360,14 +360,14 @@ static int proc_lnet_routers(struct ctl_table *table, int write, ...@@ -360,14 +360,14 @@ static int proc_lnet_routers(struct ctl_table *table, int write,
lnet_nid_t nid = peer->lp_nid; lnet_nid_t nid = peer->lp_nid;
unsigned long now = cfs_time_current(); unsigned long now = cfs_time_current();
unsigned long deadline = peer->lp_ping_deadline; unsigned long deadline = peer->lp_ping_deadline;
int nrefs = peer->lp_refcount; int nrefs = peer->lp_refcount;
int nrtrrefs = peer->lp_rtr_refcount; int nrtrrefs = peer->lp_rtr_refcount;
int alive_cnt = peer->lp_alive_count; int alive_cnt = peer->lp_alive_count;
int alive = peer->lp_alive; int alive = peer->lp_alive;
int pingsent = !peer->lp_ping_notsent; int pingsent = !peer->lp_ping_notsent;
int last_ping = cfs_duration_sec(cfs_time_sub(now, int last_ping = cfs_duration_sec(cfs_time_sub(now,
peer->lp_ping_timestamp)); peer->lp_ping_timestamp));
int down_ni = 0; int down_ni = 0;
lnet_route_t *rtr; lnet_route_t *rtr;
if ((peer->lp_ping_feats & if ((peer->lp_ping_feats &
...@@ -428,16 +428,16 @@ static int proc_lnet_routers(struct ctl_table *table, int write, ...@@ -428,16 +428,16 @@ static int proc_lnet_routers(struct ctl_table *table, int write,
static int proc_lnet_peers(struct ctl_table *table, int write, static int proc_lnet_peers(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos) void __user *buffer, size_t *lenp, loff_t *ppos)
{ {
const int tmpsiz = 256; const int tmpsiz = 256;
struct lnet_peer_table *ptable; struct lnet_peer_table *ptable;
char *tmpstr; char *tmpstr;
char *s; char *s;
int cpt = LNET_PROC_CPT_GET(*ppos); int cpt = LNET_PROC_CPT_GET(*ppos);
int ver = LNET_PROC_VER_GET(*ppos); int ver = LNET_PROC_VER_GET(*ppos);
int hash = LNET_PROC_HASH_GET(*ppos); int hash = LNET_PROC_HASH_GET(*ppos);
int hoff = LNET_PROC_HOFF_GET(*ppos); int hoff = LNET_PROC_HOFF_GET(*ppos);
int rc = 0; int rc = 0;
int len; int len;
CLASSERT(LNET_PROC_HASH_BITS >= LNET_PEER_HASH_BITS); CLASSERT(LNET_PROC_HASH_BITS >= LNET_PEER_HASH_BITS);
LASSERT(!write); LASSERT(!write);
...@@ -465,9 +465,9 @@ static int proc_lnet_peers(struct ctl_table *table, int write, ...@@ -465,9 +465,9 @@ static int proc_lnet_peers(struct ctl_table *table, int write,
hoff++; hoff++;
} else { } else {
struct lnet_peer *peer; struct lnet_peer *peer;
struct list_head *p; struct list_head *p;
int skip; int skip;
again: again:
p = NULL; p = NULL;
peer = NULL; peer = NULL;
...@@ -521,23 +521,23 @@ static int proc_lnet_peers(struct ctl_table *table, int write, ...@@ -521,23 +521,23 @@ static int proc_lnet_peers(struct ctl_table *table, int write,
} }
if (peer != NULL) { if (peer != NULL) {
lnet_nid_t nid = peer->lp_nid; lnet_nid_t nid = peer->lp_nid;
int nrefs = peer->lp_refcount; int nrefs = peer->lp_refcount;
int lastalive = -1; int lastalive = -1;
char *aliveness = "NA"; char *aliveness = "NA";
int maxcr = peer->lp_ni->ni_peertxcredits; int maxcr = peer->lp_ni->ni_peertxcredits;
int txcr = peer->lp_txcredits; int txcr = peer->lp_txcredits;
int mintxcr = peer->lp_mintxcredits; int mintxcr = peer->lp_mintxcredits;
int rtrcr = peer->lp_rtrcredits; int rtrcr = peer->lp_rtrcredits;
int minrtrcr = peer->lp_minrtrcredits; int minrtrcr = peer->lp_minrtrcredits;
int txqnob = peer->lp_txqnob; int txqnob = peer->lp_txqnob;
if (lnet_isrouter(peer) || if (lnet_isrouter(peer) ||
lnet_peer_aliveness_enabled(peer)) lnet_peer_aliveness_enabled(peer))
aliveness = peer->lp_alive ? "up" : "down"; aliveness = peer->lp_alive ? "up" : "down";
if (lnet_peer_aliveness_enabled(peer)) { if (lnet_peer_aliveness_enabled(peer)) {
unsigned long now = cfs_time_current(); unsigned long now = cfs_time_current();
long delta; long delta;
delta = cfs_time_sub(now, peer->lp_last_alive); delta = cfs_time_sub(now, peer->lp_last_alive);
...@@ -595,13 +595,13 @@ static int proc_lnet_peers(struct ctl_table *table, int write, ...@@ -595,13 +595,13 @@ static int proc_lnet_peers(struct ctl_table *table, int write,
static int __proc_lnet_buffers(void *data, int write, static int __proc_lnet_buffers(void *data, int write,
loff_t pos, void __user *buffer, int nob) loff_t pos, void __user *buffer, int nob)
{ {
char *s; char *s;
char *tmpstr; char *tmpstr;
int tmpsiz; int tmpsiz;
int idx; int idx;
int len; int len;
int rc; int rc;
int i; int i;
LASSERT(!write); LASSERT(!write);
...@@ -660,11 +660,11 @@ static int proc_lnet_buffers(struct ctl_table *table, int write, ...@@ -660,11 +660,11 @@ static int proc_lnet_buffers(struct ctl_table *table, int write,
static int proc_lnet_nis(struct ctl_table *table, int write, static int proc_lnet_nis(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos) void __user *buffer, size_t *lenp, loff_t *ppos)
{ {
int tmpsiz = 128 * LNET_CPT_NUMBER; int tmpsiz = 128 * LNET_CPT_NUMBER;
int rc = 0; int rc = 0;
char *tmpstr; char *tmpstr;
char *s; char *s;
int len; int len;
LASSERT(!write); LASSERT(!write);
...@@ -684,9 +684,9 @@ static int proc_lnet_nis(struct ctl_table *table, int write, ...@@ -684,9 +684,9 @@ static int proc_lnet_nis(struct ctl_table *table, int write,
"rtr", "max", "tx", "min"); "rtr", "max", "tx", "min");
LASSERT(tmpstr + tmpsiz - s > 0); LASSERT(tmpstr + tmpsiz - s > 0);
} else { } else {
struct list_head *n; struct list_head *n;
lnet_ni_t *ni = NULL; lnet_ni_t *ni = NULL;
int skip = *ppos - 1; int skip = *ppos - 1;
lnet_net_lock(0); lnet_net_lock(0);
...@@ -705,12 +705,12 @@ static int proc_lnet_nis(struct ctl_table *table, int write, ...@@ -705,12 +705,12 @@ static int proc_lnet_nis(struct ctl_table *table, int write,
} }
if (ni != NULL) { if (ni != NULL) {
struct lnet_tx_queue *tq; struct lnet_tx_queue *tq;
char *stat; char *stat;
long now = get_seconds(); long now = get_seconds();
int last_alive = -1; int last_alive = -1;
int i; int i;
int j; int j;
if (the_lnet.ln_routing) if (the_lnet.ln_routing)
last_alive = now - ni->ni_last_alive; last_alive = now - ni->ni_last_alive;
...@@ -777,9 +777,9 @@ static int proc_lnet_nis(struct ctl_table *table, int write, ...@@ -777,9 +777,9 @@ static int proc_lnet_nis(struct ctl_table *table, int write,
} }
struct lnet_portal_rotors { struct lnet_portal_rotors {
int pr_value; int pr_value;
const char *pr_name; const char *pr_name;
const char *pr_desc; const char *pr_desc;
}; };
static struct lnet_portal_rotors portal_rotors[] = { static struct lnet_portal_rotors portal_rotors[] = {
...@@ -815,11 +815,11 @@ extern int portal_rotor; ...@@ -815,11 +815,11 @@ extern int portal_rotor;
static int __proc_lnet_portal_rotor(void *data, int write, static int __proc_lnet_portal_rotor(void *data, int write,
loff_t pos, void __user *buffer, int nob) loff_t pos, void __user *buffer, int nob)
{ {
const int buf_len = 128; const int buf_len = 128;
char *buf; char *buf;
char *tmp; char *tmp;
int rc; int rc;
int i; int i;
LIBCFS_ALLOC(buf, buf_len); LIBCFS_ALLOC(buf, buf_len);
if (buf == NULL) if (buf == NULL)
...@@ -887,38 +887,38 @@ static struct ctl_table lnet_table[] = { ...@@ -887,38 +887,38 @@ static struct ctl_table lnet_table[] = {
* to go via /proc for portability. * to go via /proc for portability.
*/ */
{ {
.procname = "stats", .procname = "stats",
.mode = 0644, .mode = 0644,
.proc_handler = &proc_lnet_stats, .proc_handler = &proc_lnet_stats,
}, },
{ {
.procname = "routes", .procname = "routes",
.mode = 0444, .mode = 0444,
.proc_handler = &proc_lnet_routes, .proc_handler = &proc_lnet_routes,
}, },
{ {
.procname = "routers", .procname = "routers",
.mode = 0444, .mode = 0444,
.proc_handler = &proc_lnet_routers, .proc_handler = &proc_lnet_routers,
}, },
{ {
.procname = "peers", .procname = "peers",
.mode = 0444, .mode = 0444,
.proc_handler = &proc_lnet_peers, .proc_handler = &proc_lnet_peers,
}, },
{ {
.procname = "buffers", .procname = "buffers",
.mode = 0444, .mode = 0444,
.proc_handler = &proc_lnet_buffers, .proc_handler = &proc_lnet_buffers,
}, },
{ {
.procname = "nis", .procname = "nis",
.mode = 0444, .mode = 0444,
.proc_handler = &proc_lnet_nis, .proc_handler = &proc_lnet_nis,
}, },
{ {
.procname = "portal_rotor", .procname = "portal_rotor",
.mode = 0644, .mode = 0644,
.proc_handler = &proc_lnet_portal_rotor, .proc_handler = &proc_lnet_portal_rotor,
}, },
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment