4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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.
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).
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
23 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Use is subject to license terms.
26 * Copyright (c) 2012, 2017, Intel Corporation.
29 * This file is part of Lustre, http://www.lustre.org/
31 * lnet/include/lnet/lib-types.h
33 * Types used by the library side routines that do not need to be
34 * exposed to the user application
37 #ifndef __LNET_LIB_TYPES_H__
38 #define __LNET_LIB_TYPES_H__
41 # error This include is only for kernel use.
44 #include <linux/kthread.h>
45 #include <linux/uio.h>
46 #include <linux/semaphore.h>
47 #include <linux/types.h>
48 #include <linux/kref.h>
49 #include <net/genetlink.h>
51 #include <uapi/linux/lnet/lnet-nl.h>
52 #include <uapi/linux/lnet/lnet-dlc.h>
53 #include <uapi/linux/lnet/lnetctl.h>
54 #include <uapi/linux/lnet/nidstr.h>
56 int libcfs_strid(struct lnet_processid *id, const char *str);
58 int cfs_match_nid_net(struct lnet_nid *nid, u32 net,
59 struct list_head *net_num_list,
60 struct list_head *addr);
62 /* Max payload size */
63 #define LNET_MAX_PAYLOAD LNET_MTU
65 /** limit on the number of fragments in discontiguous MDs */
66 #define LNET_MAX_IOV 256
69 * This is the maximum health value.
70 * All local and peer NIs created have their health default to this value.
72 #define LNET_MAX_HEALTH_VALUE 1000
73 #define LNET_MAX_SELECTION_PRIORITY UINT_MAX
78 enum lnet_msg_hstatus {
79 LNET_MSG_STATUS_OK = 0,
80 LNET_MSG_STATUS_LOCAL_INTERRUPT,
81 LNET_MSG_STATUS_LOCAL_DROPPED,
82 LNET_MSG_STATUS_LOCAL_ABORTED,
83 LNET_MSG_STATUS_LOCAL_NO_ROUTE,
84 LNET_MSG_STATUS_LOCAL_ERROR,
85 LNET_MSG_STATUS_LOCAL_TIMEOUT,
86 LNET_MSG_STATUS_REMOTE_ERROR,
87 LNET_MSG_STATUS_REMOTE_DROPPED,
88 LNET_MSG_STATUS_REMOTE_TIMEOUT,
89 LNET_MSG_STATUS_NETWORK_TIMEOUT,
93 struct lnet_rsp_tracker {
94 /* chain on the waiting list */
95 struct list_head rspt_on_list;
99 struct lnet_nid rspt_next_hop_nid;
100 /* deadline of the REPLY/ACK */
101 ktime_t rspt_deadline;
103 struct lnet_handle_md rspt_mdh;
107 struct list_head msg_activelist;
108 struct list_head msg_list; /* Q for credits/MD */
110 struct lnet_processid msg_target;
111 /* Primary NID of the source. */
112 struct lnet_nid msg_initiator;
113 /* where is it from, it's only for building event */
114 struct lnet_nid msg_from;
118 * hold parameters in case message is with held due
121 struct lnet_nid msg_src_nid_param;
122 struct lnet_nid msg_rtr_nid_param;
125 * Deadline for the message after which it will be finalized if it
128 ktime_t msg_deadline;
130 /* The message health status. */
131 enum lnet_msg_hstatus msg_health_status;
132 /* This is a recovery message */
134 /* the number of times a transmission has been retried */
136 /* flag to indicate that we do not want to resend this message */
139 /* committed for sending */
140 unsigned int msg_tx_committed:1;
141 /* CPT # this message committed for sending */
142 unsigned int msg_tx_cpt:15;
143 /* committed for receiving */
144 unsigned int msg_rx_committed:1;
145 /* CPT # this message committed for receiving */
146 unsigned int msg_rx_cpt:15;
147 /* queued for tx credit */
148 unsigned int msg_tx_delayed:1;
149 /* queued for RX buffer */
150 unsigned int msg_rx_delayed:1;
151 /* ready for pending on RX delay list */
152 unsigned int msg_rx_ready_delay:1;
154 unsigned int msg_vmflush:1; /* VM trying to free memory */
155 unsigned int msg_target_is_router:1; /* sending to a router */
156 unsigned int msg_routing:1; /* being forwarded */
157 unsigned int msg_ack:1; /* ack on finalize (PUT) */
158 unsigned int msg_sending:1; /* outgoing message */
159 unsigned int msg_receiving:1; /* being received */
160 unsigned int msg_txcredit:1; /* taken an NI send credit */
161 unsigned int msg_peertxcredit:1; /* taken a peer send credit */
162 unsigned int msg_rtrcredit:1; /* taken a globel router credit */
163 unsigned int msg_peerrtrcredit:1; /* taken a peer router credit */
164 unsigned int msg_onactivelist:1; /* on the activelist */
165 unsigned int msg_rdma_get:1;
167 struct lnet_peer_ni *msg_txpeer; /* peer I'm sending to */
168 struct lnet_peer_ni *msg_rxpeer; /* peer I received from */
171 struct lnet_libmd *msg_md;
172 /* the NI the message was sent or received over */
173 struct lnet_ni *msg_txni;
174 struct lnet_ni *msg_rxni;
176 unsigned int msg_len;
177 unsigned int msg_wanted;
178 unsigned int msg_offset;
179 unsigned int msg_niov;
180 struct bio_vec *msg_kiov;
182 struct lnet_event msg_ev;
183 struct lnet_hdr msg_hdr;
186 struct lnet_libhandle {
187 struct list_head lh_hash_chain;
191 #define lh_entry(ptr, type, member) \
192 ((type *)((char *)(ptr)-(char *)(&((type *)0)->member)))
195 struct list_head me_list;
197 struct lnet_processid me_match_id;
198 unsigned int me_portal;
199 unsigned int me_pos; /* hash offset in mt_hash */
201 __u64 me_ignore_bits;
202 enum lnet_unlink me_unlink;
203 struct lnet_libmd *me_md;
207 struct list_head md_list;
208 struct lnet_libhandle md_lh;
209 struct lnet_me *md_me;
211 unsigned int md_offset;
212 unsigned int md_length;
213 unsigned int md_max_size;
216 unsigned int md_options;
217 unsigned int md_flags;
218 unsigned int md_niov; /* # frags at end of struct */
220 struct lnet_rsp_tracker *md_rspt_ptr;
221 lnet_handler_t md_handler;
222 struct lnet_handle_md md_bulk_handle;
223 struct bio_vec md_kiov[LNET_MAX_IOV];
226 #define LNET_MD_FLAG_ZOMBIE BIT(0)
227 #define LNET_MD_FLAG_AUTO_UNLINK BIT(1)
228 #define LNET_MD_FLAG_ABORTED BIT(2)
229 /* LNET_MD_FLAG_HANDLING is set when a non-unlink event handler
230 * is being called for an event relating to the md.
231 * It ensures only one such handler runs at a time.
232 * The final "unlink" event is only called once the
233 * md_refcount has reached zero, and this flag has been cleared,
234 * ensuring that it doesn't race with any other event handler
237 #define LNET_MD_FLAG_HANDLING BIT(3)
238 #define LNET_MD_FLAG_DISCARD BIT(4)
239 #define LNET_MD_FLAG_GPU BIT(5) /**< Special mapping needs */
241 static inline bool lnet_md_is_gpu(struct lnet_libmd *md)
243 return (md != NULL) && !!(md->md_flags & LNET_MD_FLAG_GPU);
246 struct lnet_test_peer {
247 /* info about peers we are trying to fail */
248 struct list_head tp_list; /* ln_test_peers */
249 struct lnet_nid tp_nid; /* matching nid */
250 unsigned int tp_threshold; /* # failures to simulate */
253 #define LNET_COOKIE_TYPE_MD 1
254 #define LNET_COOKIE_TYPE_ME 2
255 #define LNET_COOKIE_TYPE_EQ 3
256 #define LNET_COOKIE_TYPE_BITS 2
257 #define LNET_COOKIE_MASK ((1ULL << LNET_COOKIE_TYPE_BITS) - 1ULL)
263 void (*nf_addr2str)(u32 addr, char *str, size_t size);
264 void (*nf_addr2str_size)(const __be32 *addr, size_t asize,
265 char *str, size_t size);
266 int (*nf_str2addr)(const char *str, int nob, u32 *addr);
267 int (*nf_str2addr_size)(const char *str, int nob,
268 __be32 *addr, size_t *asize);
269 int (*nf_parse_addrlist)(char *str, int len,
270 struct list_head *list);
271 int (*nf_print_addrlist)(char *buffer, int count,
272 struct list_head *list);
273 int (*nf_match_addr)(u32 addr, struct list_head *list);
274 int (*nf_min_max)(struct list_head *nidlist, u32 *min_nid,
278 struct lnet_ni; /* forward ref */
282 /* fields initialized by the LND */
285 int (*lnd_startup)(struct lnet_ni *ni);
286 void (*lnd_shutdown)(struct lnet_ni *ni);
287 int (*lnd_ctl)(struct lnet_ni *ni, unsigned int cmd, void *arg);
289 /* In data movement APIs below, payload buffers are described as a set
290 * of 'niov' fragments which are in pages.
291 * The LND may NOT overwrite these fragment descriptors.
292 * An 'offset' and may specify a byte offset within the set of
293 * fragments to start from
296 /* Start sending a preformatted message. 'private' is NULL for PUT and
297 * GET messages; otherwise this is a response to an incoming message
298 * and 'private' is the 'private' passed to lnet_parse(). Return
299 * non-zero for immediate failure, otherwise complete later with
301 int (*lnd_send)(struct lnet_ni *ni, void *private,
302 struct lnet_msg *msg);
304 /* Start receiving 'mlen' bytes of payload data, skipping the following
305 * 'rlen' - 'mlen' bytes. 'private' is the 'private' passed to
306 * lnet_parse(). Return non-zero for immedaite failure, otherwise
307 * complete later with lnet_finalize(). This also gives back a receive
308 * credit if the LND does flow control. */
309 int (*lnd_recv)(struct lnet_ni *ni, void *private, struct lnet_msg *msg,
310 int delayed, unsigned int niov,
311 struct bio_vec *kiov,
312 unsigned int offset, unsigned int mlen, unsigned int rlen);
314 /* lnet_parse() has had to delay processing of this message
315 * (e.g. waiting for a forwarding buffer or send credits). Give the
316 * LND a chance to free urgently needed resources. If called, return 0
317 * for success and do NOT give back a receive credit; that has to wait
318 * until lnd_recv() gets called. On failure return < 0 and
319 * release resources; lnd_recv() will not be called. */
320 int (*lnd_eager_recv)(struct lnet_ni *ni, void *private,
321 struct lnet_msg *msg, void **new_privatep);
323 /* notification of peer down */
324 void (*lnd_notify_peer_down)(struct lnet_nid *peer);
326 /* accept a new connection */
327 int (*lnd_accept)(struct lnet_ni *ni, struct socket *sock);
329 /* get dma_dev priority */
330 unsigned int (*lnd_get_dev_prio)(struct lnet_ni *ni,
331 unsigned int dev_idx);
333 /* Handle LND specific Netlink handling */
334 int (*lnd_nl_get)(int cmd, struct sk_buff *msg, int type, void *data);
335 int (*lnd_nl_set)(int cmd, struct nlattr *attr, int type, void *data);
337 const struct ln_key_list *lnd_keys;
340 struct lnet_tx_queue {
341 int tq_credits; /* # tx credits free */
342 int tq_credits_min; /* lowest it's been */
343 int tq_credits_max; /* total # tx credits */
344 struct list_head tq_delayed; /* delayed TXs */
347 enum lnet_net_state {
348 /* set when net block is allocated */
349 LNET_NET_STATE_INIT = 0,
350 /* set when NIs in net are started successfully */
351 LNET_NET_STATE_ACTIVE,
352 /* set if all NIs in net are in FAILED state */
353 LNET_NET_STATE_INACTIVE,
354 /* set when shutting down a NET */
355 LNET_NET_STATE_DELETING
359 /* initial state when NI is created */
360 LNET_NI_STATE_INIT = 0,
361 /* set when NI is brought up */
362 LNET_NI_STATE_ACTIVE,
363 /* set when NI is being shutdown */
364 LNET_NI_STATE_DELETING,
367 #define LNET_NI_RECOVERY_PENDING BIT(0)
368 #define LNET_NI_RECOVERY_FAILED BIT(1)
370 enum lnet_stats_type {
371 LNET_STATS_TYPE_SEND = 0,
372 LNET_STATS_TYPE_RECV,
376 struct lnet_comm_count {
377 atomic_t co_get_count;
378 atomic_t co_put_count;
379 atomic_t co_reply_count;
380 atomic_t co_ack_count;
381 atomic_t co_hello_count;
384 struct lnet_element_stats {
385 struct lnet_comm_count el_send_stats;
386 struct lnet_comm_count el_recv_stats;
387 struct lnet_comm_count el_drop_stats;
390 struct lnet_health_local_stats {
391 atomic_t hlt_local_interrupt;
392 atomic_t hlt_local_dropped;
393 atomic_t hlt_local_aborted;
394 atomic_t hlt_local_no_route;
395 atomic_t hlt_local_timeout;
396 atomic_t hlt_local_error;
399 struct lnet_health_remote_stats {
400 atomic_t hlt_remote_dropped;
401 atomic_t hlt_remote_timeout;
402 atomic_t hlt_remote_error;
403 atomic_t hlt_network_timeout;
407 /* chain on the ln_nets */
408 struct list_head net_list;
410 /* net ID, which is composed of
411 * (net_type << 16) | net_num.
412 * net_type can be one of the enumerated types defined in
413 * lnet/include/lnet/nidstr.h */
416 /* round robin selection */
419 /* total number of CPTs in the array */
422 /* cumulative CPTs of all NIs in this net */
425 /* relative net selection priority */
426 __u32 net_sel_priority;
428 /* network tunables */
429 struct lnet_ioctl_config_lnd_cmn_tunables net_tunables;
432 * boolean to indicate that the tunables have been set and
435 bool net_tunables_set;
437 /* procedural interface */
438 const struct lnet_lnd *net_lnd;
440 /* list of NIs on this net */
441 struct list_head net_ni_list;
443 /* list of NIs being added, but not started yet */
444 struct list_head net_ni_added;
446 /* dying LND instances */
447 struct list_head net_ni_zombie;
449 /* when I was last alive */
450 time64_t net_last_alive;
452 /* protects access to net_last_alive */
455 /* list of router nids preferred for this network */
456 struct list_head net_rtr_pref_nids;
459 /* Normally Netlink atttributes are defined in UAPI headers but Lustre is
460 * different in that the ABI is in a constant state of change unlike other
461 * Netlink interfaces. LNet sends a special header to help user land handle
465 /** enum lnet_err_atrrs - LNet error netlink properties
466 * For LNet request of multiple items
467 * sometimes those items exist and
468 * others don't. In the case the item
469 * item doesn't exist we return the
472 * @LNET_ERR_ATTR_UNSPEC: unspecified attribute to catch errors
474 * @LNET_ERR_ATTR_HDR: Name of the error header
476 * @LNET_ERR_ATTR_TYPE: Which LNet function since error is for
478 * @LNET_ERR_TYPE_ERRNO: Error code for failure (NLA_S16)
479 * @LNET_ERR_DESCR: Complete error message (NLA_STRING)
481 enum lnet_err_attrs {
482 LNET_ERR_ATTR_UNSPEC = 0,
488 __LNET_ERR_ATTR_MAX_PLUS_ONE,
491 #define LNET_ERR_ATTR_MAX (__LNET_ERR_ATTR_MAX_PLUS_ONE - 1)
493 /** enum lnet_net_attrs - LNet NI netlink properties
494 * attributes that describe LNet 'NI'
495 * These values are used to piece together
496 * messages for sending and receiving.
498 * @LNET_NET_ATTR_UNSPEC: unspecified attribute to catch errors
500 * @LNET_NET_ATTR_HDR: grouping for LNet net data (NLA_NUL_STRING)
501 * @LNET_NET_ATTR_TYPE: LNet net this NI belongs to (NLA_STRING)
502 * @LNET_NET_ATTR_LOCAL: Local NI information (NLA_NESTED)
504 enum lnet_net_attrs {
505 LNET_NET_ATTR_UNSPEC = 0,
511 __LNET_NET_ATTR_MAX_PLUS_ONE,
514 #define LNET_NET_ATTR_MAX (__LNET_NET_ATTR_MAX_PLUS_ONE - 1)
516 /** enum lnet_net_local_ni_attrs - LNet local NI netlink properties
517 * attributes that describe local
520 * @LNET_NET_LOCAL_NI_ATTR_UNSPEC: unspecified attribute to catch
523 * @LNET_NET_LOCAL_NI_ATTR_NID: NID that represents this NI
525 * @LNET_NET_LOCAL_NI_ATTR_STATUS: State of this NI (NLA_STRING)
526 * @LNET_NET_LOCAL_NI_ATTR_INTERFACE: Defines physical devices. used
527 * to be many devices but no longer
530 * @LNET_NET_LOCAL_NI_ATTR_STATS: NI general msg stats (NLA_NESTED)
531 * @LNET_NET_LOCAL_NI_ATTR_UDSP_INFO: NI UDSP state (NLA_NESTED)
532 * @LNET_NET_LOCAL_NI_ATTR_SEND_STATS: NI send stats (NLA_NESTED)
533 * @LNET_NET_LOCAL_NI_ATTR_RECV_STATS: NI recieved stats (NLA_NESTED)
534 * @LNET_NET_LOCAL_NI_ATTR_DROPPED_STATS: NI dropped stats (NLA_NESTED)
535 * @LNET_NET_LOCAL_NI_ATTR_HEALTH_STATS: NI health stats (NLA_NESTED)
536 * @LNET_NET_LOCAL_NI_ATTR_TUNABLES: NI tunables (NLA_NESTED)
537 * @LNET_NET_LOCAL_NI_ATTR_LND_TUNABLES: NI LND tunables (NLA_NESTED)
538 * @LNET_NET_LOCAL_NI_ATTR_DEV_CPT: NI CPT interface bound to
540 * @LNET_NET_LOCAL_NI_ATTR_CPTS: CPT core used by this NI
543 enum lnet_net_local_ni_attrs {
544 LNET_NET_LOCAL_NI_ATTR_UNSPEC = 0,
546 LNET_NET_LOCAL_NI_ATTR_NID,
547 LNET_NET_LOCAL_NI_ATTR_STATUS,
548 LNET_NET_LOCAL_NI_ATTR_INTERFACE,
550 LNET_NET_LOCAL_NI_ATTR_STATS,
551 LNET_NET_LOCAL_NI_ATTR_UDSP_INFO,
552 LNET_NET_LOCAL_NI_ATTR_SEND_STATS,
553 LNET_NET_LOCAL_NI_ATTR_RECV_STATS,
554 LNET_NET_LOCAL_NI_ATTR_DROPPED_STATS,
555 LNET_NET_LOCAL_NI_ATTR_HEALTH_STATS,
556 LNET_NET_LOCAL_NI_ATTR_TUNABLES,
557 LNET_NET_LOCAL_NI_ATTR_LND_TUNABLES,
558 LNET_NET_LOCAL_NI_DEV_CPT,
559 LNET_NET_LOCAL_NI_CPTS,
561 __LNET_NET_LOCAL_NI_ATTR_MAX_PLUS_ONE,
564 #define LNET_NET_LOCAL_NI_ATTR_MAX (__LNET_NET_LOCAL_NI_ATTR_MAX_PLUS_ONE - 1)
566 /** enum lnet_net_local_ni_intf_attrs - LNet NI device netlink properties
567 * attribute that reports the device
570 * @LNET_NET_LOCAL_NI_INTF_ATTR_UNSPEC: unspecified attribute to catch errors
572 * @LNET_NET_LOCAL_NI_INTF_ATTR_TYPE: Physcial device interface (NLA_STRING)
574 enum lnet_net_local_ni_intf_attrs {
575 LNET_NET_LOCAL_NI_INTF_ATTR_UNSPEC = 0,
577 LNET_NET_LOCAL_NI_INTF_ATTR_TYPE,
579 __LNET_NET_LOCAL_NI_INTF_ATTR_MAX_PLUS_ONE,
582 #define LNET_NET_LOCAL_NI_INTF_ATTR_MAX (__LNET_NET_LOCAL_NI_INTF_ATTR_MAX_PLUS_ONE - 1)
584 /** enum lnet_net_local_ni_stats_attrs - LNet NI netlink properties
585 * attributes that reports the
586 * network traffic stats
588 * @LNET_NET_LOCAL_NI_STATS_ATTR_UNSPEC: unspecified attribute to catch
591 * @LNET_NET_LOCAL_NI_STATS_ATTR_SEND_COUNT: Number of sent messages
593 * @LNET_NET_LOCAL_NI_STATS_ATTR_RECV_COUNT: Number of recieved messages
595 * @LNET_NET_LOCAL_NI_STATS_ATTR_DROP_COUNT: Number of dropped messages
598 enum lnet_net_local_ni_stats_attrs {
599 LNET_NET_LOCAL_NI_STATS_ATTR_UNSPEC = 0,
601 LNET_NET_LOCAL_NI_STATS_ATTR_SEND_COUNT,
602 LNET_NET_LOCAL_NI_STATS_ATTR_RECV_COUNT,
603 LNET_NET_LOCAL_NI_STATS_ATTR_DROP_COUNT,
604 __LNET_NET_LOCAL_NI_STATS_ATTR_MAX_PLUS_ONE,
607 #define LNET_NET_LOCAL_NI_STATS_ATTR_MAX (__LNET_NET_LOCAL_NI_STATS_ATTR_MAX_PLUS_ONE - 1)
609 /** enum lnet_net_local_ni_msg_stats_attrs - LNet NI netlink
610 * properties attributes
611 * that reports the message
614 * @LNET_NET_LOCAL_NI_MSG_STATS_ATTR_UNSPEC: unspecified attribute
617 * @LNET_NET_LOCAL_NI_MSG_STATS_ATTR_PUT_COUNT: Number of PUT messages
619 * @LNET_NET_LOCAL_NI_MSG_STATS_ATTR_GET_COUNT: Number of GET messages
621 * @LNET_NET_LOCAL_NI_MSG_STATS_ATTR_REPLY_COUNT: Number of REPLY messages
623 * @LNET_NET_LOCAL_NI_MSG_STATS_ATTR_ACK_COUNT: Number of ACK messages
625 * @LNET_NET_LOCAL_NI_MSG_STATS_ATTR_HELLO_COUNT: Number of HELLO messages
628 enum lnet_net_local_ni_msg_stats_attrs {
629 LNET_NET_LOCAL_NI_MSG_STATS_ATTR_UNSPEC = 0,
631 LNET_NET_LOCAL_NI_MSG_STATS_ATTR_PUT_COUNT,
632 LNET_NET_LOCAL_NI_MSG_STATS_ATTR_GET_COUNT,
633 LNET_NET_LOCAL_NI_MSG_STATS_ATTR_REPLY_COUNT,
634 LNET_NET_LOCAL_NI_MSG_STATS_ATTR_ACK_COUNT,
635 LNET_NET_LOCAL_NI_MSG_STATS_ATTR_HELLO_COUNT,
636 __LNET_NET_LOCAL_NI_MSG_STATS_ATTR_MAX_PLUS_ONE,
639 #define LNET_NET_LOCAL_NI_MSG_STATS_ATTR_MAX (__LNET_NET_LOCAL_NI_MSG_STATS_ATTR_MAX_PLUS_ONE - 1)
641 /** enum lnet_net_local_ni_health_stats_attrs - LNet NI netlink
642 * properties attributes
646 * @LNET_NET_LOCAL_NI_HEALTH_STATS_ATTR_UNSPEC: unspecified attribute
649 * @LNET_NET_LOCAL_NI_HEALTH_STATS_ATTR_FATAL_ERRORS: How many fatal errors
651 * @LNET_NET_LOCAL_NI_HEALTH_STATS_ATTR_LEVEL: How healthly is NI
653 * @LNET_NET_LOCAL_NI_HEALTH_STATS_ATTR_INTERRUPTS: How many interrupts
655 * @LNET_NET_LOCAL_NI_HEALTH_STATS_ATTR_DROPPED: How much traffic has
656 * been dropped (NLA_U32)
657 * @LNET_NET_LOCAL_NI_HEALTH_STATS_ATTR_ABORTED: How many aborts
659 * @LNET_NET_LOCAL_NI_HEALTH_STATS_ATTR_NO_ROUTE: How often routing broke
661 * @LNET_NET_LOCAL_NI_HEALTH_STATS_ATTR_TIMEOUTS: How often timeouts
663 * @LNET_NET_LOCAL_NI_HEALTH_STATS_ATTR_ERROR: The number of errors
665 * @LNET_NET_LOCAL_NI_HEALTH_STATS_ATTR_PING_COUNT: Number of successful
667 * @LNET_NET_LOCAL_NI_HEALTH_STATS_ATTR_NEXT_PING: Number of next pings
670 enum lnet_net_local_ni_health_stats_attrs {
671 LNET_NET_LOCAL_NI_HEALTH_STATS_ATTR_UNSPEC = 0,
672 LNET_NET_LOCAL_NI_HEALTH_STATS_ATTR_PAD = LNET_NET_LOCAL_NI_HEALTH_STATS_ATTR_UNSPEC,
674 LNET_NET_LOCAL_NI_HEALTH_STATS_ATTR_FATAL_ERRORS,
675 LNET_NET_LOCAL_NI_HEALTH_STATS_ATTR_LEVEL,
676 LNET_NET_LOCAL_NI_HEALTH_STATS_ATTR_INTERRUPTS,
677 LNET_NET_LOCAL_NI_HEALTH_STATS_ATTR_DROPPED,
678 LNET_NET_LOCAL_NI_HEALTH_STATS_ATTR_ABORTED,
679 LNET_NET_LOCAL_NI_HEALTH_STATS_ATTR_NO_ROUTE,
680 LNET_NET_LOCAL_NI_HEALTH_STATS_ATTR_TIMEOUTS,
681 LNET_NET_LOCAL_NI_HEALTH_STATS_ATTR_ERROR,
682 LNET_NET_LOCAL_NI_HEALTH_STATS_ATTR_PING_COUNT,
683 LNET_NET_LOCAL_NI_HEALTH_STATS_ATTR_NEXT_PING,
684 __LNET_NET_LOCAL_NI_HEALTH_STATS_ATTR_MAX_PLUS_ONE,
686 #define LNET_NET_LOCAL_NI_HEALTH_STATS_ATTR_MAX (__LNET_NET_LOCAL_NI_HEALTH_STATS_ATTR_MAX_PLUS_ONE - 1)
688 /** enum lnet_net_local_ni_tunables_attrs - LNet NI tunables
689 * netlink properties.
690 * Performance options
693 * @LNET_NET_LOCAL_NI_TUNABLES_ATTR_UNSPEC: unspecified attribute
696 * @LNET_NET_LOCAL_NI_TUNABLES_ATTR_PEER_TIMEOUT: Timeout for LNet peer.
698 * @LNET_NET_LOCAL_NI_TUNABLES_ATTR_PEER_CREDITS: Credits for LNet peer.
700 * @LNET_NET_LOCAL_NI_TUNABLES_ATTR_PEER_BUFFER_CREDITS: Buffer credits for
701 * LNet peer. (NLA_S32)
702 * @LNET_NET_LOCAL_NI_TUNABLES_ATTR_CREDITS: Credits for LNet peer
705 enum lnet_net_local_ni_tunables_attr {
706 LNET_NET_LOCAL_NI_TUNABLES_ATTR_UNSPEC = 0,
708 LNET_NET_LOCAL_NI_TUNABLES_ATTR_PEER_TIMEOUT,
709 LNET_NET_LOCAL_NI_TUNABLES_ATTR_PEER_CREDITS,
710 LNET_NET_LOCAL_NI_TUNABLES_ATTR_PEER_BUFFER_CREDITS,
711 LNET_NET_LOCAL_NI_TUNABLES_ATTR_CREDITS,
712 __LNET_NET_LOCAL_NI_TUNABLES_ATTR_MAX_PLUS_ONE,
715 #define LNET_NET_LOCAL_NI_TUNABLES_ATTR_MAX (__LNET_NET_LOCAL_NI_TUNABLES_ATTR_MAX_PLUS_ONE - 1)
717 /** enum lnet_route_attrs - LNet route netlink
718 * attributes that describe
721 * @LNET_ROUTE_ATTR_UNSPEC: unspecified attribute to
724 * @LNET_ROUTE_ATTR_HDR: grouping for LNet route data
726 * @LNET_ROUTE_ATTR_NET: LNet remote network reached
727 * by the route (NLA_STRING)
728 * @LNET_ROUTE_ATTR_GATEWAY: gateway for the route
730 * @LNET_ROUTE_ATTR_HOP: route hop count (NLA_S32)
732 * @LNET_ROUTE_ATTR_PRIORITY: rank of this network path
734 * @LNET_ROUTE_ATTR_HEALTH_SENSITIVITY: rate of health value change
735 * for the route (NLA_U32)
736 * @LNET_ROUTE_ATTR_STATE: state of route (NLA_STRING)
738 * @LNET_ROUTE_ATTR_TYPE: Report if we support multi-hop
741 enum lnet_route_attrs {
742 LNET_ROUTE_ATTR_UNSPEC = 0,
746 LNET_ROUTE_ATTR_GATEWAY,
748 LNET_ROUTE_ATTR_PRIORITY,
749 LNET_ROUTE_ATTR_HEALTH_SENSITIVITY,
750 LNET_ROUTE_ATTR_STATE,
751 LNET_ROUTE_ATTR_TYPE,
752 __LNET_ROUTE_ATTR_MAX_PLUS_ONE,
755 #define LNET_ROUTE_ATTR_MAX (__LNET_ROUTE_ATTR_MAX_PLUS_ONE - 1)
757 /** enum lnet_peer_ni_attrs - LNet peer NI netlink properties
758 * attributes that describe LNet peer 'NI'.
759 * These values are used to piece together
760 * messages for sending and receiving.
762 * @LNET_PEER_NI_ATTR_UNSPEC: unspecified attribute to catch errors
764 * @LNET_PEER_NI_ATTR_HDR: grouping for LNet peer data
766 * @LNET_PEER_NI_ATTR_PRIMARY_NID: primary NID of this peer (NLA_STRING)
767 * @LNET_PEER_NI_ATTR_MULTIRAIL: Do we support MultiRail ? (NLA_FLAG)
768 * @LNET_PEER_NI_ATTR_STATE: Bitfields of the peer state (NLA_U32)
769 * @LNET_PEER_NI_ATTR_PEER_NI_LIST: List of remote peers we can reach
772 enum lnet_peer_ni_attrs {
773 LNET_PEER_NI_ATTR_UNSPEC = 0,
775 LNET_PEER_NI_ATTR_HDR,
776 LNET_PEER_NI_ATTR_PRIMARY_NID,
777 LNET_PEER_NI_ATTR_MULTIRAIL,
778 LNET_PEER_NI_ATTR_STATE,
779 LNET_PEER_NI_ATTR_PEER_NI_LIST,
780 __LNET_PEER_NI_ATTR_MAX_PLUS_ONE,
783 #define LNET_PEER_NI_ATTR_MAX (__LNET_PEER_NI_ATTR_MAX_PLUS_ONE - 1)
785 /** enum lnet_peer_ni_list_attrs - LNet remote peer netlink
786 * properties attributes that
787 * describe remote LNet peer 'NI'.
788 * These values are used to piece
789 * together messages for sending
792 * @LNET_PEER_NI_LIST_ATTR_UNSPEC: unspecified attribute to catch
795 * @LNET_PEER_NI_LIST_ATTR_NID: remote peer's NID (NLA_STRING)
796 * @LNET_PEER_NI_LIST_ATTR_UDSP_INFO: remote peer's UDSP info
798 * @LNET_PEER_NI_LIST_ATTR_STATE: state of remote peer
801 * @LNET_PEER_NI_LIST_ATTR_MAX_TX_CREDITS: Maximum TX credits for remote
803 * @LNET_PEER_NI_LIST_ATTR_CUR_TX_CREDITS: Current TX credits for remote
805 * @LNET_PEER_NI_LIST_ATTR_MIN_TX_CREDITS: Minimum TX credits for remote
807 * @LNET_PEER_NI_LIST_ATTR_QUEUE_BUF_COUNT: Size of TX queue buffer
809 * @LNET_PEER_NI_LIST_ATTR_CUR_RTR_CREDITS: Current router credits for
810 * remote peer (NLA_U32)
811 * @LNET_PEER_NI_LIST_ATTR_MIN_RTR_CREDITS: Minimum router credits for
812 * remote peer (NLA_U32)
813 * @LNET_PEER_NI_LIST_ATTR_REFCOUNT: Remote peer reference count
815 * @LNET_PEER_NI_LIST_ATTR_STATS_COUNT: Remote peer general stats,
816 * reports sent, recieved, and
817 * dropped packets. (NLA_NESTED)
819 * @LNET_PEER_NI_LIST_ATTR_SENT_STATS: Remote peer sent stats,
820 * reports gets, puts, acks, and
821 * hello packets. (NLA_NESTED)
822 * @LNET_PEER_NI_LIST_ATTR_RECV_STATS: Remote peer recieved stats,
823 * reports gets, puts, acks, and
824 * hello packets. (NLA_NESTED)
825 * @LNET_PEER_NI_LIST_ATTR_DROP_STATS: Remote peer dropped stats,
826 * reports gets, puts, acks, and
827 * hello packets. (NLA_NESTED)
828 * @LNET_PEER_NI_LIST_ATTR_HEALTH_STATS: Report the stats about the
829 * health of the remote peer.
832 enum lnet_peer_ni_list_attr {
833 LNET_PEER_NI_LIST_ATTR_UNSPEC = 0,
835 LNET_PEER_NI_LIST_ATTR_NID,
836 LNET_PEER_NI_LIST_ATTR_UDSP_INFO,
837 LNET_PEER_NI_LIST_ATTR_STATE,
839 LNET_PEER_NI_LIST_ATTR_MAX_TX_CREDITS,
840 LNET_PEER_NI_LIST_ATTR_CUR_TX_CREDITS,
841 LNET_PEER_NI_LIST_ATTR_MIN_TX_CREDITS,
842 LNET_PEER_NI_LIST_ATTR_QUEUE_BUF_COUNT,
843 LNET_PEER_NI_LIST_ATTR_CUR_RTR_CREDITS,
844 LNET_PEER_NI_LIST_ATTR_MIN_RTR_CREDITS,
845 LNET_PEER_NI_LIST_ATTR_REFCOUNT,
846 LNET_PEER_NI_LIST_ATTR_STATS_COUNT,
848 LNET_PEER_NI_LIST_ATTR_SENT_STATS,
849 LNET_PEER_NI_LIST_ATTR_RECV_STATS,
850 LNET_PEER_NI_LIST_ATTR_DROP_STATS,
851 LNET_PEER_NI_LIST_ATTR_HEALTH_STATS,
853 __LNET_PEER_NI_LIST_ATTR_MAX_PLUS_ONE,
856 #define LNET_PEER_NI_LIST_ATTR_MAX (__LNET_PEER_NI_LIST_ATTR_MAX_PLUS_ONE - 1)
858 /** enum lnet_peer_ni_list_stats_count - LNet remote peer traffic
859 * stats netlink properties
860 * attributes that provide
861 * traffic stats on the
862 * remote LNet peer 'NI'.
863 * These values are used to
864 * piece together messages
865 * for sending and receiving.
867 * @LNET_PEER_NI_LIST_STATS_COUNT_ATTR_UNSPEC: unspecified attribute to
870 * @LNET_PEER_NI_LIST_STATS_COUNT_ATTR_SEND_COUNT: Number of sent packets for
871 * remote peer (NLA_U32)
872 * @LNET_PEER_NI_LIST_STATS_COUNT_ATTR_RECV_COUNT: Numebr of recieved packets
873 * for remote peer (NLA_U32)
874 * @LNET_PEER_NI_LIST_STATS_COUNT_ATTR_DROP_COUNT: Number of dropped packets
875 * for remote peer (NLA_U32)
877 enum lnet_peer_ni_list_stats_count {
878 LNET_PEER_NI_LIST_STATS_COUNT_ATTR_UNSPEC = 0,
880 LNET_PEER_NI_LIST_STATS_COUNT_ATTR_SEND_COUNT,
881 LNET_PEER_NI_LIST_STATS_COUNT_ATTR_RECV_COUNT,
882 LNET_PEER_NI_LIST_STATS_COUNT_ATTR_DROP_COUNT,
883 __LNET_PEER_NI_LIST_STATS_COUNT_ATTR_MAX_PLUS_ONE,
886 #define LNET_PEER_NI_LIST_STATS_COUNT_ATTR_MAX (__LNET_PEER_NI_LIST_STATS_COUNT_ATTR_MAX_PLUS_ONE - 1)
888 /** enum lnet_peer_ni_list_stats - LNet remote peer stats netlink
889 * properties attributes that
890 * provide stats on the remote
891 * LNet peer 'NI'. These values are
892 * used to piece together messages
893 * for sending and receiving.
895 * @LNET_PEER_NI_LIST_STATS_ATTR_UNSPEC: unspecified attribute to catch
898 * @LNET_PEER_NI_LIST_STATS_ATTR_PUT: PUT message count for remote
900 * @LNET_PEER_NI_LIST_STATS_ATTR_GET: GET message count for remote
902 * @LNET_PEER_NI_LIST_STATS_ATTR_REPLY: REPLY message count for remote
904 * @LNET_PEER_NI_LIST_STATS_ATTR_ACK: ACK message count for remote
906 * @LNET_PEER_NI_LIST_STATS_ATTR_HEALTH: HELLO message count for remote
909 enum lnet_peer_ni_list_stats {
910 LNET_PEER_NI_LIST_STATS_ATTR_UNSPEC = 0,
912 LNET_PEER_NI_LIST_STATS_ATTR_PUT,
913 LNET_PEER_NI_LIST_STATS_ATTR_GET,
914 LNET_PEER_NI_LIST_STATS_ATTR_REPLY,
915 LNET_PEER_NI_LIST_STATS_ATTR_ACK,
916 LNET_PEER_NI_LIST_STATS_ATTR_HELLO,
917 __LNET_PEER_NI_LIST_STATS_ATTR_MAX_PLUS_ONE,
920 #define LNET_PEER_NI_LIST_STATS_ATTR_MAX (__LNET_PEER_NI_LIST_STATS_ATTR_MAX_PLUS_ONE - 1)
922 /** enum lnet_peer_ni_list_health_stats - LNet remote peer health
923 * stats netlink properties
924 * attributes that provide
925 * stats on the health of a
926 * remote LNet peer 'NI'.
927 * These values are used to
928 * piece together messages
929 * for sending and receiving.
931 * @LNET_PEER_NI_LIST_HEALTH_STATS_ATTR_UNSPEC: unspecified attribute to
934 * @LNET_PEER_NI_LIST_HEALTH_STATS_ATTR_VALUE: Health level of remote
936 * @LNET_PEER_NI_LIST_HEALTH_STATS_ATTR_DROP: drop message state for
937 * remote peer (NLA_U32)
938 * @LNET_PEER_NI_LIST_HEALTH_STATS_ATTR_TIMEOUT: timeout set for remote
940 * @LNET_PEER_NI_LIST_HEALTH_STATS_ATTR_ERROR: total errors for remote
942 * @LNET_PEER_NI_LIST_HEALTH_STATS_ATTR_NETWORK_TIMEOUT: network timeout for
943 * remote peer (NLA_U32)
944 * @LNET_PEER_NI_LIST_HEALTH_STATS_ATTR_PING_COUNT: number of pings for
945 * remote peer (NLA_U32)
946 * @LNET_PEER_NI_LIST_HEALTH_STATS_ATTR_NEXT_PING: timestamp for next ping
947 * sent by remote peer
950 enum lnet_peer_ni_list_health_stats {
951 LNET_PEER_NI_LIST_HEALTH_STATS_ATTR_UNSPEC = 0,
952 LNET_PEER_NI_LIST_HEALTH_STATS_ATTR_PAD = LNET_PEER_NI_LIST_HEALTH_STATS_ATTR_UNSPEC,
954 LNET_PEER_NI_LIST_HEALTH_STATS_ATTR_VALUE,
955 LNET_PEER_NI_LIST_HEALTH_STATS_ATTR_DROPPED,
956 LNET_PEER_NI_LIST_HEALTH_STATS_ATTR_TIMEOUT,
957 LNET_PEER_NI_LIST_HEALTH_STATS_ATTR_ERROR,
958 LNET_PEER_NI_LIST_HEALTH_STATS_ATTR_NETWORK_TIMEOUT,
959 LNET_PEER_NI_LIST_HEALTH_STATS_ATTR_PING_COUNT,
960 LNET_PEER_NI_LIST_HEALTH_STATS_ATTR_NEXT_PING,
962 __LNET_PEER_NI_LIST_HEALTH_STATS_ATTR_MAX_PLUS_ONE,
965 #define LNET_PEER_NI_LIST_HEALTH_STATS_ATTR_MAX (__LNET_PEER_NI_LIST_HEALTH_STATS_ATTR_MAX_PLUS_ONE - 1)
967 /** LNet netlink ping API */
969 /** enum lnet_ping_attr - LNet ping netlink properties
970 * attributes to describe ping format
971 * These values are used to piece together
972 * messages for sending and receiving.
974 * @LNET_PING_ATTR_UNSPEC: unspecified attribute to catch errors
976 * @LNET_PING_ATTR_HDR: grouping for LNet ping data (NLA_NUL_STRING)
977 * @LNET_PING_ATTR_PRIMARY_NID: Source NID for ping request (NLA_STRING)
978 * @LNET_PING_ATTR_ERRNO: error code if we fail to ping (NLA_S16)
979 * @LNET_PING_ATTR_MULTIRAIL: Report if MR is supported (NLA_FLAG)
980 * @LNET_PING_ATTR_PEER_NI_LIST: List of peer NI's (NLA_NESTED)
982 enum lnet_ping_attr {
983 LNET_PING_ATTR_UNSPEC = 0,
986 LNET_PING_ATTR_PRIMARY_NID,
987 LNET_PING_ATTR_ERRNO,
988 LNET_PING_ATTR_MULTIRAIL,
989 LNET_PING_ATTR_PEER_NI_LIST,
990 __LNET_PING_ATTR_MAX_PLUS_ONE,
993 #define LNET_PING_ATTR_MAX (__LNET_PING_ATTR_MAX_PLUS_ONE - 1)
995 /** enum lnet_ping_peer_ni_attr - LNet peer ni information reported by
996 * ping command. A list of these are
997 * returned with a ping request.
999 * @LNET_PING_PEER_NI_ATTR_UNSPEC: unspecified attribute to catch errrors
1001 * @LNET_PING_PEER_NI_ATTR_NID: NID address of peer NI. (NLA_STRING)
1003 enum lnet_ping_peer_ni_attr {
1004 LNET_PING_PEER_NI_ATTR_UNSPEC = 0,
1006 LNET_PING_PEER_NI_ATTR_NID,
1007 __LNET_PING_PEER_NI_ATTR_MAX_PLUS_ONE,
1010 #define LNET_PING_PEER_NI_ATTR_MAX (__LNET_PING_PEER_NI_ATTR_MAX_PLUS_ONE - 1)
1012 /** enum lnet_udsp_info_attr - LNet UDSP information reported for
1013 * some subsystem that tracks it.
1015 * @LNET_UDSP_INFO_ATTR_UNSPEC: unspecified attribute to catch errors
1017 * @LNET_UDSP_INFO_ATTR_NET_PRIORITY, LNet net priority in selection.
1019 * @LNET_UDSP_INFO_ATTR_NID_PRIORITY, NID's priority in selection.
1021 * @LNET_UDSP_INFO_ATTR_PREF_RTR_NIDS_LIST: Which gateway's are preferred.
1023 * @LNET_UDSP_INFO_ATTR_PREF_NIDS_LIST: Which NIDs are preferred.
1026 enum lnet_udsp_info_attr {
1027 LNET_UDSP_INFO_ATTR_UNSPEC = 0,
1029 LNET_UDSP_INFO_ATTR_NET_PRIORITY,
1030 LNET_UDSP_INFO_ATTR_NID_PRIORITY,
1031 LNET_UDSP_INFO_ATTR_PREF_RTR_NIDS_LIST,
1032 LNET_UDSP_INFO_ATTR_PREF_NIDS_LIST,
1033 __LNET_UDSP_INFO_ATTR_MAX_PLUS_ONE,
1036 #define LNET_UDSP_INFO_ATTR_MAX (__LNET_UDSP_INFO_ATTR_MAX_PLUS_ONE - 1)
1038 /** enum lnet_udsp_info_pref_nids_attr - LNet UDSP information reported for
1039 * some subsystem that tracks it.
1041 * @LNET_UDSP_INFO_PREF_NIDS_ATTR_UNSPEC: unspecified attribute to catch errors
1043 * @LNET_UDSP_INFO_PREF_NIDS_ATTR_INDEX, UDSP prority NIDs label
1045 * @LNET_UDSP_INFO_PREF_NIDS_ATTR_NID, UDSP prority NID (NLA_STRING)
1047 enum lnet_udsp_info_pref_nids_attr {
1048 LNET_UDSP_INFO_PREF_NIDS_ATTR_UNSPEC = 0,
1050 LNET_UDSP_INFO_PREF_NIDS_ATTR_INDEX,
1051 LNET_UDSP_INFO_PREF_NIDS_ATTR_NID,
1052 __LNET_UDSP_INFO_PREF_NIDS_ATTR_MAX_PLUS_ONE,
1055 #define LNET_UDSP_INFO_PREF_NIDS_ATTR_MAX (__LNET_UDSP_INFO_PREF_NIDS_ATTR_MAX_PLUS_ONE - 1)
1057 /** enum lnet_cpt_of_nid_attr - Attributes to support
1058 * lnetctl cpt-of-nid command
1060 * @LNET_CPT_OF_NID_ATTR_UNSPEC unspecified attribute to catch
1062 * @LNET_CPT_OF_NID_ATTR_HDR Grouping for cpt-of-nid
1064 * @LNET_CPT_OF_NID_ATTR_NID The NID whose CPT we want to
1065 * calculate (NLA_STRING)
1066 * LNET_CPT_OF_NID_ATTR_CPT The CPT for the specified NID
1069 enum lnet_cpt_of_nid_attr {
1070 LNET_CPT_OF_NID_ATTR_UNSPEC = 0,
1072 LNET_CPT_OF_NID_ATTR_HDR,
1073 LNET_CPT_OF_NID_ATTR_NID,
1074 LNET_CPT_OF_NID_ATTR_CPT,
1075 __LNET_CPT_OF_NID_ATTR_MAX_PLUS_ONE,
1078 #define LNET_CPT_OF_NID_ATTR_MAX (__LNET_CPT_OF_NID_ATTR_MAX_PLUS_ONE - 1)
1080 /** enum lnet_peer_dist_attr - Attributes to support
1081 * reporting distance for peers
1083 * @LNET_PEER_DIST_ATTR_UNSPEC unspecified attribute to catch
1085 * @LNET_PEER_DIST_ATTR_HDR Grouping which we just use peer
1087 * @LNET_PEER_DIST_ATTR_NID The NID we collect data for
1089 * @LNET_PEER_DIST_ATTR_DIST The distance for the specified
1091 * @LNET_PEER_DIST_ATTR_ORDER The order for the specified NID
1094 enum lnet_peer_dist_attr {
1095 LNET_PEER_DIST_ATTR_UNSPEC = 0,
1097 LNET_PEER_DIST_ATTR_HDR,
1098 LNET_PEER_DIST_ATTR_NID,
1099 LNET_PEER_DIST_ATTR_DIST,
1100 LNET_PEER_DIST_ATTR_ORDER,
1101 __LNET_PEER_DIST_ATTR_MAX_PLUS_ONE,
1104 #define LNET_PEER_DIST_ATTR_MAX (__LNET_PEER_DIST_ATTR_MAX_PLUS_ONE - 1)
1107 /* chain on the lnet_net structure */
1108 struct list_head ni_netlist;
1110 /* chain on the recovery queue */
1111 struct list_head ni_recovery;
1113 /* MD handle for recovery ping */
1114 struct lnet_handle_md ni_ping_mdh;
1118 /* number of CPTs */
1121 /* bond NI on some CPTs */
1124 /* interface's NID */
1125 struct lnet_nid ni_nid;
1127 /* instance-specific data */
1130 /* per ni credits */
1131 atomic_t ni_tx_credits;
1133 /* percpt TX queues */
1134 struct lnet_tx_queue **ni_tx_queues;
1136 /* percpt reference count */
1139 /* pointer to parent network */
1140 struct lnet_net *ni_net;
1142 /* my health status */
1145 /* NI FSM. Protected by lnet_ni_lock() */
1146 enum lnet_ni_state ni_state;
1148 /* Recovery state. Protected by lnet_ni_lock() */
1149 __u32 ni_recovery_state;
1151 /* When to send the next recovery ping */
1152 time64_t ni_next_ping;
1153 /* How many pings sent during current recovery period did not receive
1154 * a reply. NB: reset whenever _any_ message arrives on this NI
1156 unsigned int ni_ping_count;
1158 /* per NI LND tunables */
1159 struct lnet_lnd_tunables ni_lnd_tunables;
1161 /* lnd tunables set explicitly */
1162 bool ni_lnd_tunables_set;
1165 struct lnet_element_stats ni_stats;
1166 struct lnet_health_local_stats ni_hstats;
1168 /* physical device CPT */
1171 /* sequence number used to round robin over nis within a net */
1176 * initialized to LNET_MAX_HEALTH_VALUE
1177 * Value is decremented every time we fail to send a message over
1178 * this NI because of a NI specific failure.
1179 * Value is incremented if we successfully send a message.
1181 atomic_t ni_healthv;
1184 * Set to 1 by the LND when it receives an event telling it the device
1185 * has gone into a fatal state. Set to 0 when the LND receives an
1186 * even telling it the device is back online.
1188 atomic_t ni_fatal_error_on;
1190 /* the relative selection priority of this NI */
1191 __u32 ni_sel_priority;
1194 * equivalent interface to use
1197 struct net *ni_net_ns; /* original net namespace */
1200 #define LNET_PROTO_PING_MATCHBITS 0x8000000000000000LL
1203 * Descriptor of a ping info buffer: keep a separate indicator of the
1204 * size and a reference count. The type is used both as a source and
1205 * sink of data, so we need to keep some information outside of the
1206 * area that may be overwritten by network data.
1208 struct lnet_ping_buffer {
1209 int pb_nbytes; /* sizeof pb_info */
1212 struct lnet_ping_info pb_info;
1215 #define LNET_PING_BUFFER_SIZE(bytes) \
1216 (offsetof(struct lnet_ping_buffer, pb_info) + bytes)
1217 #define LNET_PING_BUFFER_LONI(PBUF) ((PBUF)->pb_info.pi_ni[0].ns_nid)
1218 #define LNET_PING_BUFFER_SEQNO(PBUF) ((PBUF)->pb_info.pi_ni[0].ns_status)
1220 #define LNET_PING_INFO_TO_BUFFER(PINFO) \
1221 container_of((PINFO), struct lnet_ping_buffer, pb_info)
1224 lnet_ping_sts_size(const struct lnet_nid *nid)
1228 if (nid_is_nid4(nid))
1229 return sizeof(struct lnet_ni_status);
1231 size = offsetof(struct lnet_ni_large_status, ns_nid) +
1234 return round_up(size, 4);
1237 static inline struct lnet_ni_large_status *
1238 lnet_ping_sts_next(const struct lnet_ni_large_status *nis)
1240 return (void *)nis + lnet_ping_sts_size(&nis->ns_nid);
1244 lnet_ping_at_least_two_entries(const struct lnet_ping_info *pi)
1246 /* Return true if we have at lease two entries. There is always a
1247 * least one, a 4-byte lo0 interface.
1249 struct lnet_ni_large_status *lns;
1251 if ((pi->pi_features & LNET_PING_FEAT_LARGE_ADDR) == 0)
1252 return pi->pi_nnis <= 2;
1253 /* There is at least 1 large-address entry */
1254 if (pi->pi_nnis != 1)
1256 lns = (void *)&pi->pi_ni[1];
1257 lns = lnet_ping_sts_next(lns);
1259 return ((void *)pi + lnet_ping_info_size(pi) <= (void *)lns);
1262 struct lnet_nid_list {
1263 struct list_head nl_list;
1264 struct lnet_nid nl_nid;
1267 struct lnet_peer_ni {
1268 /* chain on lpn_peer_nis */
1269 struct list_head lpni_peer_nis;
1270 /* chain on remote peer list */
1271 struct list_head lpni_on_remote_peer_ni_list;
1272 /* chain on recovery queue */
1273 struct list_head lpni_recovery;
1274 /* chain on peer hash */
1275 struct list_head lpni_hashlist;
1276 /* messages blocking for tx credits */
1277 struct list_head lpni_txq;
1278 /* pointer to peer net I'm part of */
1279 struct lnet_peer_net *lpni_peer_net;
1280 /* statistics kept on each peer NI */
1281 struct lnet_element_stats lpni_stats;
1282 struct lnet_health_remote_stats lpni_hstats;
1283 /* spin lock protecting credits and lpni_txq */
1284 spinlock_t lpni_lock;
1285 /* # tx credits available */
1287 /* low water mark */
1288 int lpni_mintxcredits;
1290 * Each peer_ni in a gateway maintains its own credits. This
1291 * allows more traffic to gateways that have multiple interfaces.
1293 /* # router credits */
1294 int lpni_rtrcredits;
1295 /* low water mark */
1296 int lpni_minrtrcredits;
1297 /* bytes queued for sending */
1299 /* network peer is on */
1300 struct lnet_net *lpni_net;
1302 struct lnet_nid lpni_nid;
1304 struct kref lpni_kref;
1305 /* health value for the peer */
1306 atomic_t lpni_healthv;
1307 /* recovery ping mdh */
1308 struct lnet_handle_md lpni_recovery_ping_mdh;
1309 /* When to send the next recovery ping */
1310 time64_t lpni_next_ping;
1311 /* How many pings sent during current recovery period did not receive
1312 * a reply. NB: reset whenever _any_ message arrives from this peer NI
1314 unsigned int lpni_ping_count;
1315 /* CPT this peer attached on */
1317 /* state flags -- protected by lpni_lock */
1318 unsigned lpni_state;
1319 /* status of the peer NI as reported by the peer */
1320 __u32 lpni_ns_status;
1321 /* sequence number used to round robin over peer nis within a net */
1323 /* sequence number used to round robin over gateways */
1325 /* returned RC ping features. Protected with lpni_lock */
1326 unsigned int lpni_ping_feats;
1327 /* time last message was received from the peer */
1328 time64_t lpni_last_alive;
1329 /* preferred local nids: if only one, use lpni_pref.nid */
1331 struct lnet_nid nid;
1332 struct list_head nids;
1334 /* list of router nids preferred for this peer NI */
1335 struct list_head lpni_rtr_pref_nids;
1336 /* The relative selection priority of this peer NI */
1337 __u32 lpni_sel_priority;
1338 /* number of preferred NIDs in lnpi_pref_nids */
1339 __u32 lpni_pref_nnids;
1342 /* Preferred path added due to traffic on non-MR peer_ni */
1343 #define LNET_PEER_NI_NON_MR_PREF BIT(0)
1344 /* peer is being recovered. */
1345 #define LNET_PEER_NI_RECOVERY_PENDING BIT(1)
1346 /* recovery ping failed */
1347 #define LNET_PEER_NI_RECOVERY_FAILED BIT(2)
1348 /* peer is being deleted */
1349 #define LNET_PEER_NI_DELETING BIT(3)
1352 /* chain on pt_peer_list */
1353 struct list_head lp_peer_list;
1355 /* list of peer nets */
1356 struct list_head lp_peer_nets;
1358 /* list of messages pending discovery*/
1359 struct list_head lp_dc_pendq;
1361 /* chain on router list */
1362 struct list_head lp_rtr_list;
1364 /* primary NID of the peer */
1365 struct lnet_nid lp_primary_nid;
1367 /* source NID to use during discovery */
1368 struct lnet_nid lp_disc_src_nid;
1369 /* destination NID to use during discovery */
1370 struct lnet_nid lp_disc_dst_nid;
1372 /* net to perform discovery on */
1373 __u32 lp_disc_net_id;
1375 /* CPT of peer_table */
1378 /* number of NIDs on this peer */
1381 /* # refs from lnet_route::lr_gateway */
1382 int lp_rtr_refcount;
1385 * peer specific health sensitivity value to decrement peer nis in
1386 * this peer with if set to something other than 0
1388 __u32 lp_health_sensitivity;
1390 /* messages blocking for router credits */
1391 struct list_head lp_rtrq;
1393 /* routes on this peer */
1394 struct list_head lp_routes;
1396 /* reference count */
1397 atomic_t lp_refcount;
1399 /* lock protecting peer state flags and lpni_rtrq */
1402 /* peer state flags */
1405 /* buffer for data pushed by peer */
1406 struct lnet_ping_buffer *lp_data;
1408 /* MD handle for ping in progress */
1409 struct lnet_handle_md lp_ping_mdh;
1411 /* MD handle for push in progress */
1412 struct lnet_handle_md lp_push_mdh;
1414 /* number of bytes for sizing pb_info in push data */
1417 /* NI config sequence number of peer */
1418 __u32 lp_peer_seqno;
1420 /* Local NI config sequence number acked by peer */
1421 __u32 lp_node_seqno;
1423 /* Local NI config sequence number sent to peer */
1424 __u32 lp_node_seqno_sent;
1426 /* Ping error encountered during discovery. */
1429 /* Push error encountered during discovery. */
1432 /* Error encountered during discovery. */
1435 /* time it was put on the ln_dc_working queue */
1436 time64_t lp_last_queued;
1438 /* link on discovery-related lists */
1439 struct list_head lp_dc_list;
1441 /* tasks waiting on discovery of this peer */
1442 wait_queue_head_t lp_dc_waitq;
1444 /* cached peer aliveness */
1447 /* sequence number used to round robin traffic to this peer's
1452 /* timestamp of primary nid lock */
1453 __u64 lp_prim_lock_ts;
1457 * The status flags in lp_state. Their semantics have chosen so that
1458 * lp_state can be zero-initialized.
1460 * A peer is marked MULTI_RAIL in two cases: it was configured using DLC
1461 * as multi-rail aware, or the LNET_PING_FEAT_MULTI_RAIL bit was set.
1463 * A peer is marked NO_DISCOVERY if the LNET_PING_FEAT_DISCOVERY bit was
1464 * NOT set when the peer was pinged by discovery.
1466 * A peer is marked ROUTER if it indicates so in the feature bit.
1468 #define LNET_PEER_MULTI_RAIL BIT(0) /* Multi-rail aware */
1469 #define LNET_PEER_NO_DISCOVERY BIT(1) /* Peer disabled discovery */
1470 #define LNET_PEER_ROUTER_ENABLED BIT(2) /* router feature enabled */
1473 * A peer is marked CONFIGURED if it was configured by DLC.
1475 * In addition, a peer is marked DISCOVERED if it has fully passed
1476 * through Peer Discovery.
1478 * When Peer Discovery is disabled, the discovery thread will mark
1479 * peers REDISCOVER to indicate that they should be re-examined if
1480 * discovery is (re)enabled on the node.
1482 * A peer that was created as the result of inbound traffic will not
1485 #define LNET_PEER_CONFIGURED BIT(3) /* Configured via DLC */
1486 #define LNET_PEER_DISCOVERED BIT(4) /* Peer was discovered */
1487 #define LNET_PEER_REDISCOVER BIT(5) /* Discovery was disabled */
1489 * A peer is marked DISCOVERING when discovery is in progress.
1490 * The other flags below correspond to stages of discovery.
1492 #define LNET_PEER_DISCOVERING BIT(6) /* Discovering */
1493 #define LNET_PEER_DATA_PRESENT BIT(7) /* Remote peer data present */
1494 #define LNET_PEER_NIDS_UPTODATE BIT(8) /* Remote peer info uptodate */
1495 #define LNET_PEER_PING_SENT BIT(9) /* Waiting for REPLY to Ping */
1496 #define LNET_PEER_PUSH_SENT BIT(10) /* Waiting for ACK of Push */
1497 #define LNET_PEER_PING_FAILED BIT(11) /* Ping send failure */
1498 #define LNET_PEER_PUSH_FAILED BIT(12) /* Push send failure */
1500 * A ping can be forced as a way to fix up state, or as a manual
1501 * intervention by an admin.
1502 * A push can be forced in circumstances that would normally not
1503 * allow for one to happen.
1505 #define LNET_PEER_FORCE_PING BIT(13) /* Forced Ping */
1506 #define LNET_PEER_FORCE_PUSH BIT(14) /* Forced Push */
1508 /* force delete even if router */
1509 #define LNET_PEER_RTR_NI_FORCE_DEL BIT(15)
1511 /* gw undergoing alive discovery */
1512 #define LNET_PEER_RTR_DISCOVERY BIT(16)
1513 /* gw has undergone discovery (does not indicate success or failure) */
1514 #define LNET_PEER_RTR_DISCOVERED BIT(17)
1516 /* peer is marked for deletion */
1517 #define LNET_PEER_MARK_DELETION BIT(18)
1518 /* lnet_peer_del()/lnet_peer_del_locked() has been called on the peer */
1519 #define LNET_PEER_MARK_DELETED BIT(19)
1520 /* lock primary NID to what's requested by ULP */
1521 #define LNET_PEER_LOCK_PRIMARY BIT(20)
1522 /* this is for informational purposes only. It is set if a peer gets
1523 * configured from Lustre with a primary NID which belongs to another peer
1524 * which is also configured by Lustre as the primary NID.
1526 #define LNET_PEER_BAD_CONFIG BIT(21)
1528 struct lnet_peer_net {
1529 /* chain on lp_peer_nets */
1530 struct list_head lpn_peer_nets;
1532 /* list of peer_nis on this network */
1533 struct list_head lpn_peer_nis;
1535 /* pointer to the peer I'm part of */
1536 struct lnet_peer *lpn_peer;
1541 /* peer net health */
1544 /* time of next router ping on this net */
1545 time64_t lpn_next_ping;
1547 /* selection sequence number */
1550 /* relative peer net selection priority */
1551 __u32 lpn_sel_priority;
1553 /* reference count */
1554 atomic_t lpn_refcount;
1557 /* peer hash size */
1558 #define LNET_PEER_HASH_BITS 9
1559 #define LNET_PEER_HASH_SIZE (1 << LNET_PEER_HASH_BITS)
1562 * peer hash table - one per CPT
1564 * protected by lnet_net_lock/EX for update
1569 * protected by pt_zombie_lock:
1573 * pt_zombie lock nests inside lnet_net_lock
1575 struct lnet_peer_table {
1576 int pt_version; /* /proc validity stamp */
1577 struct list_head *pt_hash; /* NID->peer hash */
1578 struct list_head pt_peer_list; /* peers */
1579 int pt_peers; /* # peers */
1580 struct list_head pt_zombie_list; /* zombie peer_ni */
1581 int pt_zombies; /* # zombie peers_ni */
1582 spinlock_t pt_zombie_lock; /* protect list and count */
1585 /* peer aliveness is enabled only on routers for peers in a network where the
1586 * struct lnet_ni::ni_peertimeout has been set to a positive value
1588 #define lnet_peer_aliveness_enabled(lp) (the_lnet.ln_routing != 0 && \
1589 ((lp)->lpni_net) && \
1590 (lp)->lpni_net->net_tunables.lct_peer_timeout > 0)
1593 struct list_head lr_list; /* chain on net */
1594 struct list_head lr_gwlist; /* chain on gateway */
1595 struct lnet_peer *lr_gateway; /* router node */
1596 struct lnet_nid lr_nid; /* NID used to add route */
1597 __u32 lr_net; /* remote network number */
1598 __u32 lr_lnet; /* local network number */
1599 int lr_seq; /* sequence for round-robin */
1600 __u32 lr_hops; /* how far I am */
1601 unsigned int lr_priority; /* route priority */
1602 atomic_t lr_alive; /* cached route aliveness */
1603 bool lr_single_hop; /* this route is single-hop */
1606 #define LNET_REMOTE_NETS_HASH_DEFAULT (1U << 7)
1607 #define LNET_REMOTE_NETS_HASH_MAX (1U << 16)
1608 #define LNET_REMOTE_NETS_HASH_SIZE (1 << the_lnet.ln_remote_nets_hbits)
1610 struct lnet_remotenet {
1611 /* chain on ln_remote_nets_hash */
1612 struct list_head lrn_list;
1614 struct list_head lrn_routes;
1619 /** lnet message has credit and can be submitted to lnd for send/receive */
1620 #define LNET_CREDIT_OK 0
1621 /** lnet message is waiting for credit */
1622 #define LNET_CREDIT_WAIT 1
1623 /** lnet message is waiting for discovery */
1624 #define LNET_DC_WAIT 2
1626 struct lnet_rtrbufpool {
1627 /* my free buffer pool */
1628 struct list_head rbp_bufs;
1629 /* messages blocking for a buffer */
1630 struct list_head rbp_msgs;
1631 /* # pages in each buffer */
1633 /* requested number of buffers */
1634 int rbp_req_nbuffers;
1635 /* # buffers actually allocated */
1637 /* # free buffers / blocked messages */
1639 /* low water mark */
1643 struct lnet_rtrbuf {
1644 struct list_head rb_list; /* chain on rbp_bufs */
1645 struct lnet_rtrbufpool *rb_pool; /* owning pool */
1646 struct bio_vec rb_kiov[0]; /* the buffer space */
1649 #define LNET_PEER_HASHSIZE 503 /* prime! */
1651 enum lnet_match_flags {
1652 /* Didn't match anything */
1653 LNET_MATCHMD_NONE = BIT(0),
1655 LNET_MATCHMD_OK = BIT(1),
1656 /* Must be discarded */
1657 LNET_MATCHMD_DROP = BIT(2),
1658 /* match and buffer is exhausted */
1659 LNET_MATCHMD_EXHAUSTED = BIT(3),
1661 LNET_MATCHMD_FINISH = (LNET_MATCHMD_OK | LNET_MATCHMD_DROP),
1664 /* Options for struct lnet_portal::ptl_options */
1665 #define LNET_PTL_LAZY BIT(0)
1666 #define LNET_PTL_MATCH_UNIQUE BIT(1) /* unique match, for RDMA */
1667 #define LNET_PTL_MATCH_WILDCARD BIT(2) /* wildcard match, request portal */
1669 /* parameter for matching operations (GET, PUT) */
1670 struct lnet_match_info {
1672 struct lnet_processid mi_id;
1673 unsigned int mi_cpt;
1674 unsigned int mi_opc;
1675 unsigned int mi_portal;
1676 unsigned int mi_rlength;
1677 unsigned int mi_roffset;
1680 /* ME hash of RDMA portal */
1681 #define LNET_MT_HASH_BITS 8
1682 #define LNET_MT_HASH_SIZE (1 << LNET_MT_HASH_BITS)
1683 #define LNET_MT_HASH_MASK (LNET_MT_HASH_SIZE - 1)
1684 /* we allocate (LNET_MT_HASH_SIZE + 1) entries for lnet_match_table::mt_hash,
1685 * the last entry is reserved for MEs with ignore-bits */
1686 #define LNET_MT_HASH_IGNORE LNET_MT_HASH_SIZE
1687 /* __u64 has 2^6 bits, so need 2^(LNET_MT_HASH_BITS - LNET_MT_BITS_U64) which
1688 * is 4 __u64s as bit-map, and add an extra __u64 (only use one bit) for the
1689 * ME-list with ignore-bits, which is mtable::mt_hash[LNET_MT_HASH_IGNORE] */
1690 #define LNET_MT_BITS_U64 6 /* 2^6 bits */
1691 #define LNET_MT_EXHAUSTED_BITS (LNET_MT_HASH_BITS - LNET_MT_BITS_U64)
1692 #define LNET_MT_EXHAUSTED_BMAP ((1 << LNET_MT_EXHAUSTED_BITS) + 1)
1694 /* portal match table */
1695 struct lnet_match_table {
1696 /* reserved for upcoming patches, CPU partition ID */
1697 unsigned int mt_cpt;
1698 unsigned int mt_portal; /* portal index */
1699 /* match table is set as "enabled" if there's non-exhausted MD
1700 * attached on mt_mhash, it's only valid for wildcard portal */
1701 unsigned int mt_enabled;
1702 /* bitmap to flag whether MEs on mt_hash are exhausted or not */
1703 __u64 mt_exhausted[LNET_MT_EXHAUSTED_BMAP];
1704 struct list_head *mt_mhash; /* matching hash */
1707 /* these are only useful for wildcard portal */
1708 /* Turn off message rotor for wildcard portals */
1709 #define LNET_PTL_ROTOR_OFF 0
1710 /* round-robin dispatch all PUT messages for wildcard portals */
1711 #define LNET_PTL_ROTOR_ON 1
1712 /* round-robin dispatch routed PUT message for wildcard portals */
1713 #define LNET_PTL_ROTOR_RR_RT 2
1714 /* dispatch routed PUT message by hashing source NID for wildcard portals */
1715 #define LNET_PTL_ROTOR_HASH_RT 3
1717 struct lnet_portal {
1718 spinlock_t ptl_lock;
1719 unsigned int ptl_index; /* portal ID, reserved */
1720 /* flags on this portal: lazy, unique... */
1721 unsigned int ptl_options;
1722 /* list of messages which are stealing buffer */
1723 struct list_head ptl_msg_stealing;
1724 /* messages blocking for MD */
1725 struct list_head ptl_msg_delayed;
1726 /* Match table for each CPT */
1727 struct lnet_match_table **ptl_mtables;
1728 /* spread rotor of incoming "PUT" */
1729 unsigned int ptl_rotor;
1730 /* # active entries for this portal */
1732 /* array of active entries' cpu-partition-id */
1736 #define LNET_LH_HASH_BITS 12
1737 #define LNET_LH_HASH_SIZE (1ULL << LNET_LH_HASH_BITS)
1738 #define LNET_LH_HASH_MASK (LNET_LH_HASH_SIZE - 1)
1740 /* resource container (ME, MD, EQ) */
1741 struct lnet_res_container {
1742 unsigned int rec_type; /* container type */
1743 __u64 rec_lh_cookie; /* cookie generator */
1744 struct list_head rec_active; /* active resource list */
1745 struct list_head *rec_lh_hash; /* handle hash */
1748 /* message container */
1749 struct lnet_msg_container {
1750 int msc_init; /* initialized or not */
1751 /* max # threads finalizing */
1752 int msc_nfinalizers;
1753 /* msgs waiting to complete finalizing */
1754 struct list_head msc_finalizing;
1755 /* msgs waiting to be resent */
1756 struct list_head msc_resending;
1757 struct list_head msc_active; /* active message list */
1758 /* threads doing finalization */
1759 void **msc_finalizers;
1760 /* threads doing resends */
1761 void **msc_resenders;
1764 /* This UDSP structures need to match the user space liblnetconfig structures
1765 * in order for the marshall and unmarshall functions to be common.
1768 /* Net is described as a
1772 struct lnet_ud_net_descr {
1774 struct list_head udn_net_num_range;
1777 /* each NID range is defined as
1779 * 2. address range descriptor
1781 struct lnet_ud_nid_descr {
1782 struct lnet_ud_net_descr ud_net_id;
1783 struct list_head ud_addr_range;
1787 /* a UDSP rule can have up to three user defined NID descriptors
1788 * - src: defines the local NID range for the rule
1789 * - dst: defines the peer NID range for the rule
1790 * - rte: defines the router NID range for the rule
1792 * An action union defines the action to take when the rule
1796 struct list_head udsp_on_list;
1798 struct lnet_ud_nid_descr udsp_src;
1799 struct lnet_ud_nid_descr udsp_dst;
1800 struct lnet_ud_nid_descr udsp_rte;
1801 enum lnet_udsp_action_type udsp_action_type;
1803 __u32 udsp_priority;
1807 /* Peer Discovery states */
1808 #define LNET_DC_STATE_SHUTDOWN 0 /* not started */
1809 #define LNET_DC_STATE_RUNNING 1 /* started up OK */
1810 #define LNET_DC_STATE_STOPPING 2 /* telling thread to stop */
1812 /* Router Checker states */
1813 #define LNET_MT_STATE_SHUTDOWN 0 /* not started */
1814 #define LNET_MT_STATE_RUNNING 1 /* started up OK */
1815 #define LNET_MT_STATE_STOPPING 2 /* telling thread to stop */
1818 #define LNET_STATE_SHUTDOWN 0 /* not started */
1819 #define LNET_STATE_RUNNING 1 /* started up OK */
1820 #define LNET_STATE_STOPPING 2 /* telling thread to stop */
1823 /* CPU partition table of LNet */
1824 struct cfs_cpt_table *ln_cpt_table;
1825 /* number of CPTs in ln_cpt_table */
1826 unsigned int ln_cpt_number;
1827 unsigned int ln_cpt_bits;
1829 /* protect LNet resources (ME/MD/EQ) */
1830 struct cfs_percpt_lock *ln_res_lock;
1833 /* the vector of portals */
1834 struct lnet_portal **ln_portals;
1835 /* percpt MD container */
1836 struct lnet_res_container **ln_md_containers;
1838 /* Event Queue container */
1839 struct lnet_res_container ln_eq_container;
1840 spinlock_t ln_eq_wait_lock;
1842 unsigned int ln_remote_nets_hbits;
1844 /* protect NI, peer table, credits, routers, rtrbuf... */
1845 struct cfs_percpt_lock *ln_net_lock;
1846 /* percpt message containers for active/finalizing/freed message */
1847 struct lnet_msg_container **ln_msg_containers;
1848 struct lnet_counters **ln_counters;
1849 struct lnet_peer_table **ln_peer_tables;
1850 /* list of peer nis not on a local network */
1851 struct list_head ln_remote_peer_ni_list;
1852 /* failure simulation */
1853 struct list_head ln_test_peers;
1854 struct list_head ln_drop_rules;
1855 struct list_head ln_delay_rules;
1857 struct list_head ln_nets;
1858 /* Sequence number used to round robin sends across all nets */
1860 /* the loopback NI */
1861 struct lnet_ni *ln_loni;
1862 /* network zombie list */
1863 struct list_head ln_net_zombie;
1864 /* resend messages list */
1865 struct list_head ln_msg_resend;
1866 /* spin lock to protect the msg resend list */
1867 spinlock_t ln_msg_resend_lock;
1869 /* remote networks with routes to them */
1870 struct list_head *ln_remote_nets_hash;
1871 /* validity stamp */
1872 __u64 ln_remote_nets_version;
1873 /* list of all known routers */
1874 struct list_head ln_routers;
1875 /* validity stamp */
1876 __u64 ln_routers_version;
1877 /* percpt router buffer pools */
1878 struct lnet_rtrbufpool **ln_rtrpools;
1881 * Ping target / Push source
1883 * The ping target and push source share a single buffer. The
1884 * ln_ping_target is protected against concurrent updates by
1887 struct lnet_handle_md ln_ping_target_md;
1888 lnet_handler_t ln_ping_target_handler;
1889 struct lnet_ping_buffer *ln_ping_target;
1890 atomic_t ln_ping_target_seqno;
1895 * ln_push_nnis contains the desired size of the push target.
1896 * The lnet_net_lock is used to handle update races. The old
1897 * buffer may linger a while after it has been unlinked, in
1898 * which case the event handler cleans up.
1900 lnet_handler_t ln_push_target_handler;
1901 struct lnet_handle_md ln_push_target_md;
1902 struct lnet_ping_buffer *ln_push_target;
1903 /* bytes needed for pb_info to receive push */
1904 int ln_push_target_nbytes;
1906 /* discovery event queue handle */
1907 lnet_handler_t ln_dc_handler;
1908 /* discovery requests */
1909 struct list_head ln_dc_request;
1910 /* discovery working list */
1911 struct list_head ln_dc_working;
1912 /* discovery expired list */
1913 struct list_head ln_dc_expired;
1914 /* discovery thread wait queue */
1915 wait_queue_head_t ln_dc_waitq;
1916 /* discovery startup/shutdown state */
1919 /* monitor thread startup/shutdown state */
1921 /* serialise startup/shutdown */
1922 struct semaphore ln_mt_signal;
1924 struct mutex ln_api_mutex;
1925 struct mutex ln_lnd_mutex;
1926 /* Have I called LNetNIInit myself? */
1928 /* LNetNIInit/LNetNIFini counter */
1930 /* SHUTDOWN/RUNNING/STOPPING */
1933 int ln_routing; /* am I a router? */
1934 lnet_pid_t ln_pid; /* requested pid */
1935 /* uniquely identifies this ni in this epoch */
1936 __u64 ln_interface_cookie;
1937 /* registered LNDs */
1938 const struct lnet_lnd *ln_lnds[NUM_LNDS];
1940 /* test protocol compatibility flags */
1941 unsigned long ln_testprotocompat;
1943 /* 0 - load the NIs from the mod params
1944 * 1 - do not load the NIs from the mod params
1945 * Reverse logic to ensure that other calls to LNetNIInit
1948 bool ln_nis_from_mod_params;
1951 * completion for the monitor thread. The monitor thread takes care of
1952 * checking routes, timedout messages and resending messages.
1954 struct completion ln_mt_wait_complete;
1956 /* per-cpt resend queues */
1957 struct list_head **ln_mt_resendqs;
1958 /* local NIs to recover */
1959 struct list_head ln_mt_localNIRecovq;
1960 /* local NIs to recover */
1961 struct list_head ln_mt_peerNIRecovq;
1963 * An array of queues for GET/PUT waiting for REPLY/ACK respectively.
1964 * There are CPT number of queues. Since response trackers will be
1965 * added on the fast path we can't afford to grab the exclusive
1966 * net lock to protect these queues. The CPT will be calculated
1967 * based on the mdh cookie.
1969 struct list_head **ln_mt_rstq;
1971 * A response tracker becomes a zombie when the associated MD is queued
1972 * for unlink before the response tracker is detached from the MD. An
1973 * entry on a zombie list can be freed when either the remaining
1974 * operations on the MD complete or when LNet has shut down.
1976 struct list_head **ln_mt_zombie_rstqs;
1977 /* recovery handler */
1978 lnet_handler_t ln_mt_handler;
1981 * Completed when the discovery and monitor threads can enter their
1984 struct completion ln_started;
1986 struct list_head ln_udsp_list;
1988 /* Number of messages that have exceeded their message deadline */
1989 atomic_t ln_late_msg_count;
1990 /* Total amount of time past their deadline for all late ^ messages */
1991 atomic64_t ln_late_msg_nsecs;
1993 /* for LNDs to signal that ping buffer needs updating */
1994 atomic_t ln_update_ping_buf;
1996 /* workqueue for serving lnd ping buffer update requests */
1997 struct workqueue_struct *ln_pb_update_wq;
1998 struct work_struct ln_pb_update_work;
2000 atomic_t ln_pb_update_ready;
2003 struct genl_filter_list {
2004 struct list_head lp_list;
2009 static const struct nla_policy scalar_attr_policy[LN_SCALAR_MAX + 1] = {
2010 [LN_SCALAR_ATTR_LIST] = { .type = NLA_NESTED },
2011 [LN_SCALAR_ATTR_LIST_SIZE] = { .type = NLA_U16 },
2012 [LN_SCALAR_ATTR_INDEX] = { .type = NLA_U16 },
2013 [LN_SCALAR_ATTR_NLA_TYPE] = { .type = NLA_U16 },
2014 [LN_SCALAR_ATTR_VALUE] = { .type = NLA_STRING },
2015 [LN_SCALAR_ATTR_KEY_FORMAT] = { .type = NLA_U16 },
2018 int lnet_genl_send_scalar_list(struct sk_buff *msg, u32 portid, u32 seq,
2019 const struct genl_family *family, int flags,
2020 u8 cmd, const struct ln_key_list *data[]);
2022 /* Special workaround for pre-4.19 kernels to send error messages
2023 * from dumpit routines. Newer kernels will send message with
2024 * NL_SET_ERR_MSG information by default if NETLINK_EXT_ACK is set.
2026 static inline int lnet_nl_send_error(struct sk_buff *msg, int portid, int seq,
2029 #ifndef HAVE_NL_DUMP_WITH_EXT_ACK
2030 struct nlmsghdr *nlh;
2035 nlh = nlmsg_put(msg, portid, seq, NLMSG_ERROR, sizeof(error), 0);
2038 #ifdef HAVE_NL_PARSE_WITH_EXT_ACK
2039 netlink_ack(msg, nlh, error, NULL);
2041 netlink_ack(msg, nlh, error);
2043 return nlmsg_len(nlh);