diff options
author | Fabio Estevam <fabio.estevam@freescale.com> | 2015-03-13 13:07:54 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-13 13:10:37 -0400 |
commit | a2fe37b69d4fe369c284d50927193fed81c238a0 (patch) | |
tree | 1aa187f3cd775d3822a411baa15e1f21b032ea91 /drivers/net/ethernet/freescale/fec_main.c | |
parent | 40fb70f3aa0a67d28a30c854d4e7aa10b0511db9 (diff) |
Revert "net: fec: fix the warning found by dma debug"
This reverts commit 2b995f63987013bacde99168218f9c7b252bdcf1.
Панов Андрей reported the following regression:
"Commit 2b995f63987013bacde99168218f9c7b252bdcf1 in 4.0.0-rc3 introduces a
nasty bug in transmit, corrupting packets.
To reproduce:
$ dd if=/dev/zero of=zeros bs=1M count=20
$ md5sum -b zeros
8f4e33f3dc3e414ff94e5fb6905cba8c *zeros
This checksum is correct.
Copy file "zeros" to another host with NFS, and it gets corrupted, checksum is
changed.
File should be big, small amounts of transmit isn't affected.
I use an i.MX6 Quad board.
If this commit is reverted, all works fine."
Reported-by: Панов Андрей <rockford@yandex.ru>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/freescale/fec_main.c')
-rw-r--r-- | drivers/net/ethernet/freescale/fec_main.c | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 787db5026191..78e1ce09b1ab 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
@@ -1189,13 +1189,12 @@ static void | |||
1189 | fec_enet_tx_queue(struct net_device *ndev, u16 queue_id) | 1189 | fec_enet_tx_queue(struct net_device *ndev, u16 queue_id) |
1190 | { | 1190 | { |
1191 | struct fec_enet_private *fep; | 1191 | struct fec_enet_private *fep; |
1192 | struct bufdesc *bdp, *bdp_t; | 1192 | struct bufdesc *bdp; |
1193 | unsigned short status; | 1193 | unsigned short status; |
1194 | struct sk_buff *skb; | 1194 | struct sk_buff *skb; |
1195 | struct fec_enet_priv_tx_q *txq; | 1195 | struct fec_enet_priv_tx_q *txq; |
1196 | struct netdev_queue *nq; | 1196 | struct netdev_queue *nq; |
1197 | int index = 0; | 1197 | int index = 0; |
1198 | int i, bdnum; | ||
1199 | int entries_free; | 1198 | int entries_free; |
1200 | 1199 | ||
1201 | fep = netdev_priv(ndev); | 1200 | fep = netdev_priv(ndev); |
@@ -1216,29 +1215,18 @@ fec_enet_tx_queue(struct net_device *ndev, u16 queue_id) | |||
1216 | if (bdp == txq->cur_tx) | 1215 | if (bdp == txq->cur_tx) |
1217 | break; | 1216 | break; |
1218 | 1217 | ||
1219 | bdp_t = bdp; | 1218 | index = fec_enet_get_bd_index(txq->tx_bd_base, bdp, fep); |
1220 | bdnum = 1; | ||
1221 | index = fec_enet_get_bd_index(txq->tx_bd_base, bdp_t, fep); | ||
1222 | skb = txq->tx_skbuff[index]; | ||
1223 | while (!skb) { | ||
1224 | bdp_t = fec_enet_get_nextdesc(bdp_t, fep, queue_id); | ||
1225 | index = fec_enet_get_bd_index(txq->tx_bd_base, bdp_t, fep); | ||
1226 | skb = txq->tx_skbuff[index]; | ||
1227 | bdnum++; | ||
1228 | } | ||
1229 | if (skb_shinfo(skb)->nr_frags && | ||
1230 | (status = bdp_t->cbd_sc) & BD_ENET_TX_READY) | ||
1231 | break; | ||
1232 | 1219 | ||
1233 | for (i = 0; i < bdnum; i++) { | 1220 | skb = txq->tx_skbuff[index]; |
1234 | if (!IS_TSO_HEADER(txq, bdp->cbd_bufaddr)) | ||
1235 | dma_unmap_single(&fep->pdev->dev, bdp->cbd_bufaddr, | ||
1236 | bdp->cbd_datlen, DMA_TO_DEVICE); | ||
1237 | bdp->cbd_bufaddr = 0; | ||
1238 | if (i < bdnum - 1) | ||
1239 | bdp = fec_enet_get_nextdesc(bdp, fep, queue_id); | ||
1240 | } | ||
1241 | txq->tx_skbuff[index] = NULL; | 1221 | txq->tx_skbuff[index] = NULL; |
1222 | if (!IS_TSO_HEADER(txq, bdp->cbd_bufaddr)) | ||
1223 | dma_unmap_single(&fep->pdev->dev, bdp->cbd_bufaddr, | ||
1224 | bdp->cbd_datlen, DMA_TO_DEVICE); | ||
1225 | bdp->cbd_bufaddr = 0; | ||
1226 | if (!skb) { | ||
1227 | bdp = fec_enet_get_nextdesc(bdp, fep, queue_id); | ||
1228 | continue; | ||
1229 | } | ||
1242 | 1230 | ||
1243 | /* Check for errors. */ | 1231 | /* Check for errors. */ |
1244 | if (status & (BD_ENET_TX_HB | BD_ENET_TX_LC | | 1232 | if (status & (BD_ENET_TX_HB | BD_ENET_TX_LC | |