}
rnet = libcfs_str2net(nw);
- if (rnet == LNET_NIDNET(LNET_NID_ANY)) {
+ if (rnet == LNET_NET_ANY) {
snprintf(err_str, LNET_MAX_STR_LEN,
"\"cannot parse remote net %s\"", nw);
rc = LUSTRE_CFG_RC_BAD_PARAM;
lnet_nid_t gateway_nid;
int rc = LUSTRE_CFG_RC_OUT_OF_MEM;
int l_errno = 0;
- __u32 net = LNET_NIDNET(LNET_NID_ANY);
+ __u32 net = LNET_NET_ANY;
int i;
struct cYAML *root = NULL, *route = NULL, *item = NULL;
struct cYAML *first_seq = NULL;
if (nw != NULL) {
net = libcfs_str2net(nw);
- if (net == LNET_NIDNET(LNET_NID_ANY)) {
+ if (net == LNET_NET_ANY) {
snprintf(err_str,
sizeof(err_str),
"\"cannot parse net '%s'\"", nw);
} else {
/* show all routes without filtering on net */
- net = LNET_NIDNET(LNET_NID_ANY);
+ net = LNET_NET_ANY;
}
if (gw != NULL) {
}
/* filter on provided data */
- if (net != LNET_NIDNET(LNET_NID_ANY) &&
+ if (net != LNET_NET_ANY &&
net != data.cfg_net)
continue;
goto out;
}
- if (nw_descr->nw_id == LNET_NIDNET(LNET_NID_ANY)) {
+ if (nw_descr->nw_id == LNET_NET_ANY) {
snprintf(err_str,
sizeof(err_str),
"\"cannot parse net '%s'\"",
if (LNET_NETTYP(nw_descr->nw_id) == LOLND)
return LUSTRE_CFG_RC_NO_ERR;
- if (nw_descr->nw_id == LNET_NIDNET(LNET_NID_ANY)) {
+ if (nw_descr->nw_id == LNET_NET_ANY) {
snprintf(err_str,
sizeof(err_str),
"\"cannot parse net '%s'\"",
struct lnet_ioctl_element_stats *stats;
struct lnet_ioctl_element_msg_stats msg_stats;
struct lnet_ioctl_local_ni_hstats hstats;
- __u32 net = LNET_NIDNET(LNET_NID_ANY);
- __u32 prev_net = LNET_NIDNET(LNET_NID_ANY);
+ __u32 net = LNET_NET_ANY;
+ __u32 prev_net = LNET_NET_ANY;
int rc = LUSTRE_CFG_RC_OUT_OF_MEM, i, j;
int l_errno = 0;
struct cYAML *root = NULL, *tunables = NULL,
if (nw != NULL) {
net = libcfs_str2net(nw);
- if (net == LNET_NIDNET(LNET_NID_ANY)) {
+ if (net == LNET_NET_ANY) {
snprintf(err_str,
sizeof(err_str),
"\"cannot parse net '%s'\"", nw);
rc_net = LNET_NIDNET(ni_data->lic_nid);
/* filter on provided data */
- if (net != LNET_NIDNET(LNET_NID_ANY) &&
+ if (net != LNET_NET_ANY &&
net != rc_net)
continue;
return rc;
}
+int lustre_lnet_config_recovery_limit(int val, int seq_no,
+ struct cYAML **err_rc)
+{
+ int rc = LUSTRE_CFG_RC_NO_ERR;
+ char err_str[LNET_MAX_STR_LEN];
+ char val_str[LNET_MAX_STR_LEN];
+
+ if (val < 0) {
+ rc = LUSTRE_CFG_RC_BAD_PARAM;
+ snprintf(err_str, sizeof(err_str),
+ "\"Must be greater than or equal to 0\"");
+ } else {
+ snprintf(err_str, sizeof(err_str), "\"success\"");
+
+ snprintf(val_str, sizeof(val_str), "%d", val);
+
+ rc = write_sysfs_file(modparam_path, "lnet_recovery_limit",
+ val_str, 1, strlen(val_str) + 1);
+ if (rc)
+ snprintf(err_str, sizeof(err_str),
+ "\"cannot configure recovery limit: %s\"",
+ strerror(errno));
+ }
+
+ cYAML_build_error(rc, seq_no, ADD_CMD, "recovery_limit", err_str,
+ err_rc);
+
+ return rc;
+}
+
int lustre_lnet_config_max_intf(int max, int seq_no, struct cYAML **err_rc)
{
int rc = LUSTRE_CFG_RC_NO_ERR;
show_rc, err_rc, l_errno);
}
+int lustre_lnet_show_recovery_limit(int seq_no, struct cYAML **show_rc,
+ struct cYAML **err_rc)
+{
+ int rc = LUSTRE_CFG_RC_OUT_OF_MEM;
+ char val[LNET_MAX_STR_LEN];
+ int recov_limit = -1, l_errno = 0;
+ char err_str[LNET_MAX_STR_LEN];
+
+ snprintf(err_str, sizeof(err_str), "\"out of memory\"");
+
+ rc = read_sysfs_file(modparam_path, "lnet_recovery_limit", val,
+ 1, sizeof(val));
+ if (rc) {
+ l_errno = -errno;
+ snprintf(err_str, sizeof(err_str),
+ "\"cannot get lnet_recovery_limit value: %d\"", rc);
+ } else {
+ recov_limit = atoi(val);
+ }
+
+ return build_global_yaml_entry(err_str, sizeof(err_str), seq_no,
+ "recovery_limit", recov_limit,
+ show_rc, err_rc, l_errno);
+}
+
int lustre_lnet_show_max_intf(int seq_no, struct cYAML **show_rc,
struct cYAML **err_rc)
{
struct cYAML **err_rc)
{
struct cYAML *max_intf, *numa, *discovery, *retry, *tto, *seq_no,
- *sen, *recov, *rsen, *drop_asym_route, *rsp_tracking;
+ *sen, *recov, *rsen, *drop_asym_route, *rsp_tracking,
+ *recov_limit;
int rc = 0;
seq_no = cYAML_get_object_item(tree, "seq_no");
: -1,
err_rc);
+ recov_limit = cYAML_get_object_item(tree, "recovery_limit");
+ if (recov_limit)
+ rc = lustre_lnet_config_recovery_limit(recov_limit->cy_valueint,
+ seq_no ? seq_no->cy_valueint
+ : -1,
+ err_rc);
+
return rc;
}
struct cYAML **err_rc)
{
struct cYAML *max_intf, *numa, *discovery, *retry, *tto, *seq_no,
- *sen, *recov, *rsen, *drop_asym_route, *rsp_tracking;
+ *sen, *recov, *rsen, *drop_asym_route, *rsp_tracking,
+ *recov_limit;
int rc = 0;
seq_no = cYAML_get_object_item(tree, "seq_no");
-1,
show_rc, err_rc);
+ recov_limit = cYAML_get_object_item(tree, "recovery_limit");
+ if (recov_limit)
+ rc = lustre_lnet_show_recovery_limit(seq_no ?
+ seq_no->cy_valueint :
+ -1,
+ show_rc, err_rc);
+
return rc;
}