Skip to content

Commit 03ecf91

Browse files
Alexander DuyckJeff Kirsher
authored andcommitted
ixgbe: fix flags relating to perfect filters to support coexistence
I am removing the requirement that Ntuple filters have the same number of queues and requirements as ATR. As a result this change will make it so that all the Ntuple flag does is disable ATR for now. This change fixes an issue in which we were incorrectly re-enabling ATR when we exited perfect filter mode. This was due to the fact that the logic assumed RSS and DCB were mutually exclusive which is no longer the case. To correct this we just need to add a check to guarantee DCB is disabled before re-enabling ATR. Signed-off-by: Alexander Duyck <[email protected]> Tested-by: Ross Brattain <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent b29a216 commit 03ecf91

File tree

3 files changed

+30
-41
lines changed

3 files changed

+30
-41
lines changed

drivers/net/ixgbe/ixgbe_dcb_nl.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,12 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state)
114114
u8 err = 0;
115115
struct ixgbe_adapter *adapter = netdev_priv(netdev);
116116

117+
/* verify there is something to do, if not then exit */
118+
if (!!state != !(adapter->flags & IXGBE_FLAG_DCB_ENABLED))
119+
return err;
120+
117121
if (state > 0) {
118122
/* Turn on DCB */
119-
if (adapter->flags & IXGBE_FLAG_DCB_ENABLED)
120-
goto out;
121-
122123
if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) {
123124
e_err(drv, "Enable failed, needs MSI-X\n");
124125
err = 1;
@@ -143,17 +144,15 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state)
143144
ixgbe_setup_tc(netdev, MAX_TRAFFIC_CLASS);
144145
} else {
145146
/* Turn off DCB */
146-
if (!(adapter->flags & IXGBE_FLAG_DCB_ENABLED))
147-
goto out;
148-
149147
adapter->hw.fc.requested_mode = adapter->last_lfc_mode;
150148
adapter->temp_dcb_cfg.pfc_mode_enable = false;
151149
adapter->dcb_cfg.pfc_mode_enable = false;
152150
adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED;
153151
switch (adapter->hw.mac.type) {
154152
case ixgbe_mac_82599EB:
155153
case ixgbe_mac_X540:
156-
adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE;
154+
if (!(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE))
155+
adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE;
157156
break;
158157
default:
159158
break;

drivers/net/ixgbe/ixgbe_ethtool.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2310,20 +2310,20 @@ static int ixgbe_set_flags(struct net_device *netdev, u32 data)
23102310
* Check if Flow Director n-tuple support was enabled or disabled. If
23112311
* the state changed, we need to reset.
23122312
*/
2313-
if ((adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE) &&
2314-
(!(data & ETH_FLAG_NTUPLE))) {
2315-
/* turn off Flow Director perfect, set hash and reset */
2313+
if (!(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) {
2314+
/* turn off ATR, enable perfect filters and reset */
2315+
if (data & ETH_FLAG_NTUPLE) {
2316+
adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE;
2317+
adapter->flags |= IXGBE_FLAG_FDIR_PERFECT_CAPABLE;
2318+
need_reset = true;
2319+
}
2320+
} else if (!(data & ETH_FLAG_NTUPLE)) {
2321+
/* turn off Flow Director, set ATR and reset */
23162322
adapter->flags &= ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE;
2317-
adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE;
2318-
need_reset = true;
2319-
} else if ((!(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) &&
2320-
(data & ETH_FLAG_NTUPLE)) {
2321-
/* turn off Flow Director hash, enable perfect and reset */
2322-
adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE;
2323-
adapter->flags |= IXGBE_FLAG_FDIR_PERFECT_CAPABLE;
2323+
if ((adapter->flags & IXGBE_FLAG_RSS_ENABLED) &&
2324+
!(adapter->flags & IXGBE_FLAG_DCB_ENABLED))
2325+
adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE;
23242326
need_reset = true;
2325-
} else {
2326-
/* no state change */
23272327
}
23282328

23292329
if (need_reset) {

drivers/net/ixgbe/ixgbe_main.c

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,9 +1555,8 @@ static void ixgbe_configure_msix(struct ixgbe_adapter *adapter)
15551555
q_vector->eitr = adapter->rx_eitr_param;
15561556

15571557
ixgbe_write_eitr(q_vector);
1558-
/* If Flow Director is enabled, set interrupt affinity */
1559-
if ((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) ||
1560-
(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) {
1558+
/* If ATR is enabled, set interrupt affinity */
1559+
if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) {
15611560
/*
15621561
* Allocate the affinity_hint cpumask, assign the mask
15631562
* for this vector, and set our affinity_hint for
@@ -2468,8 +2467,7 @@ static inline void ixgbe_irq_enable(struct ixgbe_adapter *adapter, bool queues,
24682467
default:
24692468
break;
24702469
}
2471-
if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE ||
2472-
adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)
2470+
if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE)
24732471
mask |= IXGBE_EIMS_FLOW_DIR;
24742472

24752473
IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, mask);
@@ -3767,8 +3765,6 @@ static void ixgbe_configure(struct ixgbe_adapter *adapter)
37673765
adapter->tx_ring[i]->atr_sample_rate =
37683766
adapter->atr_sample_rate;
37693767
ixgbe_init_fdir_signature_82599(hw, adapter->fdir_pballoc);
3770-
} else if (adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE) {
3771-
ixgbe_init_fdir_perfect_82599(hw, adapter->fdir_pballoc);
37723768
}
37733769
ixgbe_configure_virtualization(adapter);
37743770

@@ -4334,15 +4330,13 @@ static inline bool ixgbe_set_fdir_queues(struct ixgbe_adapter *adapter)
43344330
f_fdir->mask = 0;
43354331

43364332
/* Flow Director must have RSS enabled */
4337-
if (adapter->flags & IXGBE_FLAG_RSS_ENABLED &&
4338-
((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE ||
4339-
(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)))) {
4333+
if ((adapter->flags & IXGBE_FLAG_RSS_ENABLED) &&
4334+
(adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE)) {
43404335
adapter->num_tx_queues = f_fdir->indices;
43414336
adapter->num_rx_queues = f_fdir->indices;
43424337
ret = true;
43434338
} else {
43444339
adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE;
4345-
adapter->flags &= ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE;
43464340
}
43474341
return ret;
43484342
}
@@ -4372,12 +4366,12 @@ static inline bool ixgbe_set_fcoe_queues(struct ixgbe_adapter *adapter)
43724366

43734367
if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) {
43744368
e_info(probe, "FCoE enabled with RSS\n");
4375-
if ((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) ||
4376-
(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE))
4369+
if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE)
43774370
ixgbe_set_fdir_queues(adapter);
43784371
else
43794372
ixgbe_set_rss_queues(adapter);
43804373
}
4374+
43814375
/* adding FCoE rx rings to the end */
43824376
f->mask = adapter->num_rx_queues;
43834377
adapter->num_rx_queues += f->indices;
@@ -4670,9 +4664,8 @@ static inline bool ixgbe_cache_ring_fdir(struct ixgbe_adapter *adapter)
46704664
int i;
46714665
bool ret = false;
46724666

4673-
if (adapter->flags & IXGBE_FLAG_RSS_ENABLED &&
4674-
((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) ||
4675-
(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE))) {
4667+
if ((adapter->flags & IXGBE_FLAG_RSS_ENABLED) &&
4668+
(adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE)) {
46764669
for (i = 0; i < adapter->num_rx_queues; i++)
46774670
adapter->rx_ring[i]->reg_idx = i;
46784671
for (i = 0; i < adapter->num_tx_queues; i++)
@@ -4701,8 +4694,7 @@ static inline bool ixgbe_cache_ring_fcoe(struct ixgbe_adapter *adapter)
47014694
return false;
47024695

47034696
if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) {
4704-
if ((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) ||
4705-
(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE))
4697+
if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE)
47064698
ixgbe_cache_ring_fdir(adapter);
47074699
else
47084700
ixgbe_cache_ring_rss(adapter);
@@ -4882,14 +4874,12 @@ static int ixgbe_set_interrupt_capability(struct ixgbe_adapter *adapter)
48824874

48834875
adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED;
48844876
adapter->flags &= ~IXGBE_FLAG_RSS_ENABLED;
4885-
if (adapter->flags & (IXGBE_FLAG_FDIR_HASH_CAPABLE |
4886-
IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) {
4877+
if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) {
48874878
e_err(probe,
4888-
"Flow Director is not supported while multiple "
4879+
"ATR is not supported while multiple "
48894880
"queues are disabled. Disabling Flow Director\n");
48904881
}
48914882
adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE;
4892-
adapter->flags &= ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE;
48934883
adapter->atr_sample_rate = 0;
48944884
if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)
48954885
ixgbe_disable_sriov(adapter);

0 commit comments

Comments
 (0)