LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH] sfc: Use 'skb_add_rx_frag()' instead of hand coding it
@ 2021-04-04  9:45 Christophe JAILLET
  2021-04-05 19:00 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2021-04-04  9:45 UTC (permalink / raw)
  To: ecree.xilinx, habetsm.xilinx, davem, kuba
  Cc: netdev, linux-kernel, kernel-janitors, Christophe JAILLET

Some lines of code can be merged into an equivalent 'skb_add_rx_frag()'
call which is less verbose.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
UNTESTED. Compile tested only

The 'skb->truesize' computation is likely to be slightly slower (n
additions hidden in 'skb_add_rx_frag' instead of 1 multiplication), but I
don't think that it is an issue here.
---
 drivers/net/ethernet/sfc/rx.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c
index 89c5c75f479f..17b8119c48e5 100644
--- a/drivers/net/ethernet/sfc/rx.c
+++ b/drivers/net/ethernet/sfc/rx.c
@@ -94,12 +94,11 @@ static struct sk_buff *efx_rx_mk_skb(struct efx_channel *channel,
 		rx_buf->len -= hdr_len;
 
 		for (;;) {
-			skb_fill_page_desc(skb, skb_shinfo(skb)->nr_frags,
-					   rx_buf->page, rx_buf->page_offset,
-					   rx_buf->len);
+			skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
+					rx_buf->page, rx_buf->page_offset,
+					rx_buf->len, efx->rx_buffer_truesize);
 			rx_buf->page = NULL;
-			skb->len += rx_buf->len;
-			skb->data_len += rx_buf->len;
+
 			if (skb_shinfo(skb)->nr_frags == n_frags)
 				break;
 
@@ -111,8 +110,6 @@ static struct sk_buff *efx_rx_mk_skb(struct efx_channel *channel,
 		n_frags = 0;
 	}
 
-	skb->truesize += n_frags * efx->rx_buffer_truesize;
-
 	/* Move past the ethernet header */
 	skb->protocol = eth_type_trans(skb, efx->net_dev);
 
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] sfc: Use 'skb_add_rx_frag()' instead of hand coding it
  2021-04-04  9:45 [PATCH] sfc: Use 'skb_add_rx_frag()' instead of hand coding it Christophe JAILLET
@ 2021-04-05 19:00 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-04-05 19:00 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: ecree.xilinx, habetsm.xilinx, davem, kuba, netdev, linux-kernel,
	kernel-janitors

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Sun,  4 Apr 2021 11:45:11 +0200 you wrote:
> Some lines of code can be merged into an equivalent 'skb_add_rx_frag()'
> call which is less verbose.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> UNTESTED. Compile tested only
> 
> [...]

Here is the summary with links:
  - sfc: Use 'skb_add_rx_frag()' instead of hand coding it
    https://git.kernel.org/netdev/net-next/c/c438a801e0bb

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-05 19:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-04  9:45 [PATCH] sfc: Use 'skb_add_rx_frag()' instead of hand coding it Christophe JAILLET
2021-04-05 19:00 ` patchwork-bot+netdevbpf

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 read-only IMAP folder(s) and NNTP newsgroup(s).