Commit 99dae690 authored by Zhu Yanjun's avatar Zhu Yanjun Committed by Jason Gunthorpe

IB/rxe: optimize mcast recv process

In mcast recv process, the function skb_clone is used. In fact,
the refcount can be increased to replace cloning a new skb since
the original skb will not be modified before it is freed.

This can make the performance better and save the memory.

CC: Srinivas Eeda <srinivas.eeda@oracle.com>
CC: Junxiao Bi <junxiao.bi@oracle.com>
Signed-off-by: default avatarZhu Yanjun <yanjun.zhu@oracle.com>
Reviewed-by: default avatarYuval Shaia <yuval.shaia@oracle.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent a343e3f8
...@@ -276,7 +276,6 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb) ...@@ -276,7 +276,6 @@ 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_pkt_info *pkt = SKB_TO_PKT(skb);
struct rxe_mc_grp *mcg; struct rxe_mc_grp *mcg;
struct sk_buff *skb_copy;
struct rxe_mc_elem *mce; struct rxe_mc_elem *mce;
struct rxe_qp *qp; struct rxe_qp *qp;
union ib_gid dgid; union ib_gid dgid;
...@@ -309,18 +308,14 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb) ...@@ -309,18 +308,14 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb)
continue; continue;
/* if *not* the last qp in the list /* if *not* the last qp in the list
* make a copy of the skb to post to the next qp * increase the users of the skb then post to the next qp
*/ */
skb_copy = (mce->qp_list.next != &mcg->qp_list) ? if (mce->qp_list.next != &mcg->qp_list)
skb_clone(skb, GFP_ATOMIC) : NULL; refcount_inc(&skb->users);
pkt->qp = qp; pkt->qp = qp;
rxe_add_ref(qp); rxe_add_ref(qp);
rxe_rcv_pkt(rxe, pkt, skb); rxe_rcv_pkt(rxe, pkt, skb);
skb = skb_copy;
if (!skb)
break;
} }
spin_unlock_bh(&mcg->mcg_lock); spin_unlock_bh(&mcg->mcg_lock);
...@@ -328,7 +323,6 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb) ...@@ -328,7 +323,6 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb)
rxe_drop_ref(mcg); /* drop ref from rxe_pool_get_key. */ rxe_drop_ref(mcg); /* drop ref from rxe_pool_get_key. */
err1: err1:
if (skb)
kfree_skb(skb); kfree_skb(skb);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment