Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue

Tony Nguyen says:

====================
Intel Wired LAN Driver Updates 2022-07-29

This series contains updates to iavf driver only.

Przemyslaw prevents setting of TC max rate below minimum supported values
and reports updated queue values when setting up TCs.
---
v2: Dropped patch 3 (hw-tc-offload check)
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+50 -2
+6
drivers/net/ethernet/intel/iavf/iavf.h
··· 92 92 #define IAVF_HKEY_ARRAY_SIZE ((IAVF_VFQF_HKEY_MAX_INDEX + 1) * 4) 93 93 #define IAVF_HLUT_ARRAY_SIZE ((IAVF_VFQF_HLUT_MAX_INDEX + 1) * 4) 94 94 #define IAVF_MBPS_DIVISOR 125000 /* divisor to convert to Mbps */ 95 + #define IAVF_MBPS_QUANTA 50 95 96 96 97 #define IAVF_VIRTCHNL_VF_RESOURCE_SIZE (sizeof(struct virtchnl_vf_resource) + \ 97 98 (IAVF_MAX_VF_VSI * \ ··· 431 430 /* lock to protect access to the cloud filter list */ 432 431 spinlock_t cloud_filter_list_lock; 433 432 u16 num_cloud_filters; 433 + /* snapshot of "num_active_queues" before setup_tc for qdisc add 434 + * is invoked. This information is useful during qdisc del flow, 435 + * to restore correct number of queues 436 + */ 437 + int orig_num_active_queues; 434 438 435 439 #define IAVF_MAX_FDIR_FILTERS 128 /* max allowed Flow Director filters */ 436 440 u16 fdir_active_fltr;
+44 -2
drivers/net/ethernet/intel/iavf/iavf_main.c
··· 3322 3322 struct tc_mqprio_qopt_offload *mqprio_qopt) 3323 3323 { 3324 3324 u64 total_max_rate = 0; 3325 + u32 tx_rate_rem = 0; 3325 3326 int i, num_qps = 0; 3326 3327 u64 tx_rate = 0; 3327 3328 int ret = 0; ··· 3337 3336 return -EINVAL; 3338 3337 if (mqprio_qopt->min_rate[i]) { 3339 3338 dev_err(&adapter->pdev->dev, 3340 - "Invalid min tx rate (greater than 0) specified\n"); 3339 + "Invalid min tx rate (greater than 0) specified for TC%d\n", 3340 + i); 3341 3341 return -EINVAL; 3342 3342 } 3343 - /*convert to Mbps */ 3343 + 3344 + /* convert to Mbps */ 3344 3345 tx_rate = div_u64(mqprio_qopt->max_rate[i], 3345 3346 IAVF_MBPS_DIVISOR); 3347 + 3348 + if (mqprio_qopt->max_rate[i] && 3349 + tx_rate < IAVF_MBPS_QUANTA) { 3350 + dev_err(&adapter->pdev->dev, 3351 + "Invalid max tx rate for TC%d, minimum %dMbps\n", 3352 + i, IAVF_MBPS_QUANTA); 3353 + return -EINVAL; 3354 + } 3355 + 3356 + (void)div_u64_rem(tx_rate, IAVF_MBPS_QUANTA, &tx_rate_rem); 3357 + 3358 + if (tx_rate_rem != 0) { 3359 + dev_err(&adapter->pdev->dev, 3360 + "Invalid max tx rate for TC%d, not divisible by %d\n", 3361 + i, IAVF_MBPS_QUANTA); 3362 + return -EINVAL; 3363 + } 3364 + 3346 3365 total_max_rate += tx_rate; 3347 3366 num_qps += mqprio_qopt->qopt.count[i]; 3348 3367 } ··· 3429 3408 netif_tx_disable(netdev); 3430 3409 iavf_del_all_cloud_filters(adapter); 3431 3410 adapter->aq_required = IAVF_FLAG_AQ_DISABLE_CHANNELS; 3411 + total_qps = adapter->orig_num_active_queues; 3432 3412 goto exit; 3433 3413 } else { 3434 3414 return -EINVAL; ··· 3473 3451 adapter->ch_config.ch_info[i].offset = 0; 3474 3452 } 3475 3453 } 3454 + 3455 + /* Take snapshot of original config such as "num_active_queues" 3456 + * It is used later when delete ADQ flow is exercised, so that 3457 + * once delete ADQ flow completes, VF shall go back to its 3458 + * original queue configuration 3459 + */ 3460 + 3461 + adapter->orig_num_active_queues = adapter->num_active_queues; 3462 + 3463 + /* Store queue info based on TC so that VF gets configured 3464 + * with correct number of queues when VF completes ADQ config 3465 + * flow 3466 + */ 3476 3467 adapter->ch_config.total_qps = total_qps; 3468 + 3477 3469 netif_tx_stop_all_queues(netdev); 3478 3470 netif_tx_disable(netdev); 3479 3471 adapter->aq_required |= IAVF_FLAG_AQ_ENABLE_CHANNELS; ··· 3504 3468 } 3505 3469 } 3506 3470 exit: 3471 + if (test_bit(__IAVF_IN_REMOVE_TASK, &adapter->crit_section)) 3472 + return 0; 3473 + 3474 + netif_set_real_num_rx_queues(netdev, total_qps); 3475 + netif_set_real_num_tx_queues(netdev, total_qps); 3476 + 3507 3477 return ret; 3508 3478 } 3509 3479