e1000: remove CRC bytes from measured packet length
authorAuke Kok <auke\-jan.h.kok@intel.com>
Fri, 14 Jul 2006 23:14:34 +0000 (16:14 -0700)
committerAuke Kok <juke-jan.h.kok@intel.com>
Fri, 14 Jul 2006 23:14:34 +0000 (16:14 -0700)
After removing the hardware CRC stripping which causes problems with
SOL and related issues, we need to compensate for this changed size.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
drivers/net/e1000/e1000_main.c

index 1c6bcad5b910d050b153f0ea755ee300fd29bbf9..0074a3a506a53dc5b86b26f18c65d0ed8556ed7e 100644 (file)
@@ -3673,6 +3673,9 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter,
 
                length = le16_to_cpu(rx_desc->length);
 
+               /* adjust length to remove Ethernet CRC */
+               length -= 4;
+
                if (unlikely(!(status & E1000_RXD_STAT_EOP))) {
                        /* All receives must fit into a single buffer */
                        E1000_DBG("%s: Receive packet consumed multiple"
@@ -3877,8 +3880,9 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
                        pci_dma_sync_single_for_device(pdev,
                                ps_page_dma->ps_page_dma[0],
                                PAGE_SIZE, PCI_DMA_FROMDEVICE);
+                       /* remove the CRC */
+                       l1 -= 4;
                        skb_put(skb, l1);
-                       length += l1;
                        goto copydone;
                } /* if */
                }
@@ -3897,6 +3901,10 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
                        skb->truesize += length;
                }
 
+               /* strip the ethernet crc, problem is we're using pages now so
+                * this whole operation can get a little cpu intensive */
+               pskb_trim(skb, skb->len - 4);
+
 copydone:
                e1000_rx_checksum(adapter, staterr,
                                  le16_to_cpu(rx_desc->wb.lower.hi_dword.csum_ip.csum), skb);