From 99c67e04c87ff7bcc9c7d064f732dd8ffafc875e Mon Sep 17 00:00:00 2001 From: Olaf Weber Date: Fri, 27 Jan 2017 16:23:35 +0100 Subject: [PATCH] LU-9480 lnet: rename lnet_add/del_peer_ni_to/from_peer() Rename lnet_add_peer_ni_to_peer() to lnet_add_peer_ni(), and lnet_del_peer_ni_from_peer() to lnet_del_peer_ni(). This brings the function names closer to the ioctls they implement: IOCTL_LIBCFS_ADD_PEER_NI and IOCTL_LIBCFS_DEL_PEER_NI. These names are also a more accturate description their effect: adding or deleting an lnet_peer_ni to LNet. Test-Parameters: trivial Signed-off-by: Olaf Weber Change-Id: I0eefb60cbdedb998a659002b48d4c8ddd3b11fb2 Reviewed-on: https://review.whamcloud.com/25778 Reviewed-by: Olaf Weber Reviewed-by: Amir Shehata Tested-by: Amir Shehata --- lnet/include/lnet/lib-lnet.h | 4 ++-- lnet/lnet/api-ni.c | 10 +++++----- lnet/lnet/peer.c | 22 ++++++++++++++++------ 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/lnet/include/lnet/lib-lnet.h b/lnet/include/lnet/lib-lnet.h index d66a684..eb25244 100644 --- a/lnet/include/lnet/lib-lnet.h +++ b/lnet/include/lnet/lib-lnet.h @@ -837,8 +837,8 @@ struct lnet_peer_net *lnet_peer_get_net_locked(struct lnet_peer *peer, __u32 net_id); bool lnet_peer_is_ni_pref_locked(struct lnet_peer_ni *lpni, struct lnet_ni *ni); -int lnet_add_peer_ni_to_peer(lnet_nid_t key_nid, lnet_nid_t nid, bool mr); -int lnet_del_peer_ni_from_peer(lnet_nid_t key_nid, lnet_nid_t nid); +int lnet_add_peer_ni(lnet_nid_t key_nid, lnet_nid_t nid, bool mr); +int lnet_del_peer_ni(lnet_nid_t key_nid, lnet_nid_t nid); int lnet_get_peer_info(__u32 idx, lnet_nid_t *primary_nid, lnet_nid_t *nid, bool *mr, struct lnet_peer_ni_credit_info __user *peer_ni_info, diff --git a/lnet/lnet/api-ni.c b/lnet/lnet/api-ni.c index edff400..c7f2cf1 100644 --- a/lnet/lnet/api-ni.c +++ b/lnet/lnet/api-ni.c @@ -2919,9 +2919,9 @@ LNetCtl(unsigned int cmd, void *arg) return -EINVAL; mutex_lock(&the_lnet.ln_api_mutex); - rc = lnet_add_peer_ni_to_peer(cfg->prcfg_prim_nid, - cfg->prcfg_cfg_nid, - cfg->prcfg_mr); + rc = lnet_add_peer_ni(cfg->prcfg_prim_nid, + cfg->prcfg_cfg_nid, + cfg->prcfg_mr); mutex_unlock(&the_lnet.ln_api_mutex); return rc; } @@ -2933,8 +2933,8 @@ LNetCtl(unsigned int cmd, void *arg) return -EINVAL; mutex_lock(&the_lnet.ln_api_mutex); - rc = lnet_del_peer_ni_from_peer(cfg->prcfg_prim_nid, - cfg->prcfg_cfg_nid); + rc = lnet_del_peer_ni(cfg->prcfg_prim_nid, + cfg->prcfg_cfg_nid); mutex_unlock(&the_lnet.ln_api_mutex); return rc; } diff --git a/lnet/lnet/peer.c b/lnet/lnet/peer.c index c6c3d07..7afcf6e 100644 --- a/lnet/lnet/peer.c +++ b/lnet/lnet/peer.c @@ -885,14 +885,16 @@ lnet_peer_ni_add_non_mr(lnet_nid_t nid) } /* + * Implementation of IOC_LIBCFS_ADD_PEER_NI. + * * This API handles the following combinations: - * 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. + * 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 -lnet_add_peer_ni_to_peer(lnet_nid_t prim_nid, lnet_nid_t nid, bool mr) +lnet_add_peer_ni(lnet_nid_t prim_nid, lnet_nid_t nid, bool mr) { /* * Caller trying to setup an MR like peer hierarchy but @@ -923,8 +925,16 @@ lnet_add_peer_ni_to_peer(lnet_nid_t prim_nid, lnet_nid_t nid, bool mr) return 0; } +/* + * Implementation of IOC_LIBCFS_DEL_PEER_NI. + * + * This API handles the following combinations: + * Delete a NI from a peer if both prim_nid and nid are provided. + * Delete a peer if only prim_nid is provided. + * Delete a peer if its primary nid is provided. + */ int -lnet_del_peer_ni_from_peer(lnet_nid_t prim_nid, lnet_nid_t nid) +lnet_del_peer_ni(lnet_nid_t prim_nid, lnet_nid_t nid) { lnet_nid_t local_nid; struct lnet_peer *peer; -- 1.8.3.1