From: Olaf Weber Date: Fri, 27 Jan 2017 15:14:50 +0000 (+0100) Subject: LU-9119 lnet: rename LNET_MAX_INTERFACES X-Git-Tag: 2.9.57~2 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=057d89f5ecc9b28e5861fa037b1fc3512d6576ce LU-9119 lnet: rename LNET_MAX_INTERFACES LNET_MAX_INTERFACES is the number of interfaces supported by interface bonding in the ksocknal LND. It shows up in LNet because a number of data structures are shared between LNDs. Rename it to LNET_NUM_INTERFACES to reduce the confusion of what it does. Test-Parameters: trivial Signed-off-by: Olaf Weber Change-Id: Ibc1d85a379d6616eb1db2fcb54aaffc835ffa9f4 Reviewed-on: https://review.whamcloud.com/26693 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Doug Oucharek Reviewed-by: Oleg Drokin --- diff --git a/lnet/include/lnet/lib-dlc.h b/lnet/include/lnet/lib-dlc.h index 360383d..1b8317a 100644 --- a/lnet/include/lnet/lib-dlc.h +++ b/lnet/include/lnet/lib-dlc.h @@ -80,7 +80,7 @@ struct lnet_ioctl_config_lnd_tunables { }; struct lnet_ioctl_net_config { - char ni_interfaces[LNET_MAX_INTERFACES][LNET_MAX_STR_LEN]; + char ni_interfaces[LNET_NUM_INTERFACES][LNET_MAX_STR_LEN]; __u32 ni_status; __u32 ni_cpts[LNET_MAX_SHOW_NUM_CPT]; char cfg_bulk[0]; @@ -183,7 +183,7 @@ struct lnet_ioctl_element_msg_stats { struct lnet_ioctl_config_ni { struct libcfs_ioctl_hdr lic_cfg_hdr; lnet_nid_t lic_nid; - char lic_ni_intf[LNET_MAX_INTERFACES][LNET_MAX_STR_LEN]; + char lic_ni_intf[LNET_NUM_INTERFACES][LNET_MAX_STR_LEN]; char lic_legacy_ip2nets[LNET_MAX_STR_LEN]; __u32 lic_cpts[LNET_MAX_SHOW_NUM_CPT]; __u32 lic_ncpts; diff --git a/lnet/include/lnet/lib-types.h b/lnet/include/lnet/lib-types.h index c72771c..9b8af0e 100644 --- a/lnet/include/lnet/lib-types.h +++ b/lnet/include/lnet/lib-types.h @@ -403,7 +403,7 @@ typedef struct lnet_ni { * equivalent interfaces to use * This is an array because socklnd bonding can still be configured */ - char *ni_interfaces[LNET_MAX_INTERFACES]; + char *ni_interfaces[LNET_NUM_INTERFACES]; struct net *ni_net_ns; /* original net namespace */ } lnet_ni_t; diff --git a/lnet/include/lnet/types.h b/lnet/include/lnet/types.h index 4b11517..e4bfe3d 100644 --- a/lnet/include/lnet/types.h +++ b/lnet/include/lnet/types.h @@ -241,7 +241,13 @@ typedef struct lnet_counters { #define LNET_NI_STATUS_DOWN 0xdeadface #define LNET_NI_STATUS_INVALID 0x00000000 -#define LNET_MAX_INTERFACES 16 +/* + * This is a hard-coded limit on the number of interfaces supported by + * the interface bonding implemented by the ksocknal LND. It must be + * defined here because it is used in LNet data structures that are + * common to all LNDs. + */ +#define LNET_NUM_INTERFACES 16 /** * Objects maintained by the LNet are accessed through handles. Handle types diff --git a/lnet/klnds/o2iblnd/o2iblnd.c b/lnet/klnds/o2iblnd/o2iblnd.c index b17c5e3..db6012c 100644 --- a/lnet/klnds/o2iblnd/o2iblnd.c +++ b/lnet/klnds/o2iblnd/o2iblnd.c @@ -3233,19 +3233,19 @@ kiblnd_startup(struct lnet_ni *ni) kiblnd_tunables_setup(ni); - if (ni->ni_interfaces[0] != NULL) { - /* Use the IPoIB interface specified in 'networks=' */ + if (ni->ni_interfaces[0] != NULL) { + /* Use the IPoIB interface specified in 'networks=' */ - CLASSERT (LNET_MAX_INTERFACES > 1); - if (ni->ni_interfaces[1] != NULL) { - CERROR("Multiple interfaces not supported\n"); - goto failed; - } + CLASSERT(LNET_NUM_INTERFACES > 1); + if (ni->ni_interfaces[1] != NULL) { + CERROR("Multiple interfaces not supported\n"); + goto failed; + } - ifname = ni->ni_interfaces[0]; - } else { - ifname = *kiblnd_tunables.kib_default_ipif; - } + ifname = ni->ni_interfaces[0]; + } else { + ifname = *kiblnd_tunables.kib_default_ipif; + } if (strlen(ifname) >= sizeof(ibdev->ibd_ifname)) { CERROR("IPoIB interface name too long: %s\n", ifname); diff --git a/lnet/klnds/socklnd/socklnd.c b/lnet/klnds/socklnd/socklnd.c index d0e073c..0852e85 100644 --- a/lnet/klnds/socklnd/socklnd.c +++ b/lnet/klnds/socklnd/socklnd.c @@ -46,19 +46,19 @@ ksock_nal_data_t ksocknal_data; static ksock_interface_t * ksocknal_ip2iface(struct lnet_ni *ni, __u32 ip) { - ksock_net_t *net = ni->ni_data; - int i; - ksock_interface_t *iface; + ksock_net_t *net = ni->ni_data; + int i; + ksock_interface_t *iface; - for (i = 0; i < net->ksnn_ninterfaces; i++) { - LASSERT(i < LNET_MAX_INTERFACES); - iface = &net->ksnn_interfaces[i]; + for (i = 0; i < net->ksnn_ninterfaces; i++) { + LASSERT(i < LNET_NUM_INTERFACES); + iface = &net->ksnn_interfaces[i]; - if (iface->ksni_ipaddr == ip) - return (iface); - } + if (iface->ksni_ipaddr == ip) + return iface; + } - return (NULL); + return NULL; } static ksock_route_t * @@ -214,25 +214,27 @@ ksocknal_find_peer(struct lnet_ni *ni, struct lnet_process_id id) } static void -ksocknal_unlink_peer_locked (ksock_peer_ni_t *peer_ni) +ksocknal_unlink_peer_locked(ksock_peer_ni_t *peer_ni) { - int i; - __u32 ip; - ksock_interface_t *iface; + int i; + __u32 ip; + ksock_interface_t *iface; - for (i = 0; i < peer_ni->ksnp_n_passive_ips; i++) { - LASSERT (i < LNET_MAX_INTERFACES); - ip = peer_ni->ksnp_passive_ips[i]; + for (i = 0; i < peer_ni->ksnp_n_passive_ips; i++) { + LASSERT(i < LNET_NUM_INTERFACES); + ip = peer_ni->ksnp_passive_ips[i]; - iface = ksocknal_ip2iface(peer_ni->ksnp_ni, ip); - /* All IPs in peer_ni->ksnp_passive_ips[] come from the - * interface list, therefore the call must succeed. */ - LASSERT (iface != NULL); + iface = ksocknal_ip2iface(peer_ni->ksnp_ni, ip); + /* + * All IPs in peer_ni->ksnp_passive_ips[] come from the + * interface list, therefore the call must succeed. + */ + LASSERT(iface != NULL); - CDEBUG(D_NET, "peer_ni=%p iface=%p ksni_nroutes=%d\n", - peer_ni, iface, iface->ksni_nroutes); - iface->ksni_npeers--; - } + CDEBUG(D_NET, "peer_ni=%p iface=%p ksni_nroutes=%d\n", + peer_ni, iface, iface->ksni_nroutes); + iface->ksni_npeers--; + } LASSERT(list_empty(&peer_ni->ksnp_conns)); LASSERT(list_empty(&peer_ni->ksnp_routes)); @@ -687,29 +689,31 @@ ksocknal_choose_scheduler_locked(unsigned int cpt) static int ksocknal_local_ipvec(struct lnet_ni *ni, __u32 *ipaddrs) { - ksock_net_t *net = ni->ni_data; - int i; - int nip; + ksock_net_t *net = ni->ni_data; + int i; + int nip; read_lock(&ksocknal_data.ksnd_global_lock); - nip = net->ksnn_ninterfaces; - LASSERT (nip <= LNET_MAX_INTERFACES); + nip = net->ksnn_ninterfaces; + LASSERT(nip <= LNET_NUM_INTERFACES); - /* Only offer interfaces for additional connections if I have - * more than one. */ - if (nip < 2) { + /* + * Only offer interfaces for additional connections if I have + * more than one. + */ + if (nip < 2) { read_unlock(&ksocknal_data.ksnd_global_lock); - return 0; - } + return 0; + } - for (i = 0; i < nip; i++) { - ipaddrs[i] = net->ksnn_interfaces[i].ksni_ipaddr; - LASSERT (ipaddrs[i] != 0); - } + for (i = 0; i < nip; i++) { + ipaddrs[i] = net->ksnn_interfaces[i].ksni_ipaddr; + LASSERT(ipaddrs[i] != 0); + } read_unlock(&ksocknal_data.ksnd_global_lock); - return (nip); + return nip; } static int @@ -771,8 +775,8 @@ ksocknal_select_ips(ksock_peer_ni_t *peer_ni, __u32 *peerips, int n_peerips) write_lock_bh(global_lock); - LASSERT (n_peerips <= LNET_MAX_INTERFACES); - LASSERT (net->ksnn_ninterfaces <= LNET_MAX_INTERFACES); + LASSERT(n_peerips <= LNET_NUM_INTERFACES); + LASSERT(net->ksnn_ninterfaces <= LNET_NUM_INTERFACES); /* Only match interfaces for additional connections * if I have > 1 interface */ @@ -882,7 +886,7 @@ ksocknal_create_routes(ksock_peer_ni_t *peer_ni, int port, return; } - LASSERT (npeer_ipaddrs <= LNET_MAX_INTERFACES); + LASSERT(npeer_ipaddrs <= LNET_NUM_INTERFACES); for (i = 0; i < npeer_ipaddrs; i++) { if (newroute != NULL) { @@ -919,7 +923,7 @@ ksocknal_create_routes(ksock_peer_ni_t *peer_ni, int port, best_nroutes = 0; best_netmatch = 0; - LASSERT(net->ksnn_ninterfaces <= LNET_MAX_INTERFACES); + LASSERT(net->ksnn_ninterfaces <= LNET_NUM_INTERFACES); /* Select interface to connect from */ for (j = 0; j < net->ksnn_ninterfaces; j++) { @@ -1064,7 +1068,7 @@ ksocknal_create_conn(struct lnet_ni *ni, ksock_route_t *route, atomic_set (&conn->ksnc_tx_nob, 0); LIBCFS_ALLOC(hello, offsetof(struct ksock_hello_msg, - kshm_ips[LNET_MAX_INTERFACES])); + kshm_ips[LNET_NUM_INTERFACES])); if (hello == NULL) { rc = -ENOMEM; goto failed_1; @@ -1313,7 +1317,7 @@ ksocknal_create_conn(struct lnet_ni *ni, ksock_route_t *route, } LIBCFS_FREE(hello, offsetof(struct ksock_hello_msg, - kshm_ips[LNET_MAX_INTERFACES])); + kshm_ips[LNET_NUM_INTERFACES])); /* setup the socket AFTER I've received hello (it disables * SO_LINGER). I might call back to the acceptor who may want @@ -1397,7 +1401,7 @@ failed_2: failed_1: if (hello != NULL) LIBCFS_FREE(hello, offsetof(struct ksock_hello_msg, - kshm_ips[LNET_MAX_INTERFACES])); + kshm_ips[LNET_NUM_INTERFACES])); LIBCFS_FREE(conn, sizeof(*conn)); @@ -1943,63 +1947,63 @@ ksocknal_push(struct lnet_ni *ni, struct lnet_process_id id) static int ksocknal_add_interface(struct lnet_ni *ni, __u32 ipaddress, __u32 netmask) { - ksock_net_t *net = ni->ni_data; - ksock_interface_t *iface; - int rc; - int i; - int j; - struct list_head *ptmp; - ksock_peer_ni_t *peer_ni; - struct list_head *rtmp; - ksock_route_t *route; + ksock_net_t *net = ni->ni_data; + ksock_interface_t *iface; + int rc; + int i; + int j; + struct list_head *ptmp; + ksock_peer_ni_t *peer_ni; + struct list_head *rtmp; + ksock_route_t *route; - if (ipaddress == 0 || - netmask == 0) - return (-EINVAL); + if (ipaddress == 0 || + netmask == 0) + return -EINVAL; write_lock_bh(&ksocknal_data.ksnd_global_lock); - iface = ksocknal_ip2iface(ni, ipaddress); - if (iface != NULL) { - /* silently ignore dups */ - rc = 0; - } else if (net->ksnn_ninterfaces == LNET_MAX_INTERFACES) { - rc = -ENOSPC; - } else { - iface = &net->ksnn_interfaces[net->ksnn_ninterfaces++]; + iface = ksocknal_ip2iface(ni, ipaddress); + if (iface != NULL) { + /* silently ignore dups */ + rc = 0; + } else if (net->ksnn_ninterfaces == LNET_NUM_INTERFACES) { + rc = -ENOSPC; + } else { + iface = &net->ksnn_interfaces[net->ksnn_ninterfaces++]; - iface->ksni_ipaddr = ipaddress; - iface->ksni_netmask = netmask; - iface->ksni_nroutes = 0; - iface->ksni_npeers = 0; + iface->ksni_ipaddr = ipaddress; + iface->ksni_netmask = netmask; + iface->ksni_nroutes = 0; + iface->ksni_npeers = 0; - for (i = 0; i < ksocknal_data.ksnd_peer_hash_size; i++) { + for (i = 0; i < ksocknal_data.ksnd_peer_hash_size; i++) { list_for_each(ptmp, &ksocknal_data.ksnd_peers[i]) { peer_ni = list_entry(ptmp, ksock_peer_ni_t, - ksnp_list); + ksnp_list); - for (j = 0; j < peer_ni->ksnp_n_passive_ips; j++) - if (peer_ni->ksnp_passive_ips[j] == ipaddress) - iface->ksni_npeers++; + for (j = 0; j < peer_ni->ksnp_n_passive_ips; j++) + if (peer_ni->ksnp_passive_ips[j] == ipaddress) + iface->ksni_npeers++; list_for_each(rtmp, &peer_ni->ksnp_routes) { route = list_entry(rtmp, - ksock_route_t, - ksnr_list); + ksock_route_t, + ksnr_list); - if (route->ksnr_myipaddr == ipaddress) - iface->ksni_nroutes++; - } - } - } + if (route->ksnr_myipaddr == ipaddress) + iface->ksni_nroutes++; + } + } + } - rc = 0; - /* NB only new connections will pay attention to the new interface! */ - } + rc = 0; + /* NB only new connections will pay attention to the new interface! */ + } write_unlock_bh(&ksocknal_data.ksnd_global_lock); - return (rc); + return rc; } static void @@ -2629,11 +2633,11 @@ ksocknal_enumerate_interfaces(ksock_net_t *net) continue; } - if (j == LNET_MAX_INTERFACES) { - CWARN("Ignoring interface %s (too many interfaces)\n", - names[i]); - continue; - } + if (j == LNET_NUM_INTERFACES) { + CWARN("Ignoring interface %s (too many interfaces)\n", + names[i]); + continue; + } net->ksnn_interfaces[j].ksni_ipaddr = ip; net->ksnn_interfaces[j].ksni_netmask = mask; @@ -2802,34 +2806,34 @@ ksocknal_startup(struct lnet_ni *ni) } - if (ni->ni_interfaces[0] == NULL) { - rc = ksocknal_enumerate_interfaces(net); - if (rc <= 0) - goto fail_1; + if (ni->ni_interfaces[0] == NULL) { + rc = ksocknal_enumerate_interfaces(net); + if (rc <= 0) + goto fail_1; - net->ksnn_ninterfaces = 1; - } else { - for (i = 0; i < LNET_MAX_INTERFACES; i++) { - int up; + net->ksnn_ninterfaces = 1; + } else { + for (i = 0; i < LNET_NUM_INTERFACES; i++) { + int up; - if (ni->ni_interfaces[i] == NULL) - break; + if (ni->ni_interfaces[i] == NULL) + break; rc = lnet_ipif_query(ni->ni_interfaces[i], &up, - &net->ksnn_interfaces[i].ksni_ipaddr, - &net->ksnn_interfaces[i].ksni_netmask); + &net->ksnn_interfaces[i].ksni_ipaddr, + &net->ksnn_interfaces[i].ksni_netmask); - if (rc != 0) { - CERROR("Can't get interface %s info: %d\n", - ni->ni_interfaces[i], rc); - goto fail_1; - } + if (rc != 0) { + CERROR("Can't get interface %s info: %d\n", + ni->ni_interfaces[i], rc); + goto fail_1; + } - if (!up) { - CERROR("Interface %s is down\n", - ni->ni_interfaces[i]); - goto fail_1; - } + if (!up) { + CERROR("Interface %s is down\n", + ni->ni_interfaces[i]); + goto fail_1; + } strlcpy(net->ksnn_interfaces[i].ksni_name, ni->ni_interfaces[i], diff --git a/lnet/klnds/socklnd/socklnd.h b/lnet/klnds/socklnd/socklnd.h index 544690b..3152a45 100644 --- a/lnet/klnds/socklnd/socklnd.h +++ b/lnet/klnds/socklnd/socklnd.h @@ -183,7 +183,7 @@ typedef struct int ksnn_npeers; /* # peers */ int ksnn_shutdown; /* shutting down? */ int ksnn_ninterfaces; /* IP interfaces */ - ksock_interface_t ksnn_interfaces[LNET_MAX_INTERFACES]; + ksock_interface_t ksnn_interfaces[LNET_NUM_INTERFACES]; } ksock_net_t; /** connd timeout */ @@ -415,21 +415,21 @@ typedef struct ksock_peer atomic_t ksnp_refcount; /* # users */ int ksnp_sharecount; /* lconf usage counter */ int ksnp_closing; /* being closed */ - int ksnp_accepting;/* # passive connections pending */ - int ksnp_error; /* errno on closing last conn */ - __u64 ksnp_zc_next_cookie;/* ZC completion cookie */ - __u64 ksnp_incarnation; /* latest known peer_ni incarnation */ - struct ksock_proto *ksnp_proto; /* latest known peer_ni protocol */ + int ksnp_accepting;/* # passive connections pending */ + int ksnp_error; /* errno on closing last conn */ + __u64 ksnp_zc_next_cookie;/* ZC completion cookie */ + __u64 ksnp_incarnation; /* latest known peer_ni incarnation */ + struct ksock_proto *ksnp_proto; /* latest known peer_ni protocol */ struct list_head ksnp_conns; /* all active connections */ struct list_head ksnp_routes; /* routes */ struct list_head ksnp_tx_queue; /* waiting packets */ spinlock_t ksnp_lock; /* serialize, g_lock unsafe */ /* zero copy requests wait for ACK */ struct list_head ksnp_zc_req_list; - cfs_time_t ksnp_send_keepalive; /* time to send keepalive */ - struct lnet_ni *ksnp_ni; /* which network */ - int ksnp_n_passive_ips; /* # of... */ - __u32 ksnp_passive_ips[LNET_MAX_INTERFACES]; /* preferred local interfaces */ + cfs_time_t ksnp_send_keepalive; /* time to send keepalive */ + struct lnet_ni *ksnp_ni; /* which network */ + int ksnp_n_passive_ips; /* # of... */ + __u32 ksnp_passive_ips[LNET_NUM_INTERFACES]; /* preferred local interfaces */ } ksock_peer_ni_t; typedef struct ksock_connreq diff --git a/lnet/klnds/socklnd/socklnd_cb.c b/lnet/klnds/socklnd/socklnd_cb.c index 2da283a..3265b02 100644 --- a/lnet/klnds/socklnd/socklnd_cb.c +++ b/lnet/klnds/socklnd/socklnd_cb.c @@ -1666,22 +1666,22 @@ int ksocknal_send_hello(struct lnet_ni *ni, ksock_conn_t *conn, lnet_nid_t peer_nid, struct ksock_hello_msg *hello) { - /* CAVEAT EMPTOR: this byte flips 'ipaddrs' */ - ksock_net_t *net = (ksock_net_t *)ni->ni_data; + /* CAVEAT EMPTOR: this byte flips 'ipaddrs' */ + ksock_net_t *net = (ksock_net_t *)ni->ni_data; - LASSERT (hello->kshm_nips <= LNET_MAX_INTERFACES); + LASSERT(hello->kshm_nips <= LNET_NUM_INTERFACES); - /* rely on caller to hold a ref on socket so it wouldn't disappear */ - LASSERT (conn->ksnc_proto != NULL); + /* rely on caller to hold a ref on socket so it wouldn't disappear */ + LASSERT(conn->ksnc_proto != NULL); - hello->kshm_src_nid = ni->ni_nid; - hello->kshm_dst_nid = peer_nid; - hello->kshm_src_pid = the_lnet.ln_pid; + hello->kshm_src_nid = ni->ni_nid; + hello->kshm_dst_nid = peer_nid; + hello->kshm_src_pid = the_lnet.ln_pid; - hello->kshm_src_incarnation = net->ksnn_incarnation; - hello->kshm_ctype = conn->ksnc_type; + hello->kshm_src_incarnation = net->ksnn_incarnation; + hello->kshm_ctype = conn->ksnc_type; - return conn->ksnc_proto->pro_send_hello(conn, hello); + return conn->ksnc_proto->pro_send_hello(conn, hello); } static int diff --git a/lnet/klnds/socklnd/socklnd_proto.c b/lnet/klnds/socklnd/socklnd_proto.c index 8938089..98109ec 100644 --- a/lnet/klnds/socklnd/socklnd_proto.c +++ b/lnet/klnds/socklnd/socklnd_proto.c @@ -607,12 +607,12 @@ ksocknal_recv_hello_v1(ksock_conn_t *conn, struct ksock_hello_msg *hello,int tim hello->kshm_nips = le32_to_cpu (hdr->payload_length) / sizeof (__u32); - if (hello->kshm_nips > LNET_MAX_INTERFACES) { + if (hello->kshm_nips > LNET_NUM_INTERFACES) { CERROR("Bad nips %d from ip %pI4h\n", hello->kshm_nips, &conn->ksnc_ipaddr); - rc = -EPROTO; - goto out; - } + rc = -EPROTO; + goto out; + } if (hello->kshm_nips == 0) goto out; @@ -677,11 +677,11 @@ ksocknal_recv_hello_v2(ksock_conn_t *conn, struct ksock_hello_msg *hello, __swab32s(&hello->kshm_nips); } - if (hello->kshm_nips > LNET_MAX_INTERFACES) { + if (hello->kshm_nips > LNET_NUM_INTERFACES) { CERROR("Bad nips %d from ip %pI4h\n", hello->kshm_nips, &conn->ksnc_ipaddr); - return -EPROTO; - } + return -EPROTO; + } if (hello->kshm_nips == 0) return 0; diff --git a/lnet/lnet/config.c b/lnet/lnet/config.c index 9469a11..fbbc18c 100644 --- a/lnet/lnet/config.c +++ b/lnet/lnet/config.c @@ -121,10 +121,10 @@ lnet_ni_unique_net(struct list_head *nilist, char *iface) /* check that the NI is unique to the interfaces with in the same NI. * This is only a consideration if use_tcp_bonding is set */ static bool -lnet_ni_unique_ni(char *iface_list[LNET_MAX_INTERFACES], char *iface) +lnet_ni_unique_ni(char *iface_list[LNET_NUM_INTERFACES], char *iface) { int i; - for (i = 0; i < LNET_MAX_INTERFACES; i++) { + for (i = 0; i < LNET_NUM_INTERFACES; i++) { if (iface_list[i] != NULL && strncmp(iface_list[i], iface, strlen(iface)) == 0) return false; @@ -307,7 +307,7 @@ lnet_ni_free(struct lnet_ni *ni) if (ni->ni_cpts != NULL) cfs_expr_list_values_free(ni->ni_cpts, ni->ni_ncpts); - for (i = 0; i < LNET_MAX_INTERFACES && + for (i = 0; i < LNET_NUM_INTERFACES && ni->ni_interfaces[i] != NULL; i++) { LIBCFS_FREE(ni->ni_interfaces[i], strlen(ni->ni_interfaces[i]) + 1); @@ -407,11 +407,11 @@ lnet_ni_add_interface(struct lnet_ni *ni, char *iface) * can free the tokens at the end of the function. * The newly allocated ni_interfaces[] can be * freed when freeing the NI */ - while (niface < LNET_MAX_INTERFACES && + while (niface < LNET_NUM_INTERFACES && ni->ni_interfaces[niface] != NULL) niface++; - if (niface >= LNET_MAX_INTERFACES) { + if (niface >= LNET_NUM_INTERFACES) { LCONSOLE_ERROR_MSG(0x115, "Too many interfaces " "for net %s\n", libcfs_net2str(LNET_NIDNET(ni->ni_nid))); diff --git a/lnet/utils/lnetconfig/liblnetconfig.c b/lnet/utils/lnetconfig/liblnetconfig.c index 2313a28..523529b 100644 --- a/lnet/utils/lnetconfig/liblnetconfig.c +++ b/lnet/utils/lnetconfig/liblnetconfig.c @@ -1626,7 +1626,7 @@ int lustre_lnet_show_net(char *nw, int detail, int seq_no, if (interfaces == NULL) goto out; - for (j = 0; j < LNET_MAX_INTERFACES; j++) { + for (j = 0; j < LNET_NUM_INTERFACES; j++) { if (strlen(ni_data->lic_ni_intf[j]) > 0) { snprintf(str_buf, sizeof(str_buf), "%d", j);