|
Thomas Bogendoerfer |
d8263a |
From: Eryk Rybak <eryk.roch.rybak@intel.com>
|
|
Thomas Bogendoerfer |
d8263a |
Date: Fri, 23 Apr 2021 13:43:25 +0200
|
|
Thomas Bogendoerfer |
d8263a |
Subject: i40e: Fix changing previously set num_queue_pairs for PFs
|
|
Thomas Bogendoerfer |
d8263a |
Patch-mainline: v5.16-rc2
|
|
Thomas Bogendoerfer |
d8263a |
Git-commit: d2a69fefd75683004ffe87166de5635b3267ee07
|
|
Thomas Bogendoerfer |
d8263a |
References: git-fixes
|
|
Thomas Bogendoerfer |
d8263a |
|
|
Thomas Bogendoerfer |
d8263a |
Currently, the i40e_vsi_setup_queue_map is basing the count of queues in
|
|
Thomas Bogendoerfer |
d8263a |
TCs on a VSI's alloc_queue_pairs member which is not changed throughout
|
|
Thomas Bogendoerfer |
d8263a |
any user's action (for example via ethtool's set_channels callback).
|
|
Thomas Bogendoerfer |
d8263a |
|
|
Thomas Bogendoerfer |
d8263a |
This implies that vsi->tc_config.tc_info[n].qcount value that is given
|
|
Thomas Bogendoerfer |
d8263a |
to the kernel via netdev_set_tc_queue() that notifies about the count of
|
|
Thomas Bogendoerfer |
d8263a |
queues per particular traffic class is constant even if user has changed
|
|
Thomas Bogendoerfer |
d8263a |
the total count of queues.
|
|
Thomas Bogendoerfer |
d8263a |
|
|
Thomas Bogendoerfer |
d8263a |
This in turn caused the kernel warning after setting the queue count to
|
|
Thomas Bogendoerfer |
d8263a |
the lower value than the initial one:
|
|
Thomas Bogendoerfer |
d8263a |
|
|
Thomas Bogendoerfer |
d8263a |
$ ethtool -l ens801f0
|
|
Thomas Bogendoerfer |
d8263a |
Channel parameters for ens801f0:
|
|
Thomas Bogendoerfer |
d8263a |
Pre-set maximums:
|
|
Thomas Bogendoerfer |
d8263a |
RX: 0
|
|
Thomas Bogendoerfer |
d8263a |
TX: 0
|
|
Thomas Bogendoerfer |
d8263a |
Other: 1
|
|
Thomas Bogendoerfer |
d8263a |
Combined: 64
|
|
Thomas Bogendoerfer |
d8263a |
Current hardware settings:
|
|
Thomas Bogendoerfer |
d8263a |
RX: 0
|
|
Thomas Bogendoerfer |
d8263a |
TX: 0
|
|
Thomas Bogendoerfer |
d8263a |
Other: 1
|
|
Thomas Bogendoerfer |
d8263a |
Combined: 64
|
|
Thomas Bogendoerfer |
d8263a |
|
|
Thomas Bogendoerfer |
d8263a |
$ ethtool -L ens801f0 combined 40
|
|
Thomas Bogendoerfer |
d8263a |
|
|
Thomas Bogendoerfer |
d8263a |
[dmesg]
|
|
Thomas Bogendoerfer |
d8263a |
Number of in use tx queues changed invalidating tc mappings. Priority
|
|
Thomas Bogendoerfer |
d8263a |
traffic classification disabled!
|
|
Thomas Bogendoerfer |
d8263a |
|
|
Thomas Bogendoerfer |
d8263a |
Reason was that vsi->alloc_queue_pairs stayed at 64 value which was used
|
|
Thomas Bogendoerfer |
d8263a |
to set the qcount on TC0 (by default only TC0 exists so all of the
|
|
Thomas Bogendoerfer |
d8263a |
existing queues are assigned to TC0). we update the offset/qcount via
|
|
Thomas Bogendoerfer |
d8263a |
netdev_set_tc_queue() back to the old value but then the
|
|
Thomas Bogendoerfer |
d8263a |
netif_set_real_num_tx_queues() is using the vsi->num_queue_pairs as a
|
|
Thomas Bogendoerfer |
d8263a |
value which got set to 40.
|
|
Thomas Bogendoerfer |
d8263a |
|
|
Thomas Bogendoerfer |
d8263a |
Fix it by using vsi->req_queue_pairs as a queue count that will be
|
|
Thomas Bogendoerfer |
d8263a |
distributed across TCs. Do it only for non-zero values, which implies
|
|
Thomas Bogendoerfer |
d8263a |
that user actually requested the new count of queues.
|
|
Thomas Bogendoerfer |
d8263a |
|
|
Thomas Bogendoerfer |
d8263a |
For VSIs other than main, stay with the vsi->alloc_queue_pairs as we
|
|
Thomas Bogendoerfer |
d8263a |
only allow manipulating the queue count on main VSI.
|
|
Thomas Bogendoerfer |
d8263a |
|
|
Thomas Bogendoerfer |
d8263a |
Fixes: bc6d33c8d93f ("i40e: Fix the number of queues available to be mapped for use")
|
|
Thomas Bogendoerfer |
d8263a |
Co-developed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
|
|
Thomas Bogendoerfer |
d8263a |
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
|
|
Thomas Bogendoerfer |
d8263a |
Co-developed-by: Przemyslaw Patynowski <przemyslawx.patynowski@intel.com>
|
|
Thomas Bogendoerfer |
d8263a |
Signed-off-by: Przemyslaw Patynowski <przemyslawx.patynowski@intel.com>
|
|
Thomas Bogendoerfer |
d8263a |
Signed-off-by: Eryk Rybak <eryk.roch.rybak@intel.com>
|
|
Thomas Bogendoerfer |
d8263a |
Tested-by: Tony Brelinski <tony.brelinski@intel.com>
|
|
Thomas Bogendoerfer |
d8263a |
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
|
|
Thomas Bogendoerfer |
d8263a |
Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
|
|
Thomas Bogendoerfer |
d8263a |
---
|
|
Thomas Bogendoerfer |
d8263a |
drivers/net/ethernet/intel/i40e/i40e_main.c | 35 ++++++++++++++++++----------
|
|
Thomas Bogendoerfer |
d8263a |
1 file changed, 23 insertions(+), 12 deletions(-)
|
|
Thomas Bogendoerfer |
d8263a |
|
|
Thomas Bogendoerfer |
d8263a |
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
|
|
Thomas Bogendoerfer |
d8263a |
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
|
|
Thomas Bogendoerfer |
d8263a |
@@ -1786,6 +1786,7 @@ static void i40e_vsi_setup_queue_map(str
|
|
Thomas Bogendoerfer |
d8263a |
bool is_add)
|
|
Thomas Bogendoerfer |
d8263a |
{
|
|
Thomas Bogendoerfer |
d8263a |
struct i40e_pf *pf = vsi->back;
|
|
Thomas Bogendoerfer |
d8263a |
+ u16 num_tc_qps = 0;
|
|
Thomas Bogendoerfer |
d8263a |
u16 sections = 0;
|
|
Thomas Bogendoerfer |
d8263a |
u8 netdev_tc = 0;
|
|
Thomas Bogendoerfer |
d8263a |
u16 numtc = 1;
|
|
Thomas Bogendoerfer |
d8263a |
@@ -1793,13 +1794,29 @@ static void i40e_vsi_setup_queue_map(str
|
|
Thomas Bogendoerfer |
d8263a |
u8 offset;
|
|
Thomas Bogendoerfer |
d8263a |
u16 qmap;
|
|
Thomas Bogendoerfer |
d8263a |
int i;
|
|
Thomas Bogendoerfer |
d8263a |
- u16 num_tc_qps = 0;
|
|
Thomas Bogendoerfer |
d8263a |
|
|
Thomas Bogendoerfer |
d8263a |
sections = I40E_AQ_VSI_PROP_QUEUE_MAP_VALID;
|
|
Thomas Bogendoerfer |
d8263a |
offset = 0;
|
|
Thomas Bogendoerfer |
d8263a |
|
|
Thomas Bogendoerfer |
d8263a |
+ if (vsi->type == I40E_VSI_MAIN) {
|
|
Thomas Bogendoerfer |
d8263a |
+ /* This code helps add more queue to the VSI if we have
|
|
Thomas Bogendoerfer |
d8263a |
+ * more cores than RSS can support, the higher cores will
|
|
Thomas Bogendoerfer |
d8263a |
+ * be served by ATR or other filters. Furthermore, the
|
|
Thomas Bogendoerfer |
d8263a |
+ * non-zero req_queue_pairs says that user requested a new
|
|
Thomas Bogendoerfer |
d8263a |
+ * queue count via ethtool's set_channels, so use this
|
|
Thomas Bogendoerfer |
d8263a |
+ * value for queues distribution across traffic classes
|
|
Thomas Bogendoerfer |
d8263a |
+ */
|
|
Thomas Bogendoerfer |
d8263a |
+ if (vsi->req_queue_pairs > 0)
|
|
Thomas Bogendoerfer |
d8263a |
+ vsi->num_queue_pairs = vsi->req_queue_pairs;
|
|
Thomas Bogendoerfer |
d8263a |
+ else if (pf->flags & I40E_FLAG_MSIX_ENABLED)
|
|
Thomas Bogendoerfer |
d8263a |
+ vsi->num_queue_pairs = pf->num_lan_msix;
|
|
Thomas Bogendoerfer |
d8263a |
+ }
|
|
Thomas Bogendoerfer |
d8263a |
+
|
|
Thomas Bogendoerfer |
d8263a |
/* Number of queues per enabled TC */
|
|
Thomas Bogendoerfer |
d8263a |
- num_tc_qps = vsi->alloc_queue_pairs;
|
|
Thomas Bogendoerfer |
d8263a |
+ if (vsi->type == I40E_VSI_MAIN)
|
|
Thomas Bogendoerfer |
d8263a |
+ num_tc_qps = vsi->num_queue_pairs;
|
|
Thomas Bogendoerfer |
d8263a |
+ else
|
|
Thomas Bogendoerfer |
d8263a |
+ num_tc_qps = vsi->alloc_queue_pairs;
|
|
Thomas Bogendoerfer |
d8263a |
if (enabled_tc && (vsi->back->flags & I40E_FLAG_DCB_ENABLED)) {
|
|
Thomas Bogendoerfer |
d8263a |
/* Find numtc from enabled TC bitmap */
|
|
Thomas Bogendoerfer |
d8263a |
for (i = 0, numtc = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) {
|
|
Thomas Bogendoerfer |
d8263a |
@@ -1877,16 +1894,10 @@ static void i40e_vsi_setup_queue_map(str
|
|
Thomas Bogendoerfer |
d8263a |
}
|
|
Thomas Bogendoerfer |
d8263a |
ctxt->info.tc_mapping[i] = cpu_to_le16(qmap);
|
|
Thomas Bogendoerfer |
d8263a |
}
|
|
Thomas Bogendoerfer |
d8263a |
-
|
|
Thomas Bogendoerfer |
d8263a |
- /* Set actual Tx/Rx queue pairs */
|
|
Thomas Bogendoerfer |
d8263a |
- vsi->num_queue_pairs = offset;
|
|
Thomas Bogendoerfer |
d8263a |
- if ((vsi->type == I40E_VSI_MAIN) && (numtc == 1)) {
|
|
Thomas Bogendoerfer |
d8263a |
- if (vsi->req_queue_pairs > 0)
|
|
Thomas Bogendoerfer |
d8263a |
- vsi->num_queue_pairs = vsi->req_queue_pairs;
|
|
Thomas Bogendoerfer |
d8263a |
- else if (pf->flags & I40E_FLAG_MSIX_ENABLED)
|
|
Thomas Bogendoerfer |
d8263a |
- vsi->num_queue_pairs = pf->num_lan_msix;
|
|
Thomas Bogendoerfer |
d8263a |
- }
|
|
Thomas Bogendoerfer |
d8263a |
-
|
|
Thomas Bogendoerfer |
d8263a |
+ /* Do not change previously set num_queue_pairs for PFs */
|
|
Thomas Bogendoerfer |
d8263a |
+ if ((vsi->type == I40E_VSI_MAIN && numtc != 1) ||
|
|
Thomas Bogendoerfer |
d8263a |
+ vsi->type != I40E_VSI_MAIN)
|
|
Thomas Bogendoerfer |
d8263a |
+ vsi->num_queue_pairs = offset;
|
|
Thomas Bogendoerfer |
d8263a |
/* Scheduler section valid can only be set for ADD VSI */
|
|
Thomas Bogendoerfer |
d8263a |
if (is_add) {
|
|
Thomas Bogendoerfer |
d8263a |
sections |= I40E_AQ_VSI_PROP_SCHED_VALID;
|