mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
net: fec: remove unnecessary NULL pointer check when clearing TX BD ring
The tx_buf pointer will not NULL when its type is FEC_TXBUF_T_XDP_NDO or FEC_TXBUF_T_XDP_TX. If the type is FEC_TXBUF_T_SKB, dev_kfree_skb_any() will do NULL pointer check. So it is unnecessary to do NULL pointer check in fec_enet_bd_init() and fec_enet_tx_queue(). Signed-off-by: Wei Fang <wei.fang@nxp.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20260205085742.2685134-10-wei.fang@nxp.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
2ff7a7d392
commit
2dcc934755
|
|
@ -1032,24 +1032,19 @@ static void fec_enet_bd_init(struct net_device *dev)
|
|||
fec32_to_cpu(bdp->cbd_bufaddr),
|
||||
fec16_to_cpu(bdp->cbd_datlen),
|
||||
DMA_TO_DEVICE);
|
||||
if (txq->tx_buf[i].buf_p)
|
||||
dev_kfree_skb_any(txq->tx_buf[i].buf_p);
|
||||
dev_kfree_skb_any(txq->tx_buf[i].buf_p);
|
||||
} else if (txq->tx_buf[i].type == FEC_TXBUF_T_XDP_NDO) {
|
||||
if (bdp->cbd_bufaddr)
|
||||
dma_unmap_single(&fep->pdev->dev,
|
||||
fec32_to_cpu(bdp->cbd_bufaddr),
|
||||
fec16_to_cpu(bdp->cbd_datlen),
|
||||
DMA_TO_DEVICE);
|
||||
dma_unmap_single(&fep->pdev->dev,
|
||||
fec32_to_cpu(bdp->cbd_bufaddr),
|
||||
fec16_to_cpu(bdp->cbd_datlen),
|
||||
DMA_TO_DEVICE);
|
||||
|
||||
if (txq->tx_buf[i].buf_p)
|
||||
xdp_return_frame(txq->tx_buf[i].buf_p);
|
||||
xdp_return_frame(txq->tx_buf[i].buf_p);
|
||||
} else {
|
||||
struct page *page = txq->tx_buf[i].buf_p;
|
||||
|
||||
if (page)
|
||||
page_pool_put_page(pp_page_to_nmdesc(page)->pp,
|
||||
page, 0,
|
||||
false);
|
||||
page_pool_put_page(pp_page_to_nmdesc(page)->pp,
|
||||
page, 0, false);
|
||||
}
|
||||
|
||||
txq->tx_buf[i].buf_p = NULL;
|
||||
|
|
@ -1538,21 +1533,15 @@ fec_enet_tx_queue(struct net_device *ndev, u16 queue_id, int budget)
|
|||
|
||||
if (txq->tx_buf[index].type == FEC_TXBUF_T_XDP_NDO) {
|
||||
xdpf = txq->tx_buf[index].buf_p;
|
||||
if (bdp->cbd_bufaddr)
|
||||
dma_unmap_single(&fep->pdev->dev,
|
||||
fec32_to_cpu(bdp->cbd_bufaddr),
|
||||
fec16_to_cpu(bdp->cbd_datlen),
|
||||
DMA_TO_DEVICE);
|
||||
dma_unmap_single(&fep->pdev->dev,
|
||||
fec32_to_cpu(bdp->cbd_bufaddr),
|
||||
fec16_to_cpu(bdp->cbd_datlen),
|
||||
DMA_TO_DEVICE);
|
||||
} else {
|
||||
page = txq->tx_buf[index].buf_p;
|
||||
}
|
||||
|
||||
bdp->cbd_bufaddr = cpu_to_fec32(0);
|
||||
if (unlikely(!txq->tx_buf[index].buf_p)) {
|
||||
txq->tx_buf[index].type = FEC_TXBUF_T_SKB;
|
||||
goto tx_buf_done;
|
||||
}
|
||||
|
||||
frame_len = fec16_to_cpu(bdp->cbd_datlen);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user