struct lnet_net *net;
struct lnet_ni *ni;
struct lnet_ioctl_config_lnd_tunables *tun = NULL;
- int rc;
+ int rc, i;
__u32 net_id;
/* get the tunables if they are available */
if (!net)
return -ENOMEM;
+ for (i = 0; i < conf->lic_ncpts; i++) {
+ if (conf->lic_cpts[i] >= LNET_CPT_NUMBER)
+ return -EINVAL;
+ }
+
ni = lnet_ni_alloc_w_cpt_array(net, conf->lic_cpts, conf->lic_ncpts,
conf->lic_ni_intf[0]);
if (!ni)
&peer_info->pr_lnd_u.pr_peer_credits.cr_ni_peer_tx_credits,
&peer_info->pr_lnd_u.pr_peer_credits.cr_peer_tx_credits,
&peer_info->pr_lnd_u.pr_peer_credits.cr_peer_rtr_credits,
- &peer_info->pr_lnd_u.pr_peer_credits.cr_peer_min_rtr_credits,
+ &peer_info->pr_lnd_u.pr_peer_credits.cr_peer_min_tx_credits,
&peer_info->pr_lnd_u.pr_peer_credits.cr_peer_tx_qnob);
mutex_unlock(&the_lnet.ln_api_mutex);
return rc;
conf = (struct lnet_ioctl_config_ni*) data;
if (i == 0 && tunables != NULL)
tun = (struct lnet_ioctl_config_lnd_tunables*)
- (data + sizeof(*conf));
+ conf->lic_bulk;
LIBCFS_IOC_INIT_V2(*conf, lic_cfg_hdr);
conf->lic_cfg_hdr.ioc_len = len;
== NULL)
goto out;
+ if (cYAML_create_number(peer_ni, "min_tx_credits",
+ lpni_cri->cr_peer_min_tx_credits)
+ == NULL)
+ goto out;
+
+ if (cYAML_create_number(peer_ni, "tx_q_num_of_buf",
+ lpni_cri->cr_peer_tx_qnob)
+ == NULL)
+ goto out;
+
if (cYAML_create_number(peer_ni, "available_rtr_credits",
lpni_cri->cr_peer_rtr_credits)
== NULL)
== NULL)
goto out;
- if (cYAML_create_number(peer_ni, "tx_q_num_of_buf",
- lpni_cri->cr_peer_tx_qnob)
- == NULL)
- goto out;
-
if (cYAML_create_number(peer_ni, "send_count",
lpni_stats->send_count)
== NULL)
static bool
yaml_extract_cmn_tunables(struct cYAML *tree,
struct lnet_ioctl_config_lnd_cmn_tunables *tunables,
- int *num_global_cpts,
struct cfs_expr_list **global_cpts)
{
struct cYAML *tun, *item, *smp;
+ int rc;
tun = cYAML_get_object_item(tree, "tunables");
if (tun != NULL) {
tunables->lct_max_tx_credits = item->cy_valueint;
smp = cYAML_get_object_item(tun, "CPT");
if (smp != NULL) {
- *num_global_cpts =
- cfs_expr_list_parse(smp->cy_valuestring,
+ rc = cfs_expr_list_parse(smp->cy_valuestring,
strlen(smp->cy_valuestring),
0, UINT_MAX, global_cpts);
+ if (rc != 0)
+ *global_cpts = NULL;
}
return true;
static bool
yaml_extract_tunables(struct cYAML *tree,
struct lnet_ioctl_config_lnd_tunables *tunables,
- int *num_global_cpts,
struct cfs_expr_list **global_cpts,
__u32 net_type)
{
bool rc;
rc = yaml_extract_cmn_tunables(tree, &tunables->lt_cmn,
- num_global_cpts, global_cpts);
+ global_cpts);
if (!rc)
return rc;
{
struct cYAML *net, *intf, *seq_no, *ip2net = NULL, *local_nis = NULL,
*item = NULL;
- int num_entries = 0, num_global_cpts = 0, rc;
+ int num_entries = 0, rc;
struct lnet_dlc_network_descr nw_descr;
struct cfs_expr_list *global_cpts = NULL;
struct lnet_ioctl_config_lnd_tunables tunables;
}
}
- found = yaml_extract_tunables(tree, &tunables, &num_global_cpts,
- &global_cpts,
+ found = yaml_extract_tunables(tree, &tunables, &global_cpts,
LNET_NETTYP(nw_descr.nw_id));
seq_no = cYAML_get_object_item(tree, "seq_no");
rc = lustre_lnet_config_ni(&nw_descr,
- (num_global_cpts > 0) ? global_cpts: NULL,
+ global_cpts,
(ip2net) ? ip2net->cy_valuestring : NULL,
(found) ? &tunables: NULL,
(seq_no) ? seq_no->cy_valueint : -1,
struct lustre_lnet_ip2nets ip2nets;
struct lustre_lnet_ip_range_descr *ip_range_descr = NULL,
*tmp = NULL;
- int rc = LUSTRE_CFG_RC_NO_ERR, num_global_cpts = 0;
+ int rc = LUSTRE_CFG_RC_NO_ERR;
struct cfs_expr_list *global_cpts = NULL;
struct cfs_expr_list *el, *el_tmp;
struct lnet_ioctl_config_lnd_tunables tunables;
}
}
- found = yaml_extract_tunables(tree, &tunables, &num_global_cpts,
- &global_cpts,
+ found = yaml_extract_tunables(tree, &tunables, &global_cpts,
LNET_NETTYP(ip2nets.ip2nets_net.nw_id));
rc = lustre_lnet_config_ip2nets(&ip2nets,
(found) ? &tunables : NULL,
- (num_global_cpts > 0) ? global_cpts : NULL,
+ global_cpts,
(seq_no) ? seq_no->cy_valueint : -1,
err_rc);
char *ip2net = NULL;
long int pto = -1, pc = -1, pbc = -1, cre = -1;
struct cYAML *err_rc = NULL;
- int rc, opt, num_global_cpts = 0;
+ int rc, opt, cpt_rc = -1;
struct lnet_dlc_network_descr nw_descr;
struct cfs_expr_list *global_cpts = NULL;
struct lnet_ioctl_config_lnd_tunables tunables;
}
break;
case 's':
- num_global_cpts =
- cfs_expr_list_parse(optarg,
- strlen(optarg),
- 0, UINT_MAX, &global_cpts);
+ cpt_rc = cfs_expr_list_parse(optarg,
+ strlen(optarg), 0,
+ UINT_MAX, &global_cpts);
break;
case 'h':
print_help(net_cmds, "net", "add");
}
rc = lustre_lnet_config_ni(&nw_descr,
- (num_global_cpts > 0) ? global_cpts: NULL,
+ (cpt_rc == 0) ? global_cpts: NULL,
ip2net, (found) ? &tunables : NULL,
-1, &err_rc);