Skip to contentSkip to conversation

net: axienet: Use napi_alloc_skb when refilling RX ring

PATCH Applied Robert Hancock 3 participants 4 messages Mar 8, 2022 – Mar 10, 2022

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

PATCH 1/1 net: axienet: Use napi_alloc_skb when refilling RX ring

Use napi_alloc_skb to allocate memory when refilling the RX ring in axienet_poll for more efficiency.

---
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +1 -1
index a51a8228e1b7..1da90ec553c5 100644
@@ -965,7 +965,7 @@ static int axienet_poll(struct napi_struct *napi, int budget)
 			packets++;
 		}
 
-		new_skb = netdev_alloc_skb_ip_align(lp->ndev, lp->max_frm_size);
+		new_skb = napi_alloc_skb(napi, lp->max_frm_size);
 		if (!new_skb)
 			break;
 
Signature · 1 line
2.31.1
#1 lore raw
Quoted 11 lines

-----Original Message-----
From: Robert Hancock <[email protected]>
Sent: Wednesday, March 9, 2022 2:40 AM
To: [email protected]
Cc: Radhey Shyam Pandey <[email protected]>; [email protected]; [email protected]; Michal Simek <[email protected]>; linux-arm- [email protected]; [email protected]; Robert Hancock <[email protected]>
Subject: [PATCH net-next] net: axienet: Use napi_alloc_skb when refilling RX ring

Quoted 2 lines

Use napi_alloc_skb to allocate memory when refilling the RX ring in axienet_poll for more efficiency.

Minor nit - Good to add some details on "more efficiency" (assume it's perf?)

Quoted 24 lines
---
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +1 -1
index a51a8228e1b7..1da90ec553c5 100644
@@ -965,7 +965,7 @@ static int axienet_poll(struct napi_struct *napi, int
 budget)
 			packets++;
 		}
 
-		new_skb = netdev_alloc_skb_ip_align(lp->ndev, lp-
 >max_frm_size);
+		new_skb = napi_alloc_skb(napi, lp->max_frm_size);
 		if (!new_skb)

break;

--
2.31.1

#2 lore raw
Quoted 12 lines · Radhey Shyam Pandey
Quoted 12 lines

-----Original Message-----
From: Robert Hancock <[email protected]>
Sent: Wednesday, March 9, 2022 2:40 AM
To: [email protected]
Cc: Radhey Shyam Pandey <[email protected]>; [email protected]; [email protected]; Michal Simek <[email protected]>; linux-arm- [email protected]; [email protected]; Robert Hancock <[email protected]>
Subject: [PATCH net-next] net: axienet: Use napi_alloc_skb when refilling RX
ring

Quoted 4 lines
Quoted 2 lines

Use napi_alloc_skb to allocate memory when refilling the RX ring in axienet_poll for more efficiency.

Minor nit - Good to add some details on "more efficiency" (assume it's perf?)

Yes, it's as described in the comments for napi_alloc_skb:

 *      Allocate a new sk_buff for use in NAPI receive.  This buffer will
 *      attempt to allocate the head from a special reserved region used
 *      only for NAPI Rx allocation.  By doing this we can save several
 *      CPU cycles by avoiding having to disable and re-enable IRQs.

I guess this could be mentioned in the commit description if desired?

Quoted 24 lines
Quoted 24 lines
---
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +1 -1
index a51a8228e1b7..1da90ec553c5 100644
@@ -965,7 +965,7 @@ static int axienet_poll(struct napi_struct *napi, int
 budget)
 			packets++;
 		}
 
-		new_skb = netdev_alloc_skb_ip_align(lp->ndev, lp-
 > max_frm_size);
+		new_skb = napi_alloc_skb(napi, lp->max_frm_size);
 		if (!new_skb)

break;

--
2.31.1

Signature · 3 lines
Robert Hancock
Senior Hardware Designer, Calian Advanced Technologies
www.calian.com
#3 lore raw
In reply to Robert Hancock
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Hello:

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

Quoted 7 lines · On Tue, 8 Mar 2022 15:10:13 -0600 you wrote:

Use napi_alloc_skb to allocate memory when refilling the RX ring in axienet_poll for more efficiency.

---
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
- [net-next] net: axienet: Use napi_alloc_skb when refilling RX ring

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

You are awesome, thank you!

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