From: Gregoire Pichon Date: Mon, 14 Jan 2019 19:52:58 +0000 (+0100) Subject: LU-11860 lnet: support config of LNDs with numeric intf name X-Git-Tag: 2.12.53~122 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F28%2F34028%2F3;p=fs%2Flustre-release.git LU-11860 lnet: support config of LNDs with numeric intf name This patch adds support for the net configuration of LNDs that have numeric interface name (PTL4LND, GNILND). The GNILND case has already been treated with a specific fix (see patch a29eb587). Signed-off-by: Gregoire Pichon Change-Id: I10556f9c78ec332bca3344990e509434f904ffc0 Reviewed-on: https://review.whamcloud.com/34028 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Chris Horn Reviewed-by: Amir Shehata Reviewed-by: Oleg Drokin --- diff --git a/lnet/utils/lnetconfig/liblnetconfig.c b/lnet/utils/lnetconfig/liblnetconfig.c index a0db4ae..29a5283 100644 --- a/lnet/utils/lnetconfig/liblnetconfig.c +++ b/lnet/utils/lnetconfig/liblnetconfig.c @@ -1397,6 +1397,8 @@ static int lustre_lnet_intf2nids(struct lnet_dlc_network_descr *nw, char val[LNET_MAX_STR_LEN]; __u32 ip; int gni_num; + char *endp; + unsigned int num; if (nw == NULL || nids == NULL) { @@ -1443,15 +1445,32 @@ static int lustre_lnet_intf2nids(struct lnet_dlc_network_descr *nw, /* look at the other interfaces */ list_for_each_entry(intf, &nw->nw_intflist, intf_on_network) { - rc = lustre_lnet_queryip(intf, &ip); - if (rc != LUSTRE_CFG_RC_NO_ERR) { - snprintf(err_str, str_len, - "\"couldn't query intf %s\"", intf->intf_name); - err_str[str_len - 1] = '\0'; - goto failed; + if (LNET_NETTYP(nw->nw_id) == PTL4LND) { + /* handle LNDs with numeric interface name */ + num = strtoul(intf->intf_name, &endp, 0); + if (endp == intf->intf_name || *endp != '\0') { + rc = LUSTRE_CFG_RC_BAD_PARAM; + snprintf(err_str, str_len, + "\"couldn't query intf %s\"", + intf->intf_name); + err_str[str_len - 1] = '\0'; + goto failed; + } + (*nids)[i] = LNET_MKNID(nw->nw_id, num); + i++; + } else { + /* handle LNDs with ip interface name */ + rc = lustre_lnet_queryip(intf, &ip); + if (rc != LUSTRE_CFG_RC_NO_ERR) { + snprintf(err_str, str_len, + "\"couldn't query intf %s\"", + intf->intf_name); + err_str[str_len - 1] = '\0'; + goto failed; + } + (*nids)[i] = LNET_MKNID(nw->nw_id, ip); + i++; } - (*nids)[i] = LNET_MKNID(nw->nw_id, ip); - i++; } out: