diff options
author | Alexander Duyck <alexander.h.duyck@intel.com> | 2011-08-26 03:45:36 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2011-10-08 01:37:24 -0400 |
commit | 866cff06903ed63b7410c75ce8d4e0c86127a563 (patch) | |
tree | 9d8c622754a5f8be5ca6b3d77d1b538cc893d617 /drivers/net/ethernet/intel | |
parent | 6ad4edfcd7b6321da34e7cd0c88dd97adddd7f57 (diff) |
igb: Consolidate all of the ring feature flags into a single value
This change moves all of the ring flags into a single value. The advantage
to this is that there is one central area for all of these flags and they
can all make use of the set/test bit operations.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel')
-rw-r--r-- | drivers/net/ethernet/intel/igb/igb.h | 10 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/igb/igb_main.c | 23 |
2 files changed, 19 insertions, 14 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h index 9e4bed37d9be..0df040ad1d54 100644 --- a/drivers/net/ethernet/intel/igb/igb.h +++ b/drivers/net/ethernet/intel/igb/igb.h | |||
@@ -237,10 +237,12 @@ struct igb_ring { | |||
237 | int numa_node; /* node to alloc ring memory on */ | 237 | int numa_node; /* node to alloc ring memory on */ |
238 | }; | 238 | }; |
239 | 239 | ||
240 | #define IGB_RING_FLAG_RX_CSUM 0x00000001 /* RX CSUM enabled */ | 240 | enum e1000_ring_flags_t { |
241 | #define IGB_RING_FLAG_RX_SCTP_CSUM 0x00000002 /* SCTP CSUM offload enabled */ | 241 | IGB_RING_FLAG_RX_CSUM, |
242 | 242 | IGB_RING_FLAG_RX_SCTP_CSUM, | |
243 | #define IGB_RING_FLAG_TX_CTX_IDX 0x00000001 /* HW requires context index */ | 243 | IGB_RING_FLAG_TX_CTX_IDX, |
244 | IGB_RING_FLAG_TX_DETECT_HANG | ||
245 | }; | ||
244 | 246 | ||
245 | #define IGB_TXD_DCMD (E1000_ADVTXD_DCMD_EOP | E1000_ADVTXD_DCMD_RS) | 247 | #define IGB_TXD_DCMD (E1000_ADVTXD_DCMD_EOP | E1000_ADVTXD_DCMD_RS) |
246 | 248 | ||
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 3a5c75dda526..f339de97c5b6 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
@@ -708,7 +708,7 @@ static int igb_alloc_queues(struct igb_adapter *adapter) | |||
708 | ring->numa_node = adapter->node; | 708 | ring->numa_node = adapter->node; |
709 | /* For 82575, context index must be unique per ring. */ | 709 | /* For 82575, context index must be unique per ring. */ |
710 | if (adapter->hw.mac.type == e1000_82575) | 710 | if (adapter->hw.mac.type == e1000_82575) |
711 | ring->flags = IGB_RING_FLAG_TX_CTX_IDX; | 711 | set_bit(IGB_RING_FLAG_TX_CTX_IDX, &ring->flags); |
712 | adapter->tx_ring[i] = ring; | 712 | adapter->tx_ring[i] = ring; |
713 | } | 713 | } |
714 | /* Restore the adapter's original node */ | 714 | /* Restore the adapter's original node */ |
@@ -732,10 +732,11 @@ static int igb_alloc_queues(struct igb_adapter *adapter) | |||
732 | ring->dev = &adapter->pdev->dev; | 732 | ring->dev = &adapter->pdev->dev; |
733 | ring->netdev = adapter->netdev; | 733 | ring->netdev = adapter->netdev; |
734 | ring->numa_node = adapter->node; | 734 | ring->numa_node = adapter->node; |
735 | ring->flags = IGB_RING_FLAG_RX_CSUM; /* enable rx checksum */ | 735 | /* enable rx checksum */ |
736 | set_bit(IGB_RING_FLAG_RX_CSUM, &ring->flags); | ||
736 | /* set flag indicating ring supports SCTP checksum offload */ | 737 | /* set flag indicating ring supports SCTP checksum offload */ |
737 | if (adapter->hw.mac.type >= e1000_82576) | 738 | if (adapter->hw.mac.type >= e1000_82576) |
738 | ring->flags |= IGB_RING_FLAG_RX_SCTP_CSUM; | 739 | set_bit(IGB_RING_FLAG_RX_SCTP_CSUM, &ring->flags); |
739 | adapter->rx_ring[i] = ring; | 740 | adapter->rx_ring[i] = ring; |
740 | } | 741 | } |
741 | /* Restore the adapter's original node */ | 742 | /* Restore the adapter's original node */ |
@@ -1822,9 +1823,11 @@ static int igb_set_features(struct net_device *netdev, u32 features) | |||
1822 | 1823 | ||
1823 | for (i = 0; i < adapter->num_rx_queues; i++) { | 1824 | for (i = 0; i < adapter->num_rx_queues; i++) { |
1824 | if (features & NETIF_F_RXCSUM) | 1825 | if (features & NETIF_F_RXCSUM) |
1825 | adapter->rx_ring[i]->flags |= IGB_RING_FLAG_RX_CSUM; | 1826 | set_bit(IGB_RING_FLAG_RX_CSUM, |
1827 | &adapter->rx_ring[i]->flags); | ||
1826 | else | 1828 | else |
1827 | adapter->rx_ring[i]->flags &= ~IGB_RING_FLAG_RX_CSUM; | 1829 | clear_bit(IGB_RING_FLAG_RX_CSUM, |
1830 | &adapter->rx_ring[i]->flags); | ||
1828 | } | 1831 | } |
1829 | 1832 | ||
1830 | if (changed & NETIF_F_HW_VLAN_RX) | 1833 | if (changed & NETIF_F_HW_VLAN_RX) |
@@ -4035,7 +4038,7 @@ void igb_tx_ctxtdesc(struct igb_ring *tx_ring, u32 vlan_macip_lens, | |||
4035 | type_tucmd |= E1000_TXD_CMD_DEXT | E1000_ADVTXD_DTYP_CTXT; | 4038 | type_tucmd |= E1000_TXD_CMD_DEXT | E1000_ADVTXD_DTYP_CTXT; |
4036 | 4039 | ||
4037 | /* For 82575, context index must be unique per ring. */ | 4040 | /* For 82575, context index must be unique per ring. */ |
4038 | if (tx_ring->flags & IGB_RING_FLAG_TX_CTX_IDX) | 4041 | if (test_bit(IGB_RING_FLAG_TX_CTX_IDX, &tx_ring->flags)) |
4039 | mss_l4len_idx |= tx_ring->reg_idx << 4; | 4042 | mss_l4len_idx |= tx_ring->reg_idx << 4; |
4040 | 4043 | ||
4041 | context_desc->vlan_macip_lens = cpu_to_le32(vlan_macip_lens); | 4044 | context_desc->vlan_macip_lens = cpu_to_le32(vlan_macip_lens); |
@@ -4202,7 +4205,7 @@ static void igb_tx_olinfo_status(struct igb_ring *tx_ring, | |||
4202 | 4205 | ||
4203 | /* 82575 requires a unique index per ring if any offload is enabled */ | 4206 | /* 82575 requires a unique index per ring if any offload is enabled */ |
4204 | if ((tx_flags & (IGB_TX_FLAGS_CSUM | IGB_TX_FLAGS_VLAN)) && | 4207 | if ((tx_flags & (IGB_TX_FLAGS_CSUM | IGB_TX_FLAGS_VLAN)) && |
4205 | (tx_ring->flags & IGB_RING_FLAG_TX_CTX_IDX)) | 4208 | test_bit(IGB_RING_FLAG_TX_CTX_IDX, &tx_ring->flags)) |
4206 | olinfo_status |= tx_ring->reg_idx << 4; | 4209 | olinfo_status |= tx_ring->reg_idx << 4; |
4207 | 4210 | ||
4208 | /* insert L4 checksum */ | 4211 | /* insert L4 checksum */ |
@@ -5828,7 +5831,7 @@ static inline void igb_rx_checksum(struct igb_ring *ring, | |||
5828 | skb_checksum_none_assert(skb); | 5831 | skb_checksum_none_assert(skb); |
5829 | 5832 | ||
5830 | /* Ignore Checksum bit is set or checksum is disabled through ethtool */ | 5833 | /* Ignore Checksum bit is set or checksum is disabled through ethtool */ |
5831 | if (!(ring->flags & IGB_RING_FLAG_RX_CSUM) || | 5834 | if (!test_bit(IGB_RING_FLAG_RX_CSUM, &ring->flags) || |
5832 | (status_err & E1000_RXD_STAT_IXSM)) | 5835 | (status_err & E1000_RXD_STAT_IXSM)) |
5833 | return; | 5836 | return; |
5834 | 5837 | ||
@@ -5840,8 +5843,8 @@ static inline void igb_rx_checksum(struct igb_ring *ring, | |||
5840 | * L4E bit is set incorrectly on 64 byte (60 byte w/o crc) | 5843 | * L4E bit is set incorrectly on 64 byte (60 byte w/o crc) |
5841 | * packets, (aka let the stack check the crc32c) | 5844 | * packets, (aka let the stack check the crc32c) |
5842 | */ | 5845 | */ |
5843 | if ((skb->len == 60) && | 5846 | if (!((skb->len == 60) && |
5844 | (ring->flags & IGB_RING_FLAG_RX_SCTP_CSUM)) { | 5847 | test_bit(IGB_RING_FLAG_RX_SCTP_CSUM, &ring->flags))) { |
5845 | u64_stats_update_begin(&ring->rx_syncp); | 5848 | u64_stats_update_begin(&ring->rx_syncp); |
5846 | ring->rx_stats.csum_err++; | 5849 | ring->rx_stats.csum_err++; |
5847 | u64_stats_update_end(&ring->rx_syncp); | 5850 | u64_stats_update_end(&ring->rx_syncp); |