- /* Stuff initialised at LNetInit() */
- int ln_init; /* LNetInit() called? */
- int ln_refcount; /* LNetNIInit/LNetNIFini counter */
- int ln_niinit_self; /* Have I called LNetNIInit myself? */
-
- cfs_list_t ln_lnds; /* registered LNDs */
-
-#ifdef __KERNEL__
- cfs_spinlock_t ln_lock;
- cfs_waitq_t ln_waitq;
- cfs_semaphore_t ln_api_mutex;
- cfs_semaphore_t ln_lnd_mutex;
-#else
-# ifndef HAVE_LIBPTHREAD
- int ln_lock;
- int ln_api_mutex;
- int ln_lnd_mutex;
-# else
- pthread_cond_t ln_cond;
- pthread_mutex_t ln_lock;
- pthread_mutex_t ln_api_mutex;
- pthread_mutex_t ln_lnd_mutex;
-# endif
-#endif
-
- /* Stuff initialised at LNetNIInit() */
-
- int ln_shutdown; /* shutdown in progress */
- int ln_nportals; /* # portals */
- lnet_portal_t *ln_portals; /* the vector of portals */
-
- lnet_pid_t ln_pid; /* requested pid */
-
- cfs_list_t ln_nis; /* LND instances */
- lnet_ni_t *ln_loni; /* the loopback NI */
- lnet_ni_t *ln_eqwaitni; /* NI to wait for events in */
- cfs_list_t ln_zombie_nis; /* dying LND instances */
- int ln_nzombie_nis; /* # of NIs to wait for */
-
- cfs_list_t ln_remote_nets; /* remote networks with routes to them */
- __u64 ln_remote_nets_version; /* validity stamp */
-
- cfs_list_t ln_routers; /* list of all known routers */
- __u64 ln_routers_version; /* validity stamp */
-
- cfs_list_t *ln_peer_hash; /* NID->peer hash */
- int ln_npeers; /* # peers extant */
- int ln_peertable_version; /* /proc validity stamp */
-
- int ln_routing; /* am I a router? */
- lnet_rtrbufpool_t ln_rtrpools[LNET_NRBPOOLS]; /* router buffer pools */
-
- int ln_lh_hash_size; /* size of lib handle hash table */
- cfs_list_t *ln_lh_hash_table; /* all extant lib handles, this interface */
- __u64 ln_next_object_cookie; /* cookie generator */
- __u64 ln_interface_cookie; /* uniquely identifies this ni in this epoch */
-
- char *ln_network_tokens; /* space for network names */
- int ln_network_tokens_nob;
-
- int ln_testprotocompat; /* test protocol compatibility flags */
-
- cfs_list_t ln_finalizeq; /* msgs waiting to complete finalizing */
-#ifdef __KERNEL__
- void **ln_finalizers; /* threads doing finalization */
- int ln_nfinalizers; /* max # threads finalizing */
-#else
- int ln_finalizing;
-#endif
- cfs_list_t ln_test_peers; /* failure simulation */
-
- lnet_handle_md_t ln_ping_target_md;
- lnet_handle_eq_t ln_ping_target_eq;
- lnet_ping_info_t *ln_ping_info;
-
-#ifdef __KERNEL__
- cfs_semaphore_t ln_rc_signal; /* serialise startup/shutdown */
-#endif
- int ln_rc_state; /* router checker startup/shutdown state */
- lnet_handle_eq_t ln_rc_eqh; /* router checker's event queue */
- lnet_handle_md_t ln_rc_mdh;
- cfs_list_t ln_zombie_rcd;
-
-#ifdef LNET_USE_LIB_FREELIST
- lnet_freelist_t ln_free_mes;
- lnet_freelist_t ln_free_msgs;
- lnet_freelist_t ln_free_mds;
- lnet_freelist_t ln_free_eqs;
-#endif
- cfs_list_t ln_active_msgs;
- cfs_list_t ln_active_mds;
- cfs_list_t ln_active_eqs;
-
- lnet_counters_t ln_counters;
-
-#ifndef __KERNEL__
- /* Temporary workaround to allow uOSS and test programs force
- * server mode in userspace. The only place where we use it is
- * lnet_prepare(). The only way to turn this flag on is to
- * call lnet_server_mode() */
-
- int ln_server_mode_flag;
-#endif
+ /* CPU partition table of LNet */
+ struct cfs_cpt_table *ln_cpt_table;
+ /* number of CPTs in ln_cpt_table */
+ unsigned int ln_cpt_number;
+ unsigned int ln_cpt_bits;
+
+ /* protect LNet resources (ME/MD/EQ) */
+ struct cfs_percpt_lock *ln_res_lock;
+ /* # portals */
+ int ln_nportals;
+ /* the vector of portals */
+ lnet_portal_t **ln_portals;
+ /* percpt ME containers */
+ struct lnet_res_container **ln_me_containers;
+ /* percpt MD container */
+ struct lnet_res_container **ln_md_containers;
+
+ /* Event Queue container */
+ struct lnet_res_container ln_eq_container;
+ wait_queue_head_t ln_eq_waitq;
+ spinlock_t ln_eq_wait_lock;
+
+ unsigned int ln_remote_nets_hbits;
+
+ /* protect NI, peer table, credits, routers, rtrbuf... */
+ struct cfs_percpt_lock *ln_net_lock;
+ /* percpt message containers for active/finalizing/freed message */
+ struct lnet_msg_container **ln_msg_containers;
+ lnet_counters_t **ln_counters;
+ struct lnet_peer_table **ln_peer_tables;
+ /* list of configured or discovered peers */
+ struct list_head ln_peers;
+ /* list of peer nis not on a local network */
+ struct list_head ln_remote_peer_ni_list;
+ /* failure simulation */
+ struct list_head ln_test_peers;
+ struct list_head ln_drop_rules;
+ struct list_head ln_delay_rules;
+ /* LND instances */
+ struct list_head ln_nets;
+ /* the loopback NI */
+ struct lnet_ni *ln_loni;
+ /* network zombie list */
+ struct list_head ln_net_zombie;
+
+ /* remote networks with routes to them */
+ struct list_head *ln_remote_nets_hash;
+ /* validity stamp */
+ __u64 ln_remote_nets_version;
+ /* list of all known routers */
+ struct list_head ln_routers;
+ /* validity stamp */
+ __u64 ln_routers_version;
+ /* percpt router buffer pools */
+ lnet_rtrbufpool_t **ln_rtrpools;
+
+ lnet_handle_md_t ln_ping_target_md;
+ lnet_handle_eq_t ln_ping_target_eq;
+ struct lnet_ping_info *ln_ping_info;
+
+ /* router checker startup/shutdown state */
+ int ln_rc_state;
+ /* router checker's event queue */
+ lnet_handle_eq_t ln_rc_eqh;
+ /* rcd still pending on net */
+ struct list_head ln_rcd_deathrow;
+ /* rcd ready for free */
+ struct list_head ln_rcd_zombie;
+ /* serialise startup/shutdown */
+ struct semaphore ln_rc_signal;
+
+ struct mutex ln_api_mutex;
+ struct mutex ln_lnd_mutex;
+ /* Have I called LNetNIInit myself? */
+ int ln_niinit_self;
+ /* LNetNIInit/LNetNIFini counter */
+ int ln_refcount;
+ /* shutdown in progress */
+ int ln_shutdown;
+
+ int ln_routing; /* am I a router? */
+ lnet_pid_t ln_pid; /* requested pid */
+ /* uniquely identifies this ni in this epoch */
+ __u64 ln_interface_cookie;
+ /* registered LNDs */
+ struct list_head ln_lnds;
+
+ /* test protocol compatibility flags */
+ int ln_testprotocompat;
+
+ /* 0 - load the NIs from the mod params
+ * 1 - do not load the NIs from the mod params
+ * Reverse logic to ensure that other calls to LNetNIInit
+ * need no change
+ */
+ bool ln_nis_from_mod_params;
+
+ /* waitq for router checker. As long as there are no routes in
+ * the list, the router checker will sleep on this queue. when
+ * routes are added the thread will wake up */
+ wait_queue_head_t ln_rc_waitq;