CDEBUG(D_NET, "deleting route %s->%s\n",
libcfs_net2str(route->lr_net),
- libcfs_nid2str(route->lr_nid));
+ libcfs_nidstr(&route->lr_nid));
/*
* use the gateway's lp_primary_nid to delete the route as the
CDEBUG(D_NET, "%s: %s->%s\n",
libcfs_nidstr(&src->lp_primary_nid),
libcfs_net2str(route->lr_net),
- libcfs_nid2str(route->lr_nid));
+ libcfs_nidstr(&route->lr_nid));
}
list_splice_init(&src->lp_rtrq, &target->lp_rtrq);
list_for_each_entry_safe(route, tmp, &src->lp_routes, lr_gwlist) {
* intent here is not to confuse the user who added the route.
*/
list_for_each_entry(route, &orig_lp->lp_routes, lr_gwlist) {
- lpni = lnet_peer_get_ni_locked(orig_lp, route->lr_nid);
+ lpni = lnet_peer_ni_get_locked(orig_lp, &route->lr_nid);
if (!lpni) {
lnet_net_lock(LNET_LOCK_EX);
list_move(&route->lr_gwlist, &new_lp->lp_routes);
}
int
-lnet_add_route(__u32 net, __u32 hops, lnet_nid_t gateway,
+lnet_add_route(__u32 net, __u32 hops, struct lnet_nid *gateway,
__u32 priority, __u32 sensitivity)
{
struct list_head *route_entry;
int rc;
CDEBUG(D_NET, "Add route: remote net %s hops %d priority %u gw %s\n",
- libcfs_net2str(net), hops, priority, libcfs_nid2str(gateway));
+ libcfs_net2str(net), hops, priority, libcfs_nidstr(gateway));
- if (gateway == LNET_NID_ANY ||
- gateway == LNET_NID_LO_0 ||
+ if (LNET_NID_IS_ANY(gateway) ||
+ nid_is_lo0(gateway) ||
net == LNET_NET_ANY ||
LNET_NETTYP(net) == LOLND ||
- LNET_NIDNET(gateway) == net ||
+ LNET_NID_NET(gateway) == net ||
(hops != LNET_UNDEFINED_HOPS && (hops < 1 || hops > 255)))
return -EINVAL;
if (lnet_islocalnet(net))
return -EEXIST;
- if (!lnet_islocalnet(LNET_NIDNET(gateway))) {
+ if (!lnet_islocalnet(LNET_NID_NET(gateway))) {
CERROR("Cannot add route with gateway %s. There is no local interface configured on LNet %s\n",
- libcfs_nid2str(gateway),
- libcfs_net2str(LNET_NIDNET(gateway)));
+ libcfs_nidstr(gateway),
+ libcfs_net2str(LNET_NID_NET(gateway)));
return -EHOSTUNREACH;
}
LIBCFS_ALLOC(rnet, sizeof(*rnet));
if (route == NULL || rnet == NULL) {
CERROR("Out of memory creating route %s %d %s\n",
- libcfs_net2str(net), hops, libcfs_nid2str(gateway));
+ libcfs_net2str(net), hops, libcfs_nidstr(gateway));
if (route != NULL)
LIBCFS_FREE(route, sizeof(*route));
if (rnet != NULL)
INIT_LIST_HEAD(&rnet->lrn_routes);
rnet->lrn_net = net;
/* store the local and remote net that the route represents */
- route->lr_lnet = LNET_NIDNET(gateway);
+ route->lr_lnet = LNET_NID_NET(gateway);
route->lr_net = net;
- route->lr_nid = gateway;
+ route->lr_nid = *gateway;
route->lr_priority = priority;
route->lr_hops = hops;
if (lnet_peers_start_down())
rc = PTR_ERR(lpni);
CERROR("Error %d creating route %s %d %s\n", rc,
libcfs_net2str(net), hops,
- libcfs_nid2str(gateway));
+ libcfs_nidstr(gateway));
return rc;
}
}
/* our lookups must be true */
- LASSERT(lnet_nid_to_nid4(&route2->lr_gateway->lp_primary_nid) !=
- gateway);
+ LASSERT(!nid_same(&route2->lr_gateway->lp_primary_nid,
+ gateway));
}
/*
}
int
-lnet_get_route(int idx, __u32 *net, __u32 *hops,
- lnet_nid_t *gateway, __u32 *flags, __u32 *priority, __u32 *sensitivity)
+lnet_get_route(int idx, __u32 *net, __u32 *hops, lnet_nid_t *gateway,
+ __u32 *flags, __u32 *priority, __u32 *sensitivity)
{
struct lnet_remotenet *rnet;
struct list_head *rn_list;
if (idx-- == 0) {
*net = rnet->lrn_net;
- *gateway = route->lr_nid;
+ *gateway = lnet_nid_to_nid4(&route->lr_nid);
*hops = route->lr_hops;
*priority = route->lr_priority;
*sensitivity = route->lr_gateway->
*/
if (lnet_is_discovery_disabled(lp)) {
list_for_each_entry(route, &lp->lp_routes, lr_gwlist) {
- if (route->lr_nid ==
- lnet_nid_to_nid4(&lpni->lpni_nid))
+ if (nid_same(&route->lr_nid, &lpni->lpni_nid))
lnet_set_route_aliveness(route, alive);
}
}