]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: mvneta: avoid copying shared_info frags in mvneta_swbm_build_skb
authorLorenzo Bianconi <lorenzo@kernel.org>
Sat, 19 Sep 2020 00:03:26 +0000 (02:03 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 20 Sep 2020 21:14:27 +0000 (14:14 -0700)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/mvneta.c

index f75e05e899bbf23e6d84fb050d8380fcbaab349a..2332a7fc9a591504d0da6930592fd760ba2ca91f 100644 (file)
@@ -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;