Skip to content

Commit 4542536

Browse files
rogerqkuba-moo
authored andcommitted
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 <[email protected]> Fixes: 8acacc4 ("net: ethernet: ti: am65-cpsw: Add minimal XDP support") Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 8a9f82f commit 4542536

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

drivers/net/ethernet/ti/am65-cpsw-nuss.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -828,16 +828,24 @@ static void am65_cpsw_nuss_xmit_free(struct am65_cpsw_tx_chn *tx_chn,
828828
static void am65_cpsw_nuss_tx_cleanup(void *data, dma_addr_t desc_dma)
829829
{
830830
struct am65_cpsw_tx_chn *tx_chn = data;
831+
enum am65_cpsw_tx_buf_type buf_type;
831832
struct cppi5_host_desc_t *desc_tx;
833+
struct xdp_frame *xdpf;
832834
struct sk_buff *skb;
833835
void **swdata;
834836

835837
desc_tx = k3_cppi_desc_pool_dma2virt(tx_chn->desc_pool, desc_dma);
836838
swdata = cppi5_hdesc_get_swdata(desc_tx);
837-
skb = *(swdata);
838-
am65_cpsw_nuss_xmit_free(tx_chn, desc_tx);
839+
buf_type = am65_cpsw_nuss_buf_type(tx_chn, desc_dma);
840+
if (buf_type == AM65_CPSW_TX_BUF_TYPE_SKB) {
841+
skb = *(swdata);
842+
dev_kfree_skb_any(skb);
843+
} else {
844+
xdpf = *(swdata);
845+
xdp_return_frame(xdpf);
846+
}
839847

840-
dev_kfree_skb_any(skb);
848+
am65_cpsw_nuss_xmit_free(tx_chn, desc_tx);
841849
}
842850

843851
static struct sk_buff *am65_cpsw_build_skb(void *page_addr,

0 commit comments

Comments
 (0)