drivers: net: davinci_cpdma: remove CRC bytes from skb added by CPDMA
authorMugunthan V N <mugunthanvnm@ti.com>
Wed, 29 May 2013 20:22:01 +0000 (20:22 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 1 Jun 2013 00:25:43 +0000 (17:25 -0700)
Additional 4 bytes found in the skb is the CRC calculated by the
CPDMA hardware, check the CRC bit in CPDMA status field of
Descriptor and remove the CRC length from the skb. This extra
4 byte can be seen when capturing packets using tcpdump.
This has been tested in TI816x platform.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ti/davinci_cpdma.c

index 49dfd592ac1ecd4e0a86d8d5ad01572a97e5c346..a377bc72774084b567642c7dab0e4e89922e4cf6 100644 (file)
@@ -64,6 +64,7 @@
 #define CPDMA_DESC_TO_PORT_EN  BIT(20)
 #define CPDMA_TO_PORT_SHIFT    16
 #define CPDMA_DESC_PORT_MASK   (BIT(18) | BIT(17) | BIT(16))
+#define CPDMA_DESC_CRC_LEN     4
 
 #define CPDMA_TEARDOWN_VALUE   0xfffffffc
 
@@ -798,6 +799,10 @@ static int __cpdma_chan_process(struct cpdma_chan *chan)
                status = -EBUSY;
                goto unlock_ret;
        }
+
+       if (status & CPDMA_DESC_PASS_CRC)
+               outlen -= CPDMA_DESC_CRC_LEN;
+
        status  = status & (CPDMA_DESC_EOQ | CPDMA_DESC_TD_COMPLETE |
                            CPDMA_DESC_PORT_MASK);