Skip to content

Commit a9ce82f

Browse files
anambiarinJeff Kirsher
authored andcommitted
i40e: Enable 'channel' mode in mqprio for TC configs
The i40e driver is modified to enable the new mqprio hardware offload mode and factor the TCs and queue configuration by creating channel VSIs. In this mode, the priority to traffic class mapping and the user specified queue ranges are used to configure the traffic classes by setting the mode option to 'channel'. Example: map 0 0 0 0 1 2 2 3 queues 2@0 2@2 1@4 1@5\ hw 1 mode channel qdisc mqprio 8038: root tc 4 map 0 0 0 0 1 2 2 3 0 0 0 0 0 0 0 0 queues:(0:1) (2:3) (4:4) (5:5) mode:channel shaper:dcb The HW channels created are removed and all the queue configuration is set to default when the qdisc is detached from the root of the device. This patch also disables setting up channels via ethtool (ethtool -L) when the TCs are configured using mqprio scheduler. The patch also limits setting ethtool Rx flow hash indirection (ethtool -X eth0 equal N) to max queues configured via mqprio. The Rx flow hash indirection input through ethtool should be validated so that it is within in the queue range configured via tc/mqprio. The bound checking is achieved by reporting the current rss size to the kernel when queues are configured via mqprio. Example: map 0 0 0 1 0 2 3 0 queues 2@0 4@2 8@6 11@14\ hw 1 mode channel Cannot set RX flow hash configuration: Invalid argument Signed-off-by: Amritha Nambiar <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 8f88b30 commit a9ce82f

File tree

3 files changed

+362
-106
lines changed

3 files changed

+362
-106
lines changed

drivers/net/ethernet/intel/i40e/i40e.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
#include <linux/clocksource.h>
5555
#include <linux/net_tstamp.h>
5656
#include <linux/ptp_clock_kernel.h>
57+
#include <net/pkt_cls.h>
5758
#include "i40e_type.h"
5859
#include "i40e_prototype.h"
5960
#include "i40e_client.h"
@@ -700,6 +701,7 @@ struct i40e_vsi {
700701
enum i40e_vsi_type type; /* VSI type, e.g., LAN, FCoE, etc */
701702
s16 vf_id; /* Virtual function ID for SRIOV VSIs */
702703

704+
struct tc_mqprio_qopt_offload mqprio_qopt; /* queue parameters */
703705
struct i40e_tc_configuration tc_config;
704706
struct i40e_aqc_vsi_properties_data info;
705707

@@ -725,6 +727,7 @@ struct i40e_vsi {
725727
u16 cnt_q_avail; /* num of queues available for channel usage */
726728
u16 orig_rss_size;
727729
u16 current_rss_size;
730+
bool reconfig_rss;
728731

729732
u16 next_base_queue; /* next queue to be used for channel setup */
730733

drivers/net/ethernet/intel/i40e/i40e_ethtool.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2652,7 +2652,7 @@ static int i40e_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
26522652

26532653
switch (cmd->cmd) {
26542654
case ETHTOOL_GRXRINGS:
2655-
cmd->data = vsi->num_queue_pairs;
2655+
cmd->data = vsi->rss_size;
26562656
ret = 0;
26572657
break;
26582658
case ETHTOOL_GRXFH:
@@ -3897,6 +3897,12 @@ static int i40e_set_channels(struct net_device *dev,
38973897
if (vsi->type != I40E_VSI_MAIN)
38983898
return -EINVAL;
38993899

3900+
/* We do not support setting channels via ethtool when TCs are
3901+
* configured through mqprio
3902+
*/
3903+
if (pf->flags & I40E_FLAG_TC_MQPRIO)
3904+
return -EINVAL;
3905+
39003906
/* verify they are not requesting separate vectors */
39013907
if (!count || ch->rx_count || ch->tx_count)
39023908
return -EINVAL;

0 commit comments

Comments
 (0)