Skip to contentSkip to conversation

nfp: Use skb_put_data() instead of skb_put/memcpy pair

PATCH Applied Shang XiaoJing 3 participants 4 messages Sep 27, 2022 – Sep 29, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 nfp: Use skb_put_data() instead of skb_put/memcpy pair

Use skb_put_data() instead of skb_put() and memcpy(), which is clear.

---
changes in v2:
- no change

---
 drivers/net/ethernet/netronome/nfp/nfd3/xsk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/netronome/nfp/nfd3/xsk.c +1 -1
index 65e243168765..5d9db8c2a5b4 100644
@@ -84,7 +84,7 @@ static void nfp_nfd3_xsk_rx_skb(struct nfp_net_rx_ring *rx_ring,
 		nfp_net_xsk_rx_drop(r_vec, xrxbuf);
 		return;
 	}
-	memcpy(skb_put(skb, pkt_len), xrxbuf->xdp->data, pkt_len);
+	skb_put_data(skb, xrxbuf->xdp->data, pkt_len);
 
 	skb->mark = meta->mark;
 	skb_set_hash(skb, meta->hash, meta->hash_type);
Signature · 1 line
2.17.1
author Reviewed-by Simon Horman on v2 1/1
#1 lore raw
Quoted 15 lines · Shang XiaoJing

Use skb_put_data() instead of skb_put() and memcpy(), which is clear.

---
changes in v2:
- no change

---
  drivers/net/ethernet/netronome/nfp/nfd3/xsk.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/netronome/nfp/nfd3/xsk.c +0 -0
index 65e243168765..5d9db8c2a5b4 100644

drivers/net/ethernet/netronome/nfp/nfd3/xsk.c static void nfp_nfd3_xsk_rx_skb(struct nfp_net_rx_ring *rx_ring, · line 90

Quoted 8 lines
drivers/net/ethernet/netronome/nfp/nfd3/xsk.c +1 -1
@@ -84,7 +84,7 @@ static void nfp_nfd3_xsk_rx_skb(struct nfp_net_rx_ring *rx_ring,
  		nfp_net_xsk_rx_drop(r_vec, xrxbuf);
  		return;
  	}
-	memcpy(skb_put(skb, pkt_len), xrxbuf->xdp->data, pkt_len);
+	skb_put_data(skb, xrxbuf->xdp->data, pkt_len);
 
  	skb->mark = meta->mark;
  	skb_set_hash(skb, meta->hash, meta->hash_type);

forgot to add the reviewed tag, sorry.

Thanks,
Shang XiaoJing

Reviewed-by on v2 1/1
#2 lore raw
In reply to Shang XiaoJing

Hi Shang,

Thanks for your work.

Quoted 3 lines · Shang XiaoJing

Use skb_put_data() instead of skb_put() and memcpy(), which is clear.

Quoted 23 lines

---
changes in v2:
- no change

---
 drivers/net/ethernet/netronome/nfp/nfd3/xsk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/netronome/nfp/nfd3/xsk.c +1 -2
index 65e243168765..5d9db8c2a5b4 100644
@@ -84,7 +84,7 @@ static void nfp_nfd3_xsk_rx_skb(struct nfp_net_rx_ring *rx_ring,
                nfp_net_xsk_rx_drop(r_vec, xrxbuf);
                return;
        }
-       memcpy(skb_put(skb, pkt_len), xrxbuf->xdp->data, pkt_len);
+       skb_put_data(skb, xrxbuf->xdp->data, pkt_len);
 
        skb->mark = meta->mark;
        skb_set_hash(skb, meta->hash, meta->hash_type);
--

2.17.1

Signature · 2 lines
Kind Regards,
Niklas Söderlund
#3 lore raw
In reply to Shang XiaoJing
This patch was applied to netdev/net-next.git (master) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (master) by Paolo Abeni <[email protected]>:

Quoted 8 lines · On Tue, 27 Sep 2022 22:18:35 +0800 you wrote:

Use skb_put_data() instead of skb_put() and memcpy(), which is clear.

---
changes in v2:
- no change

[...]

Here is the summary with links:
- [-next,v2] nfp: Use skb_put_data() instead of skb_put/memcpy pair

    https://git.kernel.org/netdev/net-next/c/d49e265b66d9

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html