e1000e: fix IPMI traffic

Some users reported that they have machines with BMCs enabled that cannot
receive IPMI traffic after e1000e is loaded.
http://marc.info/?l=e1000-devel&m=121909039127414&w=2
http://marc.info/?l=e1000-devel&m=121365543823387&w=2

This fixes the issue if they load with the new parameter = 0 by disabling
crc stripping, but leaves the performance feature on for most users.
Based on work done by Hong Zhang.

Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by Jeff Kirsher and committed by David S. Miller eb7c3adb e82f54ba

+51 -2
+5
drivers/net/e1000e/e1000.h
··· 299 unsigned long led_status; 300 301 unsigned int flags; 302 struct work_struct downshift_task; 303 struct work_struct update_phy_task; 304 }; ··· 307 struct e1000_info { 308 enum e1000_mac_type mac; 309 unsigned int flags; 310 u32 pba; 311 s32 (*get_variants)(struct e1000_adapter *); 312 struct e1000_mac_operations *mac_ops; ··· 348 #define FLAG_TSO_FORCE (1 << 29) 349 #define FLAG_RX_RESTART_NOW (1 << 30) 350 #define FLAG_MSI_TEST_FAILED (1 << 31) 351 352 #define E1000_RX_DESC_PS(R, i) \ 353 (&(((union e1000_rx_desc_packet_split *)((R).desc))[i]))
··· 299 unsigned long led_status; 300 301 unsigned int flags; 302 + unsigned int flags2; 303 struct work_struct downshift_task; 304 struct work_struct update_phy_task; 305 }; ··· 306 struct e1000_info { 307 enum e1000_mac_type mac; 308 unsigned int flags; 309 + unsigned int flags2; 310 u32 pba; 311 s32 (*get_variants)(struct e1000_adapter *); 312 struct e1000_mac_operations *mac_ops; ··· 346 #define FLAG_TSO_FORCE (1 << 29) 347 #define FLAG_RX_RESTART_NOW (1 << 30) 348 #define FLAG_MSI_TEST_FAILED (1 << 31) 349 + 350 + /* CRC Stripping defines */ 351 + #define FLAG2_CRC_STRIPPING (1 << 0) 352 353 #define E1000_RX_DESC_PS(R, i) \ 354 (&(((union e1000_rx_desc_packet_split *)((R).desc))[i]))
+21 -2
drivers/net/e1000e/netdev.c
··· 499 goto next_desc; 500 } 501 502 total_rx_bytes += length; 503 total_rx_packets++; 504 ··· 808 pci_dma_sync_single_for_device(pdev, ps_page->dma, 809 PAGE_SIZE, PCI_DMA_FROMDEVICE); 810 811 skb_put(skb, l1); 812 goto copydone; 813 } /* if */ ··· 832 skb->data_len += length; 833 skb->truesize += length; 834 } 835 836 copydone: 837 total_rx_bytes += skb->len; ··· 2315 else 2316 rctl |= E1000_RCTL_LPE; 2317 2318 - /* Enable hardware CRC frame stripping */ 2319 - rctl |= E1000_RCTL_SECRC; 2320 2321 /* Setup buffer sizes */ 2322 rctl &= ~E1000_RCTL_SZ_4096; ··· 4784 adapter->ei = ei; 4785 adapter->pba = ei->pba; 4786 adapter->flags = ei->flags; 4787 adapter->hw.adapter = adapter; 4788 adapter->hw.mac.type = ei->mac; 4789 adapter->msg_enable = (1 << NETIF_MSG_DRV | NETIF_MSG_PROBE) - 1;
··· 499 goto next_desc; 500 } 501 502 + /* adjust length to remove Ethernet CRC */ 503 + if (!(adapter->flags2 & FLAG2_CRC_STRIPPING)) 504 + length -= 4; 505 + 506 total_rx_bytes += length; 507 total_rx_packets++; 508 ··· 804 pci_dma_sync_single_for_device(pdev, ps_page->dma, 805 PAGE_SIZE, PCI_DMA_FROMDEVICE); 806 807 + /* remove the CRC */ 808 + if (!(adapter->flags2 & FLAG2_CRC_STRIPPING)) 809 + l1 -= 4; 810 + 811 skb_put(skb, l1); 812 goto copydone; 813 } /* if */ ··· 824 skb->data_len += length; 825 skb->truesize += length; 826 } 827 + 828 + /* strip the ethernet crc, problem is we're using pages now so 829 + * this whole operation can get a little cpu intensive 830 + */ 831 + if (!(adapter->flags2 & FLAG2_CRC_STRIPPING)) 832 + pskb_trim(skb, skb->len - 4); 833 834 copydone: 835 total_rx_bytes += skb->len; ··· 2301 else 2302 rctl |= E1000_RCTL_LPE; 2303 2304 + /* Some systems expect that the CRC is included in SMBUS traffic. The 2305 + * hardware strips the CRC before sending to both SMBUS (BMC) and to 2306 + * host memory when this is enabled 2307 + */ 2308 + if (adapter->flags2 & FLAG2_CRC_STRIPPING) 2309 + rctl |= E1000_RCTL_SECRC; 2310 2311 /* Setup buffer sizes */ 2312 rctl &= ~E1000_RCTL_SZ_4096; ··· 4766 adapter->ei = ei; 4767 adapter->pba = ei->pba; 4768 adapter->flags = ei->flags; 4769 + adapter->flags2 = ei->flags2; 4770 adapter->hw.adapter = adapter; 4771 adapter->hw.mac.type = ei->mac; 4772 adapter->msg_enable = (1 << NETIF_MSG_DRV | NETIF_MSG_PROBE) - 1;
+25
drivers/net/e1000e/param.c
··· 151 */ 152 E1000_PARAM(WriteProtectNVM, "Write-protect NVM [WARNING: disabling this can lead to corrupted NVM]"); 153 154 struct e1000_option { 155 enum { enable_option, range_option, list_option } type; 156 const char *name; ··· 412 if ((adapter->flags & FLAG_HAS_SMART_POWER_DOWN) 413 && spd) 414 adapter->flags |= FLAG_SMART_POWER_DOWN; 415 } 416 } 417 { /* Kumeran Lock Loss Workaround */
··· 151 */ 152 E1000_PARAM(WriteProtectNVM, "Write-protect NVM [WARNING: disabling this can lead to corrupted NVM]"); 153 154 + /* 155 + * Enable CRC Stripping 156 + * 157 + * Valid Range: 0, 1 158 + * 159 + * Default Value: 1 (enabled) 160 + */ 161 + E1000_PARAM(CrcStripping, "Enable CRC Stripping, disable if your BMC needs " \ 162 + "the CRC"); 163 + 164 struct e1000_option { 165 enum { enable_option, range_option, list_option } type; 166 const char *name; ··· 402 if ((adapter->flags & FLAG_HAS_SMART_POWER_DOWN) 403 && spd) 404 adapter->flags |= FLAG_SMART_POWER_DOWN; 405 + } 406 + } 407 + { /* CRC Stripping */ 408 + const struct e1000_option opt = { 409 + .type = enable_option, 410 + .name = "CRC Stripping", 411 + .err = "defaulting to enabled", 412 + .def = OPTION_ENABLED 413 + }; 414 + 415 + if (num_CrcStripping > bd) { 416 + unsigned int crc_stripping = CrcStripping[bd]; 417 + e1000_validate_option(&crc_stripping, &opt, adapter); 418 + if (crc_stripping == OPTION_ENABLED) 419 + adapter->flags2 |= FLAG2_CRC_STRIPPING; 420 } 421 } 422 { /* Kumeran Lock Loss Workaround */