@@ -576,7 +576,7 @@ void lnet_notify_locked(struct lnet_peer_ni *lp, int notifylnd, int alive,
time64_t when);
int lnet_add_route(u32 net, u32 hops, struct lnet_nid *gateway,
u32 priority, u32 sensitivity);
-int lnet_del_route(u32 net, lnet_nid_t gw_nid);
+int lnet_del_route(u32 net, struct lnet_nid *gw_nid);
void lnet_move_route(struct lnet_route *route, struct lnet_peer *lp,
struct list_head *rt_list);
void lnet_destroy_routes(void);
@@ -3901,8 +3901,9 @@ u32 lnet_get_dlc_seq_locked(void)
if (config->cfg_hdr.ioc_len < sizeof(*config))
return -EINVAL;
+ lnet_nid4_to_nid(config->cfg_nid, &nid);
mutex_lock(&the_lnet.ln_api_mutex);
- rc = lnet_del_route(config->cfg_net, config->cfg_nid);
+ rc = lnet_del_route(config->cfg_net, &nid);
mutex_unlock(&the_lnet.ln_api_mutex);
return rc;
@@ -627,7 +627,7 @@ static void lnet_peer_cancel_discovery(struct lnet_peer *lp)
{
struct lnet_peer_ni *lp;
struct lnet_peer_ni *tmp;
- lnet_nid_t gw_nid;
+ struct lnet_nid gw_nid;
int i;
for (i = 0; i < LNET_PEER_HASH_SIZE; i++) {
@@ -639,10 +639,9 @@ static void lnet_peer_cancel_discovery(struct lnet_peer *lp)
if (!lnet_isrouter(lp))
continue;
- /* FIXME handle large-addr nid */
- gw_nid = lnet_nid_to_nid4(&lp->lpni_peer_net->lpn_peer->lp_primary_nid);
+ gw_nid = lp->lpni_peer_net->lpn_peer->lp_primary_nid;
lnet_net_unlock(LNET_LOCK_EX);
- lnet_del_route(LNET_NET_ANY, gw_nid);
+ lnet_del_route(LNET_NET_ANY, &gw_nid);
lnet_net_lock(LNET_LOCK_EX);
}
}
@@ -116,7 +116,7 @@ static int rtr_sensitivity_set(const char *val,
static void lnet_add_route_to_rnet(struct lnet_remotenet *rnet,
struct lnet_route *route);
-static void lnet_del_route_from_rnet(lnet_nid_t gw_nid,
+static void lnet_del_route_from_rnet(struct lnet_nid *gw_nid,
struct list_head *route_list,
struct list_head *zombies);
@@ -175,7 +175,7 @@ static void lnet_del_route_from_rnet(lnet_nid_t gw_nid,
/* use the gateway's lp_primary_nid to delete the route as the
* lr_nid can be a constituent NID of the peer
*/
- lnet_del_route_from_rnet(lnet_nid_to_nid4(&route->lr_gateway->lp_primary_nid),
+ lnet_del_route_from_rnet(&route->lr_gateway->lp_primary_nid,
&rnet->lrn_routes, l);
if (lp) {
@@ -788,7 +788,8 @@ static void lnet_shuffle_seed(void)
}
void
-lnet_del_route_from_rnet(lnet_nid_t gw_nid, struct list_head *route_list,
+lnet_del_route_from_rnet(struct lnet_nid *gw_nid,
+ struct list_head *route_list,
struct list_head *zombies)
{
struct lnet_peer *gateway;
@@ -797,8 +798,7 @@ static void lnet_shuffle_seed(void)
list_for_each_entry_safe(route, tmp, route_list, lr_list) {
gateway = route->lr_gateway;
- if (gw_nid != LNET_NID_ANY &&
- gw_nid != lnet_nid_to_nid4(&gateway->lp_primary_nid))
+ if (gw_nid && !nid_same(gw_nid, &gateway->lp_primary_nid))
continue;
/* move to zombie to delete outside the lock
@@ -817,7 +817,7 @@ static void lnet_shuffle_seed(void)
}
int
-lnet_del_route(u32 net, lnet_nid_t gw_nid)
+lnet_del_route(u32 net, struct lnet_nid *gw)
{
LIST_HEAD(rnet_zombies);
struct lnet_remotenet *rnet;
@@ -825,12 +825,13 @@ static void lnet_shuffle_seed(void)
struct list_head *rn_list;
struct lnet_peer_ni *lpni;
struct lnet_route *route;
+ struct lnet_nid gw_nid;
LIST_HEAD(zombies);
struct lnet_peer *lp = NULL;
int i = 0;
CDEBUG(D_NET, "Del route: net %s : gw %s\n",
- libcfs_net2str(net), libcfs_nid2str(gw_nid));
+ libcfs_net2str(net), libcfs_nidstr(gw));
/* NB Caller may specify either all routes via the given gateway
* or a specific route entry actual NIDs)
@@ -838,11 +839,15 @@ static void lnet_shuffle_seed(void)
lnet_net_lock(LNET_LOCK_EX);
- lpni = lnet_find_peer_ni_locked(gw_nid);
+ if (gw)
+ lpni = lnet_peer_ni_find_locked(gw);
+ else
+ lpni = NULL;
if (lpni) {
lp = lpni->lpni_peer_net->lpn_peer;
LASSERT(lp);
- gw_nid = lnet_nid_to_nid4(&lp->lp_primary_nid);
+ gw_nid = lp->lp_primary_nid;
+ gw = &gw_nid;
lnet_peer_ni_decref_locked(lpni);
}
@@ -852,7 +857,7 @@ static void lnet_shuffle_seed(void)
lnet_net_unlock(LNET_LOCK_EX);
return -ENOENT;
}
- lnet_del_route_from_rnet(gw_nid, &rnet->lrn_routes,
+ lnet_del_route_from_rnet(gw, &rnet->lrn_routes,
&zombies);
if (list_empty(&rnet->lrn_routes))
list_move(&rnet->lrn_list, &rnet_zombies);
@@ -863,7 +868,7 @@ static void lnet_shuffle_seed(void)
rn_list = &the_lnet.ln_remote_nets_hash[i];
list_for_each_entry_safe(rnet, tmp, rn_list, lrn_list) {
- lnet_del_route_from_rnet(gw_nid, &rnet->lrn_routes,
+ lnet_del_route_from_rnet(gw, &rnet->lrn_routes,
&zombies);
if (list_empty(&rnet->lrn_routes))
list_move(&rnet->lrn_list, &rnet_zombies);
@@ -903,7 +908,7 @@ static void lnet_shuffle_seed(void)
void
lnet_destroy_routes(void)
{
- lnet_del_route(LNET_NET_ANY, LNET_NID_ANY);
+ lnet_del_route(LNET_NET_ANY, NULL);
}
int lnet_get_rtr_pool_cfg(int cpt, struct lnet_ioctl_pool_cfg *pool_cfg)