Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: ti: icssg-prueth: Fix skb handling for XDP_PASS

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>
Link: https://patch.msgid.link/20250803180216.3569139-1-m-malladi@ti.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Meghana Malladi and committed by
Jakub Kicinski
d942fe13 e6d76268

+8 -7
+8 -7
drivers/net/ethernet/ti/icssg/icssg_common.c
··· 706 706 struct page_pool *pool; 707 707 struct sk_buff *skb; 708 708 struct xdp_buff xdp; 709 + int headroom, ret; 709 710 u32 *psdata; 710 711 void *pa; 711 - int ret; 712 712 713 713 *xdp_state = 0; 714 714 pool = rx_chn->pg_pool; ··· 757 757 xdp_prepare_buff(&xdp, pa, PRUETH_HEADROOM, pkt_len, false); 758 758 759 759 *xdp_state = emac_run_xdp(emac, &xdp, page, &pkt_len); 760 - if (*xdp_state == ICSSG_XDP_PASS) 761 - skb = xdp_build_skb_from_buff(&xdp); 762 - else 760 + if (*xdp_state != ICSSG_XDP_PASS) 763 761 goto requeue; 762 + headroom = xdp.data - xdp.data_hard_start; 763 + pkt_len = xdp.data_end - xdp.data; 764 764 } else { 765 - /* prepare skb and send to n/w stack */ 766 - skb = napi_build_skb(pa, PAGE_SIZE); 765 + headroom = PRUETH_HEADROOM; 767 766 } 768 767 768 + /* prepare skb and send to n/w stack */ 769 + skb = napi_build_skb(pa, PAGE_SIZE); 769 770 if (!skb) { 770 771 ndev->stats.rx_dropped++; 771 772 page_pool_recycle_direct(pool, page); 772 773 goto requeue; 773 774 } 774 775 775 - skb_reserve(skb, PRUETH_HEADROOM); 776 + skb_reserve(skb, headroom); 776 777 skb_put(skb, pkt_len); 777 778 skb->dev = ndev; 778 779