aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2012-06-06 01:38:20 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2012-07-21 19:04:10 -0400
commit39cb681b3bb4da17e74d48e553d1bb9a1b759aa5 (patch)
tree883c4589f1f6c0d757f1305dbde656fb932337a6
parent9f19f31dd4903d9c6a7ce33740eadd2b6bdd8ce2 (diff)
ixgbe: Fix handling of FDIR_HASH flag
This change makes it so that we can use the atr_sample_rate to determine if we are capable of supporting ATR. The advantage to this approach is that it allows us to now determine the setting of the IXGBE_FLAG_FDIR_HASH_CAPABLE based on the queueing scheme, instead of the queueing scheme being based on the flag. Using this approach there are essentially 5 conditions that must be checked prior to trying to enable ATR: 1. Is SR-IOV disabled? 2. Are the number of TCs <= 1? 3. Is RSS queueing limit greater than 1? 4. Is atr_sample_rate set? 5. Is Flow Director perfect filtering disabled? If any of these conditions are enabled they should disable ATR filtering. Note that in the case of conditions 1 through 4 being met we will set things up for ATR queueing, however if test 5 fails we will still leave the queues allocated for use by perfect filters. The reason for this is to allow for us to switch back and forth between ntuple and ATR without needing to reallocate the descriptor rings. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c22
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c48
2 files changed, 46 insertions, 24 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
index 3ff5aa801a6b..29a2a8528073 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
@@ -370,6 +370,9 @@ static bool ixgbe_set_dcb_sriov_queues(struct ixgbe_adapter *adapter)
370 adapter->ring_feature[RING_F_RSS].indices = 1; 370 adapter->ring_feature[RING_F_RSS].indices = 1;
371 adapter->ring_feature[RING_F_RSS].mask = IXGBE_RSS_DISABLED_MASK; 371 adapter->ring_feature[RING_F_RSS].mask = IXGBE_RSS_DISABLED_MASK;
372 372
373 /* disable ATR as it is not supported when VMDq is enabled */
374 adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE;
375
373 adapter->num_rx_pools = vmdq_i; 376 adapter->num_rx_pools = vmdq_i;
374 adapter->num_rx_queues_per_pool = tcs; 377 adapter->num_rx_queues_per_pool = tcs;
375 378
@@ -450,6 +453,9 @@ static bool ixgbe_set_dcb_queues(struct ixgbe_adapter *adapter)
450 f->indices = rss_i; 453 f->indices = rss_i;
451 f->mask = rss_m; 454 f->mask = rss_m;
452 455
456 /* disable ATR as it is not supported when multiple TCs are enabled */
457 adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE;
458
453#ifdef IXGBE_FCOE 459#ifdef IXGBE_FCOE
454 /* FCoE enabled queues require special configuration indexed 460 /* FCoE enabled queues require special configuration indexed
455 * by feature specific indices and offset. Here we map FCoE 461 * by feature specific indices and offset. Here we map FCoE
@@ -606,16 +612,22 @@ static bool ixgbe_set_rss_queues(struct ixgbe_adapter *adapter)
606 f->indices = rss_i; 612 f->indices = rss_i;
607 f->mask = IXGBE_RSS_16Q_MASK; 613 f->mask = IXGBE_RSS_16Q_MASK;
608 614
615 /* disable ATR by default, it will be configured below */
616 adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE;
617
609 /* 618 /*
610 * Use Flow Director in addition to RSS to ensure the best 619 * Use Flow Director in addition to RSS to ensure the best
611 * distribution of flows across cores, even when an FDIR flow 620 * distribution of flows across cores, even when an FDIR flow
612 * isn't matched. 621 * isn't matched.
613 */ 622 */
614 if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) { 623 if (rss_i > 1 && adapter->atr_sample_rate) {
615 f = &adapter->ring_feature[RING_F_FDIR]; 624 f = &adapter->ring_feature[RING_F_FDIR];
616 625
617 f->indices = min_t(u16, num_online_cpus(), f->limit); 626 f->indices = min_t(u16, num_online_cpus(), f->limit);
618 rss_i = max_t(u16, rss_i, f->indices); 627 rss_i = max_t(u16, rss_i, f->indices);
628
629 if (!(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE))
630 adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE;
619 } 631 }
620 632
621#ifdef IXGBE_FCOE 633#ifdef IXGBE_FCOE
@@ -1054,13 +1066,7 @@ static void ixgbe_set_interrupt_capability(struct ixgbe_adapter *adapter)
1054 } 1066 }
1055 1067
1056 adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED; 1068 adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED;
1057 if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) { 1069
1058 e_err(probe,
1059 "ATR is not supported while multiple "
1060 "queues are disabled. Disabling Flow Director\n");
1061 }
1062 adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE;
1063 adapter->atr_sample_rate = 0;
1064 ixgbe_disable_sriov(adapter); 1070 ixgbe_disable_sriov(adapter);
1065 1071
1066 adapter->ring_feature[RING_F_RSS].limit = 1; 1072 adapter->ring_feature[RING_F_RSS].limit = 1;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 9c42679ad83e..7be35043b751 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -2688,8 +2688,7 @@ void ixgbe_configure_tx_ring(struct ixgbe_adapter *adapter,
2688 32; /* PTHRESH = 32 */ 2688 32; /* PTHRESH = 32 */
2689 2689
2690 /* reinitialize flowdirector state */ 2690 /* reinitialize flowdirector state */
2691 if ((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) && 2691 if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) {
2692 adapter->atr_sample_rate) {
2693 ring->atr_sample_rate = adapter->atr_sample_rate; 2692 ring->atr_sample_rate = adapter->atr_sample_rate;
2694 ring->atr_count = 0; 2693 ring->atr_count = 0;
2695 set_bit(__IXGBE_TX_FDIR_INIT_DONE, &ring->state); 2694 set_bit(__IXGBE_TX_FDIR_INIT_DONE, &ring->state);
@@ -4419,7 +4418,6 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter)
4419 if (hw->device_id == IXGBE_DEV_ID_82599_T3_LOM) 4418 if (hw->device_id == IXGBE_DEV_ID_82599_T3_LOM)
4420 adapter->flags2 |= IXGBE_FLAG2_TEMP_SENSOR_CAPABLE; 4419 adapter->flags2 |= IXGBE_FLAG2_TEMP_SENSOR_CAPABLE;
4421 /* Flow Director hash filters enabled */ 4420 /* Flow Director hash filters enabled */
4422 adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE;
4423 adapter->atr_sample_rate = 20; 4421 adapter->atr_sample_rate = 20;
4424 adapter->ring_feature[RING_F_FDIR].limit = 4422 adapter->ring_feature[RING_F_FDIR].limit =
4425 IXGBE_MAX_FDIR_INDICES; 4423 IXGBE_MAX_FDIR_INDICES;
@@ -6726,7 +6724,6 @@ int ixgbe_setup_tc(struct net_device *dev, u8 tc)
6726 ixgbe_set_prio_tc_map(adapter); 6724 ixgbe_set_prio_tc_map(adapter);
6727 6725
6728 adapter->flags |= IXGBE_FLAG_DCB_ENABLED; 6726 adapter->flags |= IXGBE_FLAG_DCB_ENABLED;
6729 adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE;
6730 6727
6731 if (adapter->hw.mac.type == ixgbe_mac_82598EB) { 6728 if (adapter->hw.mac.type == ixgbe_mac_82598EB) {
6732 adapter->last_lfc_mode = adapter->hw.fc.requested_mode; 6729 adapter->last_lfc_mode = adapter->hw.fc.requested_mode;
@@ -6739,7 +6736,6 @@ int ixgbe_setup_tc(struct net_device *dev, u8 tc)
6739 adapter->hw.fc.requested_mode = adapter->last_lfc_mode; 6736 adapter->hw.fc.requested_mode = adapter->last_lfc_mode;
6740 6737
6741 adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED; 6738 adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED;
6742 adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE;
6743 6739
6744 adapter->temp_dcb_cfg.pfc_mode_enable = false; 6740 adapter->temp_dcb_cfg.pfc_mode_enable = false;
6745 adapter->dcb_cfg.pfc_mode_enable = false; 6741 adapter->dcb_cfg.pfc_mode_enable = false;
@@ -6808,20 +6804,40 @@ static int ixgbe_set_features(struct net_device *netdev,
6808 * Check if Flow Director n-tuple support was enabled or disabled. If 6804 * Check if Flow Director n-tuple support was enabled or disabled. If
6809 * the state changed, we need to reset. 6805 * the state changed, we need to reset.
6810 */ 6806 */
6811 if (!(features & NETIF_F_NTUPLE)) { 6807 switch (features & NETIF_F_NTUPLE) {
6812 if (adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE) { 6808 case NETIF_F_NTUPLE:
6813 /* turn off Flow Director, set ATR and reset */
6814 if (!(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) &&
6815 !(adapter->flags & IXGBE_FLAG_DCB_ENABLED))
6816 adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE;
6817 need_reset = true;
6818 }
6819 adapter->flags &= ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE;
6820 } else if (!(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) {
6821 /* turn off ATR, enable perfect filters and reset */ 6809 /* turn off ATR, enable perfect filters and reset */
6810 if (!(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE))
6811 need_reset = true;
6812
6822 adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE; 6813 adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE;
6823 adapter->flags |= IXGBE_FLAG_FDIR_PERFECT_CAPABLE; 6814 adapter->flags |= IXGBE_FLAG_FDIR_PERFECT_CAPABLE;
6824 need_reset = true; 6815 break;
6816 default:
6817 /* turn off perfect filters, enable ATR and reset */
6818 if (adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)
6819 need_reset = true;
6820
6821 adapter->flags &= ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE;
6822
6823 /* We cannot enable ATR if SR-IOV is enabled */
6824 if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)
6825 break;
6826
6827 /* We cannot enable ATR if we have 2 or more traffic classes */
6828 if (netdev_get_num_tc(netdev) > 1)
6829 break;
6830
6831 /* We cannot enable ATR if RSS is disabled */
6832 if (adapter->ring_feature[RING_F_RSS].limit <= 1)
6833 break;
6834
6835 /* A sample rate of 0 indicates ATR disabled */
6836 if (!adapter->atr_sample_rate)
6837 break;
6838
6839 adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE;
6840 break;
6825 } 6841 }
6826 6842
6827 if (features & NETIF_F_HW_VLAN_RX) 6843 if (features & NETIF_F_HW_VLAN_RX)