X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lnet%2Flnet%2Fapi-ni.c;h=f86a31f3fc4323e62874e7e0996eaf0431e5d862;hb=47cc77462343533b4d706836e7e087f7a1844318;hp=45abed83ebe29a1e883b15cd2638c7437138f240;hpb=9b0738c53c962f4269178e420d45565f9ec5bd09;p=fs%2Flustre-release.git diff --git a/lnet/lnet/api-ni.c b/lnet/lnet/api-ni.c index 45abed8..f86a31f 100644 --- a/lnet/lnet/api-ni.c +++ b/lnet/lnet/api-ni.c @@ -1462,7 +1462,7 @@ lnet_net_clr_pref_rtrs(struct lnet_net *net) int lnet_net_add_pref_rtr(struct lnet_net *net, - lnet_nid_t gw_nid) + struct lnet_nid *gw_nid) __must_hold(&the_lnet.ln_api_mutex) { struct lnet_nid_list *ne; @@ -1473,7 +1473,7 @@ __must_hold(&the_lnet.ln_api_mutex) * lock. */ list_for_each_entry(ne, &net->net_rtr_pref_nids, nl_list) { - if (ne->nl_nid == gw_nid) + if (nid_same(&ne->nl_nid, gw_nid)) return -EEXIST; } @@ -1481,7 +1481,7 @@ __must_hold(&the_lnet.ln_api_mutex) if (!ne) return -ENOMEM; - ne->nl_nid = gw_nid; + ne->nl_nid = *gw_nid; /* Lock the cpt to protect against addition and checks in the * selection algorithm @@ -1494,11 +1494,11 @@ __must_hold(&the_lnet.ln_api_mutex) } bool -lnet_net_is_pref_rtr_locked(struct lnet_net *net, lnet_nid_t rtr_nid) +lnet_net_is_pref_rtr_locked(struct lnet_net *net, struct lnet_nid *rtr_nid) { struct lnet_nid_list *ne; - CDEBUG(D_NET, "%s: rtr pref emtpy: %d\n", + CDEBUG(D_NET, "%s: rtr pref empty: %d\n", libcfs_net2str(net->net_id), list_empty(&net->net_rtr_pref_nids)); @@ -1507,9 +1507,9 @@ lnet_net_is_pref_rtr_locked(struct lnet_net *net, lnet_nid_t rtr_nid) list_for_each_entry(ne, &net->net_rtr_pref_nids, nl_list) { CDEBUG(D_NET, "Comparing pref %s with gw %s\n", - libcfs_nid2str(ne->nl_nid), - libcfs_nid2str(rtr_nid)); - if (rtr_nid == ne->nl_nid) + libcfs_nidstr(&ne->nl_nid), + libcfs_nidstr(rtr_nid)); + if (nid_same(rtr_nid, &ne->nl_nid)) return true; } @@ -1713,7 +1713,7 @@ lnet_nid_to_ni_addref(struct lnet_nid *nid) EXPORT_SYMBOL(lnet_nid_to_ni_addref); int -lnet_islocalnid(lnet_nid_t nid) +lnet_islocalnid4(lnet_nid_t nid) { struct lnet_ni *ni; int cpt; @@ -1726,6 +1726,19 @@ lnet_islocalnid(lnet_nid_t nid) } int +lnet_islocalnid(struct lnet_nid *nid) +{ + struct lnet_ni *ni; + int cpt; + + cpt = lnet_net_lock_current(); + ni = lnet_nid_to_ni_locked(nid, cpt); + lnet_net_unlock(cpt); + + return ni != NULL; +} + +int lnet_count_acceptor_nets(void) { /* Return the # of NIs that need the acceptor. */ @@ -3922,6 +3935,7 @@ LNetCtl(unsigned int cmd, void *arg) struct lnet_ioctl_config_data *config; struct lnet_process_id id = {0}; struct lnet_ni *ni; + struct lnet_nid nid; int rc; BUILD_BUG_ON(sizeof(struct lnet_ioctl_net_config) + @@ -3949,10 +3963,11 @@ LNetCtl(unsigned int cmd, void *arg) config->cfg_config_u.cfg_route.rtr_sensitivity; } + lnet_nid4_to_nid(config->cfg_nid, &nid); mutex_lock(&the_lnet.ln_api_mutex); rc = lnet_add_route(config->cfg_net, config->cfg_config_u.cfg_route.rtr_hop, - config->cfg_nid, + &nid, config->cfg_config_u.cfg_route. rtr_priority, sensitivity); mutex_unlock(&the_lnet.ln_api_mutex);