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 2022 Hewlett Packard Enterprise Development LP
26 * This file is part of Lustre, http://www.lustre.org/
29 * kfilnd module parameters
35 module_param(cksum, uint, 0444);
36 MODULE_PARM_DESC(cksum, "Enable checksums for non-zero messages (not RDMA)");
38 /* Scale factor for TX context queue depth. The factor is applied to the number
39 * of credits to determine queue depth.
41 unsigned int tx_scale_factor = 2;
42 module_param(tx_scale_factor, uint, 0444);
43 MODULE_PARM_DESC(tx_scale_factor,
44 "Factor applied to credits to determine TX context size");
46 /* Scale factor for TX and RX completion queue depth. The factor is applied to
47 * the number of credits to determine queue depth.
49 unsigned int rx_cq_scale_factor = 10;
50 module_param(rx_cq_scale_factor, uint, 0444);
51 MODULE_PARM_DESC(rx_cq_scale_factor,
52 "Factor applied to credits to determine RX CQ size");
54 unsigned int tx_cq_scale_factor = 10;
55 module_param(tx_cq_scale_factor, uint, 0444);
56 MODULE_PARM_DESC(tx_cq_scale_factor,
57 "Factor applied to credits to determine TX CQ size");
59 unsigned int eq_size = 1024;
60 module_param(eq_size, uint, 0444);
61 MODULE_PARM_DESC(eq_size, "Default event queue size used by all kfi LNet NIs");
63 unsigned int immediate_rx_buf_count = 8;
64 module_param(immediate_rx_buf_count, uint, 0444);
65 MODULE_PARM_DESC(immediate_rx_buf_count,
66 "Number of immediate multi-receive buffers posted per CPT");
68 /* Common LND network tunables. */
69 static int credits = 256;
70 module_param(credits, int, 0444);
71 MODULE_PARM_DESC(credits, "Number of concurrent sends on network");
73 static int peer_credits = 16;
74 module_param(peer_credits, int, 0444);
75 MODULE_PARM_DESC(peer_credits, "Number of concurrent sends to 1 peer");
77 static int peer_buffer_credits = -1;
78 module_param(peer_buffer_credits, int, 0444);
79 MODULE_PARM_DESC(peer_buffer_credits,
80 "Number of per-peer router buffer credits");
82 static int peer_timeout = -1;
83 module_param(peer_timeout, int, 0444);
84 MODULE_PARM_DESC(peer_timeout,
85 "Seconds without aliveness news to declare peer dead (less than or equal to 0 to disable).");
87 static unsigned int prov_major_version = 1;
88 module_param(prov_major_version, int, 0444);
89 MODULE_PARM_DESC(prov_major_version,
90 "Default kfabric provider major version kfilnd should use");
92 static unsigned int prov_minor_version;
93 module_param(prov_minor_version, int, 0444);
94 MODULE_PARM_DESC(prov_minor_version,
95 "Default kfabric provider minor version kfilnd should use");
97 static unsigned int auth_key = 255;
98 module_param(auth_key, uint, 0444);
99 MODULE_PARM_DESC(auth_key, "Default authorization key to be used for LNet NIs");
101 int kfilnd_tunables_setup(struct lnet_ni *ni)
103 struct lnet_ioctl_config_lnd_cmn_tunables *net_tunables;
104 struct lnet_ioctl_config_kfilnd_tunables *kfilnd_tunables;
106 net_tunables = &ni->ni_net->net_tunables;
107 kfilnd_tunables = &ni->ni_lnd_tunables.lnd_tun_u.lnd_kfi;
109 if (!ni->ni_net->net_tunables_set) {
110 net_tunables->lct_max_tx_credits = credits;
111 net_tunables->lct_peer_tx_credits = peer_credits;
112 net_tunables->lct_peer_rtr_credits = peer_buffer_credits;
113 net_tunables->lct_peer_timeout = peer_timeout;
115 if (net_tunables->lct_peer_tx_credits >
116 net_tunables->lct_max_tx_credits)
117 net_tunables->lct_peer_tx_credits =
118 net_tunables->lct_max_tx_credits;
121 kfilnd_tunables->lnd_version = KFILND_MSG_VERSION;
122 if (!ni->ni_lnd_tunables_set) {
123 kfilnd_tunables->lnd_prov_major_version = prov_major_version;
124 kfilnd_tunables->lnd_prov_minor_version = prov_minor_version;
126 /* Treat zero as uninitialized. */
127 if (ni->ni_lnd_tunables.lnd_tun_u.lnd_kfi.lnd_auth_key == 0)
128 ni->ni_lnd_tunables.lnd_tun_u.lnd_kfi.lnd_auth_key =
132 if (net_tunables->lct_max_tx_credits > KFILND_EP_KEY_MAX) {
133 CERROR("Credits cannot exceed %lu\n", KFILND_EP_KEY_MAX);
137 if (net_tunables->lct_peer_tx_credits > KFILND_EP_KEY_MAX) {
138 CERROR("Peer credits cannot exceed %lu\n", KFILND_EP_KEY_MAX);
145 int kfilnd_tunables_init(void)
147 if (tx_scale_factor < 1) {
148 CERROR("TX context scale factor less than 1");
152 if (rx_cq_scale_factor < 1) {
153 CERROR("RX CQ scale factor less than 1");
157 if (tx_cq_scale_factor < 1) {
158 CERROR("TX CQ scale factor less than 1");
162 if (immediate_rx_buf_count < 2) {
163 CERROR("Immediate multi-receive buffer count less than 2");
168 CERROR("Authorization key cannot be less than 1");
172 if (credits > KFILND_EP_KEY_MAX) {
173 CERROR("Credits cannot exceed %lu\n", KFILND_EP_KEY_MAX);
177 if (peer_credits > KFILND_EP_KEY_MAX) {
178 CERROR("Peer credits cannot exceed %lu\n", KFILND_EP_KEY_MAX);