History

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.

Zhu Yanjun committed 8 years ago

Commit 99dae691 parent a343e3f1 file · +4 −10Browse files

Unified · Split

drivers/infiniband/sw/rxe/rxe_recv.c+4−10
@@ -276,7 +276,6 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb) · 275 unmodified lines
276{276{
277 struct rxe_pkt_info *pkt = SKB_TO_PKT(skb);277 struct rxe_pkt_info *pkt = SKB_TO_PKT(skb);
278 struct rxe_mc_grp *mcg;278 struct rxe_mc_grp *mcg;
279 struct sk_buff *skb_copy;
280 struct rxe_mc_elem *mce;279 struct rxe_mc_elem *mce;
281 struct rxe_qp *qp;280 struct rxe_qp *qp;
282 union ib_gid dgid;281 union ib_gid dgid;
@@ -309,18 +308,14 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb) · 26 unmodified lines
309 continue;308 continue;
310 309
311 /* if *not* the last qp in the list310 /* if *not* the last qp in the list
312 * make a copy of the skb to post to the next qp311 * increase the users of the skb then post to the next qp
313 */312 */
314 skb_copy = (mce->qp_list.next != &mcg->qp_list) ?313 if (mce->qp_list.next != &mcg->qp_list)
315 skb_clone(skb, GFP_ATOMIC) : NULL;314 refcount_inc(&skb->users);
316 315
317 pkt->qp = qp;316 pkt->qp = qp;
318 rxe_add_ref(qp);317 rxe_add_ref(qp);
319 rxe_rcv_pkt(rxe, pkt, skb);318 rxe_rcv_pkt(rxe, pkt, skb);
320
321 skb = skb_copy;
322 if (!skb)
323 break;
324 }319 }
325 320
326 spin_unlock_bh(&mcg->mcg_lock);321 spin_unlock_bh(&mcg->mcg_lock);
@@ -328,8 +323,7 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb) · 1 unmodified line
328 rxe_drop_ref(mcg); /* drop ref from rxe_pool_get_key. */323 rxe_drop_ref(mcg); /* drop ref from rxe_pool_get_key. */
329 324
330err1:325err1:
331 if (skb)326 kfree_skb(skb);
332 kfree_skb(skb);
333}327}
334 328
335static int rxe_match_dgid(struct rxe_dev *rxe, struct sk_buff *skb)329static int rxe_match_dgid(struct rxe_dev *rxe, struct sk_buff *skb)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t