Merge remote-tracking branch 'usb-chipidea-next/ci-for-usb-next'
[deliverable/linux.git] / drivers / staging / lustre / include / linux / lnet / lib-types.h
1 /*
2 * GPL HEADER START
3 *
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 only,
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License version 2 for more details (a copy is included
14 * in the LICENSE file that accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License
17 * version 2 along with this program; If not, see
18 * http://www.gnu.org/licenses/gpl-2.0.html
19 *
20 * GPL HEADER END
21 */
22 /*
23 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Use is subject to license terms.
25 *
26 * Copyright (c) 2012, 2015, Intel Corporation.
27 */
28 /*
29 * This file is part of Lustre, http://www.lustre.org/
30 * Lustre is a trademark of Seagate, Inc.
31 *
32 * lnet/include/lnet/lib-types.h
33 */
34
35 #ifndef __LNET_LIB_TYPES_H__
36 #define __LNET_LIB_TYPES_H__
37
38 #include <linux/kthread.h>
39 #include <linux/uio.h>
40 #include <linux/types.h>
41 #include <linux/completion.h>
42
43 #include "types.h"
44 #include "lnetctl.h"
45
46 /* Max payload size */
47 #define LNET_MAX_PAYLOAD CONFIG_LNET_MAX_PAYLOAD
48 #if (LNET_MAX_PAYLOAD < LNET_MTU)
49 # error "LNET_MAX_PAYLOAD too small - error in configure --with-max-payload-mb"
50 #elif (LNET_MAX_PAYLOAD > (PAGE_SIZE * LNET_MAX_IOV))
51 # error "LNET_MAX_PAYLOAD too large - error in configure --with-max-payload-mb"
52 #endif
53
54 /* forward refs */
55 struct lnet_libmd;
56
57 typedef struct lnet_msg {
58 struct list_head msg_activelist;
59 struct list_head msg_list; /* Q for credits/MD */
60
61 lnet_process_id_t msg_target;
62 /* where is it from, it's only for building event */
63 lnet_nid_t msg_from;
64 __u32 msg_type;
65
66 /* committed for sending */
67 unsigned int msg_tx_committed:1;
68 /* CPT # this message committed for sending */
69 unsigned int msg_tx_cpt:15;
70 /* committed for receiving */
71 unsigned int msg_rx_committed:1;
72 /* CPT # this message committed for receiving */
73 unsigned int msg_rx_cpt:15;
74 /* queued for tx credit */
75 unsigned int msg_tx_delayed:1;
76 /* queued for RX buffer */
77 unsigned int msg_rx_delayed:1;
78 /* ready for pending on RX delay list */
79 unsigned int msg_rx_ready_delay:1;
80
81 unsigned int msg_vmflush:1; /* VM trying to free memory */
82 unsigned int msg_target_is_router:1; /* sending to a router */
83 unsigned int msg_routing:1; /* being forwarded */
84 unsigned int msg_ack:1; /* ack on finalize (PUT) */
85 unsigned int msg_sending:1; /* outgoing message */
86 unsigned int msg_receiving:1; /* being received */
87 unsigned int msg_txcredit:1; /* taken an NI send credit */
88 unsigned int msg_peertxcredit:1; /* taken a peer send credit */
89 unsigned int msg_rtrcredit:1; /* taken a global router credit */
90 unsigned int msg_peerrtrcredit:1; /* taken a peer router credit */
91 unsigned int msg_onactivelist:1; /* on the activelist */
92 unsigned int msg_rdma_get:1;
93
94 struct lnet_peer *msg_txpeer; /* peer I'm sending to */
95 struct lnet_peer *msg_rxpeer; /* peer I received from */
96
97 void *msg_private;
98 struct lnet_libmd *msg_md;
99
100 unsigned int msg_len;
101 unsigned int msg_wanted;
102 unsigned int msg_offset;
103 unsigned int msg_niov;
104 struct kvec *msg_iov;
105 lnet_kiov_t *msg_kiov;
106
107 lnet_event_t msg_ev;
108 lnet_hdr_t msg_hdr;
109 } lnet_msg_t;
110
111 typedef struct lnet_libhandle {
112 struct list_head lh_hash_chain;
113 __u64 lh_cookie;
114 } lnet_libhandle_t;
115
116 #define lh_entry(ptr, type, member) \
117 ((type *)((char *)(ptr) - (char *)(&((type *)0)->member)))
118
119 typedef struct lnet_eq {
120 struct list_head eq_list;
121 lnet_libhandle_t eq_lh;
122 lnet_seq_t eq_enq_seq;
123 lnet_seq_t eq_deq_seq;
124 unsigned int eq_size;
125 lnet_eq_handler_t eq_callback;
126 lnet_event_t *eq_events;
127 int **eq_refs; /* percpt refcount for EQ */
128 } lnet_eq_t;
129
130 typedef struct lnet_me {
131 struct list_head me_list;
132 lnet_libhandle_t me_lh;
133 lnet_process_id_t me_match_id;
134 unsigned int me_portal;
135 unsigned int me_pos; /* hash offset in mt_hash */
136 __u64 me_match_bits;
137 __u64 me_ignore_bits;
138 lnet_unlink_t me_unlink;
139 struct lnet_libmd *me_md;
140 } lnet_me_t;
141
142 typedef struct lnet_libmd {
143 struct list_head md_list;
144 lnet_libhandle_t md_lh;
145 lnet_me_t *md_me;
146 char *md_start;
147 unsigned int md_offset;
148 unsigned int md_length;
149 unsigned int md_max_size;
150 int md_threshold;
151 int md_refcount;
152 unsigned int md_options;
153 unsigned int md_flags;
154 void *md_user_ptr;
155 lnet_eq_t *md_eq;
156 unsigned int md_niov; /* # frags */
157 union {
158 struct kvec iov[LNET_MAX_IOV];
159 lnet_kiov_t kiov[LNET_MAX_IOV];
160 } md_iov;
161 } lnet_libmd_t;
162
163 #define LNET_MD_FLAG_ZOMBIE (1 << 0)
164 #define LNET_MD_FLAG_AUTO_UNLINK (1 << 1)
165 #define LNET_MD_FLAG_ABORTED (1 << 2)
166
167 typedef struct {
168 /* info about peers we are trying to fail */
169 struct list_head tp_list; /* ln_test_peers */
170 lnet_nid_t tp_nid; /* matching nid */
171 unsigned int tp_threshold; /* # failures to simulate */
172 } lnet_test_peer_t;
173
174 #define LNET_COOKIE_TYPE_MD 1
175 #define LNET_COOKIE_TYPE_ME 2
176 #define LNET_COOKIE_TYPE_EQ 3
177 #define LNET_COOKIE_TYPE_BITS 2
178 #define LNET_COOKIE_MASK ((1ULL << LNET_COOKIE_TYPE_BITS) - 1ULL)
179
180 struct lnet_ni; /* forward ref */
181
182 typedef struct lnet_lnd {
183 /* fields managed by portals */
184 struct list_head lnd_list; /* stash in the LND table */
185 int lnd_refcount; /* # active instances */
186
187 /* fields initialised by the LND */
188 __u32 lnd_type;
189
190 int (*lnd_startup)(struct lnet_ni *ni);
191 void (*lnd_shutdown)(struct lnet_ni *ni);
192 int (*lnd_ctl)(struct lnet_ni *ni, unsigned int cmd, void *arg);
193
194 /*
195 * In data movement APIs below, payload buffers are described as a set
196 * of 'niov' fragments which are...
197 * EITHER
198 * in virtual memory (struct iovec *iov != NULL)
199 * OR
200 * in pages (kernel only: plt_kiov_t *kiov != NULL).
201 * The LND may NOT overwrite these fragment descriptors.
202 * An 'offset' and may specify a byte offset within the set of
203 * fragments to start from
204 */
205
206 /*
207 * Start sending a preformatted message. 'private' is NULL for PUT and
208 * GET messages; otherwise this is a response to an incoming message
209 * and 'private' is the 'private' passed to lnet_parse(). Return
210 * non-zero for immediate failure, otherwise complete later with
211 * lnet_finalize()
212 */
213 int (*lnd_send)(struct lnet_ni *ni, void *private, lnet_msg_t *msg);
214
215 /*
216 * Start receiving 'mlen' bytes of payload data, skipping the following
217 * 'rlen' - 'mlen' bytes. 'private' is the 'private' passed to
218 * lnet_parse(). Return non-zero for immediate failure, otherwise
219 * complete later with lnet_finalize(). This also gives back a receive
220 * credit if the LND does flow control.
221 */
222 int (*lnd_recv)(struct lnet_ni *ni, void *private, lnet_msg_t *msg,
223 int delayed, unsigned int niov,
224 struct kvec *iov, lnet_kiov_t *kiov,
225 unsigned int offset, unsigned int mlen,
226 unsigned int rlen);
227
228 /*
229 * lnet_parse() has had to delay processing of this message
230 * (e.g. waiting for a forwarding buffer or send credits). Give the
231 * LND a chance to free urgently needed resources. If called, return 0
232 * for success and do NOT give back a receive credit; that has to wait
233 * until lnd_recv() gets called. On failure return < 0 and
234 * release resources; lnd_recv() will not be called.
235 */
236 int (*lnd_eager_recv)(struct lnet_ni *ni, void *private,
237 lnet_msg_t *msg, void **new_privatep);
238
239 /* notification of peer health */
240 void (*lnd_notify)(struct lnet_ni *ni, lnet_nid_t peer, int alive);
241
242 /* query of peer aliveness */
243 void (*lnd_query)(struct lnet_ni *ni, lnet_nid_t peer,
244 unsigned long *when);
245
246 /* accept a new connection */
247 int (*lnd_accept)(struct lnet_ni *ni, struct socket *sock);
248 } lnd_t;
249
250 struct lnet_tx_queue {
251 int tq_credits; /* # tx credits free */
252 int tq_credits_min; /* lowest it's been */
253 int tq_credits_max; /* total # tx credits */
254 struct list_head tq_delayed; /* delayed TXs */
255 };
256
257 typedef struct lnet_ni {
258 spinlock_t ni_lock;
259 struct list_head ni_list; /* chain on ln_nis */
260 struct list_head ni_cptlist; /* chain on ln_nis_cpt */
261 int ni_maxtxcredits; /* # tx credits */
262 /* # per-peer send credits */
263 int ni_peertxcredits;
264 /* # per-peer router buffer credits */
265 int ni_peerrtrcredits;
266 /* seconds to consider peer dead */
267 int ni_peertimeout;
268 int ni_ncpts; /* number of CPTs */
269 __u32 *ni_cpts; /* bond NI on some CPTs */
270 lnet_nid_t ni_nid; /* interface's NID */
271 void *ni_data; /* instance-specific data */
272 lnd_t *ni_lnd; /* procedural interface */
273 struct lnet_tx_queue **ni_tx_queues; /* percpt TX queues */
274 int **ni_refs; /* percpt reference count */
275 time64_t ni_last_alive;/* when I was last alive */
276 lnet_ni_status_t *ni_status; /* my health status */
277 /* per NI LND tunables */
278 struct lnet_ioctl_config_lnd_tunables *ni_lnd_tunables;
279 /* equivalent interfaces to use */
280 char *ni_interfaces[LNET_MAX_INTERFACES];
281 } lnet_ni_t;
282
283 #define LNET_PROTO_PING_MATCHBITS 0x8000000000000000LL
284
285 /*
286 * NB: value of these features equal to LNET_PROTO_PING_VERSION_x
287 * of old LNet, so there shouldn't be any compatibility issue
288 */
289 #define LNET_PING_FEAT_INVAL (0) /* no feature */
290 #define LNET_PING_FEAT_BASE (1 << 0) /* just a ping */
291 #define LNET_PING_FEAT_NI_STATUS (1 << 1) /* return NI status */
292 #define LNET_PING_FEAT_RTE_DISABLED (1 << 2) /* Routing enabled */
293
294 #define LNET_PING_FEAT_MASK (LNET_PING_FEAT_BASE | \
295 LNET_PING_FEAT_NI_STATUS)
296
297 /* router checker data, per router */
298 #define LNET_MAX_RTR_NIS 16
299 #define LNET_PINGINFO_SIZE offsetof(lnet_ping_info_t, pi_ni[LNET_MAX_RTR_NIS])
300 typedef struct {
301 /* chain on the_lnet.ln_zombie_rcd or ln_deathrow_rcd */
302 struct list_head rcd_list;
303 lnet_handle_md_t rcd_mdh; /* ping buffer MD */
304 struct lnet_peer *rcd_gateway; /* reference to gateway */
305 lnet_ping_info_t *rcd_pinginfo; /* ping buffer */
306 } lnet_rc_data_t;
307
308 typedef struct lnet_peer {
309 struct list_head lp_hashlist; /* chain on peer hash */
310 struct list_head lp_txq; /* messages blocking for
311 tx credits */
312 struct list_head lp_rtrq; /* messages blocking for
313 router credits */
314 struct list_head lp_rtr_list; /* chain on router list */
315 int lp_txcredits; /* # tx credits available */
316 int lp_mintxcredits; /* low water mark */
317 int lp_rtrcredits; /* # router credits */
318 int lp_minrtrcredits; /* low water mark */
319 unsigned int lp_alive:1; /* alive/dead? */
320 unsigned int lp_notify:1; /* notification outstanding? */
321 unsigned int lp_notifylnd:1;/* outstanding notification
322 for LND? */
323 unsigned int lp_notifying:1; /* some thread is handling
324 notification */
325 unsigned int lp_ping_notsent;/* SEND event outstanding
326 from ping */
327 int lp_alive_count; /* # times router went
328 dead<->alive */
329 long lp_txqnob; /* bytes queued for sending */
330 unsigned long lp_timestamp; /* time of last aliveness
331 news */
332 unsigned long lp_ping_timestamp;/* time of last ping
333 attempt */
334 unsigned long lp_ping_deadline; /* != 0 if ping reply
335 expected */
336 unsigned long lp_last_alive; /* when I was last alive */
337 unsigned long lp_last_query; /* when lp_ni was queried
338 last time */
339 lnet_ni_t *lp_ni; /* interface peer is on */
340 lnet_nid_t lp_nid; /* peer's NID */
341 int lp_refcount; /* # refs */
342 int lp_cpt; /* CPT this peer attached on */
343 /* # refs from lnet_route_t::lr_gateway */
344 int lp_rtr_refcount;
345 /* returned RC ping features */
346 unsigned int lp_ping_feats;
347 struct list_head lp_routes; /* routers on this peer */
348 lnet_rc_data_t *lp_rcd; /* router checker state */
349 } lnet_peer_t;
350
351 /* peer hash size */
352 #define LNET_PEER_HASH_BITS 9
353 #define LNET_PEER_HASH_SIZE (1 << LNET_PEER_HASH_BITS)
354
355 /* peer hash table */
356 struct lnet_peer_table {
357 int pt_version; /* /proc validity stamp */
358 int pt_number; /* # peers extant */
359 /* # zombies to go to deathrow (and not there yet) */
360 int pt_zombies;
361 struct list_head pt_deathrow; /* zombie peers */
362 struct list_head *pt_hash; /* NID->peer hash */
363 };
364
365 /*
366 * peer aliveness is enabled only on routers for peers in a network where the
367 * lnet_ni_t::ni_peertimeout has been set to a positive value
368 */
369 #define lnet_peer_aliveness_enabled(lp) (the_lnet.ln_routing && \
370 (lp)->lp_ni->ni_peertimeout > 0)
371
372 typedef struct {
373 struct list_head lr_list; /* chain on net */
374 struct list_head lr_gwlist; /* chain on gateway */
375 lnet_peer_t *lr_gateway; /* router node */
376 __u32 lr_net; /* remote network number */
377 int lr_seq; /* sequence for round-robin */
378 unsigned int lr_downis; /* number of down NIs */
379 __u32 lr_hops; /* how far I am */
380 unsigned int lr_priority; /* route priority */
381 } lnet_route_t;
382
383 #define LNET_REMOTE_NETS_HASH_DEFAULT (1U << 7)
384 #define LNET_REMOTE_NETS_HASH_MAX (1U << 16)
385 #define LNET_REMOTE_NETS_HASH_SIZE (1 << the_lnet.ln_remote_nets_hbits)
386
387 typedef struct {
388 struct list_head lrn_list; /* chain on
389 ln_remote_nets_hash */
390 struct list_head lrn_routes; /* routes to me */
391 __u32 lrn_net; /* my net number */
392 } lnet_remotenet_t;
393
394 /** lnet message has credit and can be submitted to lnd for send/receive */
395 #define LNET_CREDIT_OK 0
396 /** lnet message is waiting for credit */
397 #define LNET_CREDIT_WAIT 1
398
399 typedef struct {
400 struct list_head rbp_bufs; /* my free buffer pool */
401 struct list_head rbp_msgs; /* messages blocking
402 for a buffer */
403 int rbp_npages; /* # pages in each buffer */
404 /* requested number of buffers */
405 int rbp_req_nbuffers;
406 /* # buffers actually allocated */
407 int rbp_nbuffers;
408 int rbp_credits; /* # free buffers /
409 blocked messages */
410 int rbp_mincredits; /* low water mark */
411 } lnet_rtrbufpool_t;
412
413 typedef struct {
414 struct list_head rb_list; /* chain on rbp_bufs */
415 lnet_rtrbufpool_t *rb_pool; /* owning pool */
416 lnet_kiov_t rb_kiov[0]; /* the buffer space */
417 } lnet_rtrbuf_t;
418
419 #define LNET_PEER_HASHSIZE 503 /* prime! */
420
421 #define LNET_TINY_BUF_IDX 0
422 #define LNET_SMALL_BUF_IDX 1
423 #define LNET_LARGE_BUF_IDX 2
424
425 /* # different router buffer pools */
426 #define LNET_NRBPOOLS (LNET_LARGE_BUF_IDX + 1)
427
428 enum {
429 /* Didn't match anything */
430 LNET_MATCHMD_NONE = (1 << 0),
431 /* Matched OK */
432 LNET_MATCHMD_OK = (1 << 1),
433 /* Must be discarded */
434 LNET_MATCHMD_DROP = (1 << 2),
435 /* match and buffer is exhausted */
436 LNET_MATCHMD_EXHAUSTED = (1 << 3),
437 /* match or drop */
438 LNET_MATCHMD_FINISH = (LNET_MATCHMD_OK | LNET_MATCHMD_DROP),
439 };
440
441 /* Options for lnet_portal_t::ptl_options */
442 #define LNET_PTL_LAZY (1 << 0)
443 #define LNET_PTL_MATCH_UNIQUE (1 << 1) /* unique match, for RDMA */
444 #define LNET_PTL_MATCH_WILDCARD (1 << 2) /* wildcard match,
445 request portal */
446
447 /* parameter for matching operations (GET, PUT) */
448 struct lnet_match_info {
449 __u64 mi_mbits;
450 lnet_process_id_t mi_id;
451 unsigned int mi_opc;
452 unsigned int mi_portal;
453 unsigned int mi_rlength;
454 unsigned int mi_roffset;
455 };
456
457 /* ME hash of RDMA portal */
458 #define LNET_MT_HASH_BITS 8
459 #define LNET_MT_HASH_SIZE (1 << LNET_MT_HASH_BITS)
460 #define LNET_MT_HASH_MASK (LNET_MT_HASH_SIZE - 1)
461 /*
462 * we allocate (LNET_MT_HASH_SIZE + 1) entries for lnet_match_table::mt_hash,
463 * the last entry is reserved for MEs with ignore-bits
464 */
465 #define LNET_MT_HASH_IGNORE LNET_MT_HASH_SIZE
466 /*
467 * __u64 has 2^6 bits, so need 2^(LNET_MT_HASH_BITS - LNET_MT_BITS_U64) which
468 * is 4 __u64s as bit-map, and add an extra __u64 (only use one bit) for the
469 * ME-list with ignore-bits, which is mtable::mt_hash[LNET_MT_HASH_IGNORE]
470 */
471 #define LNET_MT_BITS_U64 6 /* 2^6 bits */
472 #define LNET_MT_EXHAUSTED_BITS (LNET_MT_HASH_BITS - LNET_MT_BITS_U64)
473 #define LNET_MT_EXHAUSTED_BMAP ((1 << LNET_MT_EXHAUSTED_BITS) + 1)
474
475 /* portal match table */
476 struct lnet_match_table {
477 /* reserved for upcoming patches, CPU partition ID */
478 unsigned int mt_cpt;
479 unsigned int mt_portal; /* portal index */
480 /*
481 * match table is set as "enabled" if there's non-exhausted MD
482 * attached on mt_mhash, it's only valid for wildcard portal
483 */
484 unsigned int mt_enabled;
485 /* bitmap to flag whether MEs on mt_hash are exhausted or not */
486 __u64 mt_exhausted[LNET_MT_EXHAUSTED_BMAP];
487 struct list_head *mt_mhash; /* matching hash */
488 };
489
490 /* these are only useful for wildcard portal */
491 /* Turn off message rotor for wildcard portals */
492 #define LNET_PTL_ROTOR_OFF 0
493 /* round-robin dispatch all PUT messages for wildcard portals */
494 #define LNET_PTL_ROTOR_ON 1
495 /* round-robin dispatch routed PUT message for wildcard portals */
496 #define LNET_PTL_ROTOR_RR_RT 2
497 /* dispatch routed PUT message by hashing source NID for wildcard portals */
498 #define LNET_PTL_ROTOR_HASH_RT 3
499
500 typedef struct lnet_portal {
501 spinlock_t ptl_lock;
502 unsigned int ptl_index; /* portal ID, reserved */
503 /* flags on this portal: lazy, unique... */
504 unsigned int ptl_options;
505 /* list of messages which are stealing buffer */
506 struct list_head ptl_msg_stealing;
507 /* messages blocking for MD */
508 struct list_head ptl_msg_delayed;
509 /* Match table for each CPT */
510 struct lnet_match_table **ptl_mtables;
511 /* spread rotor of incoming "PUT" */
512 unsigned int ptl_rotor;
513 /* # active entries for this portal */
514 int ptl_mt_nmaps;
515 /* array of active entries' cpu-partition-id */
516 int ptl_mt_maps[0];
517 } lnet_portal_t;
518
519 #define LNET_LH_HASH_BITS 12
520 #define LNET_LH_HASH_SIZE (1ULL << LNET_LH_HASH_BITS)
521 #define LNET_LH_HASH_MASK (LNET_LH_HASH_SIZE - 1)
522
523 /* resource container (ME, MD, EQ) */
524 struct lnet_res_container {
525 unsigned int rec_type; /* container type */
526 __u64 rec_lh_cookie; /* cookie generator */
527 struct list_head rec_active; /* active resource list */
528 struct list_head *rec_lh_hash; /* handle hash */
529 };
530
531 /* message container */
532 struct lnet_msg_container {
533 int msc_init; /* initialized or not */
534 /* max # threads finalizing */
535 int msc_nfinalizers;
536 /* msgs waiting to complete finalizing */
537 struct list_head msc_finalizing;
538 struct list_head msc_active; /* active message list */
539 /* threads doing finalization */
540 void **msc_finalizers;
541 };
542
543 /* Router Checker states */
544 #define LNET_RC_STATE_SHUTDOWN 0 /* not started */
545 #define LNET_RC_STATE_RUNNING 1 /* started up OK */
546 #define LNET_RC_STATE_STOPPING 2 /* telling thread to stop */
547
548 typedef struct {
549 /* CPU partition table of LNet */
550 struct cfs_cpt_table *ln_cpt_table;
551 /* number of CPTs in ln_cpt_table */
552 unsigned int ln_cpt_number;
553 unsigned int ln_cpt_bits;
554
555 /* protect LNet resources (ME/MD/EQ) */
556 struct cfs_percpt_lock *ln_res_lock;
557 /* # portals */
558 int ln_nportals;
559 /* the vector of portals */
560 lnet_portal_t **ln_portals;
561 /* percpt ME containers */
562 struct lnet_res_container **ln_me_containers;
563 /* percpt MD container */
564 struct lnet_res_container **ln_md_containers;
565
566 /* Event Queue container */
567 struct lnet_res_container ln_eq_container;
568 wait_queue_head_t ln_eq_waitq;
569 spinlock_t ln_eq_wait_lock;
570 unsigned int ln_remote_nets_hbits;
571
572 /* protect NI, peer table, credits, routers, rtrbuf... */
573 struct cfs_percpt_lock *ln_net_lock;
574 /* percpt message containers for active/finalizing/freed message */
575 struct lnet_msg_container **ln_msg_containers;
576 lnet_counters_t **ln_counters;
577 struct lnet_peer_table **ln_peer_tables;
578 /* failure simulation */
579 struct list_head ln_test_peers;
580 struct list_head ln_drop_rules;
581 struct list_head ln_delay_rules;
582
583 struct list_head ln_nis; /* LND instances */
584 /* NIs bond on specific CPT(s) */
585 struct list_head ln_nis_cpt;
586 /* dying LND instances */
587 struct list_head ln_nis_zombie;
588 lnet_ni_t *ln_loni; /* the loopback NI */
589
590 /* remote networks with routes to them */
591 struct list_head *ln_remote_nets_hash;
592 /* validity stamp */
593 __u64 ln_remote_nets_version;
594 /* list of all known routers */
595 struct list_head ln_routers;
596 /* validity stamp */
597 __u64 ln_routers_version;
598 /* percpt router buffer pools */
599 lnet_rtrbufpool_t **ln_rtrpools;
600
601 lnet_handle_md_t ln_ping_target_md;
602 lnet_handle_eq_t ln_ping_target_eq;
603 lnet_ping_info_t *ln_ping_info;
604
605 /* router checker startup/shutdown state */
606 int ln_rc_state;
607 /* router checker's event queue */
608 lnet_handle_eq_t ln_rc_eqh;
609 /* rcd still pending on net */
610 struct list_head ln_rcd_deathrow;
611 /* rcd ready for free */
612 struct list_head ln_rcd_zombie;
613 /* serialise startup/shutdown */
614 struct completion ln_rc_signal;
615
616 struct mutex ln_api_mutex;
617 struct mutex ln_lnd_mutex;
618 struct mutex ln_delay_mutex;
619 /* Have I called LNetNIInit myself? */
620 int ln_niinit_self;
621 /* LNetNIInit/LNetNIFini counter */
622 int ln_refcount;
623 /* shutdown in progress */
624 int ln_shutdown;
625
626 int ln_routing; /* am I a router? */
627 lnet_pid_t ln_pid; /* requested pid */
628 /* uniquely identifies this ni in this epoch */
629 __u64 ln_interface_cookie;
630 /* registered LNDs */
631 struct list_head ln_lnds;
632
633 /* test protocol compatibility flags */
634 int ln_testprotocompat;
635
636 /*
637 * 0 - load the NIs from the mod params
638 * 1 - do not load the NIs from the mod params
639 * Reverse logic to ensure that other calls to LNetNIInit
640 * need no change
641 */
642 bool ln_nis_from_mod_params;
643
644 /*
645 * waitq for router checker. As long as there are no routes in
646 * the list, the router checker will sleep on this queue. when
647 * routes are added the thread will wake up
648 */
649 wait_queue_head_t ln_rc_waitq;
650
651 } lnet_t;
652
653 #endif
This page took 0.049898 seconds and 5 git commands to generate.