diff mbox series

[for-next,v11,03/11] RDMA/rxe: Replace grp by mcg, mce by mca

Message ID 20220208211644.123457-4-rpearsonhpe@gmail.com (mailing list archive)
State Superseded
Delegated to: Jason Gunthorpe
Headers show
Series Move two object pools to rxe_mcast.c | expand

Commit Message

Bob Pearson Feb. 8, 2022, 9:16 p.m. UTC
Replace 'grp' by 'mcg', 'mce' by 'mca'.
Shorten subroutine names in rxe_mcast.c.
These name uses are more in line with other object names used.

Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
---
 drivers/infiniband/sw/rxe/rxe_mcast.c | 110 +++++++++++++-------------
 drivers/infiniband/sw/rxe/rxe_recv.c  |   8 +-
 2 files changed, 59 insertions(+), 59 deletions(-)
diff mbox series

Patch

diff --git a/drivers/infiniband/sw/rxe/rxe_mcast.c b/drivers/infiniband/sw/rxe/rxe_mcast.c
index 3c06b0590c82..96dc11a892a4 100644
--- a/drivers/infiniband/sw/rxe/rxe_mcast.c
+++ b/drivers/infiniband/sw/rxe/rxe_mcast.c
@@ -26,66 +26,66 @@  static int rxe_mcast_delete(struct rxe_dev *rxe, union ib_gid *mgid)
 }
 
 /* caller should hold rxe->mcg_lock */
