e1000: Support RX-ALL flag.
Subsystems (3)
PATCH v4 1/1 e1000: Support RX-ALL flag.
From: Ben Greear <[email protected]>
This allows the NIC to receive errored frames (bad FCS, etc) and pass them up the stack. This can be useful when using sniffers.
---
:100644 100644 a680ee6... ab2f748... M drivers/net/ethernet/intel/e1000/e1000_main.c
drivers/net/ethernet/intel/e1000/e1000_main.c | 22 ++++++++++++++++++++-- 1 files changed, 20 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/e1000/e1000_main.c +20 -2
@@ -826,9 +826,10 @@ static int e1000_set_features(struct net_device *netdev,if (changed &NETIF_F_HW_VLAN_RX )e1000_vlan_mode (netdev, features); -if (!(changed &NETIF_F_RXCSUM )) +if (!(changed & (NETIF_F_RXCSUM |NETIF_F_RXALL )))return 0 ; + netdev->features = features; adapter->rx_csum = !!(features &NETIF_F_RXCSUM );if (netif_running (netdev))
@@ -1074,6 +1075,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev, netdev->features |= netdev->hw_features; netdev->hw_features |=NETIF_F_RXCSUM ; netdev->hw_features |=NETIF_F_RXFCS ; + netdev->hw_features |=NETIF_F_RXALL ;if (pci_using_dac) { netdev->features |=NETIF_F_HIGHDMA ;
@@ -1807,7 +1809,7 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter) rctl &= ~(3 <<E1000_RCTL_MO_SHIFT ); rctl |=E1000_RCTL_BAM |E1000_RCTL_LBM_NO | -E1000_RCTL_RDMTS_HALF | +E1000_RCTL_RDMTS_HALF |E1000_RCTL_DPF | (hw->mc_filter_type <<E1000_RCTL_MO_SHIFT );if (hw->tbi_compatibility_on ==1 )
@@ -1840,6 +1842,16 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)break ; } +/* This is useful for sniffing bad packets. */ +if (adapter->netdev->features &NETIF_F_RXALL ) { +/* UPE and MPE will be handled by normal PROMISC logic +* in e1000e_set_rx_mode */ + rctl |= (E1000_RCTL_SBP |/* Receive bad packets */ +E1000_RCTL_PMCF );/* RX All MAC Ctrl Pkts */ + + rctl &= ~(E1000_RCTL_DPF );/* Allow filtered pause */ + } +ew32 (RCTL , rctl); }
@@ -3845,6 +3857,8 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter, irq_flags); length--; }else { +if (netdev->features &NETIF_F_RXALL ) + goto process_skb;/* recycle both page and skb */ buffer_info->skb = skb;/* an error means any chain goes out the window
@@ -3857,6 +3871,7 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter, }#define rxtop rx_ring->rx_skb_top +process_skb:if (!(status &E1000_RXD_STAT_EOP )) {/* this descriptor is only the beginning (or middle) */ if (!rxtop) {
@@ -4066,12 +4081,15 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter, flags); length--; }else { +if (netdev->features &NETIF_F_RXALL ) + goto process_skb;/* recycle */ buffer_info->skb = skb; goto next_desc; } } +process_skb: total_rx_bytes += (length -4 );/* don't count FCS */ total_rx_packets++;
Signature · 1 line
1.7.3.4
Quoted 7 lines · On Thu, 2012-03-29 at 15:47 -0700, [email protected] wrote:
From: Ben Greear <[email protected]>
This allows the NIC to receive errored frames (bad FCS, etc) and pass them up the stack. This can be useful when using sniffers.
Quoted 7 lines
Signed-off-by Ben Greear <[email protected]>---
:100644 100644 a680ee6... ab2f748...
Mdrivers/net/ethernet/intel/e1000/e1000_main.cdrivers/net/ethernet/intel/e1000/e1000_main.c | 22 ++++++++++++++++++++-- 1 files changed, 20 insertions(+), 2 deletions(-)
FYI- I was just about to push this upstream :) Thanks Ben!
This is the same patch Aaron has tested in-house.
Quoted 16 lines · Jeff Kirsher
Quoted 7 lines · On Thu, 2012-03-29 at 15:47 -0700, [email protected] wrote:
From: Ben Greear<[email protected]>
This allows the NIC to receive errored frames (bad FCS, etc) and pass them up the stack. This can be useful when using sniffers.
Quoted 7 lines
Signed-off-by Ben Greear<[email protected]>---
:100644 100644 a680ee6... ab2f748...
Mdrivers/net/ethernet/intel/e1000/e1000_main.cdrivers/net/ethernet/intel/e1000/e1000_main.c | 22 ++++++++++++++++++++-- 1 files changed, 20 insertions(+), 2 deletions(-)
Quoted 3 lines
FYI- I was just about to push this upstream :) Thanks Ben!
This is the same patch Aaron has tested in-house.
Sounds good.
From what I recall, igb is missing rx-fcs (and it may not be possible to support the feature..chipset seems to act weird), but I think that takes care of the rest of the 10/100/1000 Intel NICs.
I'll see if I can add some support for ixgbe when I get a chance. That would take care of all the NICs I normally use I think...
Thanks,
Ben
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com