spin_lock_init(&the_lnet.ln_eq_wait_lock);
spin_lock_init(&the_lnet.ln_msg_resend_lock);
init_waitqueue_head(&the_lnet.ln_eq_waitq);
- init_waitqueue_head(&the_lnet.ln_mt_waitq);
+ init_completion(&the_lnet.ln_mt_wait_complete);
mutex_init(&the_lnet.ln_lnd_mutex);
}
* with gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7) */
/* Constants... */
- CLASSERT(LNET_PROTO_TCP_MAGIC == 0xeebc0ded);
- CLASSERT(LNET_PROTO_TCP_VERSION_MAJOR == 1);
- CLASSERT(LNET_PROTO_TCP_VERSION_MINOR == 0);
- CLASSERT(LNET_MSG_ACK == 0);
- CLASSERT(LNET_MSG_PUT == 1);
- CLASSERT(LNET_MSG_GET == 2);
- CLASSERT(LNET_MSG_REPLY == 3);
- CLASSERT(LNET_MSG_HELLO == 4);
+ BUILD_BUG_ON(LNET_PROTO_TCP_MAGIC != 0xeebc0ded);
+ BUILD_BUG_ON(LNET_PROTO_TCP_VERSION_MAJOR != 1);
+ BUILD_BUG_ON(LNET_PROTO_TCP_VERSION_MINOR != 0);
+ BUILD_BUG_ON(LNET_MSG_ACK != 0);
+ BUILD_BUG_ON(LNET_MSG_PUT != 1);
+ BUILD_BUG_ON(LNET_MSG_GET != 2);
+ BUILD_BUG_ON(LNET_MSG_REPLY != 3);
+ BUILD_BUG_ON(LNET_MSG_HELLO != 4);
/* Checks for struct lnet_handle_wire */
- CLASSERT((int)sizeof(struct lnet_handle_wire) == 16);
- CLASSERT((int)offsetof(struct lnet_handle_wire, wh_interface_cookie) == 0);
- CLASSERT((int)sizeof(((struct lnet_handle_wire *)0)->wh_interface_cookie) == 8);
- CLASSERT((int)offsetof(struct lnet_handle_wire, wh_object_cookie) == 8);
- CLASSERT((int)sizeof(((struct lnet_handle_wire *)0)->wh_object_cookie) == 8);
+ BUILD_BUG_ON((int)sizeof(struct lnet_handle_wire) != 16);
+ BUILD_BUG_ON((int)offsetof(struct lnet_handle_wire,
+ wh_interface_cookie) != 0);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_handle_wire *)0)->wh_interface_cookie) != 8);
+ BUILD_BUG_ON((int)offsetof(struct lnet_handle_wire,
+ wh_object_cookie) != 8);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_handle_wire *)0)->wh_object_cookie) != 8);
/* Checks for struct struct lnet_magicversion */
- CLASSERT((int)sizeof(struct lnet_magicversion) == 8);
- CLASSERT((int)offsetof(struct lnet_magicversion, magic) == 0);
- CLASSERT((int)sizeof(((struct lnet_magicversion *)0)->magic) == 4);
- CLASSERT((int)offsetof(struct lnet_magicversion, version_major) == 4);
- CLASSERT((int)sizeof(((struct lnet_magicversion *)0)->version_major) == 2);
- CLASSERT((int)offsetof(struct lnet_magicversion, version_minor) == 6);
- CLASSERT((int)sizeof(((struct lnet_magicversion *)0)->version_minor) == 2);
+ BUILD_BUG_ON((int)sizeof(struct lnet_magicversion) != 8);
+ BUILD_BUG_ON((int)offsetof(struct lnet_magicversion, magic) != 0);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_magicversion *)0)->magic) != 4);
+ BUILD_BUG_ON((int)offsetof(struct lnet_magicversion, version_major) != 4);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_magicversion *)0)->version_major) != 2);
+ BUILD_BUG_ON((int)offsetof(struct lnet_magicversion,
+ version_minor) != 6);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_magicversion *)0)->version_minor) != 2);
/* Checks for struct struct lnet_hdr */
- CLASSERT((int)sizeof(struct lnet_hdr) == 72);
- CLASSERT((int)offsetof(struct lnet_hdr, dest_nid) == 0);
- CLASSERT((int)sizeof(((struct lnet_hdr *)0)->dest_nid) == 8);
- CLASSERT((int)offsetof(struct lnet_hdr, src_nid) == 8);
- CLASSERT((int)sizeof(((struct lnet_hdr *)0)->src_nid) == 8);
- CLASSERT((int)offsetof(struct lnet_hdr, dest_pid) == 16);
- CLASSERT((int)sizeof(((struct lnet_hdr *)0)->dest_pid) == 4);
- CLASSERT((int)offsetof(struct lnet_hdr, src_pid) == 20);
- CLASSERT((int)sizeof(((struct lnet_hdr *)0)->src_pid) == 4);
- CLASSERT((int)offsetof(struct lnet_hdr, type) == 24);
- CLASSERT((int)sizeof(((struct lnet_hdr *)0)->type) == 4);
- CLASSERT((int)offsetof(struct lnet_hdr, payload_length) == 28);
- CLASSERT((int)sizeof(((struct lnet_hdr *)0)->payload_length) == 4);
- CLASSERT((int)offsetof(struct lnet_hdr, msg) == 32);
- CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg) == 40);
+ BUILD_BUG_ON((int)sizeof(struct lnet_hdr) != 72);
+ BUILD_BUG_ON((int)offsetof(struct lnet_hdr, dest_nid) != 0);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_hdr *)0)->dest_nid) != 8);
+ BUILD_BUG_ON((int)offsetof(struct lnet_hdr, src_nid) != 8);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_hdr *)0)->src_nid) != 8);
+ BUILD_BUG_ON((int)offsetof(struct lnet_hdr, dest_pid) != 16);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_hdr *)0)->dest_pid) != 4);
+ BUILD_BUG_ON((int)offsetof(struct lnet_hdr, src_pid) != 20);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_hdr *)0)->src_pid) != 4);
+ BUILD_BUG_ON((int)offsetof(struct lnet_hdr, type) != 24);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_hdr *)0)->type) != 4);
+ BUILD_BUG_ON((int)offsetof(struct lnet_hdr, payload_length) != 28);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_hdr *)0)->payload_length) != 4);
+ BUILD_BUG_ON((int)offsetof(struct lnet_hdr, msg) != 32);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_hdr *)0)->msg) != 40);
/* Ack */
- CLASSERT((int)offsetof(struct lnet_hdr, msg.ack.dst_wmd) == 32);
- CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.ack.dst_wmd) == 16);
- CLASSERT((int)offsetof(struct lnet_hdr, msg.ack.match_bits) == 48);
- CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.ack.match_bits) == 8);
- CLASSERT((int)offsetof(struct lnet_hdr, msg.ack.mlength) == 56);
- CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.ack.mlength) == 4);
+ BUILD_BUG_ON((int)offsetof(struct lnet_hdr, msg.ack.dst_wmd) != 32);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_hdr *)0)->msg.ack.dst_wmd) != 16);
+ BUILD_BUG_ON((int)offsetof(struct lnet_hdr, msg.ack.match_bits) != 48);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_hdr *)0)->msg.ack.match_bits) != 8);
+ BUILD_BUG_ON((int)offsetof(struct lnet_hdr, msg.ack.mlength) != 56);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_hdr *)0)->msg.ack.mlength) != 4);
/* Put */
- CLASSERT((int)offsetof(struct lnet_hdr, msg.put.ack_wmd) == 32);
- CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.put.ack_wmd) == 16);
- CLASSERT((int)offsetof(struct lnet_hdr, msg.put.match_bits) == 48);
- CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.put.match_bits) == 8);
- CLASSERT((int)offsetof(struct lnet_hdr, msg.put.hdr_data) == 56);
- CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.put.hdr_data) == 8);
- CLASSERT((int)offsetof(struct lnet_hdr, msg.put.ptl_index) == 64);
- CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.put.ptl_index) == 4);
- CLASSERT((int)offsetof(struct lnet_hdr, msg.put.offset) == 68);
- CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.put.offset) == 4);
+ BUILD_BUG_ON((int)offsetof(struct lnet_hdr, msg.put.ack_wmd) != 32);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_hdr *)0)->msg.put.ack_wmd) != 16);
+ BUILD_BUG_ON((int)offsetof(struct lnet_hdr, msg.put.match_bits) != 48);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_hdr *)0)->msg.put.match_bits) != 8);
+ BUILD_BUG_ON((int)offsetof(struct lnet_hdr, msg.put.hdr_data) != 56);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_hdr *)0)->msg.put.hdr_data) != 8);
+ BUILD_BUG_ON((int)offsetof(struct lnet_hdr, msg.put.ptl_index) != 64);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_hdr *)0)->msg.put.ptl_index) != 4);
+ BUILD_BUG_ON((int)offsetof(struct lnet_hdr, msg.put.offset) != 68);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_hdr *)0)->msg.put.offset) != 4);
/* Get */
- CLASSERT((int)offsetof(struct lnet_hdr, msg.get.return_wmd) == 32);
- CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.get.return_wmd) == 16);
- CLASSERT((int)offsetof(struct lnet_hdr, msg.get.match_bits) == 48);
- CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.get.match_bits) == 8);
- CLASSERT((int)offsetof(struct lnet_hdr, msg.get.ptl_index) == 56);
- CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.get.ptl_index) == 4);
- CLASSERT((int)offsetof(struct lnet_hdr, msg.get.src_offset) == 60);
- CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.get.src_offset) == 4);
- CLASSERT((int)offsetof(struct lnet_hdr, msg.get.sink_length) == 64);
- CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.get.sink_length) == 4);
+ BUILD_BUG_ON((int)offsetof(struct lnet_hdr, msg.get.return_wmd) != 32);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_hdr *)0)->msg.get.return_wmd) != 16);
+ BUILD_BUG_ON((int)offsetof(struct lnet_hdr, msg.get.match_bits) != 48);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_hdr *)0)->msg.get.match_bits) != 8);
+ BUILD_BUG_ON((int)offsetof(struct lnet_hdr, msg.get.ptl_index) != 56);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_hdr *)0)->msg.get.ptl_index) != 4);
+ BUILD_BUG_ON((int)offsetof(struct lnet_hdr, msg.get.src_offset) != 60);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_hdr *)0)->msg.get.src_offset) != 4);
+ BUILD_BUG_ON((int)offsetof(struct lnet_hdr, msg.get.sink_length) != 64);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_hdr *)0)->msg.get.sink_length) != 4);
/* Reply */
- CLASSERT((int)offsetof(struct lnet_hdr, msg.reply.dst_wmd) == 32);
- CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.reply.dst_wmd) == 16);
+ BUILD_BUG_ON((int)offsetof(struct lnet_hdr, msg.reply.dst_wmd) != 32);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_hdr *)0)->msg.reply.dst_wmd) != 16);
/* Hello */
- CLASSERT((int)offsetof(struct lnet_hdr, msg.hello.incarnation) == 32);
- CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.hello.incarnation) == 8);
- CLASSERT((int)offsetof(struct lnet_hdr, msg.hello.type) == 40);
- CLASSERT((int)sizeof(((struct lnet_hdr *)0)->msg.hello.type) == 4);
+ BUILD_BUG_ON((int)offsetof(struct lnet_hdr, msg.hello.incarnation) != 32);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_hdr *)0)->msg.hello.incarnation) != 8);
+ BUILD_BUG_ON((int)offsetof(struct lnet_hdr, msg.hello.type) != 40);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_hdr *)0)->msg.hello.type) != 4);
/* Checks for struct lnet_ni_status and related constants */
- CLASSERT(LNET_NI_STATUS_INVALID == 0x00000000);
- CLASSERT(LNET_NI_STATUS_UP == 0x15aac0de);
- CLASSERT(LNET_NI_STATUS_DOWN == 0xdeadface);
+ BUILD_BUG_ON(LNET_NI_STATUS_INVALID != 0x00000000);
+ BUILD_BUG_ON(LNET_NI_STATUS_UP != 0x15aac0de);
+ BUILD_BUG_ON(LNET_NI_STATUS_DOWN != 0xdeadface);
/* Checks for struct lnet_ni_status */
- CLASSERT((int)sizeof(struct lnet_ni_status) == 16);
- CLASSERT((int)offsetof(struct lnet_ni_status, ns_nid) == 0);
- CLASSERT((int)sizeof(((struct lnet_ni_status *)0)->ns_nid) == 8);
- CLASSERT((int)offsetof(struct lnet_ni_status, ns_status) == 8);
- CLASSERT((int)sizeof(((struct lnet_ni_status *)0)->ns_status) == 4);
- CLASSERT((int)offsetof(struct lnet_ni_status, ns_unused) == 12);
- CLASSERT((int)sizeof(((struct lnet_ni_status *)0)->ns_unused) == 4);
+ BUILD_BUG_ON((int)sizeof(struct lnet_ni_status) != 16);
+ BUILD_BUG_ON((int)offsetof(struct lnet_ni_status, ns_nid) != 0);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_ni_status *)0)->ns_nid) != 8);
+ BUILD_BUG_ON((int)offsetof(struct lnet_ni_status, ns_status) != 8);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_ni_status *)0)->ns_status) != 4);
+ BUILD_BUG_ON((int)offsetof(struct lnet_ni_status, ns_unused) != 12);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_ni_status *)0)->ns_unused) != 4);
/* Checks for struct lnet_ping_info and related constants */
- CLASSERT(LNET_PROTO_PING_MAGIC == 0x70696E67);
- CLASSERT(LNET_PING_FEAT_INVAL == 0);
- CLASSERT(LNET_PING_FEAT_BASE == 1);
- CLASSERT(LNET_PING_FEAT_NI_STATUS == 2);
- CLASSERT(LNET_PING_FEAT_RTE_DISABLED == 4);
- CLASSERT(LNET_PING_FEAT_MULTI_RAIL == 8);
- CLASSERT(LNET_PING_FEAT_DISCOVERY == 16);
- CLASSERT(LNET_PING_FEAT_BITS == 31);
+ BUILD_BUG_ON(LNET_PROTO_PING_MAGIC != 0x70696E67);
+ BUILD_BUG_ON(LNET_PING_FEAT_INVAL != 0);
+ BUILD_BUG_ON(LNET_PING_FEAT_BASE != 1);
+ BUILD_BUG_ON(LNET_PING_FEAT_NI_STATUS != 2);
+ BUILD_BUG_ON(LNET_PING_FEAT_RTE_DISABLED != 4);
+ BUILD_BUG_ON(LNET_PING_FEAT_MULTI_RAIL != 8);
+ BUILD_BUG_ON(LNET_PING_FEAT_DISCOVERY != 16);
+ BUILD_BUG_ON(LNET_PING_FEAT_BITS != 31);
/* Checks for struct lnet_ping_info */
- CLASSERT((int)sizeof(struct lnet_ping_info) == 16);
- CLASSERT((int)offsetof(struct lnet_ping_info, pi_magic) == 0);
- CLASSERT((int)sizeof(((struct lnet_ping_info *)0)->pi_magic) == 4);
- CLASSERT((int)offsetof(struct lnet_ping_info, pi_features) == 4);
- CLASSERT((int)sizeof(((struct lnet_ping_info *)0)->pi_features) == 4);
- CLASSERT((int)offsetof(struct lnet_ping_info, pi_pid) == 8);
- CLASSERT((int)sizeof(((struct lnet_ping_info *)0)->pi_pid) == 4);
- CLASSERT((int)offsetof(struct lnet_ping_info, pi_nnis) == 12);
- CLASSERT((int)sizeof(((struct lnet_ping_info *)0)->pi_nnis) == 4);
- CLASSERT((int)offsetof(struct lnet_ping_info, pi_ni) == 16);
- CLASSERT((int)sizeof(((struct lnet_ping_info *)0)->pi_ni) == 0);
+ BUILD_BUG_ON((int)sizeof(struct lnet_ping_info) != 16);
+ BUILD_BUG_ON((int)offsetof(struct lnet_ping_info, pi_magic) != 0);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_ping_info *)0)->pi_magic) != 4);
+ BUILD_BUG_ON((int)offsetof(struct lnet_ping_info, pi_features) != 4);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_ping_info *)0)->pi_features) != 4);
+ BUILD_BUG_ON((int)offsetof(struct lnet_ping_info, pi_pid) != 8);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_ping_info *)0)->pi_pid) != 4);
+ BUILD_BUG_ON((int)offsetof(struct lnet_ping_info, pi_nnis) != 12);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_ping_info *)0)->pi_nnis) != 4);
+ BUILD_BUG_ON((int)offsetof(struct lnet_ping_info, pi_ni) != 16);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_ping_info *)0)->pi_ni) != 0);
}
-static struct lnet_lnd *lnet_find_lnd_by_type(__u32 type)
+static const struct lnet_lnd *lnet_find_lnd_by_type(__u32 type)
{
- struct lnet_lnd *lnd;
- struct list_head *tmp;
+ const struct lnet_lnd *lnd;
/* holding lnd mutex */
- list_for_each(tmp, &the_lnet.ln_lnds) {
- lnd = list_entry(tmp, struct lnet_lnd, lnd_list);
+ if (type >= NUM_LNDS)
+ return NULL;
+ lnd = the_lnet.ln_lnds[type];
+ LASSERT(!lnd || lnd->lnd_type == type);
- if (lnd->lnd_type == type)
- return lnd;
- }
- return NULL;
+ return lnd;
}
unsigned int
EXPORT_SYMBOL(lnet_get_lnd_timeout);
void
-lnet_register_lnd(struct lnet_lnd *lnd)
+lnet_register_lnd(const struct lnet_lnd *lnd)
{
mutex_lock(&the_lnet.ln_lnd_mutex);
LASSERT(libcfs_isknown_lnd(lnd->lnd_type));
LASSERT(lnet_find_lnd_by_type(lnd->lnd_type) == NULL);
- list_add_tail(&lnd->lnd_list, &the_lnet.ln_lnds);
- lnd->lnd_refcount = 0;
+ the_lnet.ln_lnds[lnd->lnd_type] = lnd;
CDEBUG(D_NET, "%s LND registered\n", libcfs_lnd2str(lnd->lnd_type));
EXPORT_SYMBOL(lnet_register_lnd);
void
-lnet_unregister_lnd(struct lnet_lnd *lnd)
+lnet_unregister_lnd(const struct lnet_lnd *lnd)
{
mutex_lock(&the_lnet.ln_lnd_mutex);
LASSERT(lnet_find_lnd_by_type(lnd->lnd_type) == lnd);
- LASSERT(lnd->lnd_refcount == 0);
- list_del(&lnd->lnd_list);
+ the_lnet.ln_lnds[lnd->lnd_type] = NULL;
CDEBUG(D_NET, "%s LND unregistered\n", libcfs_lnd2str(lnd->lnd_type));
mutex_unlock(&the_lnet.ln_lnd_mutex);
__swab64s(&stat->ns_nid);
__swab32s(&stat->ns_status);
}
- return;
}
int
lnet_net_lock(LNET_LOCK_EX);
- net->net_state = LNET_NET_STATE_DELETING;
-
list_del_init(&net->net_list);
while (!list_empty(&net->net_ni_list)) {
/* Do peer table cleanup for this net */
lnet_peer_tables_cleanup(net);
- lnet_net_lock(LNET_LOCK_EX);
- /*
- * decrement ref count on lnd only when the entire network goes
- * away
- */
- net->net_lnd->lnd_refcount--;
-
- lnet_net_unlock(LNET_LOCK_EX);
-
lnet_net_free(net);
}
if (rc != 0) {
LCONSOLE_ERROR_MSG(0x105, "Error %d starting up LNI %s\n",
rc, libcfs_lnd2str(net->net_lnd->lnd_type));
- lnet_net_lock(LNET_LOCK_EX);
- net->net_lnd->lnd_refcount--;
- lnet_net_unlock(LNET_LOCK_EX);
goto failed0;
}
int rc;
int ni_count = 0;
__u32 lnd_type;
- struct lnet_lnd *lnd;
+ const struct lnet_lnd *lnd;
int peer_timeout =
net->net_tunables.lct_peer_timeout;
int maxtxcredits =
}
}
- lnet_net_lock(LNET_LOCK_EX);
- lnd->lnd_refcount++;
- lnet_net_unlock(LNET_LOCK_EX);
-
net->net_lnd = lnd;
mutex_unlock(&the_lnet.ln_lnd_mutex);
rc = lnet_startup_lndni(ni, tun);
- LASSERT(ni->ni_net->net_tunables.lct_peer_timeout <= 0 ||
- ni->ni_net->net_lnd->lnd_query != NULL);
-
if (rc < 0)
goto failed1;
+ LASSERT(ni->ni_net->net_tunables.lct_peer_timeout <= 0 ||
+ ni->ni_net->net_lnd->lnd_query != NULL);
+
lnet_ni_addref(ni);
list_add_tail(&ni->ni_netlist, &local_ni_list);
*/
lnet_net_free(net);
} else {
- net->net_state = LNET_NET_STATE_ACTIVE;
/*
* restore tunables after it has been overwitten by the
* lnd
}
the_lnet.ln_refcount = 0;
- INIT_LIST_HEAD(&the_lnet.ln_lnds);
INIT_LIST_HEAD(&the_lnet.ln_net_zombie);
INIT_LIST_HEAD(&the_lnet.ln_msg_resend);
*
* \pre lnet_lib_init() called with success.
* \pre All LNet users called LNetNIFini() for matching LNetNIInit() calls.
+ *
+ * As this happens at module-unload, all lnds must already be unloaded,
+ * so they must already be unregistered.
*/
void lnet_lib_exit(void)
{
- LASSERT(the_lnet.ln_refcount == 0);
+ int i;
- while (!list_empty(&the_lnet.ln_lnds))
- lnet_unregister_lnd(list_entry(the_lnet.ln_lnds.next,
- struct lnet_lnd, lnd_list));
+ LASSERT(the_lnet.ln_refcount == 0);
+ lnet_unregister_lnd(&the_lolnd);
+ for (i = 0; i < NUM_LNDS; i++)
+ LASSERT(!the_lnet.ln_lnds[i]);
lnet_destroy_locks();
}
* \return always 0 for current implementation.
*/
int
-LNetNIFini()
+LNetNIFini(void)
{
mutex_lock(&the_lnet.ln_api_mutex);