Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH net-next] net: mvneta: avoid copying shared_info frags in mvneta_swbm_build_skb
@ 2020-09-19 0:03 Lorenzo Bianconi
2020-09-20 21:13 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Lorenzo Bianconi @ 2020-09-19 0:03 UTC (permalink / raw)
To: netdev; +Cc: lorenzo.bianconi, davem, kuba, brouer, echaudro, thomas.petazzoni
Avoid copying skb_shared_info frags array in mvneta_swbm_build_skb() since
__build_skb_around() does not overwrite it
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
drivers/net/ethernet/marvell/mvneta.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 0cd315f1380e..d315ba1cd332 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -2305,11 +2305,8 @@ mvneta_swbm_build_skb(struct mvneta_port *pp, struct mvneta_rx_queue *rxq,
{
struct skb_shared_info *sinfo = xdp_get_shared_info_from_buff(xdp);
int i, num_frags = sinfo->nr_frags;
- skb_frag_t frags[MAX_SKB_FRAGS];
struct sk_buff *skb;
- memcpy(frags, sinfo->frags, sizeof(skb_frag_t) * num_frags);
-
skb = build_skb(xdp->data_hard_start, PAGE_SIZE);
if (!skb)
return ERR_PTR(-ENOMEM);
@@ -2321,12 +2318,12 @@ mvneta_swbm_build_skb(struct mvneta_port *pp, struct mvneta_rx_queue *rxq,
mvneta_rx_csum(pp, desc_status, skb);
for (i = 0; i < num_frags; i++) {
- struct page *page = skb_frag_page(&frags[i]);
+ skb_frag_t *frag = &sinfo->frags[i];
skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
- page, skb_frag_off(&frags[i]),
- skb_frag_size(&frags[i]), PAGE_SIZE);
- page_pool_release_page(rxq->page_pool, page);
+ skb_frag_page(frag), skb_frag_off(frag),
+ skb_frag_size(frag), PAGE_SIZE);
+ page_pool_release_page(rxq->page_pool, skb_frag_page(frag));
}
return skb;
--
2.26.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] net: mvneta: avoid copying shared_info frags in mvneta_swbm_build_skb
2020-09-19 0:03 [PATCH net-next] net: mvneta: avoid copying shared_info frags in mvneta_swbm_build_skb Lorenzo Bianconi
@ 2020-09-20 21:13 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-09-20 21:13 UTC (permalink / raw)
To: lorenzo
Cc: netdev, lorenzo.bianconi, kuba, brouer, echaudro, thomas.petazzoni
From: Lorenzo Bianconi <lorenzo@kernel.org>
Date: Sat, 19 Sep 2020 02:03:26 +0200
> Avoid copying skb_shared_info frags array in mvneta_swbm_build_skb() since
> __build_skb_around() does not overwrite it
>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Applied, thank you.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-20 21:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-19 0:03 [PATCH net-next] net: mvneta: avoid copying shared_info frags in mvneta_swbm_build_skb Lorenzo Bianconi
2020-09-20 21:13 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).