Whamcloud - gitweb
LU-7734 lnet: rename peer key_nid to prim_nid
authorAmir Shehata <amir.shehata@intel.com>
Thu, 27 Oct 2016 23:49:27 +0000 (16:49 -0700)
committerAmir Shehata <amir.shehata@intel.com>
Wed, 25 Jan 2017 03:10:18 +0000 (19:10 -0800)
To make the interface clear, renamed key_nid to
prim_nid to indicate that this parameter refers to
the peer's primary nid.

Signed-off-by: Amir Shehata <amir.shehata@intel.com>
Change-Id: I74bd17cdd55ba8d2c52bc28557db149d23ecbfb5
Reviewed-on: http://review.whamcloud.com/23460
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Olaf Weber <olaf@sgi.com>
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
lnet/include/lnet/lib-dlc.h
lnet/lnet/api-ni.c
lnet/lnet/peer.c
lnet/utils/lnetconfig/liblnetconfig.c
lnet/utils/lnetconfig/liblnetconfig.h
lnet/utils/lnetctl.c

index c006dbc..1a67738 100644 (file)
@@ -215,7 +215,7 @@ struct lnet_ioctl_dbg {
 
 struct lnet_ioctl_peer_cfg {
        struct libcfs_ioctl_hdr prcfg_hdr;
 
 struct lnet_ioctl_peer_cfg {
        struct libcfs_ioctl_hdr prcfg_hdr;
-       lnet_nid_t prcfg_key_nid;
+       lnet_nid_t prcfg_prim_nid;
        lnet_nid_t prcfg_cfg_nid;
        __u32 prcfg_idx;
        bool prcfg_mr;
        lnet_nid_t prcfg_cfg_nid;
        __u32 prcfg_idx;
        bool prcfg_mr;
index e3e120e..f64c834 100644 (file)
@@ -2802,7 +2802,7 @@ LNetCtl(unsigned int cmd, void *arg)
                        return -EINVAL;
 
                mutex_lock(&the_lnet.ln_api_mutex);
                        return -EINVAL;
 
                mutex_lock(&the_lnet.ln_api_mutex);
-               rc = lnet_add_peer_ni_to_peer(cfg->prcfg_key_nid,
+               rc = lnet_add_peer_ni_to_peer(cfg->prcfg_prim_nid,
                                              cfg->prcfg_cfg_nid,
                                              cfg->prcfg_mr);
                mutex_unlock(&the_lnet.ln_api_mutex);
                                              cfg->prcfg_cfg_nid,
                                              cfg->prcfg_mr);
                mutex_unlock(&the_lnet.ln_api_mutex);
@@ -2816,7 +2816,7 @@ LNetCtl(unsigned int cmd, void *arg)
                        return -EINVAL;
 
                mutex_lock(&the_lnet.ln_api_mutex);
                        return -EINVAL;
 
                mutex_lock(&the_lnet.ln_api_mutex);
-               rc = lnet_del_peer_ni_from_peer(cfg->prcfg_key_nid,
+               rc = lnet_del_peer_ni_from_peer(cfg->prcfg_prim_nid,
                                                cfg->prcfg_cfg_nid);
                mutex_unlock(&the_lnet.ln_api_mutex);
                return rc;
                                                cfg->prcfg_cfg_nid);
                mutex_unlock(&the_lnet.ln_api_mutex);
                return rc;
@@ -2859,7 +2859,7 @@ LNetCtl(unsigned int cmd, void *arg)
                             (cfg->prcfg_bulk + sizeof(*lpni_cri));
 
                mutex_lock(&the_lnet.ln_api_mutex);
                             (cfg->prcfg_bulk + sizeof(*lpni_cri));
 
                mutex_lock(&the_lnet.ln_api_mutex);
-               rc = lnet_get_peer_info(cfg->prcfg_idx, &cfg->prcfg_key_nid,
+               rc = lnet_get_peer_info(cfg->prcfg_idx, &cfg->prcfg_prim_nid,
                                        &cfg->prcfg_cfg_nid, &cfg->prcfg_mr,
                                        lpni_cri, lpni_stats);
                mutex_unlock(&the_lnet.ln_api_mutex);
                                        &cfg->prcfg_cfg_nid, &cfg->prcfg_mr,
                                        lpni_cri, lpni_stats);
                mutex_unlock(&the_lnet.ln_api_mutex);
index c73668c..a5758fa 100644 (file)
@@ -774,18 +774,18 @@ lnet_add_prim_lpni(lnet_nid_t nid)
 }
 
 static int
 }
 
 static int
-lnet_add_peer_ni_to_prim_lpni(lnet_nid_t key_nid, lnet_nid_t nid)
+lnet_add_peer_ni_to_prim_lpni(lnet_nid_t prim_nid, lnet_nid_t nid)
 {
        struct lnet_peer *peer, *primary_peer;
        struct lnet_peer_ni *lpni = NULL, *klpni = NULL;
 
 {
        struct lnet_peer *peer, *primary_peer;
        struct lnet_peer_ni *lpni = NULL, *klpni = NULL;
 
-       LASSERT(key_nid != LNET_NID_ANY && nid != LNET_NID_ANY);
+       LASSERT(prim_nid != LNET_NID_ANY && nid != LNET_NID_ANY);
 
        /*
         * key nid must be created by this point. If not then this
         * operation is not permitted
         */
 
        /*
         * key nid must be created by this point. If not then this
         * operation is not permitted
         */
-       klpni = lnet_find_peer_ni_locked(key_nid);
+       klpni = lnet_find_peer_ni_locked(prim_nid);
        if (!klpni)
                return -ENOENT;
 
        if (!klpni)
                return -ENOENT;
 
@@ -802,13 +802,13 @@ lnet_add_peer_ni_to_prim_lpni(lnet_nid_t key_nid, lnet_nid_t nid)
                 * lpni already exists in the system but it belongs to
                 * a different peer. We can't re-added it
                 */
                 * lpni already exists in the system but it belongs to
                 * a different peer. We can't re-added it
                 */
-               if (peer->lp_primary_nid != key_nid && peer->lp_multi_rail) {
+               if (peer->lp_primary_nid != prim_nid && peer->lp_multi_rail) {
                        CERROR("Cannot add NID %s owned by peer %s to peer %s\n",
                               libcfs_nid2str(lpni->lpni_nid),
                               libcfs_nid2str(peer->lp_primary_nid),
                        CERROR("Cannot add NID %s owned by peer %s to peer %s\n",
                               libcfs_nid2str(lpni->lpni_nid),
                               libcfs_nid2str(peer->lp_primary_nid),
-                              libcfs_nid2str(key_nid));
+                              libcfs_nid2str(prim_nid));
                        return -EEXIST;
                        return -EEXIST;
-               } else if (peer->lp_primary_nid == key_nid) {
+               } else if (peer->lp_primary_nid == prim_nid) {
                        /*
                         * found a peer_ni that is already part of the
                         * peer. This is a no-op operation.
                        /*
                         * found a peer_ni that is already part of the
                         * peer. This is a no-op operation.
@@ -817,7 +817,7 @@ lnet_add_peer_ni_to_prim_lpni(lnet_nid_t key_nid, lnet_nid_t nid)
                }
 
                /*
                }
 
                /*
-                * TODO: else if (peer->lp_primary_nid != key_nid &&
+                * TODO: else if (peer->lp_primary_nid != prim_nid &&
                 *                !peer->lp_multi_rail)
                 * peer is not an MR peer and it will be moved in the next
                 * step to klpni, so update its flags accordingly.
                 *                !peer->lp_multi_rail)
                 * peer is not an MR peer and it will be moved in the next
                 * step to klpni, so update its flags accordingly.
@@ -889,55 +889,55 @@ lnet_peer_ni_add_non_mr(lnet_nid_t nid)
 
 /*
  * This API handles the following combinations:
 
 /*
  * This API handles the following combinations:
- *     Create a primary NI if only the key_nid is provided
+ *     Create a primary NI if only the prim_nid is provided
  *     Create or add an lpni to a primary NI. Primary NI must've already
  *     been created
  *     Create a non-MR peer.
  */
 int
  *     Create or add an lpni to a primary NI. Primary NI must've already
  *     been created
  *     Create a non-MR peer.
  */
 int
-lnet_add_peer_ni_to_peer(lnet_nid_t key_nid, lnet_nid_t nid, bool mr)
+lnet_add_peer_ni_to_peer(lnet_nid_t prim_nid, lnet_nid_t nid, bool mr)
 {
        /*
         * Caller trying to setup an MR like peer hierarchy but
         * specifying it to be non-MR. This is not allowed.
         */
 {
        /*
         * Caller trying to setup an MR like peer hierarchy but
         * specifying it to be non-MR. This is not allowed.
         */
-       if (key_nid != LNET_NID_ANY &&
+       if (prim_nid != LNET_NID_ANY &&
            nid != LNET_NID_ANY && !mr)
                return -EPERM;
 
        /* Add the primary NID of a peer */
            nid != LNET_NID_ANY && !mr)
                return -EPERM;
 
        /* Add the primary NID of a peer */
-       if (key_nid != LNET_NID_ANY &&
+       if (prim_nid != LNET_NID_ANY &&
            nid == LNET_NID_ANY && mr)
            nid == LNET_NID_ANY && mr)
-               return lnet_add_prim_lpni(key_nid);
+               return lnet_add_prim_lpni(prim_nid);
 
        /* Add a NID to an existing peer */
 
        /* Add a NID to an existing peer */
-       if (key_nid != LNET_NID_ANY &&
+       if (prim_nid != LNET_NID_ANY &&
            nid != LNET_NID_ANY && mr)
            nid != LNET_NID_ANY && mr)
-               return lnet_add_peer_ni_to_prim_lpni(key_nid, nid);
+               return lnet_add_peer_ni_to_prim_lpni(prim_nid, nid);
 
        /* Add a non-MR peer NI */
 
        /* Add a non-MR peer NI */
-       if (((key_nid != LNET_NID_ANY &&
+       if (((prim_nid != LNET_NID_ANY &&
              nid == LNET_NID_ANY) ||
              nid == LNET_NID_ANY) ||
-            (key_nid == LNET_NID_ANY &&
+            (prim_nid == LNET_NID_ANY &&
              nid != LNET_NID_ANY)) && !mr)
              nid != LNET_NID_ANY)) && !mr)
-               return lnet_peer_ni_add_non_mr(key_nid != LNET_NID_ANY ?
-                                                        key_nid : nid);
+               return lnet_peer_ni_add_non_mr(prim_nid != LNET_NID_ANY ?
+                                                        prim_nid : nid);
 
        return 0;
 }
 
 int
 
        return 0;
 }
 
 int
-lnet_del_peer_ni_from_peer(lnet_nid_t key_nid, lnet_nid_t nid)
+lnet_del_peer_ni_from_peer(lnet_nid_t prim_nid, lnet_nid_t nid)
 {
        lnet_nid_t local_nid;
        struct lnet_peer *peer;
        struct lnet_peer_ni *lpni;
        int rc;
 
 {
        lnet_nid_t local_nid;
        struct lnet_peer *peer;
        struct lnet_peer_ni *lpni;
        int rc;
 
-       if (key_nid == LNET_NID_ANY)
+       if (prim_nid == LNET_NID_ANY)
                return -EINVAL;
 
                return -EINVAL;
 
-       local_nid = (nid != LNET_NID_ANY) ? nid : key_nid;
+       local_nid = (nid != LNET_NID_ANY) ? nid : prim_nid;
 
        lpni = lnet_find_peer_ni_locked(local_nid);
        if (!lpni)
 
        lpni = lnet_find_peer_ni_locked(local_nid);
        if (!lpni)
index bafd6b7..d32ce27 100644 (file)
@@ -406,13 +406,13 @@ static lnet_nid_t *allocate_create_nid_array(char **nids, __u32 num_nids,
        return array;
 }
 
        return array;
 }
 
-static int dispatch_peer_ni_cmd(lnet_nid_t knid, lnet_nid_t nid, __u32 cmd,
+static int dispatch_peer_ni_cmd(lnet_nid_t pnid, lnet_nid_t nid, __u32 cmd,
                                struct lnet_ioctl_peer_cfg *data,
                                char *err_str, char *cmd_str)
 {
        int rc;
 
                                struct lnet_ioctl_peer_cfg *data,
                                char *err_str, char *cmd_str)
 {
        int rc;
 
-       data->prcfg_key_nid = knid;
+       data->prcfg_prim_nid = pnid;
        data->prcfg_cfg_nid = nid;
 
        rc = l_ioctl(LNET_DEV_ID, cmd, data);
        data->prcfg_cfg_nid = nid;
 
        rc = l_ioctl(LNET_DEV_ID, cmd, data);
@@ -427,23 +427,23 @@ static int dispatch_peer_ni_cmd(lnet_nid_t knid, lnet_nid_t nid, __u32 cmd,
        return rc;
 }
 
        return rc;
 }
 
-int lustre_lnet_config_peer_nid(char *knid, char **nid, int num_nids,
+int lustre_lnet_config_peer_nid(char *pnid, char **nid, int num_nids,
                                bool mr, int seq_no, struct cYAML **err_rc)
 {
        struct lnet_ioctl_peer_cfg data;
                                bool mr, int seq_no, struct cYAML **err_rc)
 {
        struct lnet_ioctl_peer_cfg data;
-       lnet_nid_t key_nid = LNET_NID_ANY;
+       lnet_nid_t prim_nid = LNET_NID_ANY;
        int rc = LUSTRE_CFG_RC_NO_ERR;
        int idx = 0;
        bool nid0_used = false;
        char err_str[LNET_MAX_STR_LEN] = {0};
        lnet_nid_t *nids = allocate_create_nid_array(nid, num_nids, err_str);
 
        int rc = LUSTRE_CFG_RC_NO_ERR;
        int idx = 0;
        bool nid0_used = false;
        char err_str[LNET_MAX_STR_LEN] = {0};
        lnet_nid_t *nids = allocate_create_nid_array(nid, num_nids, err_str);
 
-       if (knid) {
-               key_nid = libcfs_str2nid(knid);
-               if (key_nid == LNET_NID_ANY) {
+       if (pnid) {
+               prim_nid = libcfs_str2nid(pnid);
+               if (prim_nid == LNET_NID_ANY) {
                        snprintf(err_str, sizeof(err_str),
                                 "bad key NID: '%s'",
                        snprintf(err_str, sizeof(err_str),
                                 "bad key NID: '%s'",
-                                knid);
+                                pnid);
                        rc = LUSTRE_CFG_RC_MISSING_PARAM;
                        goto out;
                }
                        rc = LUSTRE_CFG_RC_MISSING_PARAM;
                        goto out;
                }
@@ -453,7 +453,7 @@ int lustre_lnet_config_peer_nid(char *knid, char **nid, int num_nids,
                rc = LUSTRE_CFG_RC_MISSING_PARAM;
                goto out;
        } else {
                rc = LUSTRE_CFG_RC_MISSING_PARAM;
                goto out;
        } else {
-               key_nid = LNET_NID_ANY;
+               prim_nid = LNET_NID_ANY;
        }
 
        snprintf(err_str, sizeof(err_str), "\"Success\"");
        }
 
        snprintf(err_str, sizeof(err_str), "\"Success\"");
@@ -462,17 +462,17 @@ int lustre_lnet_config_peer_nid(char *knid, char **nid, int num_nids,
        data.prcfg_mr = mr;
 
        /*
        data.prcfg_mr = mr;
 
        /*
-        * if key_nid is not specified use the first nid in the list of
-        * nids provided as the key_nid. NOTE: on entering 'if' we must
+        * if prim_nid is not specified use the first nid in the list of
+        * nids provided as the prim_nid. NOTE: on entering 'if' we must
         * have at least 1 NID
         */
         * have at least 1 NID
         */
-       if (key_nid == LNET_NID_ANY) {
+       if (prim_nid == LNET_NID_ANY) {
                nid0_used = true;
                nid0_used = true;
-               key_nid = nids[0];
+               prim_nid = nids[0];
        }
 
        }
 
-       /* Create the key_nid first */
-       rc = dispatch_peer_ni_cmd(key_nid, LNET_NID_ANY,
+       /* Create the prim_nid first */
+       rc = dispatch_peer_ni_cmd(prim_nid, LNET_NID_ANY,
                                  IOC_LIBCFS_ADD_PEER_NI,
                                  &data, err_str, "add");
 
                                  IOC_LIBCFS_ADD_PEER_NI,
                                  &data, err_str, "add");
 
@@ -482,12 +482,12 @@ int lustre_lnet_config_peer_nid(char *knid, char **nid, int num_nids,
        /* add the rest of the nids to the key nid if any are available */
        for (idx = nid0_used ? 1 : 0 ; nids && idx < num_nids; idx++) {
                /*
        /* add the rest of the nids to the key nid if any are available */
        for (idx = nid0_used ? 1 : 0 ; nids && idx < num_nids; idx++) {
                /*
-                * If key_nid is not provided then the first nid in the
-                * list becomes the key_nid. First time round the loop use
+                * If prim_nid is not provided then the first nid in the
+                * list becomes the prim_nid. First time round the loop use
                 * LNET_NID_ANY for the first parameter, then use nid[0]
                 * as the key nid after wards
                 */
                 * LNET_NID_ANY for the first parameter, then use nid[0]
                 * as the key nid after wards
                 */
-               rc = dispatch_peer_ni_cmd(key_nid, nids[idx],
+               rc = dispatch_peer_ni_cmd(prim_nid, nids[idx],
                                          IOC_LIBCFS_ADD_PEER_NI, &data,
                                          err_str, "add");
 
                                          IOC_LIBCFS_ADD_PEER_NI, &data,
                                          err_str, "add");
 
@@ -502,28 +502,28 @@ out:
        return rc;
 }
 
        return rc;
 }
 
-int lustre_lnet_del_peer_nid(char *knid, char **nid, int num_nids,
+int lustre_lnet_del_peer_nid(char *pnid, char **nid, int num_nids,
                             int seq_no, struct cYAML **err_rc)
 {
        struct lnet_ioctl_peer_cfg data;
                             int seq_no, struct cYAML **err_rc)
 {
        struct lnet_ioctl_peer_cfg data;
-       lnet_nid_t key_nid;
+       lnet_nid_t prim_nid;
        int rc = LUSTRE_CFG_RC_NO_ERR;
        int idx = 0;
        char err_str[LNET_MAX_STR_LEN] = {0};
        lnet_nid_t *nids = allocate_create_nid_array(nid, num_nids, err_str);
 
        int rc = LUSTRE_CFG_RC_NO_ERR;
        int idx = 0;
        char err_str[LNET_MAX_STR_LEN] = {0};
        lnet_nid_t *nids = allocate_create_nid_array(nid, num_nids, err_str);
 
-       if (knid == NULL) {
+       if (pnid == NULL) {
                snprintf(err_str, sizeof(err_str),
                         "\"Primary nid is not provided\"");
                rc = LUSTRE_CFG_RC_MISSING_PARAM;
                goto out;
        } else {
                snprintf(err_str, sizeof(err_str),
                         "\"Primary nid is not provided\"");
                rc = LUSTRE_CFG_RC_MISSING_PARAM;
                goto out;
        } else {
-               key_nid = libcfs_str2nid(knid);
-               if (key_nid == LNET_NID_ANY) {
+               prim_nid = libcfs_str2nid(pnid);
+               if (prim_nid == LNET_NID_ANY) {
                        rc = LUSTRE_CFG_RC_BAD_PARAM;
                        snprintf(err_str, sizeof(err_str),
                                 "bad key NID: '%s'",
                        rc = LUSTRE_CFG_RC_BAD_PARAM;
                        snprintf(err_str, sizeof(err_str),
                                 "bad key NID: '%s'",
-                                knid);
+                                pnid);
                        goto out;
                }
        }
                        goto out;
                }
        }
@@ -532,14 +532,14 @@ int lustre_lnet_del_peer_nid(char *knid, char **nid, int num_nids,
 
        LIBCFS_IOC_INIT_V2(data, prcfg_hdr);
        if (!nids || nids[0] == LNET_NID_ANY) {
 
        LIBCFS_IOC_INIT_V2(data, prcfg_hdr);
        if (!nids || nids[0] == LNET_NID_ANY) {
-               rc = dispatch_peer_ni_cmd(key_nid, LNET_NID_ANY,
+               rc = dispatch_peer_ni_cmd(prim_nid, LNET_NID_ANY,
                                          IOC_LIBCFS_DEL_PEER_NI,
                                          &data, err_str, "del");
                goto out;
        }
 
        for (idx = 0; nids && idx < num_nids; idx++) {
                                          IOC_LIBCFS_DEL_PEER_NI,
                                          &data, err_str, "del");
                goto out;
        }
 
        for (idx = 0; nids && idx < num_nids; idx++) {
-               rc = dispatch_peer_ni_cmd(key_nid, nids[idx],
+               rc = dispatch_peer_ni_cmd(prim_nid, nids[idx],
                                          IOC_LIBCFS_DEL_PEER_NI, &data,
                                          err_str, "del");
 
                                          IOC_LIBCFS_DEL_PEER_NI, &data,
                                          err_str, "del");
 
@@ -2022,6 +2022,10 @@ out:
 int lustre_lnet_show_peer(char *knid, int detail, int seq_no,
                          struct cYAML **show_rc, struct cYAML **err_rc)
 {
 int lustre_lnet_show_peer(char *knid, int detail, int seq_no,
                          struct cYAML **show_rc, struct cYAML **err_rc)
 {
+       /*
+        * TODO: This function is changing in a future patch to accommodate
+        * PEER_LIST and proper filtering on any nid of the peer
+        */
        struct lnet_ioctl_peer_cfg *peer_info;
        struct lnet_peer_ni_credit_info *lpni_cri;
        struct lnet_ioctl_element_stats *lpni_stats;
        struct lnet_ioctl_peer_cfg *peer_info;
        struct lnet_peer_ni_credit_info *lpni_cri;
        struct lnet_ioctl_element_stats *lpni_stats;
@@ -2071,7 +2075,7 @@ int lustre_lnet_show_peer(char *knid, int detail, int seq_no,
                        }
 
                        if (primary_nid != LNET_NID_ANY &&
                        }
 
                        if (primary_nid != LNET_NID_ANY &&
-                           primary_nid != peer_info->prcfg_key_nid)
+                           primary_nid != peer_info->prcfg_prim_nid)
                                        continue;
 
                        lpni_cri = (struct lnet_peer_ni_credit_info*)peer_info->prcfg_bulk;
                                        continue;
 
                        lpni_cri = (struct lnet_peer_ni_credit_info*)peer_info->prcfg_bulk;
@@ -2083,13 +2087,13 @@ int lustre_lnet_show_peer(char *knid, int detail, int seq_no,
                        if (peer == NULL)
                                goto out;
 
                        if (peer == NULL)
                                goto out;
 
-                       if (peer_info->prcfg_key_nid != prev_primary_nid) {
-                               prev_primary_nid = peer_info->prcfg_key_nid;
+                       if (peer_info->prcfg_prim_nid != prev_primary_nid) {
+                               prev_primary_nid = peer_info->prcfg_prim_nid;
                                new_peer = true;
                        }
 
                        if (new_peer) {
                                new_peer = true;
                        }
 
                        if (new_peer) {
-                               lnet_nid_t pnid = peer_info->prcfg_key_nid;
+                               lnet_nid_t pnid = peer_info->prcfg_prim_nid;
                                if (cYAML_create_string(peer, "primary nid",
                                                        libcfs_nid2str(pnid))
                                    == NULL)
                                if (cYAML_create_string(peer, "primary nid",
                                                        libcfs_nid2str(pnid))
                                    == NULL)
@@ -2820,17 +2824,17 @@ static int handle_yaml_config_peer(struct cYAML *tree, struct cYAML **show_rc,
 {
        char **nids = NULL;
        int num, rc;
 {
        char **nids = NULL;
        int num, rc;
-       struct cYAML *seq_no, *key_nid, *non_mr;
+       struct cYAML *seq_no, *prim_nid, *non_mr;
 
        num = yaml_copy_peer_nids(tree, &nids);
        if (num < 0)
                return num;
 
        seq_no = cYAML_get_object_item(tree, "seq_no");
 
        num = yaml_copy_peer_nids(tree, &nids);
        if (num < 0)
                return num;
 
        seq_no = cYAML_get_object_item(tree, "seq_no");
-       key_nid = cYAML_get_object_item(tree, "primary nid");
+       prim_nid = cYAML_get_object_item(tree, "primary nid");
        non_mr = cYAML_get_object_item(tree, "non_mr");
 
        non_mr = cYAML_get_object_item(tree, "non_mr");
 
-       rc = lustre_lnet_config_peer_nid((key_nid) ? key_nid->cy_valuestring : NULL,
+       rc = lustre_lnet_config_peer_nid((prim_nid) ? prim_nid->cy_valuestring : NULL,
                                         nids, num,
                                         (non_mr) ? false : true,
                                         (seq_no) ? seq_no->cy_valueint : -1,
                                         nids, num,
                                         (non_mr) ? false : true,
                                         (seq_no) ? seq_no->cy_valueint : -1,
@@ -2845,16 +2849,16 @@ static int handle_yaml_del_peer(struct cYAML *tree, struct cYAML **show_rc,
 {
        char **nids = NULL;
        int num, rc;
 {
        char **nids = NULL;
        int num, rc;
-       struct cYAML *seq_no, *key_nid;
+       struct cYAML *seq_no, *prim_nid;
 
        num = yaml_copy_peer_nids(tree, &nids);
        if (num < 0)
                return num;
 
        seq_no = cYAML_get_object_item(tree, "seq_no");
 
        num = yaml_copy_peer_nids(tree, &nids);
        if (num < 0)
                return num;
 
        seq_no = cYAML_get_object_item(tree, "seq_no");
-       key_nid = cYAML_get_object_item(tree, "primary nid");
+       prim_nid = cYAML_get_object_item(tree, "primary nid");
 
 
-       rc = lustre_lnet_del_peer_nid((key_nid) ? key_nid->cy_valuestring : NULL,
+       rc = lustre_lnet_del_peer_nid((prim_nid) ? prim_nid->cy_valuestring : NULL,
                                      nids, num,
                                      (seq_no) ? seq_no->cy_valueint : -1,
                                      err_rc);
                                      nids, num,
                                      (seq_no) ? seq_no->cy_valueint : -1,
                                      err_rc);
@@ -2987,16 +2991,16 @@ static int handle_yaml_show_routing(struct cYAML *tree, struct cYAML **show_rc,
                                        show_rc, err_rc);
 }
 
                                        show_rc, err_rc);
 }
 
-static int handle_yaml_show_credits(struct cYAML *tree, struct cYAML **show_rc,
-                                   struct cYAML **err_rc)
+static int handle_yaml_show_peers(struct cYAML *tree, struct cYAML **show_rc,
+                                 struct cYAML **err_rc)
 {
 {
-       struct cYAML *seq_no, *key_nid, *detail;
+       struct cYAML *seq_no, *nid, *detail;
 
        seq_no = cYAML_get_object_item(tree, "seq_no");
        detail = cYAML_get_object_item(tree, "detail");
 
        seq_no = cYAML_get_object_item(tree, "seq_no");
        detail = cYAML_get_object_item(tree, "detail");
-       key_nid = cYAML_get_object_item(tree, "key_nid");
+       nid = cYAML_get_object_item(tree, "nid");
 
 
-       return lustre_lnet_show_peer((key_nid) ? key_nid->cy_valuestring : NULL,
+       return lustre_lnet_show_peer((nid) ? nid->cy_valuestring : NULL,
                                     (detail) ? detail->cy_valueint : 0,
                                     (seq_no) ? seq_no->cy_valueint : -1,
                                     show_rc, err_rc);
                                     (detail) ? detail->cy_valueint : 0,
                                     (seq_no) ? seq_no->cy_valueint : -1,
                                     show_rc, err_rc);
@@ -3078,7 +3082,7 @@ static struct lookup_cmd_hdlr_tbl lookup_show_tbl[] = {
        {"net", handle_yaml_show_net},
        {"buffers", handle_yaml_show_routing},
        {"routing", handle_yaml_show_routing},
        {"net", handle_yaml_show_net},
        {"buffers", handle_yaml_show_routing},
        {"routing", handle_yaml_show_routing},
-       {"credits", handle_yaml_show_credits},
+       {"peer", handle_yaml_show_peers},
        {"statistics", handle_yaml_show_stats},
        {"numa", handle_yaml_show_numa},
        {NULL, NULL}
        {"statistics", handle_yaml_show_stats},
        {"numa", handle_yaml_show_numa},
        {NULL, NULL}
index d139976..3256726 100644 (file)
@@ -258,49 +258,49 @@ int lustre_lnet_show_stats(int seq_no, struct cYAML **show_rc,
 
 /*
  * lustre_lnet_config_peer_nid
 
 /*
  * lustre_lnet_config_peer_nid
- *   Add a peer nid to an peer identified by knid. If no knid is given
+ *   Add a peer nid to a peer with primary nid pnid. If no pnid is given
  *   then the first nid in the nid list becomes the primary nid for
  *   a newly created peer.
  *   then the first nid in the nid list becomes the primary nid for
  *   a newly created peer.
- *   Otherwise if knid is provided an it's unique then a new peer is
- *   created with knid as the primary NID and the nids in the nid list as
+ *   Otherwise if pnid is provided and it's unique then a new peer is
+ *   created with pnid as the primary NID and the nids in the nid list as
  *   secondary nids.
  *   secondary nids.
- *   If any of the peers nids provided in with exception to the knid is
+ *   If any of the peers nids provided in with exception to the pnid is
  *   not unique the operation fails. Some peer nids might have already
  *   been added. It's the role of the caller of this API to remove the
  *   added NIDs if they wish.
  *
  *   not unique the operation fails. Some peer nids might have already
  *   been added. It's the role of the caller of this API to remove the
  *   added NIDs if they wish.
  *
- *     knid - Key NID of the peer
+ *     pnid - Primary NID of the peer
  *     nid - list of nids to add
  *     num_nids - number of nids in the nid array
  *     mr - true if this peer is MR capable.
  *     seq_no - sequence number of the command
  *     err_rc - YAML strucutre of the resultant return code.
  */
  *     nid - list of nids to add
  *     num_nids - number of nids in the nid array
  *     mr - true if this peer is MR capable.
  *     seq_no - sequence number of the command
  *     err_rc - YAML strucutre of the resultant return code.
  */
-int lustre_lnet_config_peer_nid(char *knid, char **nid, int num_nids,
+int lustre_lnet_config_peer_nid(char *pnid, char **nid, int num_nids,
                                bool mr, int seq_no, struct cYAML **err_rc);
 
 /*
  * lustre_lnet_del_peer_nid
                                bool mr, int seq_no, struct cYAML **err_rc);
 
 /*
  * lustre_lnet_del_peer_nid
- *  Delete the nids identified in the nid list from the peer identified by
- *  knid. If knid is NULL or it doesn't identify a peer the operation
+ *  Delete the nids given in the nid list from the peer with primary NID
+ *  pnid. If pnid is NULL or it doesn't identify a peer the operation
  *  fails and no change happens to the system.
  *  The operation is aborted on the first NID that fails to be deleted.
  *
  *  fails and no change happens to the system.
  *  The operation is aborted on the first NID that fails to be deleted.
  *
- *     knid - Key NID of the peer
+ *     pnid - Primary NID of the peer
  *     nid - list of nids to add
  *     num_nids - number of nids in the nid array
  *     seq_no - sequence number of the command
  *     err_rc - YAML strucutre of the resultant return code.
  */
  *     nid - list of nids to add
  *     num_nids - number of nids in the nid array
  *     seq_no - sequence number of the command
  *     err_rc - YAML strucutre of the resultant return code.
  */
-int lustre_lnet_del_peer_nid(char *knid, char **nid, int num_nids,
+int lustre_lnet_del_peer_nid(char *pnid, char **nid, int num_nids,
                             int seq_no, struct cYAML **err_rc);
 
 /*
  * lustre_lnet_show_peer
                             int seq_no, struct cYAML **err_rc);
 
 /*
  * lustre_lnet_show_peer
- *   Show the peer identified by knid. If knid is NULL all peers in the
- *   system are shown.
+ *   Show the peer identified by nid, knid. If knid is NULL all
+ *   peers in the system are shown.
  *
  *
- *     knid - Key NID of the peer
+ *     knid - A NID of the peer
  *     detail - display detailed information
  *     seq_no - sequence number of the command
  *     show_rc - YAML structure of the resultant show
  *     detail - display detailed information
  *     seq_no - sequence number of the command
  *     show_rc - YAML structure of the resultant show
index 83c32a2..1c6c731 100644 (file)
@@ -135,17 +135,17 @@ command_t set_cmds[] = {
 
 command_t peer_cmds[] = {
        {"add", jt_add_peer_nid, 0, "add a peer NID\n"
 
 command_t peer_cmds[] = {
        {"add", jt_add_peer_nid, 0, "add a peer NID\n"
-        "\t--key_nid: NID to identify peer. If not provided then the first\n"
-        "\t           NID in the list becomes the key NID of a newly created\n"
-        "\t           peer. \n"
+        "\t--prim_nid: Primary NID of the peer. If not provided then the first\n"
+        "\t            NID in the list becomes the Primary NID of a newly created\n"
+        "\t            peer. \n"
         "\t--nid: one or more peer NIDs\n"
         "\t--non_mr: create this peer as not Multi-Rail capable\n"},
        {"del", jt_del_peer_nid, 0, "delete a peer NID\n"
         "\t--nid: one or more peer NIDs\n"
         "\t--non_mr: create this peer as not Multi-Rail capable\n"},
        {"del", jt_del_peer_nid, 0, "delete a peer NID\n"
-        "\t--key_nid: NID to identify peer.\n"
+        "\t--prim_nid: Primary NID of the peer.\n"
         "\t--nid: list of NIDs to remove. If none provided,\n"
         "\t       peer is deleted\n"},
        {"show", jt_show_peer, 0, "show peer credits\n"
         "\t--nid: list of NIDs to remove. If none provided,\n"
         "\t       peer is deleted\n"},
        {"show", jt_show_peer, 0, "show peer credits\n"
-        "\t--primary_nid: NID of peer to filter on.\n"},
+        "\t--nid: NID of peer to filter on.\n"},
        { 0, 0, 0, NULL }
 };
 
        { 0, 0, 0, NULL }
 };
 
@@ -1086,7 +1086,7 @@ static int jt_export(int argc, char **argv)
 
 static int jt_add_peer_nid(int argc, char **argv)
 {
 
 static int jt_add_peer_nid(int argc, char **argv)
 {
-       char *key_nid = NULL;
+       char *prim_nid = NULL;
        char **nids = NULL, **nids2 = NULL;
        int size = 0;
        struct cYAML *err_rc = NULL;
        char **nids = NULL, **nids2 = NULL;
        int size = 0;
        struct cYAML *err_rc = NULL;
@@ -1095,7 +1095,7 @@ static int jt_add_peer_nid(int argc, char **argv)
 
        const char *const short_options = "k:n:mh";
        const struct option long_options[] = {
 
        const char *const short_options = "k:n:mh";
        const struct option long_options[] = {
-               { "key_nid", 1, NULL, 'k' },
+               { "prim_nid", 1, NULL, 'k' },
                { "nid", 1, NULL, 'n' },
                { "non_mr", 0, NULL, 'm'},
                { "help", 0, NULL, 'h' },
                { "nid", 1, NULL, 'n' },
                { "non_mr", 0, NULL, 'm'},
                { "help", 0, NULL, 'h' },
@@ -1106,7 +1106,7 @@ static int jt_add_peer_nid(int argc, char **argv)
                                  long_options, NULL)) != -1) {
                switch (opt) {
                case 'k':
                                  long_options, NULL)) != -1) {
                switch (opt) {
                case 'k':
-                       key_nid = optarg;
+                       prim_nid = optarg;
                        break;
                case 'n':
                        size = lustre_lnet_parse_nids(optarg, nids, size,
                        break;
                case 'n':
                        size = lustre_lnet_parse_nids(optarg, nids, size,
@@ -1127,7 +1127,7 @@ static int jt_add_peer_nid(int argc, char **argv)
                }
        }
 
                }
        }
 
-       rc = lustre_lnet_config_peer_nid(key_nid, nids, size,
+       rc = lustre_lnet_config_peer_nid(prim_nid, nids, size,
                                         !non_mr, -1, &err_rc);
 
 failed:
                                         !non_mr, -1, &err_rc);
 
 failed:
@@ -1145,14 +1145,14 @@ failed:
 
 static int jt_del_peer_nid(int argc, char **argv)
 {
 
 static int jt_del_peer_nid(int argc, char **argv)
 {
-       char *key_nid = NULL;
+       char *prim_nid = NULL;
        char **nids = NULL, **nids2 = NULL;
        struct cYAML *err_rc = NULL;
        int rc = LUSTRE_CFG_RC_NO_ERR, opt, i, size = 0;
 
        const char *const short_options = "k:n:h";
        const struct option long_options[] = {
        char **nids = NULL, **nids2 = NULL;
        struct cYAML *err_rc = NULL;
        int rc = LUSTRE_CFG_RC_NO_ERR, opt, i, size = 0;
 
        const char *const short_options = "k:n:h";
        const struct option long_options[] = {
-               { "key_nid", 1, NULL, 'k' },
+               { "prim_nid", 1, NULL, 'k' },
                { "nid", 1, NULL, 'n' },
                { "help", 0, NULL, 'h' },
                { NULL, 0, NULL, 0 },
                { "nid", 1, NULL, 'n' },
                { "help", 0, NULL, 'h' },
                { NULL, 0, NULL, 0 },
@@ -1162,7 +1162,7 @@ static int jt_del_peer_nid(int argc, char **argv)
                                  long_options, NULL)) != -1) {
                switch (opt) {
                case 'k':
                                  long_options, NULL)) != -1) {
                switch (opt) {
                case 'k':
-                       key_nid = optarg;
+                       prim_nid = optarg;
                        break;
                case 'n':
                        size = lustre_lnet_parse_nids(optarg, nids, size,
                        break;
                case 'n':
                        size = lustre_lnet_parse_nids(optarg, nids, size,
@@ -1180,7 +1180,7 @@ static int jt_del_peer_nid(int argc, char **argv)
                }
        }
 
                }
        }
 
-       rc = lustre_lnet_del_peer_nid(key_nid, nids, size, -1, &err_rc);
+       rc = lustre_lnet_del_peer_nid(prim_nid, nids, size, -1, &err_rc);
 
 failed:
        for (i = 0; i < size; i++)
 
 failed:
        for (i = 0; i < size; i++)
@@ -1197,14 +1197,14 @@ failed:
 
 static int jt_show_peer(int argc, char **argv)
 {
 
 static int jt_show_peer(int argc, char **argv)
 {
-       char *key_nid = NULL;
+       char *nid = NULL;
        int rc, opt;
        struct cYAML *err_rc = NULL, *show_rc = NULL;
        int detail = 0;
 
        const char *const short_options = "k:vh";
        const struct option long_options[] = {
        int rc, opt;
        struct cYAML *err_rc = NULL, *show_rc = NULL;
        int detail = 0;
 
        const char *const short_options = "k:vh";
        const struct option long_options[] = {
-               { "key_nid", 1, NULL, 'k' },
+               { "nid", 1, NULL, 'n' },
                { "verbose", 0, NULL, 'v' },
                { "help", 0, NULL, 'h' },
                { NULL, 0, NULL, 0 },
                { "verbose", 0, NULL, 'v' },
                { "help", 0, NULL, 'h' },
                { NULL, 0, NULL, 0 },
@@ -1214,20 +1214,20 @@ static int jt_show_peer(int argc, char **argv)
                                  long_options, NULL)) != -1) {
                switch (opt) {
                case 'k':
                                  long_options, NULL)) != -1) {
                switch (opt) {
                case 'k':
-                       key_nid = optarg;
+                       nid = optarg;
                        break;
                case 'v':
                        detail = 1;
                        break;
                case 'h':
                        break;
                case 'v':
                        detail = 1;
                        break;
                case 'h':
-                       print_help(peer_cmds, "peer", "add");
+                       print_help(peer_cmds, "peer", "show");
                        return 0;
                default:
                        return 0;
                }
        }
 
                        return 0;
                default:
                        return 0;
                }
        }
 
-       rc = lustre_lnet_show_peer(key_nid, detail, -1, &show_rc, &err_rc);
+       rc = lustre_lnet_show_peer(nid, detail, -1, &show_rc, &err_rc);
 
        if (rc != LUSTRE_CFG_RC_NO_ERR)
                cYAML_print_tree2file(stderr, err_rc);
 
        if (rc != LUSTRE_CFG_RC_NO_ERR)
                cYAML_print_tree2file(stderr, err_rc);