@@ -2244,14 +2244,14 @@ static int __i40e_get_coalesce(struct net_device *netdev,
2244
2244
rx_ring = vsi -> rx_rings [queue ];
2245
2245
tx_ring = vsi -> tx_rings [queue ];
2246
2246
2247
- if (ITR_IS_DYNAMIC (rx_ring -> rx_itr_setting ))
2247
+ if (ITR_IS_DYNAMIC (rx_ring -> itr_setting ))
2248
2248
ec -> use_adaptive_rx_coalesce = 1 ;
2249
2249
2250
- if (ITR_IS_DYNAMIC (tx_ring -> tx_itr_setting ))
2250
+ if (ITR_IS_DYNAMIC (tx_ring -> itr_setting ))
2251
2251
ec -> use_adaptive_tx_coalesce = 1 ;
2252
2252
2253
- ec -> rx_coalesce_usecs = rx_ring -> rx_itr_setting & ~I40E_ITR_DYNAMIC ;
2254
- ec -> tx_coalesce_usecs = tx_ring -> tx_itr_setting & ~I40E_ITR_DYNAMIC ;
2253
+ ec -> rx_coalesce_usecs = rx_ring -> itr_setting & ~I40E_ITR_DYNAMIC ;
2254
+ ec -> tx_coalesce_usecs = tx_ring -> itr_setting & ~I40E_ITR_DYNAMIC ;
2255
2255
2256
2256
/* we use the _usecs_high to store/set the interrupt rate limit
2257
2257
* that the hardware supports, that almost but not quite
@@ -2311,34 +2311,35 @@ static void i40e_set_itr_per_queue(struct i40e_vsi *vsi,
2311
2311
struct i40e_pf * pf = vsi -> back ;
2312
2312
struct i40e_hw * hw = & pf -> hw ;
2313
2313
struct i40e_q_vector * q_vector ;
2314
- u16 vector , intrl ;
2314
+ u16 intrl ;
2315
2315
2316
2316
intrl = i40e_intrl_usec_to_reg (vsi -> int_rate_limit );
2317
2317
2318
- rx_ring -> rx_itr_setting = ec -> rx_coalesce_usecs ;
2319
- tx_ring -> tx_itr_setting = ec -> tx_coalesce_usecs ;
2318
+ rx_ring -> itr_setting = ITR_REG_ALIGN ( ec -> rx_coalesce_usecs ) ;
2319
+ tx_ring -> itr_setting = ITR_REG_ALIGN ( ec -> tx_coalesce_usecs ) ;
2320
2320
2321
2321
if (ec -> use_adaptive_rx_coalesce )
2322
- rx_ring -> rx_itr_setting |= I40E_ITR_DYNAMIC ;
2322
+ rx_ring -> itr_setting |= I40E_ITR_DYNAMIC ;
2323
2323
else
2324
- rx_ring -> rx_itr_setting &= ~I40E_ITR_DYNAMIC ;
2324
+ rx_ring -> itr_setting &= ~I40E_ITR_DYNAMIC ;
2325
2325
2326
2326
if (ec -> use_adaptive_tx_coalesce )
2327
- tx_ring -> tx_itr_setting |= I40E_ITR_DYNAMIC ;
2327
+ tx_ring -> itr_setting |= I40E_ITR_DYNAMIC ;
2328
2328
else
2329
- tx_ring -> tx_itr_setting &= ~I40E_ITR_DYNAMIC ;
2329
+ tx_ring -> itr_setting &= ~I40E_ITR_DYNAMIC ;
2330
2330
2331
2331
q_vector = rx_ring -> q_vector ;
2332
- q_vector -> rx .itr = ITR_TO_REG (rx_ring -> rx_itr_setting );
2333
- vector = vsi -> base_vector + q_vector -> v_idx ;
2334
- wr32 (hw , I40E_PFINT_ITRN (I40E_RX_ITR , vector - 1 ), q_vector -> rx .itr );
2332
+ q_vector -> rx .target_itr = ITR_TO_REG (rx_ring -> itr_setting );
2335
2333
2336
2334
q_vector = tx_ring -> q_vector ;
2337
- q_vector -> tx .itr = ITR_TO_REG (tx_ring -> tx_itr_setting );
2338
- vector = vsi -> base_vector + q_vector -> v_idx ;
2339
- wr32 (hw , I40E_PFINT_ITRN (I40E_TX_ITR , vector - 1 ), q_vector -> tx .itr );
2335
+ q_vector -> tx .target_itr = ITR_TO_REG (tx_ring -> itr_setting );
2340
2336
2341
- wr32 (hw , I40E_PFINT_RATEN (vector - 1 ), intrl );
2337
+ /* The interrupt handler itself will take care of programming
2338
+ * the Tx and Rx ITR values based on the values we have entered
2339
+ * into the q_vector, no need to write the values now.
2340
+ */
2341
+
2342
+ wr32 (hw , I40E_PFINT_RATEN (q_vector -> reg_idx ), intrl );
2342
2343
i40e_flush (hw );
2343
2344
}
2344
2345
@@ -2364,11 +2365,11 @@ static int __i40e_set_coalesce(struct net_device *netdev,
2364
2365
vsi -> work_limit = ec -> tx_max_coalesced_frames_irq ;
2365
2366
2366
2367
if (queue < 0 ) {
2367
- cur_rx_itr = vsi -> rx_rings [0 ]-> rx_itr_setting ;
2368
- cur_tx_itr = vsi -> tx_rings [0 ]-> tx_itr_setting ;
2368
+ cur_rx_itr = vsi -> rx_rings [0 ]-> itr_setting ;
2369
+ cur_tx_itr = vsi -> tx_rings [0 ]-> itr_setting ;
2369
2370
} else if (queue < vsi -> num_queue_pairs ) {
2370
- cur_rx_itr = vsi -> rx_rings [queue ]-> rx_itr_setting ;
2371
- cur_tx_itr = vsi -> tx_rings [queue ]-> tx_itr_setting ;
2371
+ cur_rx_itr = vsi -> rx_rings [queue ]-> itr_setting ;
2372
+ cur_tx_itr = vsi -> tx_rings [queue ]-> itr_setting ;
2372
2373
} else {
2373
2374
netif_info (pf , drv , netdev , "Invalid queue value, queue range is 0 - %d\n" ,
2374
2375
vsi -> num_queue_pairs - 1 );
@@ -2396,7 +2397,7 @@ static int __i40e_set_coalesce(struct net_device *netdev,
2396
2397
return - EINVAL ;
2397
2398
}
2398
2399
2399
- if (ec -> rx_coalesce_usecs > ( I40E_MAX_ITR << 1 ) ) {
2400
+ if (ec -> rx_coalesce_usecs > I40E_MAX_ITR ) {
2400
2401
netif_info (pf , drv , netdev , "Invalid value, rx-usecs range is 0-8160\n" );
2401
2402
return - EINVAL ;
2402
2403
}
@@ -2407,16 +2408,16 @@ static int __i40e_set_coalesce(struct net_device *netdev,
2407
2408
return - EINVAL ;
2408
2409
}
2409
2410
2410
- if (ec -> tx_coalesce_usecs > ( I40E_MAX_ITR << 1 ) ) {
2411
+ if (ec -> tx_coalesce_usecs > I40E_MAX_ITR ) {
2411
2412
netif_info (pf , drv , netdev , "Invalid value, tx-usecs range is 0-8160\n" );
2412
2413
return - EINVAL ;
2413
2414
}
2414
2415
2415
2416
if (ec -> use_adaptive_rx_coalesce && !cur_rx_itr )
2416
- ec -> rx_coalesce_usecs = I40E_MIN_ITR << 1 ;
2417
+ ec -> rx_coalesce_usecs = I40E_MIN_ITR ;
2417
2418
2418
2419
if (ec -> use_adaptive_tx_coalesce && !cur_tx_itr )
2419
- ec -> tx_coalesce_usecs = I40E_MIN_ITR << 1 ;
2420
+ ec -> tx_coalesce_usecs = I40E_MIN_ITR ;
2420
2421
2421
2422
intrl_reg = i40e_intrl_usec_to_reg (ec -> rx_coalesce_usecs_high );
2422
2423
vsi -> int_rate_limit = INTRL_REG_TO_USEC (intrl_reg );
@@ -4406,6 +4407,8 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
4406
4407
}
4407
4408
4408
4409
flags_complete :
4410
+ changed_flags = orig_flags ^ new_flags ;
4411
+
4409
4412
/* Before we finalize any flag changes, we need to perform some
4410
4413
* checks to ensure that the changes are supported and safe.
4411
4414
*/
@@ -4415,21 +4418,25 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
4415
4418
!(pf -> hw_features & I40E_HW_ATR_EVICT_CAPABLE ))
4416
4419
return - EOPNOTSUPP ;
4417
4420
4418
- /* Disable FW LLDP not supported if NPAR active or if FW
4419
- * API version < 1.7
4421
+ /* If the driver detected FW LLDP was disabled on init, this flag could
4422
+ * be set, however we do not support _changing_ the flag if NPAR is
4423
+ * enabled or FW API version < 1.7. There are situations where older
4424
+ * FW versions/NPAR enabled PFs could disable LLDP, however we _must_
4425
+ * not allow the user to enable/disable LLDP with this flag on
4426
+ * unsupported FW versions.
4420
4427
*/
4421
- if (new_flags & I40E_FLAG_DISABLE_FW_LLDP ) {
4428
+ if (changed_flags & I40E_FLAG_DISABLE_FW_LLDP ) {
4422
4429
if (pf -> hw .func_caps .npar_enable ) {
4423
4430
dev_warn (& pf -> pdev -> dev ,
4424
- "Unable to stop FW LLDP if NPAR active\n" );
4431
+ "Unable to change FW LLDP if NPAR active\n" );
4425
4432
return - EOPNOTSUPP ;
4426
4433
}
4427
4434
4428
4435
if (pf -> hw .aq .api_maj_ver < 1 ||
4429
4436
(pf -> hw .aq .api_maj_ver == 1 &&
4430
4437
pf -> hw .aq .api_min_ver < 7 )) {
4431
4438
dev_warn (& pf -> pdev -> dev ,
4432
- "FW ver does not support stopping FW LLDP\n" );
4439
+ "FW ver does not support changing FW LLDP\n" );
4433
4440
return - EOPNOTSUPP ;
4434
4441
}
4435
4442
}
@@ -4439,15 +4446,17 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
4439
4446
* something else has modified the flags variable since we copied it
4440
4447
* originally. We'll just punt with an error and log something in the
4441
4448
* message buffer.
4449
+ *
4450
+ * This is the point of no return for this function. We need to have
4451
+ * checked any discrepancies or misconfigurations and returned
4452
+ * EOPNOTSUPP before updating pf->flags here.
4442
4453
*/
4443
4454
if (cmpxchg64 (& pf -> flags , orig_flags , new_flags ) != orig_flags ) {
4444
4455
dev_warn (& pf -> pdev -> dev ,
4445
4456
"Unable to update pf->flags as it was modified by another thread...\n" );
4446
4457
return - EAGAIN ;
4447
4458
}
4448
4459
4449
- changed_flags = orig_flags ^ new_flags ;
4450
-
4451
4460
/* Process any additional changes needed as a result of flag changes.
4452
4461
* The changed_flags value reflects the list of bits that were
4453
4462
* changed in the code above.
@@ -4479,6 +4488,12 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
4479
4488
}
4480
4489
}
4481
4490
4491
+ if ((changed_flags & pf -> flags &
4492
+ I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED ) &&
4493
+ (pf -> flags & I40E_FLAG_MFP_ENABLED ))
4494
+ dev_warn (& pf -> pdev -> dev ,
4495
+ "Turning on link-down-on-close flag may affect other partitions\n" );
4496
+
4482
4497
if (changed_flags & I40E_FLAG_DISABLE_FW_LLDP ) {
4483
4498
if (pf -> flags & I40E_FLAG_DISABLE_FW_LLDP ) {
4484
4499
struct i40e_dcbx_config * dcbcfg ;
0 commit comments