diff options
author | Ben Greear <greearb@candelatech.com> | 2012-02-17 08:43:44 -0500 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2012-03-01 02:00:45 -0500 |
commit | 0bf61e66a09793aba617e8918fbf739cd5db8e78 (patch) | |
tree | 3670a14f9e55ca5562015095a6282e940dd3abbb | |
parent | 75f58a537674cdff2122789cfd3cc7a76956ece5 (diff) |
e100: Support RXALL feature flag.
This allows the NIC to receive packets with bad FCS
and other errors. Good for sniffing packets on flakey
networks.
v4: Only flax rx-over-length errors if pkt is beyond
maximum expected packet size, not just beyond the MTU.
This matches the existing logic for this counter.
Signed-off-by: Ben Greear <greearb@candelatech.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r-- | drivers/net/ethernet/intel/e100.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c index 6f9f70a04474..4d8a616fe9cd 100644 --- a/drivers/net/ethernet/intel/e100.c +++ b/drivers/net/ethernet/intel/e100.c | |||
@@ -462,7 +462,7 @@ struct config { | |||
462 | /*5*/ u8 X(tx_dma_max_count:7, dma_max_count_enable:1); | 462 | /*5*/ u8 X(tx_dma_max_count:7, dma_max_count_enable:1); |
463 | /*6*/ u8 X(X(X(X(X(X(X(late_scb_update:1, direct_rx_dma:1), | 463 | /*6*/ u8 X(X(X(X(X(X(X(late_scb_update:1, direct_rx_dma:1), |
464 | tno_intr:1), cna_intr:1), standard_tcb:1), standard_stat_counter:1), | 464 | tno_intr:1), cna_intr:1), standard_tcb:1), standard_stat_counter:1), |
465 | rx_discard_overruns:1), rx_save_bad_frames:1); | 465 | rx_save_overruns : 1), rx_save_bad_frames : 1); |
466 | /*7*/ u8 X(X(X(X(X(rx_discard_short_frames:1, tx_underrun_retry:2), | 466 | /*7*/ u8 X(X(X(X(X(rx_discard_short_frames:1, tx_underrun_retry:2), |
467 | pad7:2), rx_extended_rfd:1), tx_two_frames_in_fifo:1), | 467 | pad7:2), rx_extended_rfd:1), tx_two_frames_in_fifo:1), |
468 | tx_dynamic_tbd:1); | 468 | tx_dynamic_tbd:1); |
@@ -1165,6 +1165,12 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) | |||
1165 | } | 1165 | } |
1166 | } | 1166 | } |
1167 | 1167 | ||
1168 | if (netdev->features & NETIF_F_RXALL) { | ||
1169 | config->rx_save_overruns = 0x1; /* 1=save, 0=discard */ | ||
1170 | config->rx_save_bad_frames = 0x1; /* 1=save, 0=discard */ | ||
1171 | config->rx_discard_short_frames = 0x0; /* 1=discard, 0=save */ | ||
1172 | } | ||
1173 | |||
1168 | netif_printk(nic, hw, KERN_DEBUG, nic->netdev, | 1174 | netif_printk(nic, hw, KERN_DEBUG, nic->netdev, |
1169 | "[00-07]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n", | 1175 | "[00-07]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n", |
1170 | c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7]); | 1176 | c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7]); |
@@ -1999,6 +2005,16 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx, | |||
1999 | skb_put(skb, actual_size); | 2005 | skb_put(skb, actual_size); |
2000 | skb->protocol = eth_type_trans(skb, nic->netdev); | 2006 | skb->protocol = eth_type_trans(skb, nic->netdev); |
2001 | 2007 | ||
2008 | /* If we are receiving all frames, then don't bother | ||
2009 | * checking for errors. | ||
2010 | */ | ||
2011 | if (unlikely(dev->features & NETIF_F_RXALL)) { | ||
2012 | if (actual_size > ETH_DATA_LEN + VLAN_ETH_HLEN + fcs_pad) | ||
2013 | /* Received oversized frame, but keep it. */ | ||
2014 | nic->rx_over_length_errors++; | ||
2015 | goto process_skb; | ||
2016 | } | ||
2017 | |||
2002 | if (unlikely(!(rfd_status & cb_ok))) { | 2018 | if (unlikely(!(rfd_status & cb_ok))) { |
2003 | /* Don't indicate if hardware indicates errors */ | 2019 | /* Don't indicate if hardware indicates errors */ |
2004 | dev_kfree_skb_any(skb); | 2020 | dev_kfree_skb_any(skb); |
@@ -2007,6 +2023,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx, | |||
2007 | nic->rx_over_length_errors++; | 2023 | nic->rx_over_length_errors++; |
2008 | dev_kfree_skb_any(skb); | 2024 | dev_kfree_skb_any(skb); |
2009 | } else { | 2025 | } else { |
2026 | process_skb: | ||
2010 | dev->stats.rx_packets++; | 2027 | dev->stats.rx_packets++; |
2011 | dev->stats.rx_bytes += (actual_size - fcs_pad); | 2028 | dev->stats.rx_bytes += (actual_size - fcs_pad); |
2012 | netif_receive_skb(skb); | 2029 | netif_receive_skb(skb); |
@@ -2758,7 +2775,7 @@ static int e100_set_features(struct net_device *netdev, | |||
2758 | struct nic *nic = netdev_priv(netdev); | 2775 | struct nic *nic = netdev_priv(netdev); |
2759 | netdev_features_t changed = features ^ netdev->features; | 2776 | netdev_features_t changed = features ^ netdev->features; |
2760 | 2777 | ||
2761 | if (!(changed & (NETIF_F_RXFCS))) | 2778 | if (!(changed & (NETIF_F_RXFCS | NETIF_F_RXALL))) |
2762 | return 0; | 2779 | return 0; |
2763 | 2780 | ||
2764 | netdev->features = features; | 2781 | netdev->features = features; |
@@ -2794,6 +2811,7 @@ static int __devinit e100_probe(struct pci_dev *pdev, | |||
2794 | 2811 | ||
2795 | netdev->hw_features |= NETIF_F_RXFCS; | 2812 | netdev->hw_features |= NETIF_F_RXFCS; |
2796 | netdev->priv_flags |= IFF_SUPP_NOFCS; | 2813 | netdev->priv_flags |= IFF_SUPP_NOFCS; |
2814 | netdev->hw_features |= NETIF_F_RXALL; | ||
2797 | 2815 | ||
2798 | netdev->netdev_ops = &e100_netdev_ops; | 2816 | netdev->netdev_ops = &e100_netdev_ops; |
2799 | SET_ETHTOOL_OPS(netdev, &e100_ethtool_ops); | 2817 | SET_ETHTOOL_OPS(netdev, &e100_ethtool_ops); |