net: ethernet: ti: am65_cpsw: fix tx_cleanup for XDP case
For XDP transmit case, swdata doesn't contain SKB but the
XDP Frame. Infer the correct swdata based on buffer type
and return the XDP Frame for XDP transmit case.
Signed-off-by: Roger Quadros <rogerq@kernel.org>
Fixes: 8acacc40f7
("net: ethernet: ti: am65-cpsw: Add minimal XDP support")
Link: https://patch.msgid.link/20250210-am65-cpsw-xdp-fixes-v1-3-ec6b1f7f1aca@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
8a9f82ff15
commit
4542536f66
1 changed files with 11 additions and 3 deletions
|
@ -828,16 +828,24 @@ static void am65_cpsw_nuss_xmit_free(struct am65_cpsw_tx_chn *tx_chn,
|
|||
static void am65_cpsw_nuss_tx_cleanup(void *data, dma_addr_t desc_dma)
|
||||
{
|
||||
struct am65_cpsw_tx_chn *tx_chn = data;
|
||||
enum am65_cpsw_tx_buf_type buf_type;
|
||||
struct cppi5_host_desc_t *desc_tx;
|
||||
struct xdp_frame *xdpf;
|
||||
struct sk_buff *skb;
|
||||
void **swdata;
|
||||
|
||||
desc_tx = k3_cppi_desc_pool_dma2virt(tx_chn->desc_pool, desc_dma);
|
||||
swdata = cppi5_hdesc_get_swdata(desc_tx);
|
||||
skb = *(swdata);
|
||||
am65_cpsw_nuss_xmit_free(tx_chn, desc_tx);
|
||||
buf_type = am65_cpsw_nuss_buf_type(tx_chn, desc_dma);
|
||||
if (buf_type == AM65_CPSW_TX_BUF_TYPE_SKB) {
|
||||
skb = *(swdata);
|
||||
dev_kfree_skb_any(skb);
|
||||
} else {
|
||||
xdpf = *(swdata);
|
||||
xdp_return_frame(xdpf);
|
||||
}
|
||||
|
||||
dev_kfree_skb_any(skb);
|
||||
am65_cpsw_nuss_xmit_free(tx_chn, desc_tx);
|
||||
}
|
||||
|
||||
static struct sk_buff *am65_cpsw_build_skb(void *page_addr,
|
||||
|
|
Loading…
Add table
Reference in a new issue