Skip to content

Commit 99dae69

Browse files
Zhu Yanjunjgunthorpe
authored andcommitted
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 <[email protected]> CC: Junxiao Bi <[email protected]> Signed-off-by: Zhu Yanjun <[email protected]> Reviewed-by: Yuval Shaia <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent a343e3f commit 99dae69

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

drivers/infiniband/sw/rxe/rxe_recv.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,6 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb)
276276
{
277277
struct rxe_pkt_info *pkt = SKB_TO_PKT(skb);
278278
struct rxe_mc_grp *mcg;
279-
struct sk_buff *skb_copy;
280279
struct rxe_mc_elem *mce;
281280
struct rxe_qp *qp;
282281
union ib_gid dgid;
@@ -309,27 +308,22 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb)
309308
continue;
310309

311310
/* if *not* the last qp in the list
312-
* make a copy of the skb to post to the next qp
311+
* increase the users of the skb then post to the next qp
313312
*/
314-
skb_copy = (mce->qp_list.next != &mcg->qp_list) ?
315-
skb_clone(skb, GFP_ATOMIC) : NULL;
313+
if (mce->qp_list.next != &mcg->qp_list)
314+
refcount_inc(&skb->users);
316315

317316
pkt->qp = qp;
318317
rxe_add_ref(qp);
319318
rxe_rcv_pkt(rxe, pkt, skb);
320-
321-
skb = skb_copy;
322-
if (!skb)
323-
break;
324319
}
325320

326321
spin_unlock_bh(&mcg->mcg_lock);
327322

328323
rxe_drop_ref(mcg); /* drop ref from rxe_pool_get_key. */
329324

330325
err1:
331-
if (skb)
332-
kfree_skb(skb);
326+
kfree_skb(skb);
333327
}
334328

335329
static int rxe_match_dgid(struct rxe_dev *rxe, struct sk_buff *skb)

0 commit comments

Comments
 (0)