- kib_dev_t *ibn_dev; /* underlying IB device */
-} kib_net_t;
-
-typedef struct
-{
- int kib_init; /* initialisation state */
- int kib_shutdown; /* shut down? */
- cfs_list_t kib_devs; /* IB devices extant */
- cfs_list_t kib_failed_devs; /* list head of failed devices */
- cfs_atomic_t kib_nthreads; /* # live threads */
- cfs_rwlock_t kib_global_lock; /* stabilize net/dev/peer/conn ops */
-
- cfs_list_t *kib_peers; /* hash table of all my known peers */
- int kib_peer_hash_size;/* size of kib_peers */
-
- void *kib_connd; /* the connd task (serialisation assertions) */
- cfs_list_t kib_connd_conns; /* connections to setup/teardown */
- cfs_list_t kib_connd_zombies;/* connections with zero refcount */
- cfs_waitq_t kib_connd_waitq; /* connection daemon sleeps here */
- cfs_spinlock_t kib_connd_lock; /* serialise */
-
- cfs_waitq_t kib_sched_waitq; /* schedulers sleep here */
- cfs_list_t kib_sched_conns; /* conns to check for rx completions */
- cfs_spinlock_t kib_sched_lock; /* serialise */
- cfs_waitq_t kib_failover_waitq; /* schedulers sleep here */
-
- struct ib_qp_attr kib_error_qpa; /* QP->ERROR */
-} kib_data_t;
+struct kib_net {
+ /* chain on struct kib_dev::ibd_nets */
+ struct list_head ibn_list;
+ __u64 ibn_incarnation;/* my epoch */
+ int ibn_init; /* initialisation state */
+ int ibn_shutdown; /* shutting down? */
+
+ atomic_t ibn_npeers; /* # peers extant */
+ atomic_t ibn_nconns; /* # connections extant */
+
+ struct kib_tx_poolset **ibn_tx_ps; /* tx pool-set */
+ struct kib_fmr_poolset **ibn_fmr_ps; /* fmr pool-set */
+
+ struct kib_dev *ibn_dev; /* underlying IB device */
+ struct lnet_ni *ibn_ni; /* LNet interface */
+};
+
+#define KIB_THREAD_SHIFT 16
+#define KIB_THREAD_ID(cpt, tid) ((cpt) << KIB_THREAD_SHIFT | (tid))
+#define KIB_THREAD_CPT(id) ((id) >> KIB_THREAD_SHIFT)
+#define KIB_THREAD_TID(id) ((id) & ((1UL << KIB_THREAD_SHIFT) - 1))
+
+struct kib_sched_info {
+ /* serialise */
+ spinlock_t ibs_lock;
+ /* schedulers sleep here */
+ wait_queue_head_t ibs_waitq;
+ /* conns to check for rx completions */
+ struct list_head ibs_conns;
+ /* number of scheduler threads */
+ int ibs_nthreads;
+ /* max allowed scheduler threads */
+ int ibs_nthreads_max;
+ int ibs_cpt; /* CPT id */
+};
+
+struct kib_data {
+ int kib_init; /* initialisation state */
+ int kib_shutdown; /* shut down? */
+ struct list_head kib_devs; /* IB devices extant */
+ /* list head of failed devices */
+ struct list_head kib_failed_devs;
+ /* schedulers sleep here */
+ wait_queue_head_t kib_failover_waitq;
+ atomic_t kib_nthreads; /* # live threads */
+ /* stabilize net/dev/peer_ni/conn ops */
+ rwlock_t kib_global_lock;
+ /* hash table of all my known peers */
+ struct list_head *kib_peers;
+ /* size of kib_peers */
+ int kib_peer_hash_size;
+ /* the connd task (serialisation assertions) */
+ void *kib_connd;
+ /* connections to setup/teardown */
+ struct list_head kib_connd_conns;
+ /* connections with zero refcount */
+ struct list_head kib_connd_zombies;
+ /* connections to reconnect */
+ struct list_head kib_reconn_list;
+ /* peers wait for reconnection */
+ struct list_head kib_reconn_wait;
+ /*
+ * The second that peers are pulled out from \a kib_reconn_wait
+ * for reconnection.
+ */
+ time64_t kib_reconn_sec;
+ /* connection daemon sleeps here */
+ wait_queue_head_t kib_connd_waitq;
+ spinlock_t kib_connd_lock; /* serialise */
+ struct ib_qp_attr kib_error_qpa; /* QP->ERROR */
+ /* percpt data for schedulers */
+ struct kib_sched_info **kib_scheds;
+};