diff options
Diffstat (limited to 'drivers/net/ethernet/intel/ixgbe/ixgbe_main.c')
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 299 |
1 files changed, 123 insertions, 176 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index e47e0c470508..4f28621b76e1 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -1128,6 +1128,9 @@ static void ixgbe_tx_timeout_reset(struct ixgbe_adapter *adapter) | |||
1128 | 1128 | ||
1129 | /** | 1129 | /** |
1130 | * ixgbe_tx_maxrate - callback to set the maximum per-queue bitrate | 1130 | * ixgbe_tx_maxrate - callback to set the maximum per-queue bitrate |
1131 | * @netdev: network interface device structure | ||
1132 | * @queue_index: Tx queue to set | ||
1133 | * @maxrate: desired maximum transmit bitrate | ||
1131 | **/ | 1134 | **/ |
1132 | static int ixgbe_tx_maxrate(struct net_device *netdev, | 1135 | static int ixgbe_tx_maxrate(struct net_device *netdev, |
1133 | int queue_index, u32 maxrate) | 1136 | int queue_index, u32 maxrate) |
@@ -1749,9 +1752,15 @@ static void ixgbe_process_skb_fields(struct ixgbe_ring *rx_ring, | |||
1749 | __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid); | 1752 | __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid); |
1750 | } | 1753 | } |
1751 | 1754 | ||
1752 | skb_record_rx_queue(skb, rx_ring->queue_index); | ||
1753 | |||
1754 | skb->protocol = eth_type_trans(skb, dev); | 1755 | skb->protocol = eth_type_trans(skb, dev); |
1756 | |||
1757 | /* record Rx queue, or update MACVLAN statistics */ | ||
1758 | if (netif_is_ixgbe(dev)) | ||
1759 | skb_record_rx_queue(skb, rx_ring->queue_index); | ||
1760 | else | ||
1761 | macvlan_count_rx(netdev_priv(dev), skb->len + ETH_HLEN, true, | ||
1762 | (skb->pkt_type == PACKET_BROADCAST) || | ||
1763 | (skb->pkt_type == PACKET_MULTICAST)); | ||
1755 | } | 1764 | } |
1756 | 1765 | ||
1757 | static void ixgbe_rx_skb(struct ixgbe_q_vector *q_vector, | 1766 | static void ixgbe_rx_skb(struct ixgbe_q_vector *q_vector, |
@@ -1916,10 +1925,13 @@ static bool ixgbe_cleanup_headers(struct ixgbe_ring *rx_ring, | |||
1916 | if (IS_ERR(skb)) | 1925 | if (IS_ERR(skb)) |
1917 | return true; | 1926 | return true; |
1918 | 1927 | ||
1919 | /* verify that the packet does not have any known errors */ | 1928 | /* Verify netdev is present, and that packet does not have any |
1920 | if (unlikely(ixgbe_test_staterr(rx_desc, | 1929 | * errors that would be unacceptable to the netdev. |
1921 | IXGBE_RXDADV_ERR_FRAME_ERR_MASK) && | 1930 | */ |
1922 | !(netdev->features & NETIF_F_RXALL))) { | 1931 | if (!netdev || |
1932 | (unlikely(ixgbe_test_staterr(rx_desc, | ||
1933 | IXGBE_RXDADV_ERR_FRAME_ERR_MASK) && | ||
1934 | !(netdev->features & NETIF_F_RXALL)))) { | ||
1923 | dev_kfree_skb_any(skb); | 1935 | dev_kfree_skb_any(skb); |
1924 | return true; | 1936 | return true; |
1925 | } | 1937 | } |
@@ -2016,8 +2028,8 @@ static bool ixgbe_can_reuse_rx_page(struct ixgbe_rx_buffer *rx_buffer) | |||
2016 | * ixgbe_add_rx_frag - Add contents of Rx buffer to sk_buff | 2028 | * ixgbe_add_rx_frag - Add contents of Rx buffer to sk_buff |
2017 | * @rx_ring: rx descriptor ring to transact packets on | 2029 | * @rx_ring: rx descriptor ring to transact packets on |
2018 | * @rx_buffer: buffer containing page to add | 2030 | * @rx_buffer: buffer containing page to add |
2019 | * @rx_desc: descriptor containing length of buffer written by hardware | ||
2020 | * @skb: sk_buff to place the data into | 2031 | * @skb: sk_buff to place the data into |
2032 | * @size: size of data in rx_buffer | ||
2021 | * | 2033 | * |
2022 | * This function will add the data contained in rx_buffer->page to the skb. | 2034 | * This function will add the data contained in rx_buffer->page to the skb. |
2023 | * This is done either through a direct copy if the data in the buffer is | 2035 | * This is done either through a direct copy if the data in the buffer is |
@@ -3008,6 +3020,8 @@ static inline void ixgbe_irq_disable_queues(struct ixgbe_adapter *adapter, | |||
3008 | /** | 3020 | /** |
3009 | * ixgbe_irq_enable - Enable default interrupt generation settings | 3021 | * ixgbe_irq_enable - Enable default interrupt generation settings |
3010 | * @adapter: board private structure | 3022 | * @adapter: board private structure |
3023 | * @queues: enable irqs for queues | ||
3024 | * @flush: flush register write | ||
3011 | **/ | 3025 | **/ |
3012 | static inline void ixgbe_irq_enable(struct ixgbe_adapter *adapter, bool queues, | 3026 | static inline void ixgbe_irq_enable(struct ixgbe_adapter *adapter, bool queues, |
3013 | bool flush) | 3027 | bool flush) |
@@ -3463,6 +3477,7 @@ static inline void ixgbe_irq_disable(struct ixgbe_adapter *adapter) | |||
3463 | 3477 | ||
3464 | /** | 3478 | /** |
3465 | * ixgbe_configure_msi_and_legacy - Initialize PIN (INTA...) and MSI interrupts | 3479 | * ixgbe_configure_msi_and_legacy - Initialize PIN (INTA...) and MSI interrupts |
3480 | * @adapter: board private structure | ||
3466 | * | 3481 | * |
3467 | **/ | 3482 | **/ |
3468 | static void ixgbe_configure_msi_and_legacy(struct ixgbe_adapter *adapter) | 3483 | static void ixgbe_configure_msi_and_legacy(struct ixgbe_adapter *adapter) |
@@ -3574,7 +3589,7 @@ static void ixgbe_setup_mtqc(struct ixgbe_adapter *adapter) | |||
3574 | { | 3589 | { |
3575 | struct ixgbe_hw *hw = &adapter->hw; | 3590 | struct ixgbe_hw *hw = &adapter->hw; |
3576 | u32 rttdcs, mtqc; | 3591 | u32 rttdcs, mtqc; |
3577 | u8 tcs = netdev_get_num_tc(adapter->netdev); | 3592 | u8 tcs = adapter->hw_tcs; |
3578 | 3593 | ||
3579 | if (hw->mac.type == ixgbe_mac_82598EB) | 3594 | if (hw->mac.type == ixgbe_mac_82598EB) |
3580 | return; | 3595 | return; |
@@ -3929,7 +3944,7 @@ static void ixgbe_setup_mrqc(struct ixgbe_adapter *adapter) | |||
3929 | if (adapter->ring_feature[RING_F_RSS].mask) | 3944 | if (adapter->ring_feature[RING_F_RSS].mask) |
3930 | mrqc = IXGBE_MRQC_RSSEN; | 3945 | mrqc = IXGBE_MRQC_RSSEN; |
3931 | } else { | 3946 | } else { |
3932 | u8 tcs = netdev_get_num_tc(adapter->netdev); | 3947 | u8 tcs = adapter->hw_tcs; |
3933 | 3948 | ||
3934 | if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) { | 3949 | if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) { |
3935 | if (tcs > 4) | 3950 | if (tcs > 4) |
@@ -3991,8 +4006,8 @@ static void ixgbe_setup_mrqc(struct ixgbe_adapter *adapter) | |||
3991 | 4006 | ||
3992 | /** | 4007 | /** |
3993 | * ixgbe_configure_rscctl - enable RSC for the indicated ring | 4008 | * ixgbe_configure_rscctl - enable RSC for the indicated ring |
3994 | * @adapter: address of board private structure | 4009 | * @adapter: address of board private structure |
3995 | * @index: index of ring to set | 4010 | * @ring: structure containing ring specific data |
3996 | **/ | 4011 | **/ |
3997 | static void ixgbe_configure_rscctl(struct ixgbe_adapter *adapter, | 4012 | static void ixgbe_configure_rscctl(struct ixgbe_adapter *adapter, |
3998 | struct ixgbe_ring *ring) | 4013 | struct ixgbe_ring *ring) |
@@ -4848,9 +4863,11 @@ int ixgbe_del_mac_filter(struct ixgbe_adapter *adapter, | |||
4848 | 4863 | ||
4849 | return -ENOMEM; | 4864 | return -ENOMEM; |
4850 | } | 4865 | } |
4866 | |||
4851 | /** | 4867 | /** |
4852 | * ixgbe_write_uc_addr_list - write unicast addresses to RAR table | 4868 | * ixgbe_write_uc_addr_list - write unicast addresses to RAR table |
4853 | * @netdev: network interface device structure | 4869 | * @netdev: network interface device structure |
4870 | * @vfn: pool to associate with unicast addresses | ||
4854 | * | 4871 | * |
4855 | * Writes unicast address list to the RAR table. | 4872 | * Writes unicast address list to the RAR table. |
4856 | * Returns: -ENOMEM on failure/insufficient address space | 4873 | * Returns: -ENOMEM on failure/insufficient address space |
@@ -5197,7 +5214,7 @@ static int ixgbe_lpbthresh(struct ixgbe_adapter *adapter, int pb) | |||
5197 | static void ixgbe_pbthresh_setup(struct ixgbe_adapter *adapter) | 5214 | static void ixgbe_pbthresh_setup(struct ixgbe_adapter *adapter) |
5198 | { | 5215 | { |
5199 | struct ixgbe_hw *hw = &adapter->hw; | 5216 | struct ixgbe_hw *hw = &adapter->hw; |
5200 | int num_tc = netdev_get_num_tc(adapter->netdev); | 5217 | int num_tc = adapter->hw_tcs; |
5201 | int i; | 5218 | int i; |
5202 | 5219 | ||
5203 | if (!num_tc) | 5220 | if (!num_tc) |
@@ -5220,7 +5237,7 @@ static void ixgbe_configure_pb(struct ixgbe_adapter *adapter) | |||
5220 | { | 5237 | { |
5221 | struct ixgbe_hw *hw = &adapter->hw; | 5238 | struct ixgbe_hw *hw = &adapter->hw; |
5222 | int hdrm; | 5239 | int hdrm; |
5223 | u8 tc = netdev_get_num_tc(adapter->netdev); | 5240 | u8 tc = adapter->hw_tcs; |
5224 | 5241 | ||
5225 | if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE || | 5242 | if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE || |
5226 | adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE) | 5243 | adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE) |
@@ -5331,47 +5348,11 @@ static void ixgbe_clean_rx_ring(struct ixgbe_ring *rx_ring) | |||
5331 | rx_ring->next_to_use = 0; | 5348 | rx_ring->next_to_use = 0; |
5332 | } | 5349 | } |
5333 | 5350 | ||
5334 | static void ixgbe_disable_fwd_ring(struct ixgbe_fwd_adapter *vadapter, | ||
5335 | struct ixgbe_ring *rx_ring) | ||
5336 | { | ||
5337 | struct ixgbe_adapter *adapter = vadapter->real_adapter; | ||
5338 | int index = rx_ring->queue_index + vadapter->rx_base_queue; | ||
5339 | |||
5340 | /* shutdown specific queue receive and wait for dma to settle */ | ||
5341 | ixgbe_disable_rx_queue(adapter, rx_ring); | ||
5342 | usleep_range(10000, 20000); | ||
5343 | ixgbe_irq_disable_queues(adapter, BIT_ULL(index)); | ||
5344 | ixgbe_clean_rx_ring(rx_ring); | ||
5345 | } | ||
5346 | |||
5347 | static int ixgbe_fwd_ring_down(struct net_device *vdev, | ||
5348 | struct ixgbe_fwd_adapter *accel) | ||
5349 | { | ||
5350 | struct ixgbe_adapter *adapter = accel->real_adapter; | ||
5351 | unsigned int rxbase = accel->rx_base_queue; | ||
5352 | unsigned int txbase = accel->tx_base_queue; | ||
5353 | int i; | ||
5354 | |||
5355 | netif_tx_stop_all_queues(vdev); | ||
5356 | |||
5357 | for (i = 0; i < adapter->num_rx_queues_per_pool; i++) { | ||
5358 | ixgbe_disable_fwd_ring(accel, adapter->rx_ring[rxbase + i]); | ||
5359 | adapter->rx_ring[rxbase + i]->netdev = adapter->netdev; | ||
5360 | } | ||
5361 | |||
5362 | for (i = 0; i < adapter->num_rx_queues_per_pool; i++) | ||
5363 | adapter->tx_ring[txbase + i]->netdev = adapter->netdev; | ||
5364 | |||
5365 | |||
5366 | return 0; | ||
5367 | } | ||
5368 | |||
5369 | static int ixgbe_fwd_ring_up(struct net_device *vdev, | 5351 | static int ixgbe_fwd_ring_up(struct net_device *vdev, |
5370 | struct ixgbe_fwd_adapter *accel) | 5352 | struct ixgbe_fwd_adapter *accel) |
5371 | { | 5353 | { |
5372 | struct ixgbe_adapter *adapter = accel->real_adapter; | 5354 | struct ixgbe_adapter *adapter = accel->real_adapter; |
5373 | unsigned int rxbase, txbase, queues; | 5355 | int i, baseq, err; |
5374 | int i, baseq, err = 0; | ||
5375 | 5356 | ||
5376 | if (!test_bit(accel->pool, adapter->fwd_bitmask)) | 5357 | if (!test_bit(accel->pool, adapter->fwd_bitmask)) |
5377 | return 0; | 5358 | return 0; |
@@ -5382,38 +5363,30 @@ static int ixgbe_fwd_ring_up(struct net_device *vdev, | |||
5382 | baseq, baseq + adapter->num_rx_queues_per_pool); | 5363 | baseq, baseq + adapter->num_rx_queues_per_pool); |
5383 | 5364 | ||
5384 | accel->netdev = vdev; | 5365 | accel->netdev = vdev; |
5385 | accel->rx_base_queue = rxbase = baseq; | 5366 | accel->rx_base_queue = baseq; |
5386 | accel->tx_base_queue = txbase = baseq; | 5367 | accel->tx_base_queue = baseq; |
5387 | 5368 | ||
5388 | for (i = 0; i < adapter->num_rx_queues_per_pool; i++) | 5369 | for (i = 0; i < adapter->num_rx_queues_per_pool; i++) |
5389 | ixgbe_disable_fwd_ring(accel, adapter->rx_ring[rxbase + i]); | 5370 | adapter->rx_ring[baseq + i]->netdev = vdev; |
5390 | 5371 | ||
5391 | for (i = 0; i < adapter->num_rx_queues_per_pool; i++) { | 5372 | /* Guarantee all rings are updated before we update the |
5392 | adapter->rx_ring[rxbase + i]->netdev = vdev; | 5373 | * MAC address filter. |
5393 | ixgbe_configure_rx_ring(adapter, adapter->rx_ring[rxbase + i]); | 5374 | */ |
5375 | wmb(); | ||
5376 | |||
5377 | /* ixgbe_add_mac_filter will return an index if it succeeds, so we | ||
5378 | * need to only treat it as an error value if it is negative. | ||
5379 | */ | ||
5380 | err = ixgbe_add_mac_filter(adapter, vdev->dev_addr, | ||
5381 | VMDQ_P(accel->pool)); | ||
5382 | if (err >= 0) { | ||
5383 | ixgbe_macvlan_set_rx_mode(vdev, accel->pool, adapter); | ||
5384 | return 0; | ||
5394 | } | 5385 | } |
5395 | 5386 | ||
5396 | for (i = 0; i < adapter->num_rx_queues_per_pool; i++) | 5387 | for (i = 0; i < adapter->num_rx_queues_per_pool; i++) |
5397 | adapter->tx_ring[txbase + i]->netdev = vdev; | 5388 | adapter->rx_ring[baseq + i]->netdev = NULL; |
5398 | |||
5399 | queues = min_t(unsigned int, | ||
5400 | adapter->num_rx_queues_per_pool, vdev->num_tx_queues); | ||
5401 | err = netif_set_real_num_tx_queues(vdev, queues); | ||
5402 | if (err) | ||
5403 | goto fwd_queue_err; | ||
5404 | |||
5405 | err = netif_set_real_num_rx_queues(vdev, queues); | ||
5406 | if (err) | ||
5407 | goto fwd_queue_err; | ||
5408 | |||
5409 | if (is_valid_ether_addr(vdev->dev_addr)) | ||
5410 | ixgbe_add_mac_filter(adapter, vdev->dev_addr, | ||
5411 | VMDQ_P(accel->pool)); | ||
5412 | 5389 | ||
5413 | ixgbe_macvlan_set_rx_mode(vdev, VMDQ_P(accel->pool), adapter); | ||
5414 | return err; | ||
5415 | fwd_queue_err: | ||
5416 | ixgbe_fwd_ring_down(vdev, accel); | ||
5417 | return err; | 5390 | return err; |
5418 | } | 5391 | } |
5419 | 5392 | ||
@@ -5889,21 +5862,6 @@ static void ixgbe_fdir_filter_exit(struct ixgbe_adapter *adapter) | |||
5889 | spin_unlock(&adapter->fdir_perfect_lock); | 5862 | spin_unlock(&adapter->fdir_perfect_lock); |
5890 | } | 5863 | } |
5891 | 5864 | ||
5892 | static int ixgbe_disable_macvlan(struct net_device *upper, void *data) | ||
5893 | { | ||
5894 | if (netif_is_macvlan(upper)) { | ||
5895 | struct macvlan_dev *vlan = netdev_priv(upper); | ||
5896 | |||
5897 | if (vlan->fwd_priv) { | ||
5898 | netif_tx_stop_all_queues(upper); | ||
5899 | netif_carrier_off(upper); | ||
5900 | netif_tx_disable(upper); | ||
5901 | } | ||
5902 | } | ||
5903 | |||
5904 | return 0; | ||
5905 | } | ||
5906 | |||
5907 | void ixgbe_down(struct ixgbe_adapter *adapter) | 5865 | void ixgbe_down(struct ixgbe_adapter *adapter) |
5908 | { | 5866 | { |
5909 | struct net_device *netdev = adapter->netdev; | 5867 | struct net_device *netdev = adapter->netdev; |
@@ -5933,10 +5891,6 @@ void ixgbe_down(struct ixgbe_adapter *adapter) | |||
5933 | netif_carrier_off(netdev); | 5891 | netif_carrier_off(netdev); |
5934 | netif_tx_disable(netdev); | 5892 | netif_tx_disable(netdev); |
5935 | 5893 | ||
5936 | /* disable any upper devices */ | ||
5937 | netdev_walk_all_upper_dev_rcu(adapter->netdev, | ||
5938 | ixgbe_disable_macvlan, NULL); | ||
5939 | |||
5940 | ixgbe_irq_disable(adapter); | 5894 | ixgbe_irq_disable(adapter); |
5941 | 5895 | ||
5942 | ixgbe_napi_disable_all(adapter); | 5896 | ixgbe_napi_disable_all(adapter); |
@@ -6091,6 +6045,7 @@ static void ixgbe_init_dcb(struct ixgbe_adapter *adapter) | |||
6091 | /** | 6045 | /** |
6092 | * ixgbe_sw_init - Initialize general software structures (struct ixgbe_adapter) | 6046 | * ixgbe_sw_init - Initialize general software structures (struct ixgbe_adapter) |
6093 | * @adapter: board private structure to initialize | 6047 | * @adapter: board private structure to initialize |
6048 | * @ii: pointer to ixgbe_info for device | ||
6094 | * | 6049 | * |
6095 | * ixgbe_sw_init initializes the Adapter private data structure. | 6050 | * ixgbe_sw_init initializes the Adapter private data structure. |
6096 | * Fields are initialized based on PCI device information and | 6051 | * Fields are initialized based on PCI device information and |
@@ -6125,6 +6080,7 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter, | |||
6125 | fdir = min_t(int, IXGBE_MAX_FDIR_INDICES, num_online_cpus()); | 6080 | fdir = min_t(int, IXGBE_MAX_FDIR_INDICES, num_online_cpus()); |
6126 | adapter->ring_feature[RING_F_FDIR].limit = fdir; | 6081 | adapter->ring_feature[RING_F_FDIR].limit = fdir; |
6127 | adapter->fdir_pballoc = IXGBE_FDIR_PBALLOC_64K; | 6082 | adapter->fdir_pballoc = IXGBE_FDIR_PBALLOC_64K; |
6083 | adapter->ring_feature[RING_F_VMDQ].limit = 1; | ||
6128 | #ifdef CONFIG_IXGBE_DCA | 6084 | #ifdef CONFIG_IXGBE_DCA |
6129 | adapter->flags |= IXGBE_FLAG_DCA_CAPABLE; | 6085 | adapter->flags |= IXGBE_FLAG_DCA_CAPABLE; |
6130 | #endif | 6086 | #endif |
@@ -6374,6 +6330,7 @@ err_setup_tx: | |||
6374 | 6330 | ||
6375 | /** | 6331 | /** |
6376 | * ixgbe_setup_rx_resources - allocate Rx resources (Descriptors) | 6332 | * ixgbe_setup_rx_resources - allocate Rx resources (Descriptors) |
6333 | * @adapter: pointer to ixgbe_adapter | ||
6377 | * @rx_ring: rx descriptor ring (for a specific queue) to setup | 6334 | * @rx_ring: rx descriptor ring (for a specific queue) to setup |
6378 | * | 6335 | * |
6379 | * Returns 0 on success, negative on failure | 6336 | * Returns 0 on success, negative on failure |
@@ -6624,20 +6581,12 @@ int ixgbe_open(struct net_device *netdev) | |||
6624 | goto err_req_irq; | 6581 | goto err_req_irq; |
6625 | 6582 | ||
6626 | /* Notify the stack of the actual queue counts. */ | 6583 | /* Notify the stack of the actual queue counts. */ |
6627 | if (adapter->num_rx_pools > 1) | 6584 | queues = adapter->num_tx_queues; |
6628 | queues = adapter->num_rx_queues_per_pool; | ||
6629 | else | ||
6630 | queues = adapter->num_tx_queues; | ||
6631 | |||
6632 | err = netif_set_real_num_tx_queues(netdev, queues); | 6585 | err = netif_set_real_num_tx_queues(netdev, queues); |
6633 | if (err) | 6586 | if (err) |
6634 | goto err_set_queues; | 6587 | goto err_set_queues; |
6635 | 6588 | ||
6636 | if (adapter->num_rx_pools > 1 && | 6589 | queues = adapter->num_rx_queues; |
6637 | adapter->num_rx_queues > IXGBE_MAX_L2A_QUEUES) | ||
6638 | queues = IXGBE_MAX_L2A_QUEUES; | ||
6639 | else | ||
6640 | queues = adapter->num_rx_queues; | ||
6641 | err = netif_set_real_num_rx_queues(netdev, queues); | 6590 | err = netif_set_real_num_rx_queues(netdev, queues); |
6642 | if (err) | 6591 | if (err) |
6643 | goto err_set_queues; | 6592 | goto err_set_queues; |
@@ -7194,7 +7143,6 @@ static void ixgbe_check_hang_subtask(struct ixgbe_adapter *adapter) | |||
7194 | /** | 7143 | /** |
7195 | * ixgbe_watchdog_update_link - update the link status | 7144 | * ixgbe_watchdog_update_link - update the link status |
7196 | * @adapter: pointer to the device adapter structure | 7145 | * @adapter: pointer to the device adapter structure |
7197 | * @link_speed: pointer to a u32 to store the link_speed | ||
7198 | **/ | 7146 | **/ |
7199 | static void ixgbe_watchdog_update_link(struct ixgbe_adapter *adapter) | 7147 | static void ixgbe_watchdog_update_link(struct ixgbe_adapter *adapter) |
7200 | { | 7148 | { |
@@ -7251,18 +7199,6 @@ static void ixgbe_update_default_up(struct ixgbe_adapter *adapter) | |||
7251 | #endif | 7199 | #endif |
7252 | } | 7200 | } |
7253 | 7201 | ||
7254 | static int ixgbe_enable_macvlan(struct net_device *upper, void *data) | ||
7255 | { | ||
7256 | if (netif_is_macvlan(upper)) { | ||
7257 | struct macvlan_dev *vlan = netdev_priv(upper); | ||
7258 | |||
7259 | if (vlan->fwd_priv) | ||
7260 | netif_tx_wake_all_queues(upper); | ||
7261 | } | ||
7262 | |||
7263 | return 0; | ||
7264 | } | ||
7265 | |||
7266 | /** | 7202 | /** |
7267 | * ixgbe_watchdog_link_is_up - update netif_carrier status and | 7203 | * ixgbe_watchdog_link_is_up - update netif_carrier status and |
7268 | * print link up message | 7204 | * print link up message |
@@ -7343,12 +7279,6 @@ static void ixgbe_watchdog_link_is_up(struct ixgbe_adapter *adapter) | |||
7343 | /* enable transmits */ | 7279 | /* enable transmits */ |
7344 | netif_tx_wake_all_queues(adapter->netdev); | 7280 | netif_tx_wake_all_queues(adapter->netdev); |
7345 | 7281 | ||
7346 | /* enable any upper devices */ | ||
7347 | rtnl_lock(); | ||
7348 | netdev_walk_all_upper_dev_rcu(adapter->netdev, | ||
7349 | ixgbe_enable_macvlan, NULL); | ||
7350 | rtnl_unlock(); | ||
7351 | |||
7352 | /* update the default user priority for VFs */ | 7282 | /* update the default user priority for VFs */ |
7353 | ixgbe_update_default_up(adapter); | 7283 | ixgbe_update_default_up(adapter); |
7354 | 7284 | ||
@@ -7665,7 +7595,7 @@ static void ixgbe_sfp_link_config_subtask(struct ixgbe_adapter *adapter) | |||
7665 | 7595 | ||
7666 | /** | 7596 | /** |
7667 | * ixgbe_service_timer - Timer Call-back | 7597 | * ixgbe_service_timer - Timer Call-back |
7668 | * @data: pointer to adapter cast into an unsigned long | 7598 | * @t: pointer to timer_list structure |
7669 | **/ | 7599 | **/ |
7670 | static void ixgbe_service_timer(struct timer_list *t) | 7600 | static void ixgbe_service_timer(struct timer_list *t) |
7671 | { | 7601 | { |
@@ -8309,14 +8239,19 @@ static u16 ixgbe_select_queue(struct net_device *dev, struct sk_buff *skb, | |||
8309 | void *accel_priv, select_queue_fallback_t fallback) | 8239 | void *accel_priv, select_queue_fallback_t fallback) |
8310 | { | 8240 | { |
8311 | struct ixgbe_fwd_adapter *fwd_adapter = accel_priv; | 8241 | struct ixgbe_fwd_adapter *fwd_adapter = accel_priv; |
8312 | #ifdef IXGBE_FCOE | ||
8313 | struct ixgbe_adapter *adapter; | 8242 | struct ixgbe_adapter *adapter; |
8314 | struct ixgbe_ring_feature *f; | ||
8315 | int txq; | 8243 | int txq; |
8244 | #ifdef IXGBE_FCOE | ||
8245 | struct ixgbe_ring_feature *f; | ||
8316 | #endif | 8246 | #endif |
8317 | 8247 | ||
8318 | if (fwd_adapter) | 8248 | if (fwd_adapter) { |
8319 | return skb->queue_mapping + fwd_adapter->tx_base_queue; | 8249 | adapter = netdev_priv(dev); |
8250 | txq = reciprocal_scale(skb_get_hash(skb), | ||
8251 | adapter->num_rx_queues_per_pool); | ||
8252 | |||
8253 | return txq + fwd_adapter->tx_base_queue; | ||
8254 | } | ||
8320 | 8255 | ||
8321 | #ifdef IXGBE_FCOE | 8256 | #ifdef IXGBE_FCOE |
8322 | 8257 | ||
@@ -8648,7 +8583,7 @@ static int ixgbe_ioctl(struct net_device *netdev, struct ifreq *req, int cmd) | |||
8648 | /** | 8583 | /** |
8649 | * ixgbe_add_sanmac_netdev - Add the SAN MAC address to the corresponding | 8584 | * ixgbe_add_sanmac_netdev - Add the SAN MAC address to the corresponding |
8650 | * netdev->dev_addrs | 8585 | * netdev->dev_addrs |
8651 | * @netdev: network interface device structure | 8586 | * @dev: network interface device structure |
8652 | * | 8587 | * |
8653 | * Returns non-zero on failure | 8588 | * Returns non-zero on failure |
8654 | **/ | 8589 | **/ |
@@ -8672,7 +8607,7 @@ static int ixgbe_add_sanmac_netdev(struct net_device *dev) | |||
8672 | /** | 8607 | /** |
8673 | * ixgbe_del_sanmac_netdev - Removes the SAN MAC address to the corresponding | 8608 | * ixgbe_del_sanmac_netdev - Removes the SAN MAC address to the corresponding |
8674 | * netdev->dev_addrs | 8609 | * netdev->dev_addrs |
8675 | * @netdev: network interface device structure | 8610 | * @dev: network interface device structure |
8676 | * | 8611 | * |
8677 | * Returns non-zero on failure | 8612 | * Returns non-zero on failure |
8678 | **/ | 8613 | **/ |
@@ -8839,7 +8774,7 @@ static void ixgbe_set_prio_tc_map(struct ixgbe_adapter *adapter) | |||
8839 | /** | 8774 | /** |
8840 | * ixgbe_setup_tc - configure net_device for multiple traffic classes | 8775 | * ixgbe_setup_tc - configure net_device for multiple traffic classes |
8841 | * | 8776 | * |
8842 | * @netdev: net device to configure | 8777 | * @dev: net device to configure |
8843 | * @tc: number of traffic classes to enable | 8778 | * @tc: number of traffic classes to enable |
8844 | */ | 8779 | */ |
8845 | int ixgbe_setup_tc(struct net_device *dev, u8 tc) | 8780 | int ixgbe_setup_tc(struct net_device *dev, u8 tc) |
@@ -8870,6 +8805,7 @@ int ixgbe_setup_tc(struct net_device *dev, u8 tc) | |||
8870 | netdev_set_num_tc(dev, tc); | 8805 | netdev_set_num_tc(dev, tc); |
8871 | ixgbe_set_prio_tc_map(adapter); | 8806 | ixgbe_set_prio_tc_map(adapter); |
8872 | 8807 | ||
8808 | adapter->hw_tcs = tc; | ||
8873 | adapter->flags |= IXGBE_FLAG_DCB_ENABLED; | 8809 | adapter->flags |= IXGBE_FLAG_DCB_ENABLED; |
8874 | 8810 | ||
8875 | if (adapter->hw.mac.type == ixgbe_mac_82598EB) { | 8811 | if (adapter->hw.mac.type == ixgbe_mac_82598EB) { |
@@ -8879,10 +8815,19 @@ int ixgbe_setup_tc(struct net_device *dev, u8 tc) | |||
8879 | } else { | 8815 | } else { |
8880 | netdev_reset_tc(dev); | 8816 | netdev_reset_tc(dev); |
8881 | 8817 | ||
8818 | /* To support macvlan offload we have to use num_tc to | ||
8819 | * restrict the queues that can be used by the device. | ||
8820 | * By doing this we can avoid reporting a false number of | ||
8821 | * queues. | ||
8822 | */ | ||
8823 | if (!tc && adapter->num_rx_pools > 1) | ||
8824 | netdev_set_num_tc(dev, 1); | ||
8825 | |||
8882 | if (adapter->hw.mac.type == ixgbe_mac_82598EB) | 8826 | if (adapter->hw.mac.type == ixgbe_mac_82598EB) |
8883 | adapter->hw.fc.requested_mode = adapter->last_lfc_mode; | 8827 | adapter->hw.fc.requested_mode = adapter->last_lfc_mode; |
8884 | 8828 | ||
8885 | adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED; | 8829 | adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED; |
8830 | adapter->hw_tcs = tc; | ||
8886 | 8831 | ||
8887 | adapter->temp_dcb_cfg.pfc_mode_enable = false; | 8832 | adapter->temp_dcb_cfg.pfc_mode_enable = false; |
8888 | adapter->dcb_cfg.pfc_mode_enable = false; | 8833 | adapter->dcb_cfg.pfc_mode_enable = false; |
@@ -9415,7 +9360,7 @@ void ixgbe_sriov_reinit(struct ixgbe_adapter *adapter) | |||
9415 | struct net_device *netdev = adapter->netdev; | 9360 | struct net_device *netdev = adapter->netdev; |
9416 | 9361 | ||
9417 | rtnl_lock(); | 9362 | rtnl_lock(); |
9418 | ixgbe_setup_tc(netdev, netdev_get_num_tc(netdev)); | 9363 | ixgbe_setup_tc(netdev, adapter->hw_tcs); |
9419 | rtnl_unlock(); | 9364 | rtnl_unlock(); |
9420 | } | 9365 | } |
9421 | 9366 | ||
@@ -9491,7 +9436,7 @@ static int ixgbe_set_features(struct net_device *netdev, | |||
9491 | /* We cannot enable ATR if SR-IOV is enabled */ | 9436 | /* We cannot enable ATR if SR-IOV is enabled */ |
9492 | if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED || | 9437 | if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED || |
9493 | /* We cannot enable ATR if we have 2 or more tcs */ | 9438 | /* We cannot enable ATR if we have 2 or more tcs */ |
9494 | (netdev_get_num_tc(netdev) > 1) || | 9439 | (adapter->hw_tcs > 1) || |
9495 | /* We cannot enable ATR if RSS is disabled */ | 9440 | /* We cannot enable ATR if RSS is disabled */ |
9496 | (adapter->ring_feature[RING_F_RSS].limit <= 1) || | 9441 | (adapter->ring_feature[RING_F_RSS].limit <= 1) || |
9497 | /* A sample rate of 0 indicates ATR disabled */ | 9442 | /* A sample rate of 0 indicates ATR disabled */ |
@@ -9666,8 +9611,8 @@ static int ixgbe_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[], | |||
9666 | 9611 | ||
9667 | /** | 9612 | /** |
9668 | * ixgbe_configure_bridge_mode - set various bridge modes | 9613 | * ixgbe_configure_bridge_mode - set various bridge modes |
9669 | * @adapter - the private structure | 9614 | * @adapter: the private structure |
9670 | * @mode - requested bridge mode | 9615 | * @mode: requested bridge mode |
9671 | * | 9616 | * |
9672 | * Configure some settings require for various bridge modes. | 9617 | * Configure some settings require for various bridge modes. |
9673 | **/ | 9618 | **/ |
@@ -9792,7 +9737,7 @@ static void *ixgbe_fwd_add(struct net_device *pdev, struct net_device *vdev) | |||
9792 | struct ixgbe_fwd_adapter *fwd_adapter = NULL; | 9737 | struct ixgbe_fwd_adapter *fwd_adapter = NULL; |
9793 | struct ixgbe_adapter *adapter = netdev_priv(pdev); | 9738 | struct ixgbe_adapter *adapter = netdev_priv(pdev); |
9794 | int used_pools = adapter->num_vfs + adapter->num_rx_pools; | 9739 | int used_pools = adapter->num_vfs + adapter->num_rx_pools; |
9795 | int tcs = netdev_get_num_tc(pdev) ? : 1; | 9740 | int tcs = adapter->hw_tcs ? : 1; |
9796 | unsigned int limit; | 9741 | unsigned int limit; |
9797 | int pool, err; | 9742 | int pool, err; |
9798 | 9743 | ||
@@ -9803,22 +9748,6 @@ static void *ixgbe_fwd_add(struct net_device *pdev, struct net_device *vdev) | |||
9803 | if (used_pools >= IXGBE_MAX_VF_FUNCTIONS) | 9748 | if (used_pools >= IXGBE_MAX_VF_FUNCTIONS) |
9804 | return ERR_PTR(-EINVAL); | 9749 | return ERR_PTR(-EINVAL); |
9805 | 9750 | ||
9806 | #ifdef CONFIG_RPS | ||
9807 | if (vdev->num_rx_queues != vdev->num_tx_queues) { | ||
9808 | netdev_info(pdev, "%s: Only supports a single queue count for TX and RX\n", | ||
9809 | vdev->name); | ||
9810 | return ERR_PTR(-EINVAL); | ||
9811 | } | ||
9812 | #endif | ||
9813 | /* Check for hardware restriction on number of rx/tx queues */ | ||
9814 | if (vdev->num_tx_queues > IXGBE_MAX_L2A_QUEUES || | ||
9815 | vdev->num_tx_queues == IXGBE_BAD_L2A_QUEUE) { | ||
9816 | netdev_info(pdev, | ||
9817 | "%s: Supports RX/TX Queue counts 1,2, and 4\n", | ||
9818 | pdev->name); | ||
9819 | return ERR_PTR(-EINVAL); | ||
9820 | } | ||
9821 | |||
9822 | if (((adapter->flags & IXGBE_FLAG_DCB_ENABLED) && | 9751 | if (((adapter->flags & IXGBE_FLAG_DCB_ENABLED) && |
9823 | adapter->num_rx_pools >= (MAX_TX_QUEUES / tcs)) || | 9752 | adapter->num_rx_pools >= (MAX_TX_QUEUES / tcs)) || |
9824 | (adapter->num_rx_pools > IXGBE_MAX_MACVLANS)) | 9753 | (adapter->num_rx_pools > IXGBE_MAX_MACVLANS)) |
@@ -9835,24 +9764,19 @@ static void *ixgbe_fwd_add(struct net_device *pdev, struct net_device *vdev) | |||
9835 | /* Enable VMDq flag so device will be set in VM mode */ | 9764 | /* Enable VMDq flag so device will be set in VM mode */ |
9836 | adapter->flags |= IXGBE_FLAG_VMDQ_ENABLED | IXGBE_FLAG_SRIOV_ENABLED; | 9765 | adapter->flags |= IXGBE_FLAG_VMDQ_ENABLED | IXGBE_FLAG_SRIOV_ENABLED; |
9837 | adapter->ring_feature[RING_F_VMDQ].limit = limit + 1; | 9766 | adapter->ring_feature[RING_F_VMDQ].limit = limit + 1; |
9838 | adapter->ring_feature[RING_F_RSS].limit = vdev->num_tx_queues; | ||
9839 | 9767 | ||
9840 | /* Force reinit of ring allocation with VMDQ enabled */ | ||
9841 | err = ixgbe_setup_tc(pdev, netdev_get_num_tc(pdev)); | ||
9842 | if (err) | ||
9843 | goto fwd_add_err; | ||
9844 | fwd_adapter->pool = pool; | 9768 | fwd_adapter->pool = pool; |
9845 | fwd_adapter->real_adapter = adapter; | 9769 | fwd_adapter->real_adapter = adapter; |
9846 | 9770 | ||
9847 | if (netif_running(pdev)) { | 9771 | /* Force reinit of ring allocation with VMDQ enabled */ |
9772 | err = ixgbe_setup_tc(pdev, adapter->hw_tcs); | ||
9773 | |||
9774 | if (!err && netif_running(pdev)) | ||
9848 | err = ixgbe_fwd_ring_up(vdev, fwd_adapter); | 9775 | err = ixgbe_fwd_ring_up(vdev, fwd_adapter); |
9849 | if (err) | ||
9850 | goto fwd_add_err; | ||
9851 | netif_tx_start_all_queues(vdev); | ||
9852 | } | ||
9853 | 9776 | ||
9854 | return fwd_adapter; | 9777 | if (!err) |
9855 | fwd_add_err: | 9778 | return fwd_adapter; |
9779 | |||
9856 | /* unwind counter and free adapter struct */ | 9780 | /* unwind counter and free adapter struct */ |
9857 | netdev_info(pdev, | 9781 | netdev_info(pdev, |
9858 | "%s: dfwd hardware acceleration failed\n", vdev->name); | 9782 | "%s: dfwd hardware acceleration failed\n", vdev->name); |
@@ -9863,15 +9787,38 @@ fwd_add_err: | |||
9863 | 9787 | ||
9864 | static void ixgbe_fwd_del(struct net_device *pdev, void *priv) | 9788 | static void ixgbe_fwd_del(struct net_device *pdev, void *priv) |
9865 | { | 9789 | { |
9866 | struct ixgbe_fwd_adapter *fwd_adapter = priv; | 9790 | struct ixgbe_fwd_adapter *accel = priv; |
9867 | struct ixgbe_adapter *adapter = fwd_adapter->real_adapter; | 9791 | struct ixgbe_adapter *adapter = accel->real_adapter; |
9868 | unsigned int limit; | 9792 | unsigned int rxbase = accel->rx_base_queue; |
9793 | unsigned int limit, i; | ||
9869 | 9794 | ||
9870 | clear_bit(fwd_adapter->pool, adapter->fwd_bitmask); | 9795 | /* delete unicast filter associated with offloaded interface */ |
9796 | ixgbe_del_mac_filter(adapter, accel->netdev->dev_addr, | ||
9797 | VMDQ_P(accel->pool)); | ||
9871 | 9798 | ||
9799 | /* disable ability to receive packets for this pool */ | ||
9800 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_VMOLR(accel->pool), 0); | ||
9801 | |||
9802 | /* Allow remaining Rx packets to get flushed out of the | ||
9803 | * Rx FIFO before we drop the netdev for the ring. | ||
9804 | */ | ||
9805 | usleep_range(10000, 20000); | ||
9806 | |||
9807 | for (i = 0; i < adapter->num_rx_queues_per_pool; i++) { | ||
9808 | struct ixgbe_ring *ring = adapter->rx_ring[rxbase + i]; | ||
9809 | struct ixgbe_q_vector *qv = ring->q_vector; | ||
9810 | |||
9811 | /* Make sure we aren't processing any packets and clear | ||
9812 | * netdev to shut down the ring. | ||
9813 | */ | ||
9814 | if (netif_running(adapter->netdev)) | ||
9815 | napi_synchronize(&qv->napi); | ||
9816 | ring->netdev = NULL; | ||
9817 | } | ||
9818 | |||
9819 | clear_bit(accel->pool, adapter->fwd_bitmask); | ||
9872 | limit = find_last_bit(adapter->fwd_bitmask, adapter->num_rx_pools); | 9820 | limit = find_last_bit(adapter->fwd_bitmask, adapter->num_rx_pools); |
9873 | adapter->ring_feature[RING_F_VMDQ].limit = limit + 1; | 9821 | adapter->ring_feature[RING_F_VMDQ].limit = limit + 1; |
9874 | ixgbe_fwd_ring_down(fwd_adapter->netdev, fwd_adapter); | ||
9875 | 9822 | ||
9876 | /* go back to full RSS if we're done with our VMQs */ | 9823 | /* go back to full RSS if we're done with our VMQs */ |
9877 | if (adapter->ring_feature[RING_F_VMDQ].limit == 1) { | 9824 | if (adapter->ring_feature[RING_F_VMDQ].limit == 1) { |
@@ -9883,13 +9830,13 @@ static void ixgbe_fwd_del(struct net_device *pdev, void *priv) | |||
9883 | adapter->ring_feature[RING_F_RSS].limit = rss; | 9830 | adapter->ring_feature[RING_F_RSS].limit = rss; |
9884 | } | 9831 | } |
9885 | 9832 | ||
9886 | ixgbe_setup_tc(pdev, netdev_get_num_tc(pdev)); | 9833 | ixgbe_setup_tc(pdev, adapter->hw_tcs); |
9887 | netdev_dbg(pdev, "pool %i:%i queues %i:%i\n", | 9834 | netdev_dbg(pdev, "pool %i:%i queues %i:%i\n", |
9888 | fwd_adapter->pool, adapter->num_rx_pools, | 9835 | accel->pool, adapter->num_rx_pools, |
9889 | fwd_adapter->rx_base_queue, | 9836 | accel->rx_base_queue, |
9890 | fwd_adapter->rx_base_queue + | 9837 | accel->rx_base_queue + |
9891 | adapter->num_rx_queues_per_pool); | 9838 | adapter->num_rx_queues_per_pool); |
9892 | kfree(fwd_adapter); | 9839 | kfree(accel); |
9893 | } | 9840 | } |
9894 | 9841 | ||
9895 | #define IXGBE_MAX_MAC_HDR_LEN 127 | 9842 | #define IXGBE_MAX_MAC_HDR_LEN 127 |
@@ -9956,7 +9903,7 @@ static int ixgbe_xdp_setup(struct net_device *dev, struct bpf_prog *prog) | |||
9956 | 9903 | ||
9957 | /* If transitioning XDP modes reconfigure rings */ | 9904 | /* If transitioning XDP modes reconfigure rings */ |
9958 | if (!!prog != !!old_prog) { | 9905 | if (!!prog != !!old_prog) { |
9959 | int err = ixgbe_setup_tc(dev, netdev_get_num_tc(dev)); | 9906 | int err = ixgbe_setup_tc(dev, adapter->hw_tcs); |
9960 | 9907 | ||
9961 | if (err) { | 9908 | if (err) { |
9962 | rcu_assign_pointer(adapter->xdp_prog, old_prog); | 9909 | rcu_assign_pointer(adapter->xdp_prog, old_prog); |
@@ -10133,7 +10080,7 @@ static inline int ixgbe_enumerate_functions(struct ixgbe_adapter *adapter) | |||
10133 | * ixgbe_wol_supported - Check whether device supports WoL | 10080 | * ixgbe_wol_supported - Check whether device supports WoL |
10134 | * @adapter: the adapter private structure | 10081 | * @adapter: the adapter private structure |
10135 | * @device_id: the device ID | 10082 | * @device_id: the device ID |
10136 | * @subdev_id: the subsystem device ID | 10083 | * @subdevice_id: the subsystem device ID |
10137 | * | 10084 | * |
10138 | * This function is used by probe and ethtool to determine | 10085 | * This function is used by probe and ethtool to determine |
10139 | * which devices have WoL support | 10086 | * which devices have WoL support |