* [PATCH net v2] net: ti: icssg-prueth: Fix skb handling for XDP_PASS
@ 2025-08-03 18:02 Meghana Malladi
2025-08-06 1:07 ` Jakub Kicinski
2025-08-06 1:10 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Meghana Malladi @ 2025-08-03 18:02 UTC (permalink / raw)
To: namcao, r-gunasekaran, jacob.e.keller, m-malladi, sdf,
john.fastabend, hawk, daniel, ast, pabeni, kuba, edumazet, davem,
andrew+netdev
Cc: bpf, linux-kernel, netdev, linux-arm-kernel, srk,
Vignesh Raghavendra, Roger Quadros, danishanwar
emac_rx_packet() is a common function for handling traffic
for both xdp and non-xdp use cases. Use common logic for
handling skb with or without xdp to prevent any incorrect
packet processing. This patch fixes ping working with
XDP_PASS for icssg driver.
Fixes: 62aa3246f4623 ("net: ti: icssg-prueth: Add XDP support")
Signed-off-by: Meghana Malladi <m-malladi@ti.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
---
v2-v1:
- Collected RB tag from Jacob Keller <jacob.e.keller@intel.com>
- Populated headroom from xdp buffer instead of hardcoding as
pointed out by Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/ti/icssg/icssg_common.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/ti/icssg/icssg_common.c b/drivers/net/ethernet/ti/icssg/icssg_common.c
index 12f25cec6255..57e5f1c88f50 100644
--- a/drivers/net/ethernet/ti/icssg/icssg_common.c
+++ b/drivers/net/ethernet/ti/icssg/icssg_common.c
@@ -706,9 +706,9 @@ static int emac_rx_packet(struct prueth_emac *emac, u32 flow_id, u32 *xdp_state)
struct page_pool *pool;
struct sk_buff *skb;
struct xdp_buff xdp;
+ int headroom, ret;
u32 *psdata;
void *pa;
- int ret;
*xdp_state = 0;
pool = rx_chn->pg_pool;
@@ -757,22 +757,23 @@ static int emac_rx_packet(struct prueth_emac *emac, u32 flow_id, u32 *xdp_state)
xdp_prepare_buff(&xdp, pa, PRUETH_HEADROOM, pkt_len, false);
*xdp_state = emac_run_xdp(emac, &xdp, page, &pkt_len);
- if (*xdp_state == ICSSG_XDP_PASS)
- skb = xdp_build_skb_from_buff(&xdp);
- else
+ if (*xdp_state != ICSSG_XDP_PASS)
goto requeue;
+ headroom = xdp.data - xdp.data_hard_start;
+ pkt_len = xdp.data_end - xdp.data;
} else {
- /* prepare skb and send to n/w stack */
- skb = napi_build_skb(pa, PAGE_SIZE);
+ headroom = PRUETH_HEADROOM;
}
+ /* prepare skb and send to n/w stack */
+ skb = napi_build_skb(pa, PAGE_SIZE);
if (!skb) {
ndev->stats.rx_dropped++;
page_pool_recycle_direct(pool, page);
goto requeue;
}
- skb_reserve(skb, PRUETH_HEADROOM);
+ skb_reserve(skb, headroom);
skb_put(skb, pkt_len);
skb->dev = ndev;
base-commit: 759dfc7d04bab1b0b86113f1164dc1fec192b859
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net v2] net: ti: icssg-prueth: Fix skb handling for XDP_PASS
2025-08-03 18:02 [PATCH net v2] net: ti: icssg-prueth: Fix skb handling for XDP_PASS Meghana Malladi
@ 2025-08-06 1:07 ` Jakub Kicinski
2025-08-06 1:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2025-08-06 1:07 UTC (permalink / raw)
To: Meghana Malladi
Cc: namcao, r-gunasekaran, jacob.e.keller, sdf, john.fastabend, hawk,
daniel, ast, pabeni, edumazet, davem, andrew+netdev, bpf,
linux-kernel, netdev, linux-arm-kernel, srk, Vignesh Raghavendra,
Roger Quadros, danishanwar
On Sun, 3 Aug 2025 23:32:16 +0530 Meghana Malladi wrote:
> emac_rx_packet() is a common function for handling traffic
> for both xdp and non-xdp use cases. Use common logic for
> handling skb with or without xdp to prevent any incorrect
> packet processing. This patch fixes ping working with
> XDP_PASS for icssg driver.
Out of curiosity were you able to use the in-tree XDP test?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net v2] net: ti: icssg-prueth: Fix skb handling for XDP_PASS
2025-08-03 18:02 [PATCH net v2] net: ti: icssg-prueth: Fix skb handling for XDP_PASS Meghana Malladi
2025-08-06 1:07 ` Jakub Kicinski
@ 2025-08-06 1:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-08-06 1:10 UTC (permalink / raw)
To: Meghana Malladi
Cc: namcao, r-gunasekaran, jacob.e.keller, sdf, john.fastabend, hawk,
daniel, ast, pabeni, kuba, edumazet, davem, andrew+netdev, bpf,
linux-kernel, netdev, linux-arm-kernel, srk, vigneshr, rogerq,
danishanwar
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Sun, 3 Aug 2025 23:32:16 +0530 you wrote:
> emac_rx_packet() is a common function for handling traffic
> for both xdp and non-xdp use cases. Use common logic for
> handling skb with or without xdp to prevent any incorrect
> packet processing. This patch fixes ping working with
> XDP_PASS for icssg driver.
>
> Fixes: 62aa3246f4623 ("net: ti: icssg-prueth: Add XDP support")
> Signed-off-by: Meghana Malladi <m-malladi@ti.com>
> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
>
> [...]
Here is the summary with links:
- [net,v2] net: ti: icssg-prueth: Fix skb handling for XDP_PASS
https://git.kernel.org/netdev/net/c/d942fe13f72b
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] 3+ messages in thread
end of thread, other threads:[~2025-08-06 1:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-03 18:02 [PATCH net v2] net: ti: icssg-prueth: Fix skb handling for XDP_PASS Meghana Malladi
2025-08-06 1:07 ` Jakub Kicinski
2025-08-06 1:10 ` 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 NNTP newsgroup(s).