-static struct rxe_mcg *__rxe_create_grp(struct rxe_dev *rxe,
+static struct rxe_mcg *__rxe_create_mcg(struct rxe_dev *rxe,
 					struct rxe_pool *pool,
 					union ib_gid *mgid)
 {
-	struct rxe_mcg *grp;
+	struct rxe_mcg *mcg;
 	int err;
 
-	grp = rxe_alloc_locked(pool);
-	if (!grp)
+	mcg = rxe_alloc_locked(pool);
+	if (!mcg)
 		return ERR_PTR(-ENOMEM);
 
 	err = rxe_mcast_add(rxe, mgid);
 	if (unlikely(err)) {
-		rxe_drop_ref(grp);
+		rxe_drop_ref(mcg);
 		return ERR_PTR(err);
 	}
 
-	INIT_LIST_HEAD(&grp->qp_list);
-	grp->rxe = rxe;
+	INIT_LIST_HEAD(&mcg->qp_list);
+	mcg->rxe = rxe;
 
-	/* rxe_alloc_locked takes a ref on grp but that will be
-	 * dropped when grp goes out of scope. We need to take a ref
+	/* rxe_alloc_locked takes a ref on mcg but that will be
+	 * dropped when mcg goes out of scope. We need to take a ref
 	 * on the pointer that will be saved in the red-black tree
-	 * by rxe_add_key and used to lookup grp from mgid later.
+	 * by rxe_add_key and used to lookup mcg from mgid later.
 	 * Adding key makes object visible to outside so this should
 	 * be done last after the object is ready.
 	 */
-	rxe_add_ref(grp);
-	rxe_add_key_locked(grp, mgid);
+	rxe_add_ref(mcg);
+	rxe_add_key_locked(mcg, mgid);
 
-	return grp;
+	return mcg;
 }
 
-static struct rxe_mcg *rxe_mcast_get_grp(struct rxe_dev *rxe,
+static struct rxe_mcg *rxe_get_mcg(struct rxe_dev *rxe,
 					 union ib_gid *mgid)
 {
-	struct rxe_mcg *grp;
+	struct rxe_mcg *mcg;
 	struct rxe_pool *pool = &rxe->mc_grp_pool;
 
 	if (rxe->attr.max_mcast_qp_attach == 0)
 		return ERR_PTR(-EINVAL);
 
 	spin_lock_bh(&rxe->mcg_lock);
-	grp = rxe_pool_get_key_locked(pool, mgid);
-	if (!grp)
-		grp = __rxe_create_grp(rxe, pool, mgid);
+	mcg = rxe_pool_get_key_locked(pool, mgid);
+	if (!mcg)
+		mcg = __rxe_create_mcg(rxe, pool, mgid);
 	spin_unlock_bh(&rxe->mcg_lock);
 
-	return grp;
+	return mcg;
 }
 
-static int rxe_mcast_add_grp_elem(struct rxe_dev *rxe, struct rxe_qp *qp,
-				  struct rxe_mcg *grp)
+static int rxe_attach_mcg(struct rxe_dev *rxe, struct rxe_qp *qp,
+				  struct rxe_mcg *mcg)
 {
 	struct rxe_mca *mca, *tmp;
 	int err;
 
 	/* check to see if the qp is already a member of the group */
 	spin_lock_bh(&rxe->mcg_lock);
-	list_for_each_entry(mca, &grp->qp_list, qp_list) {
+	list_for_each_entry(mca, &mcg->qp_list, qp_list) {
 		if (mca->qp == qp) {
 			spin_unlock_bh(&rxe->mcg_lock);
 			return 0;
@@ -100,7 +100,7 @@  static int rxe_mcast_add_grp_elem(struct rxe_dev *rxe, struct rxe_qp *qp,
 
 	spin_lock_bh(&rxe->mcg_lock);
 	/* re-check to see if someone else just attached qp */
-	list_for_each_entry(tmp, &grp->qp_list, qp_list) {
+	list_for_each_entry(tmp, &mcg->qp_list, qp_list) {
 		if (tmp->qp == qp) {
 			kfree(mca);
 			err = 0;
@@ -109,7 +109,7 @@  static int rxe_mcast_add_grp_elem(struct rxe_dev *rxe, struct rxe_qp *qp,
 	}
 
 	/* check limits after checking if already attached */
-	if (grp->num_qp >= rxe->attr.max_mcast_qp_attach) {
+	if (mcg->num_qp >= rxe->attr.max_mcast_qp_attach) {
 		kfree(mca);
 		err = -ENOMEM;
 		goto out;
@@ -120,8 +120,8 @@  static int rxe_mcast_add_grp_elem(struct rxe_dev *rxe, struct rxe_qp *qp,
 	mca->qp = qp;
 
 	atomic_inc(&qp->mcg_num);
-	grp->num_qp++;
-	list_add(&mca->qp_list, &grp->qp_list);
+	mcg->num_qp++;
+	list_add(&mca->qp_list, &mcg->qp_list);
 
 	err = 0;
 out:
@@ -130,21 +130,21 @@  static int rxe_mcast_add_grp_elem(struct rxe_dev *rxe, struct rxe_qp *qp,
 }
 
 /* caller should be holding rxe->mcg_lock */
-static void __rxe_destroy_grp(struct rxe_mcg *grp)
+static void __rxe_destroy_mcg(struct rxe_mcg *mcg)
 {
-	/* first remove grp from red-black tree then drop ref */
-	rxe_drop_key_locked(grp);
-	rxe_drop_ref(grp);
+	/* first remove mcg from red-black tree then drop ref */
+	rxe_drop_key_locked(mcg);
+	rxe_drop_ref(mcg);
 
-	rxe_mcast_delete(grp->rxe, &grp->mgid);
+	rxe_mcast_delete(mcg->rxe, &mcg->mgid);
 }
 
-static void rxe_destroy_grp(struct rxe_mcg *grp)
+static void rxe_destroy_mcg(struct rxe_mcg *mcg)
 {
-	struct rxe_dev *rxe = grp->rxe;
+	struct rxe_dev *rxe = mcg->rxe;
 
 	spin_lock_bh(&rxe->mcg_lock);
-	__rxe_destroy_grp(grp);
+	__rxe_destroy_mcg(mcg);
 	spin_unlock_bh(&rxe->mcg_lock);
 }
 
@@ -153,22 +153,22 @@  void rxe_mc_cleanup(struct rxe_pool_elem *elem)
 	/* nothing left to do for now */
 }
 
-static int rxe_mcast_drop_grp_elem(struct rxe_dev *rxe, struct rxe_qp *qp,
+static int rxe_detach_mcg(struct rxe_dev *rxe, struct rxe_qp *qp,
 				   union ib_gid *mgid)
 {
-	struct rxe_mcg *grp;
+	struct rxe_mcg *mcg;
 	struct rxe_mca *mca, *tmp;
 	int err;
 
 	spin_lock_bh(&rxe->mcg_lock);
-	grp = rxe_pool_get_key_locked(&rxe->mc_grp_pool, mgid);
-	if (!grp) {
+	mcg = rxe_pool_get_key_locked(&rxe->mc_grp_pool, mgid);
+	if (!mcg) {
 		/* we didn't find the mcast group for mgid */
 		err = -EINVAL;
 		goto out_unlock;
 	}
 
-	list_for_each_entry_safe(mca, tmp, &grp->qp_list, qp_list) {
+	list_for_each_entry_safe(mca, tmp, &mcg->qp_list, qp_list) {
 		if (mca->qp == qp) {
 			list_del(&mca->qp_list);
 
@@ -178,16 +178,16 @@  static int rxe_mcast_drop_grp_elem(struct rxe_dev *rxe, struct rxe_qp *qp,
 			 * object since we are still holding a ref
 			 * from the get key above.
 			 */
-			grp->num_qp--;
-			if (grp->num_qp <= 0)
-				__rxe_destroy_grp(grp);
+			mcg->num_qp--;
+			if (mcg->num_qp <= 0)
+				__rxe_destroy_mcg(mcg);
 
 			atomic_dec(&qp->mcg_num);
 
 			/* drop the ref from get key. This will free the
 			 * object if num_qp is zero.
 			 */
-			rxe_drop_ref(grp);
+			rxe_drop_ref(mcg);
 			kfree(mca);
 			err = 0;
 			goto out_unlock;
@@ -195,7 +195,7 @@  static int rxe_mcast_drop_grp_elem(struct rxe_dev *rxe, struct rxe_qp *qp,
 	}
 
 	/* we didn't find the qp on the list */
-	rxe_drop_ref(grp);
+	rxe_drop_ref(mcg);
 	err = -EINVAL;
 
 out_unlock:
@@ -208,20 +208,20 @@  int rxe_attach_mcast(struct ib_qp *ibqp, union ib_gid *mgid, u16 mlid)
 	int err;
 	struct rxe_dev *rxe = to_rdev(ibqp->device);
 	struct rxe_qp *qp = to_rqp(ibqp);
-	struct rxe_mcg *grp;
+	struct rxe_mcg *mcg;
 
-	/* takes a ref on grp if successful */
-	grp = rxe_mcast_get_grp(rxe, mgid);
-	if (IS_ERR(grp))
-		return PTR_ERR(grp);
+	/* takes a ref on mcg if successful */
+	mcg = rxe_get_mcg(rxe, mgid);
+	if (IS_ERR(mcg))
+		return PTR_ERR(mcg);
 
-	err = rxe_mcast_add_grp_elem(rxe, qp, grp);
+	err = rxe_attach_mcg(rxe, qp, mcg);
 
-	/* if we failed to attach the first qp to grp tear it down */
-	if (grp->num_qp == 0)
-		rxe_destroy_grp(grp);
+	/* if we failed to attach the first qp to mcg tear it down */
+	if (mcg->num_qp == 0)
+		rxe_destroy_mcg(mcg);
 
-	rxe_drop_ref(grp);
+	rxe_drop_ref(mcg);
 	return err;
 }
 
@@ -230,5 +230,5 @@  int rxe_detach_mcast(struct ib_qp *ibqp, union ib_gid *mgid, u16 mlid)
 	struct rxe_dev *rxe = to_rdev(ibqp->device);
 	struct rxe_qp *qp = to_rqp(ibqp);
 
-	return rxe_mcast_drop_grp_elem(rxe, qp, mgid);
+	return rxe_detach_mcg(rxe, qp, mgid);
 }
diff --git a/drivers/infiniband/sw/rxe/rxe_recv.c b/drivers/infiniband/sw/rxe/rxe_recv.c
index a084b5d69937..d91c6660e83c 100644
--- a/drivers/infiniband/sw/rxe/rxe_recv.c
+++ b/drivers/infiniband/sw/rxe/rxe_recv.c
@@ -234,7 +234,7 @@  static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb)
 {
 	struct rxe_pkt_info *pkt = SKB_TO_PKT(skb);
 	struct rxe_mcg *mcg;
-	struct rxe_mca *mce;
+	struct rxe_mca *mca;
 	struct rxe_qp *qp;
 	union ib_gid dgid;
 	int err;
@@ -257,8 +257,8 @@  static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb)
 	 * single QP happen and just move on and try
 	 * the rest of them on the list
 	 */
-	list_for_each_entry(mce, &mcg->qp_list, qp_list) {
-		qp = mce->qp;
+	list_for_each_entry(mca, &mcg->qp_list, qp_list) {
+		qp = mca->qp;
 
 		/* validate qp for incoming packet */
 		err = check_type_state(rxe, pkt, qp);
@@ -273,7 +273,7 @@  static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb)
 		 * skb and pass to the QP. Pass the original skb to
 		 * the last QP in the list.
 		 */
-		if (mce->qp_list.next != &mcg->qp_list) {
+		if (mca->qp_list.next != &mcg->qp_list) {
 			struct sk_buff *cskb;
 			struct rxe_pkt_info *cpkt;