diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2019-11-14 13:39:56 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-11-14 13:56:35 +0100 |
commit | e971714cdf89eb0def9aab4ffba026d044e42c66 (patch) | |
tree | 6e61165b75fd06182aeecd99c49d2088f3df9e30 | |
parent | 506426c51b136b619f4710a325f47bae3d72b29f (diff) | |
download | barebox-e971714cdf89eb0def9aab4ffba026d044e42c66.tar.gz barebox-e971714cdf89eb0def9aab4ffba026d044e42c66.tar.xz |
net: fsl-fman: do not leave not transmitted DMA buffers mapped
When a packet can't be transmitted we should unmap it. This probably
won't change much since when we can't transmit a packet the fman
probably can't recover from it anyway, but still it is cleaner to not
leave the buffers mapped.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | drivers/net/fsl-fman.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/net/fsl-fman.c b/drivers/net/fsl-fman.c index 01f7064fd2..467f7840bf 100644 --- a/drivers/net/fsl-fman.c +++ b/drivers/net/fsl-fman.c @@ -835,7 +835,7 @@ static int fm_eth_send(struct eth_device *edev, void *buf, int len) struct fm_eth *fm_eth = to_fm_eth(edev); struct fm_port_global_pram *pram; struct fm_port_bd *txbd; - int i; + int i, ret; dma_addr_t dma; pram = fm_eth->tx_pram; @@ -869,18 +869,20 @@ static int fm_eth_send(struct eth_device *edev, void *buf, int len) fm_eth->cur_txbd_idx * sizeof(struct fm_port_bd)); /* wait for buffer to be transmitted */ + ret = 0; for (i = 0; muram_readw(&txbd->status) & TxBD_READY; i++) { udelay(10); if (i > 0x10000) { dev_err(&edev->dev, "Tx error, txbd->status = 0x%x\n", muram_readw(&txbd->status)); - return -EIO; + ret = -EIO; + break; } } dma_unmap_single(fm_eth->dev, dma, len, DMA_TO_DEVICE); - return 0; + return ret; } static int fm_eth_recv(struct eth_device *edev) |