On Fri, Jul 17, 2015 at 6:26 PM, Otavio Salvador
<[email protected]> wrote:

> The patch has dropped the revert of patch 2b995f63 (your commit a2fe37b6).
>
> I checked the FEC source code to try to do the merge byhand and I
> didn't feel confident to do so. Can you take a look and let me know
> your though?

Here is the patch adapted for 3.14.38. I only recommend applying after
someone could test and confirm that the original problem is fixed.

Regards,

Fabio Estevam
From bad7695cfc339c4c583f5130acf2037663cb5f13 Mon Sep 17 00:00:00 2001
From: Fabio Estevam <[email protected]>
Date: Sat, 18 Jul 2015 12:47:43 -0300
Subject: [PATCH] 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: Панов Андрей <[email protected]>
Signed-off-by: Fabio Estevam <[email protected]>
Signed-off-by: David S. Miller <[email protected]>

Signed-off-by: Fabio Estevam <[email protected]>
---
 drivers/net/ethernet/freescale/fec_main.c | 32 +++++++++++--------------------
 1 file changed, 11 insertions(+), 21 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c 
b/drivers/net/ethernet/freescale/fec_main.c
index 20dc442..4d2450d 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1192,13 +1192,12 @@ static void
 fec_enet_tx_queue(struct net_device *ndev, u16 queue_id)
 {
        struct  fec_enet_private *fep;
-       struct bufdesc *bdp, *bdp_t;
+       struct bufdesc *bdp;
        unsigned short status;
        struct  sk_buff *skb;
        struct fec_enet_priv_tx_q *txq;
        struct netdev_queue *nq;
        int     index = 0;
-       int     i, bdnum;
        int     entries_free;
 
        fep = netdev_priv(ndev);
@@ -1219,28 +1218,19 @@ fec_enet_tx_queue(struct net_device *ndev, u16 queue_id)
                if (bdp == txq->cur_tx)
                        break;
 
-               bdp_t = bdp;
-               bdnum = 1;
-               index = fec_enet_get_bd_index(txq->tx_bd_base, bdp_t, fep);
+               index = fec_enet_get_bd_index(txq->tx_bd_base, bdp, fep);
+
                skb = txq->tx_skbuff[index];
-               while (!skb) {
-                       bdp_t = fec_enet_get_nextdesc(bdp_t, fep, queue_id);
-                       index = fec_enet_get_bd_index(txq->tx_bd_base, bdp_t, 
fep);
-                       skb = txq->tx_skbuff[index];
-                       bdnum++;
-               }
-               if ((status = bdp_t->cbd_sc) & BD_ENET_TX_READY)
-                       break;
+               txq->tx_skbuff[index] = NULL;
 
-               for (i = 0; i < bdnum; i++) {
-                       if (!IS_TSO_HEADER(txq, bdp->cbd_bufaddr))
-                               dma_unmap_single(&fep->pdev->dev, 
bdp->cbd_bufaddr,
-                                                bdp->cbd_datlen, 
DMA_TO_DEVICE);
-                       bdp->cbd_bufaddr = 0;
-                       if (i < bdnum - 1)
-                               bdp = fec_enet_get_nextdesc(bdp, fep, queue_id);
+               if (!IS_TSO_HEADER(txq, bdp->cbd_bufaddr))
+                       dma_unmap_single(&fep->pdev->dev, bdp->cbd_bufaddr,
+                                       bdp->cbd_datlen, DMA_TO_DEVICE);
+               bdp->cbd_bufaddr = 0;
+               if (!skb) {
+                       bdp = fec_enet_get_nextdesc(bdp, fep, queue_id);
+                       continue;
                }
-               txq->tx_skbuff[index] = NULL;
 
                /* Check for errors. */
                if (status & (BD_ENET_TX_HB | BD_ENET_TX_LC |
-- 
1.9.1

-- 
_______________________________________________
meta-freescale mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-freescale

Reply via email to