4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library.
23 * Copyright (c) 2014, 2017, Intel Corporation.
26 * Author: Amir Shehata <amir.shehata@intel.com>
29 #ifndef __UAPI_LNET_DLC_H_
30 #define __UAPI_LNET_DLC_H_
32 #include <linux/types.h>
33 #include <linux/lnet/libcfs_ioctl.h>
34 #include <linux/lnet/lnet-types.h>
36 #define MAX_NUM_SHOW_ENTRIES 32
37 #define LNET_MAX_STR_LEN 128
38 #define LNET_MAX_SHOW_NUM_CPT 128
39 #define LNET_MAX_SHOW_NUM_NID 128
40 #define LNET_UNDEFINED_HOPS ((__u32) -1)
42 #define LNET_RT_ALIVE (1 << 0)
43 #define LNET_RT_MULTI_HOP (1 << 1)
46 * sparse kernel source annotations
52 #define LNET_GENL_NAME "lnet"
53 #define LNET_GENL_VERSION 0x05
55 /* enum lnet_commands - Supported core LNet Netlink commands
57 * @LNET_CMD_UNSPEC: unspecified command to catch errors
59 * @LNET_CMD_CONFIGURE: command to setup LNet stack
60 * @LNET_CMD_NETS: command to manage the LNet networks
61 * @LNET_CMD_ROUTES: command to manage LNet routes
62 * @LNET_CMD_PING: command to send pings to LNet connections
63 * @LNET_CMD_CPT_OF_NID: command to calculate the CPT of specified NIDs
68 LNET_CMD_CONFIGURE = 1,
74 LNET_CMD_CPT_OF_NID = 7,
75 LNET_CMD_PEER_DIST = 8,
77 __LNET_CMD_MAX_PLUS_ONE
80 #define LNET_CMD_MAX (__LNET_CMD_MAX_PLUS_ONE - 1)
83 * To allow for future enhancements to extend the tunables
84 * add a hdr to this structure, so that the version can be set
85 * and checked for backwards compatibility. Newer versions of LNet
86 * can still work with older versions of lnetctl. The restriction is
87 * that the structure can be added to and not removed from in order
88 * to not invalidate older lnetctl utilities. Moreover, the order of
89 * fields must remain the same, and new fields appended to the structure
91 * That said all existing LND tunables will be added in this structure
92 * to avoid future changes.
94 struct lnet_ioctl_config_lnd_cmn_tunables {
96 __s32 lct_peer_timeout;
97 __s32 lct_peer_tx_credits;
98 __s32 lct_peer_rtr_credits;
99 __s32 lct_max_tx_credits;
102 struct lnet_ioctl_config_o2iblnd_tunables {
104 __u32 lnd_peercredits_hiw;
105 __u32 lnd_map_on_demand;
106 __u32 lnd_concurrent_sends;
107 __u32 lnd_fmr_pool_size;
108 __u32 lnd_fmr_flush_trigger;
110 __u16 lnd_conns_per_peer;
116 struct lnet_ioctl_config_kfilnd_tunables {
118 __u32 lnd_prov_major_version;
119 __u32 lnd_prov_minor_version;
121 char lnd_traffic_class_str[LNET_MAX_STR_LEN];
122 __u32 lnd_traffic_class;
125 struct lnet_ioctl_config_socklnd_tunables {
127 __u16 lnd_conns_per_peer;
133 struct lnet_ioctl_config_gnilnd_tunables {
138 struct lnet_lnd_tunables {
140 struct lnet_ioctl_config_o2iblnd_tunables lnd_o2ib;
141 struct lnet_ioctl_config_socklnd_tunables lnd_sock;
142 struct lnet_ioctl_config_kfilnd_tunables lnd_kfi;
143 struct lnet_ioctl_config_gnilnd_tunables lnd_gni;
147 struct lnet_ioctl_config_lnd_tunables {
148 struct lnet_ioctl_config_lnd_cmn_tunables lt_cmn;
149 struct lnet_lnd_tunables lt_tun;
152 struct lnet_ioctl_net_config {
153 char ni_interface[LNET_MAX_STR_LEN];
155 __u32 ni_cpts[LNET_MAX_SHOW_NUM_CPT];
159 #define LNET_TINY_BUF_IDX 0
160 #define LNET_SMALL_BUF_IDX 1
161 #define LNET_LARGE_BUF_IDX 2
163 /* # different router buffer pools */
164 #define LNET_NRBPOOLS (LNET_LARGE_BUF_IDX + 1)
166 struct lnet_ioctl_pool_cfg {
172 } pl_pools[LNET_NRBPOOLS];
176 struct lnet_ioctl_ping_data {
177 struct libcfs_ioctl_hdr ping_hdr;
183 struct lnet_process_id ping_id;
184 struct lnet_process_id __user *ping_buf;
188 struct lnet_ioctl_config_data {
189 struct libcfs_ioctl_hdr cfg_hdr;
201 __u32 rtr_sensitivity;
204 char net_intf[LNET_MAX_STR_LEN];
205 __s32 net_peer_timeout;
206 __s32 net_peer_tx_credits;
207 __s32 net_peer_rtr_credits;
208 __s32 net_max_tx_credits;
209 __u32 net_cksum_algo;
210 __u32 net_interface_count;
223 struct lnet_ioctl_comm_count {
226 __u32 ico_reply_count;
228 __u32 ico_hello_count;
231 struct lnet_ioctl_element_stats {
232 __u32 iel_send_count;
233 __u32 iel_recv_count;
234 __u32 iel_drop_count;
237 enum lnet_health_type {
238 LNET_HEALTH_TYPE_LOCAL_NI = 0,
239 LNET_HEALTH_TYPE_PEER_NI,
242 struct lnet_ioctl_local_ni_hstats {
243 struct libcfs_ioctl_hdr hlni_hdr;
245 __u32 hlni_local_interrupt;
246 __u32 hlni_local_dropped;
247 __u32 hlni_local_aborted;
248 __u32 hlni_local_no_route;
249 __u32 hlni_local_timeout;
250 __u32 hlni_local_error;
251 __s32 hlni_fatal_error;
252 __s32 hlni_health_value;
253 __u32 hlni_ping_count;
254 __u64 hlni_next_ping;
257 struct lnet_ioctl_peer_ni_hstats {
258 __u32 hlpni_remote_dropped;
259 __u32 hlpni_remote_timeout;
260 __u32 hlpni_remote_error;
261 __u32 hlpni_network_timeout;
262 __s32 hlpni_health_value;
263 __u32 hlpni_ping_count;
264 __u64 hlpni_next_ping;
267 struct lnet_ioctl_element_msg_stats {
268 struct libcfs_ioctl_hdr im_hdr;
270 struct lnet_ioctl_comm_count im_send_stats;
271 struct lnet_ioctl_comm_count im_recv_stats;
272 struct lnet_ioctl_comm_count im_drop_stats;
276 * lnet_ioctl_config_ni
277 * This structure describes an NI configuration. There are multiple components
278 * when configuring an NI: Net, Interfaces, CPT list and LND tunables
279 * A network is passed as a string to the DLC and translated using
281 * An interface is the name of the system configured interface
283 * CPT is the list of CPTS LND tunables are passed in the lic_bulk area
285 struct lnet_ioctl_config_ni {
286 struct libcfs_ioctl_hdr lic_cfg_hdr;
288 char lic_ni_intf[LNET_MAX_STR_LEN];
289 char lic_legacy_ip2nets[LNET_MAX_STR_LEN];
290 __u32 lic_cpts[LNET_MAX_SHOW_NUM_CPT];
299 struct lnet_peer_ni_credit_info {
300 char cr_aliveness[LNET_MAX_STR_LEN];
302 __s32 cr_ni_peer_tx_credits;
303 __s32 cr_peer_tx_credits;
304 __s32 cr_peer_min_tx_credits;
305 __u32 cr_peer_tx_qnob;
306 __s32 cr_peer_rtr_credits;
307 __s32 cr_peer_min_rtr_credits;
311 struct lnet_ioctl_peer {
312 struct libcfs_ioctl_hdr pr_hdr;
318 struct lnet_peer_ni_credit_info pr_peer_credits;
322 struct lnet_ioctl_peer_cfg {
323 struct libcfs_ioctl_hdr prcfg_hdr;
324 lnet_nid_t prcfg_prim_nid;
325 lnet_nid_t prcfg_cfg_nid;
326 __u32 prcfg_count; /* ADD_PEER_NI: used for 'lock_prim' option
327 * DEL_PEER_NI: used for 'force' option
332 void __user *prcfg_bulk;
335 struct lnet_ioctl_reset_health_cfg {
336 struct libcfs_ioctl_hdr rh_hdr;
337 enum lnet_health_type rh_type:32;
343 struct lnet_ioctl_reset_conns_per_peer_cfg {
344 struct libcfs_ioctl_hdr rcpp_hdr;
350 struct lnet_ioctl_recovery_list {
351 struct libcfs_ioctl_hdr rlst_hdr;
352 enum lnet_health_type rlst_type:32;
354 lnet_nid_t rlst_nid_array[LNET_MAX_SHOW_NUM_NID];
357 struct lnet_ioctl_set_value {
358 struct libcfs_ioctl_hdr sv_hdr;
362 struct lnet_ioctl_lnet_stats {
363 struct libcfs_ioctl_hdr st_hdr;
364 struct lnet_counters st_cntrs;
367 /* An IP, numeric NID or a Net number is composed of 1 or more of these
368 * descriptor structures.
370 struct lnet_range_expr {
376 /* le_count identifies the number of lnet_range_expr in the bulk
379 struct lnet_expressions {
383 /* A net descriptor has the net type, IE: O2IBLND, SOCKLND, etc and an
384 * expression describing a net number range.
386 struct lnet_ioctl_udsp_net_descr {
388 struct lnet_expressions ud_net_num_expr;
391 /* The UDSP descriptor header contains the type of matching criteria, SRC,
392 * DST, RTE, etc and how many lnet_expressions compose the LNet portion of
393 * the LNet NID. For example an IP can be
394 * composed of 4 lnet_expressions , a gni can be composed of 1
396 struct lnet_ioctl_udsp_descr_hdr {
397 /* The literals SRC, DST and RTE are encoded
401 __u32 ud_descr_count;
404 /* each matching expression in the UDSP is described with this.
405 * The bulk format is as follows:
406 * 1. 1x struct lnet_ioctl_udsp_net_descr
407 * -> the net part of the NID
408 * 2. >=0 struct lnet_expressions
409 * -> the address part of the NID
411 struct lnet_ioctl_udsp_descr {
412 struct lnet_ioctl_udsp_descr_hdr iud_src_hdr;
413 struct lnet_ioctl_udsp_net_descr iud_net;
416 /* The cumulative UDSP descriptor
417 * The bulk format is as follows:
418 * 1. >=1 struct lnet_ioctl_udsp_descr
420 * The size indicated in iou_hdr is the total size of the UDSP.
423 struct lnet_ioctl_udsp {
424 struct libcfs_ioctl_hdr iou_hdr;
426 __u32 iou_action_type;
431 void __user *iou_bulk;
434 /* structure used to request udsp instantiation information on the
435 * specified construct.
436 * cud_nid: the NID of the local or remote NI to pull info on.
437 * cud_nid_priority: NID prio of the requested NID.
438 * cud_net_priority: net prio of network of the requested NID.
439 * cud_pref_nid: array of preferred NIDs if it exists.
441 struct lnet_ioctl_construct_udsp_info {
442 struct libcfs_ioctl_hdr cud_hdr;
445 __u32 cud_nid_priority;
446 __u32 cud_net_priority;
447 lnet_nid_t cud_pref_nid[LNET_MAX_SHOW_NUM_NID];
448 lnet_nid_t cud_pref_rtr_nid[LNET_MAX_SHOW_NUM_NID];
451 #endif /* _LNET_DLC_H_ */