[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1456360619-24390-17-git-send-email-troy.kisky@boundarydevices.com>
Date: Wed, 24 Feb 2016 17:36:59 -0700
From: Troy Kisky <troy.kisky@...ndarydevices.com>
To: netdev@...r.kernel.org, davem@...emloft.net, B38611@...escale.com
Cc: fabio.estevam@...escale.com, l.stach@...gutronix.de,
andrew@...n.ch, tremyfr@...il.com, linux@....linux.org.uk,
linux-arm-kernel@...ts.infradead.org, laci@...ndarydevices.com,
shawnguo@...nel.org, johannes@...solutions.net,
stillcompiling@...il.com, sergei.shtylyov@...entembedded.com,
arnd@...db.de, Troy Kisky <troy.kisky@...ndarydevices.com>
Subject: [PATCH net-next V2 16/16] net: fec: don't set cbd_bufaddr unless no mapping error
Not assigning cbd_bufaddr on error will prevent trying to
unmap the error in case the FEC is reset.
Signed-off-by: Troy Kisky <troy.kisky@...ndarydevices.com>
---
drivers/net/ethernet/freescale/fec_main.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 1d71b2e..c443a96 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -600,7 +600,7 @@ fec_enet_txq_put_hdr_tso(struct fec_enet_priv_tx_q *txq,
int hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
struct bufdesc_ex *ebdp = container_of(bdp, struct bufdesc_ex, desc);
void *bufaddr;
- unsigned long dmabuf;
+ dma_addr_t dmabuf;
unsigned int estatus = 0;
bufaddr = txq->tso_hdrs + index * TSO_HEADER_SIZE;
@@ -1298,17 +1298,21 @@ fec_enet_new_rxbdp(struct net_device *ndev, struct bufdesc *bdp, struct sk_buff
{
struct fec_enet_private *fep = netdev_priv(ndev);
int off;
+ dma_addr_t dmabuf;
off = ((unsigned long)skb->data) & fep->rx_align;
if (off)
skb_reserve(skb, fep->rx_align + 1 - off);
- bdp->cbd_bufaddr = cpu_to_fec32(dma_map_single(&fep->pdev->dev, skb->data, FEC_ENET_RX_FRSIZE - fep->rx_align, DMA_FROM_DEVICE));
- if (dma_mapping_error(&fep->pdev->dev, fec32_to_cpu(bdp->cbd_bufaddr))) {
+ dmabuf = dma_map_single(&fep->pdev->dev, skb->data,
+ FEC_ENET_RX_FRSIZE - fep->rx_align,
+ DMA_FROM_DEVICE);
+ if (dma_mapping_error(&fep->pdev->dev, dmabuf)) {
if (net_ratelimit())
netdev_err(ndev, "Rx DMA memory map failed\n");
return -ENOMEM;
}
+ bdp->cbd_bufaddr = cpu_to_fec32(dmabuf);
return 0;
}
--
2.5.0
Powered by blists - more mailing lists