Commit 9fe2e6f3 authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parents 5121db6a 93cb804e
......@@ -92,6 +92,7 @@ struct iavf_vsi {
#define IAVF_HKEY_ARRAY_SIZE ((IAVF_VFQF_HKEY_MAX_INDEX + 1) * 4)
#define IAVF_HLUT_ARRAY_SIZE ((IAVF_VFQF_HLUT_MAX_INDEX + 1) * 4)
#define IAVF_MBPS_DIVISOR 125000 /* divisor to convert to Mbps */
#define IAVF_MBPS_QUANTA 50
#define IAVF_VIRTCHNL_VF_RESOURCE_SIZE (sizeof(struct virtchnl_vf_resource) + \
(IAVF_MAX_VF_VSI * \
......@@ -430,6 +431,11 @@ struct iavf_adapter {
/* lock to protect access to the cloud filter list */
spinlock_t cloud_filter_list_lock;
u16 num_cloud_filters;
/* snapshot of "num_active_queues" before setup_tc for qdisc add
* is invoked. This information is useful during qdisc del flow,
* to restore correct number of queues
*/
int orig_num_active_queues;
#define IAVF_MAX_FDIR_FILTERS 128 /* max allowed Flow Director filters */
u16 fdir_active_fltr;
......
......@@ -3322,6 +3322,7 @@ static int iavf_validate_ch_config(struct iavf_adapter *adapter,
struct tc_mqprio_qopt_offload *mqprio_qopt)
{
u64 total_max_rate = 0;
u32 tx_rate_rem = 0;
int i, num_qps = 0;
u64 tx_rate = 0;
int ret = 0;
......@@ -3336,12 +3337,32 @@ static int iavf_validate_ch_config(struct iavf_adapter *adapter,
return -EINVAL;
if (mqprio_qopt->min_rate[i]) {
dev_err(&adapter->pdev->dev,
"Invalid min tx rate (greater than 0) specified\n");
"Invalid min tx rate (greater than 0) specified for TC%d\n",
i);
return -EINVAL;
}
/*convert to Mbps */
/* convert to Mbps */
tx_rate = div_u64(mqprio_qopt->max_rate[i],
IAVF_MBPS_DIVISOR);
if (mqprio_qopt->max_rate[i] &&
tx_rate < IAVF_MBPS_QUANTA) {
dev_err(&adapter->pdev->dev,
"Invalid max tx rate for TC%d, minimum %dMbps\n",
i, IAVF_MBPS_QUANTA);
return -EINVAL;
}
(void)div_u64_rem(tx_rate, IAVF_MBPS_QUANTA, &tx_rate_rem);
if (tx_rate_rem != 0) {
dev_err(&adapter->pdev->dev,
"Invalid max tx rate for TC%d, not divisible by %d\n",
i, IAVF_MBPS_QUANTA);
return -EINVAL;
}
total_max_rate += tx_rate;
num_qps += mqprio_qopt->qopt.count[i];
}
......@@ -3408,6 +3429,7 @@ static int __iavf_setup_tc(struct net_device *netdev, void *type_data)
netif_tx_disable(netdev);
iavf_del_all_cloud_filters(adapter);
adapter->aq_required = IAVF_FLAG_AQ_DISABLE_CHANNELS;
total_qps = adapter->orig_num_active_queues;
goto exit;
} else {
return -EINVAL;
......@@ -3451,7 +3473,21 @@ static int __iavf_setup_tc(struct net_device *netdev, void *type_data)
adapter->ch_config.ch_info[i].offset = 0;
}
}
/* Take snapshot of original config such as "num_active_queues"
* It is used later when delete ADQ flow is exercised, so that
* once delete ADQ flow completes, VF shall go back to its
* original queue configuration
*/
adapter->orig_num_active_queues = adapter->num_active_queues;
/* Store queue info based on TC so that VF gets configured
* with correct number of queues when VF completes ADQ config
* flow
*/
adapter->ch_config.total_qps = total_qps;
netif_tx_stop_all_queues(netdev);
netif_tx_disable(netdev);
adapter->aq_required |= IAVF_FLAG_AQ_ENABLE_CHANNELS;
......@@ -3468,6 +3504,12 @@ static int __iavf_setup_tc(struct net_device *netdev, void *type_data)
}
}
exit:
if (test_bit(__IAVF_IN_REMOVE_TASK, &adapter->crit_section))
return 0;
netif_set_real_num_rx_queues(netdev, total_qps);
netif_set_real_num_tx_queues(netdev, total_qps);
return ret;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment