mirror of https://github.com/torvalds/linux.git
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: 62aa3246f4 ("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>
This commit is contained in:
parent
e6d7626881
commit
d942fe13f7
|
|
@ -706,9 +706,9 @@ static int emac_rx_packet(struct prueth_emac *emac, u32 flow_id, u32 *xdp_state)
|
||||||
struct page_pool *pool;
|
struct page_pool *pool;
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
struct xdp_buff xdp;
|
struct xdp_buff xdp;
|
||||||
|
int headroom, ret;
|
||||||
u32 *psdata;
|
u32 *psdata;
|
||||||
void *pa;
|
void *pa;
|
||||||
int ret;
|
|
||||||
|
|
||||||
*xdp_state = 0;
|
*xdp_state = 0;
|
||||||
pool = rx_chn->pg_pool;
|
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_prepare_buff(&xdp, pa, PRUETH_HEADROOM, pkt_len, false);
|
||||||
|
|
||||||
*xdp_state = emac_run_xdp(emac, &xdp, page, &pkt_len);
|
*xdp_state = emac_run_xdp(emac, &xdp, page, &pkt_len);
|
||||||
if (*xdp_state == ICSSG_XDP_PASS)
|
if (*xdp_state != ICSSG_XDP_PASS)
|
||||||
skb = xdp_build_skb_from_buff(&xdp);
|
|
||||||
else
|
|
||||||
goto requeue;
|
goto requeue;
|
||||||
|
headroom = xdp.data - xdp.data_hard_start;
|
||||||
|
pkt_len = xdp.data_end - xdp.data;
|
||||||
} else {
|
} else {
|
||||||
/* prepare skb and send to n/w stack */
|
headroom = PRUETH_HEADROOM;
|
||||||
skb = napi_build_skb(pa, PAGE_SIZE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* prepare skb and send to n/w stack */
|
||||||
|
skb = napi_build_skb(pa, PAGE_SIZE);
|
||||||
if (!skb) {
|
if (!skb) {
|
||||||
ndev->stats.rx_dropped++;
|
ndev->stats.rx_dropped++;
|
||||||
page_pool_recycle_direct(pool, page);
|
page_pool_recycle_direct(pool, page);
|
||||||
goto requeue;
|
goto requeue;
|
||||||
}
|
}
|
||||||
|
|
||||||
skb_reserve(skb, PRUETH_HEADROOM);
|
skb_reserve(skb, headroom);
|
||||||
skb_put(skb, pkt_len);
|
skb_put(skb, pkt_len);
|
||||||
skb->dev = ndev;
|
skb->dev = ndev;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue