I'm trying to write a patch to allow rx-fcs on the igb driver
(82580 chipset).
I tried the patch below, but when I then enable rx-fcs, traffic
rx breaks and I see Rx-FIFO error counts increasing. I'm testing
with 1024 byte UDP payloads, at 56kpbs.
First, if anyone sees an obvious problem with the patch, please
let me know...but more importantly, what developer's manual
is valid for the igb supported hardware? I found the '316080.pdf'
that seems valid for e1000e, but I'm not sure it works for igb
as well?
Here's the patch that doesn't work right:
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c
b/drivers/net/ethernet/intel/igb/igb_main.c
index 94be6c3..6bea9fb 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -1767,10 +1767,16 @@ static int igb_set_features(struct net_device *netdev,
netdev_features_t features)
{
netdev_features_t changed = netdev->features ^ features;
+ struct igb_adapter *adapter = netdev_priv(netdev);
if (changed & NETIF_F_HW_VLAN_RX)
igb_vlan_mode(netdev, features);
+ if (changed & NETIF_F_RXFCS) {
+ netdev->features = features;
+ igb_setup_rctl(adapter);
+ }
+
return 0;
}
@@ -1952,6 +1958,7 @@ static int __devinit igb_probe(struct pci_dev *pdev,
/* copy netdev features into list of user selectable features */
netdev->hw_features |= netdev->features;
+ netdev->hw_features |= NETIF_F_RXFCS;
/* set this bit last since it cannot be part of hw_features */
netdev->features |= NETIF_F_HW_VLAN_FILTER;
@@ -2964,6 +2971,7 @@ static void igb_setup_mrqc(struct igb_adapter *adapter)
void igb_setup_rctl(struct igb_adapter *adapter)
{
struct e1000_hw *hw = &adapter->hw;
+ struct net_device *netdev = adapter->netdev;
u32 rctl;
rctl = rd32(E1000_RCTL);
@@ -2979,7 +2987,10 @@ void igb_setup_rctl(struct igb_adapter *adapter)
* redirection as it did with e1000. Newer features require
* that the HW strips the CRC.
*/
- rctl |= E1000_RCTL_SECRC;
+ if (netdev->features & NETIF_F_RXFCS)
+ rctl &= ~E1000_RCTL_SECRC;
+ else
+ rctl |= E1000_RCTL_SECRC;
/* disable store bad packets and clear size bits. */
rctl &= ~(E1000_RCTL_SBP | E1000_RCTL_SZ_256);
@@ -6106,7 +6117,11 @@ static bool igb_clean_rx_irq(struct igb_q_vector
*q_vector, int budget)
igb_rx_checksum(rx_ring, rx_desc, skb);
igb_rx_vlan(rx_ring, rx_desc, skb);
- total_bytes += skb->len;
+ if (unlikely(rx_ring->netdev->features & NETIF_F_RXFCS))
+ total_bytes += (skb->len - 4);
+ else
+ total_bytes += skb->len;
+
total_packets++;
skb->protocol = eth_type_trans(skb, rx_ring->netdev);
--
Ben Greear <[email protected]>
Candela Technologies Inc http://www.candelatech.com
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
E1000-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit
http://communities.intel.com/community/wired