/** exclusive lock */
#define LNET_LOCK_EX CFS_PERCPT_LOCK_EX
-/* default timeout */
+/* default timeout and credits */
#define DEFAULT_PEER_TIMEOUT 180
+#define DEFAULT_PEER_CREDITS 8
+#define DEFAULT_CREDITS 256
#ifdef HAVE_KERN_SOCK_GETNAME_2ARGS
#define lnet_kernel_getpeername(sock, addr, addrlen) \
MODULE_PARM_DESC(ntx, "# of message descriptors allocated for each pool");
/* NB: this value is shared by all CPTs */
-static int credits = 256;
+static int credits = DEFAULT_CREDITS;
module_param(credits, int, 0444);
MODULE_PARM_DESC(credits, "# concurrent sends");
-static int peer_credits = 8;
+static int peer_credits = DEFAULT_PEER_CREDITS;
module_param(peer_credits, int, 0444);
MODULE_PARM_DESC(peer_credits, "# concurrent sends to 1 peer");
module_param(sock_timeout, int, 0644);
MODULE_PARM_DESC(sock_timeout, "dead socket timeout (seconds)");
-static int credits = 256;
+static int credits = DEFAULT_CREDITS;
module_param(credits, int, 0444);
MODULE_PARM_DESC(credits, "# concurrent sends");
-static int peer_credits = 8;
+static int peer_credits = DEFAULT_PEER_CREDITS;
module_param(peer_credits, int, 0444);
MODULE_PARM_DESC(peer_credits, "# concurrent sends to 1 peer");
return rc;
}
+static void
+lnet_set_tune_defaults(struct lnet_ioctl_config_lnd_tunables *tun)
+{
+ if (tun) {
+ if (!tun->lt_cmn.lct_peer_timeout)
+ tun->lt_cmn.lct_peer_timeout = DEFAULT_PEER_TIMEOUT;
+ if (!tun->lt_cmn.lct_peer_tx_credits)
+ tun->lt_cmn.lct_peer_tx_credits = DEFAULT_PEER_CREDITS;
+ if (!tun->lt_cmn.lct_max_tx_credits)
+ tun->lt_cmn.lct_max_tx_credits = DEFAULT_CREDITS;
+ }
+}
+
static int lnet_handle_legacy_ip2nets(char *ip2nets,
struct lnet_ioctl_config_lnd_tunables *tun)
{
if (rc < 0)
return rc;
+ lnet_set_tune_defaults(tun);
+
mutex_lock(&the_lnet.ln_api_mutex);
while (!list_empty(&net_head)) {
net = list_entry(net_head.next, struct lnet_net, net_list);
if (!ni)
return -ENOMEM;
+ lnet_set_tune_defaults(tun);
+
mutex_lock(&the_lnet.ln_api_mutex);
rc = lnet_add_net_common(net, tun);
memset(&tun, 0, sizeof(tun));
tun.lt_cmn.lct_peer_timeout =
- conf->cfg_config_u.cfg_net.net_peer_timeout;
+ (!conf->cfg_config_u.cfg_net.net_peer_timeout) ? DEFAULT_PEER_TIMEOUT :
+ conf->cfg_config_u.cfg_net.net_peer_timeout;
tun.lt_cmn.lct_peer_tx_credits =
- conf->cfg_config_u.cfg_net.net_peer_tx_credits;
+ (!conf->cfg_config_u.cfg_net.net_peer_tx_credits) ? DEFAULT_PEER_CREDITS :
+ conf->cfg_config_u.cfg_net.net_peer_tx_credits;
tun.lt_cmn.lct_peer_rtr_credits =
conf->cfg_config_u.cfg_net.net_peer_rtr_credits;
tun.lt_cmn.lct_max_tx_credits =
- conf->cfg_config_u.cfg_net.net_max_tx_credits;
+ (!conf->cfg_config_u.cfg_net.net_max_tx_credits) ? DEFAULT_CREDITS :
+ conf->cfg_config_u.cfg_net.net_max_tx_credits;
rc = lnet_add_net_common(net, &tun);