Skip to contentSkip to conversation

ice: Expose RSS indirection tables for queue groups via ethtool

PATCH Superseded Sudheer Mogilappagari 4 participants 6 messages May 3, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ice: Expose RSS indirection tables for queue groups via ethtool

From: Sridhar Samudrala <[email protected]>

When ADQ queue groups(TCs) are created via tc mqprio command, RSS contexts and associated RSS indirection tables are configured automatically per TC based on the queue ranges specified for each traffic class.

For ex:
tc qdisc add dev enp175s0f0 root mqprio num_tc 3 map 0 1 2 \
queues 2 at 0 8 at 2 4 at 10 hw 1 mode channel

will create 3 queue groups(TC 0-2) with queue ranges 2, 8 and 4 in 3 queue groups. Each queue group is associated with its own RSS context and RSS indirection table.

Add support to expose RSS indirection tables for all ADQ queue groups using ethtool RSS contexts interface.
ethtool -x enp175s0f0 context <tc-num>

---
 drivers/net/ethernet/intel/ice/ice_ethtool.c | 69 +++++++++++++++-----
 1 file changed, 51 insertions(+), 18 deletions(-)
drivers/net/ethernet/intel/ice/ice_ethtool.c +51 -18
index 476bd1c83c87..1e71b70f0e52 100644
@@ -3111,36 +3111,47 @@ static u32 ice_get_rxfh_indir_size(struct net_device *netdev)
 	return np->vsi->rss_table_size;
 }
 
-/**
- * ice_get_rxfh - get the Rx flow hash indirection table
- * @netdev: network interface device structure
- * @indir: indirection table
- * @key: hash key
- * @hfunc: hash function
- *
- * Reads the indirection table directly from the hardware.
- */
 static int
-ice_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, u8 *hfunc)
+ice_get_rxfh_context(struct net_device *netdev, u32 *indir,
+		     u8 *key, u8 *hfunc, u32 rss_context)
 {
 	struct ice_netdev_priv *np = netdev_priv(netdev);
 	struct ice_vsi *vsi = np->vsi;
 	struct ice_pf *pf = vsi->back;
-	int err, i;
+	u16 qcount, offset;
+	int err, num_tc, i;
 	u8 *lut;
 
+	if (!test_bit(ICE_FLAG_RSS_ENA, pf->flags)) {
+		netdev_warn(netdev, "RSS is not supported on this VSI!\n");
+		return -EOPNOTSUPP;
+	}
+
+	if (rss_context && !ice_is_adq_active(pf)) {
+		netdev_err(netdev, "RSS context cannot be non-zero when ADQ is not configured.\n");
+		return -EINVAL;
+	}
+
+	qcount = vsi->mqprio_qopt.qopt.count[rss_context];
+	offset = vsi->mqprio_qopt.qopt.offset[rss_context];
+
+	if (rss_context && ice_is_adq_active(pf)) {
+		num_tc = vsi->mqprio_qopt.qopt.num_tc;
+		if (rss_context >= num_tc) {
+			netdev_err(netdev, "RSS context:%d  > num_tc:%d\n",
+				   rss_context, num_tc);
+			return -EINVAL;
+		}
+		/* Use channel VSI of given TC */
+		vsi = vsi->tc_map_vsi[rss_context];
+	}
+
 	if (hfunc)
 		*hfunc = ETH_RSS_HASH_TOP;
 
 	if (!indir)
 		return 0;
 
-	if (!test_bit(ICE_FLAG_RSS_ENA, pf->flags)) {
-		/* RSS not supported return error here */
-		netdev_warn(netdev, "RSS is not configured on this VSI!\n");
-		return -EIO;
-	}
-
 	lut = kzalloc(vsi->rss_table_size, GFP_KERNEL);
 	if (!lut)
 		return -ENOMEM;
@@ -3153,14 +3164,35 @@ ice_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, u8 *hfunc)
 	if (err)
 		goto out;
 
+	if (ice_is_adq_active(pf)) {
+		for (i = 0; i < vsi->rss_table_size; i++)
+			indir[i] = offset + lut[i] % qcount;
+		goto out;
+	}
+
 	for (i = 0; i < vsi->rss_table_size; i++)
-		indir[i] = (u32)(lut[i]);
+		indir[i] = lut[i];
 
 out:
 	kfree(lut);
 	return err;
 }
 
+/**
+ * ice_get_rxfh - get the Rx flow hash indirection table
+ * @netdev: network interface device structure
+ * @indir: indirection table
+ * @key: hash key
+ * @hfunc: hash function
+ *
+ * Reads the indirection table directly from the hardware.
+ */
+static int
+ice_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, u8 *hfunc)
+{
+	return ice_get_rxfh_context(netdev, indir, key, hfunc, 0);
+}
+
 /**
  * ice_set_rxfh - set the Rx flow hash indirection table
  * @netdev: network interface device structure
@@ -4102,6 +4134,7 @@ static const struct ethtool_ops ice_ethtool_ops = {
 	.set_pauseparam		= ice_set_pauseparam,
 	.get_rxfh_key_size	= ice_get_rxfh_key_size,
 	.get_rxfh_indir_size	= ice_get_rxfh_indir_size,
+	.get_rxfh_context	= ice_get_rxfh_context,
 	.get_rxfh		= ice_get_rxfh,
 	.set_rxfh		= ice_set_rxfh,
 	.get_channels		= ice_get_channels,
Signature · 1 line
2.27.0
#1 lore raw

PATCH 1/1 ice: Expose RSS indirection tables for queue groups via ethtool

Dear Sudheer,

Thank you for your patch.

Am 03.05.22 um 15:24 schrieb Sudheer Mogilappagari:

Quoted 3 lines

From: Sridhar Samudrala <[email protected]>

When ADQ queue groups(TCs) are created via tc mqprio command,

Please add a space before the (.

Quoted 9 lines

RSS contexts and associated RSS indirection tables are configured automatically per TC based on the queue ranges specified for each traffic class.

For ex:
tc qdisc add dev enp175s0f0 root mqprio num_tc 3 map 0 1 2 \
queues 2 at 0 8 at 2 4 at 10 hw 1 mode channel

will create 3 queue groups(TC 0-2) with queue ranges 2, 8 and 4

Ditto.

Quoted 8 lines

in 3 queue groups. Each queue group is associated with its own RSS context and RSS indirection table.

Add support to expose RSS indirection tables for all ADQ queue groups using ethtool RSS contexts interface.
ethtool -x enp175s0f0 context <tc-num>

Missing space before the <.

Quoted 23 lines
---
  drivers/net/ethernet/intel/ice/ice_ethtool.c | 69 +++++++++++++++-----
  1 file changed, 51 insertions(+), 18 deletions(-)
drivers/net/ethernet/intel/ice/ice_ethtool.c +0 -9
index 476bd1c83c87..1e71b70f0e52 100644
@@ -3111,36 +3111,47 @@ static u32 ice_get_rxfh_indir_size(struct net_device *netdev)
  	return np->vsi->rss_table_size;
  }
 
-/**
- * ice_get_rxfh - get the Rx flow hash indirection table
- * @netdev: network interface device structure
- * @indir: indirection table
- * @key: hash key
- * @hfunc: hash function
- *
- * Reads the indirection table directly from the hardware.
- */
  static int

drivers/net/ethernet/intel/ice/ice_ethtool.c static u32 ice_get_rxfh_indir_size(struct net_device *netdev) · line 3122

Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_ethtool.c +4 -2
-ice_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, u8 *hfunc)
+ice_get_rxfh_context(struct net_device *netdev, u32 *indir,
+		     u8 *key, u8 *hfunc, u32 rss_context)
  {
  	struct ice_netdev_priv *np = netdev_priv(netdev);
  	struct ice_vsi *vsi = np->vsi;
  	struct ice_pf *pf = vsi->back;
-	int err, i;
+	u16 qcount, offset;
+	int err, num_tc, i;

num_tc is defined as __u8 in include/uapi/linux/pkt_sched.h. No idea, if it?s useful to use the same type, or just unsigned int.

Quoted 16 lines
drivers/net/ethernet/intel/ice/ice_ethtool.c +14 -0
  	u8 *lut;
 
+	if (!test_bit(ICE_FLAG_RSS_ENA, pf->flags)) {
+		netdev_warn(netdev, "RSS is not supported on this VSI!\n");
+		return -EOPNOTSUPP;
+	}
+
+	if (rss_context && !ice_is_adq_active(pf)) {
+		netdev_err(netdev, "RSS context cannot be non-zero when ADQ is not configured.\n");
+		return -EINVAL;
+	}
+
+	qcount = vsi->mqprio_qopt.qopt.count[rss_context];
+	offset = vsi->mqprio_qopt.qopt.offset[rss_context];
+
+	if (rss_context && ice_is_adq_active(pf)) {

drivers/net/ethernet/intel/ice/ice_ethtool.c static u32 ice_get_rxfh_indir_size(struct net_device *netdev) · line 3148

Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_ethtool.c +10 -0
+		num_tc = vsi->mqprio_qopt.qopt.num_tc;
+		if (rss_context >= num_tc) {
+			netdev_err(netdev, "RSS context:%d  > num_tc:%d\n",
+				   rss_context, num_tc);
+			return -EINVAL;
+		}
+		/* Use channel VSI of given TC */
+		vsi = vsi->tc_map_vsi[rss_context];
+	}
+

Kind regards,

Paul

Quoted 60 lines
drivers/net/ethernet/intel/ice/ice_ethtool.c +23 -7
  	if (hfunc)
  		*hfunc = ETH_RSS_HASH_TOP;
 
  	if (!indir)
  		return 0;
 
-	if (!test_bit(ICE_FLAG_RSS_ENA, pf->flags)) {
-		/* RSS not supported return error here */
-		netdev_warn(netdev, "RSS is not configured on this VSI!\n");
-		return -EIO;
-	}
-
  	lut = kzalloc(vsi->rss_table_size, GFP_KERNEL);
  	if (!lut)
  		return -ENOMEM;
@@ -3153,14 +3164,35 @@ ice_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, u8 *hfunc)
  	if (err)
  		goto out;
 
+	if (ice_is_adq_active(pf)) {
+		for (i = 0; i < vsi->rss_table_size; i++)
+			indir[i] = offset + lut[i] % qcount;
+		goto out;
+	}
+
  	for (i = 0; i < vsi->rss_table_size; i++)
-		indir[i] = (u32)(lut[i]);
+		indir[i] = lut[i];
 
  out:
  	kfree(lut);
  	return err;
  }
 
+/**
+ * ice_get_rxfh - get the Rx flow hash indirection table
+ * @netdev: network interface device structure
+ * @indir: indirection table
+ * @key: hash key
+ * @hfunc: hash function
+ *
+ * Reads the indirection table directly from the hardware.
+ */
+static int
+ice_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, u8 *hfunc)
+{
+	return ice_get_rxfh_context(netdev, indir, key, hfunc, 0);
+}
+
  /**
   * ice_set_rxfh - set the Rx flow hash indirection table
   * @netdev: network interface device structure
@@ -4102,6 +4134,7 @@ static const struct ethtool_ops ice_ethtool_ops = {
  	.set_pauseparam		= ice_set_pauseparam,
  	.get_rxfh_key_size	= ice_get_rxfh_key_size,
  	.get_rxfh_indir_size	= ice_get_rxfh_indir_size,
+	.get_rxfh_context	= ice_get_rxfh_context,
  	.get_rxfh		= ice_get_rxfh,
  	.set_rxfh		= ice_set_rxfh,
  	.get_channels		= ice_get_channels,
#2 lore raw

PATCH 1/1 ice: Expose RSS indirection tables for queue groups via ethtool

Quoted 38 lines

-----Original Message-----
From: Paul Menzel <[email protected]>
Sent: Tuesday, May 3, 2022 8:20 AM
To: Mogilappagari, Sudheer <[email protected]>
Cc: intel-wired-lan at osuosl.org; Samudrala, Sridhar <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH net-next v1] ice: Expose RSS indirection tables for queue groups via ethtool

Dear Sudheer,

Thank you for your patch.

Am 03.05.22 um 15:24 schrieb Sudheer Mogilappagari:

Quoted 3 lines

From: Sridhar Samudrala <[email protected]>

When ADQ queue groups(TCs) are created via tc mqprio command,

Please add a space before the (.

Quoted 9 lines

RSS contexts and associated RSS indirection tables are configured automatically per TC based on the queue ranges specified for each traffic class.

For ex:
tc qdisc add dev enp175s0f0 root mqprio num_tc 3 map 0 1 2 \
queues 2 at 0 8 at 2 4 at 10 hw 1 mode channel

will create 3 queue groups(TC 0-2) with queue ranges 2, 8 and 4

Ditto.

Quoted 3 lines

in 3 queue groups. Each queue group is associated with its own RSS context and RSS indirection table.

Quoted 7 lines
Quoted 5 lines

Add support to expose RSS indirection tables for all ADQ queue groups using ethtool RSS contexts interface.
ethtool -x enp175s0f0 context <tc-num>

Missing space before the <.

Thank you Paul for reviewing! Have updated patch with your review comments.

Best Regards
Sudheer

Quoted 136 lines
Quoted 4 lines
---
  drivers/net/ethernet/intel/ice/ice_ethtool.c | 69 +++++++++++++++----

-

drivers/net/ethernet/intel/ice/ice_ethtool.c static u32 ice_get_rxfh_indir_size(struct

Quoted 8 lines
  1 file changed, 51 insertions(+), 18 deletions(-)
drivers/net/ethernet/intel/ice/ice_ethtool.c +0 -0
index 476bd1c83c87..1e71b70f0e52 100644
@@ -3111,36 +3111,47 @@ static u32 ice_get_rxfh_indir_size(struct

net_device *netdev)

Quoted 14 lines
drivers/net/ethernet/intel/ice/ice_ethtool.c +0 -10
  	return np->vsi->rss_table_size;
  }
 
-/**
- * ice_get_rxfh - get the Rx flow hash indirection table
- * @netdev: network interface device structure
- * @indir: indirection table
- * @key: hash key
- * @hfunc: hash function
- *
- * Reads the indirection table directly from the hardware.
- */
  static int
-ice_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, u8

drivers/net/ethernet/intel/ice/ice_ethtool.c static u32 ice_get_rxfh_indir_size(struct net_device *netdev) · line 3122

Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_ethtool.c +4 -1
 *hfunc)
+ice_get_rxfh_context(struct net_device *netdev, u32 *indir,
+		     u8 *key, u8 *hfunc, u32 rss_context)
  {
  	struct ice_netdev_priv *np = netdev_priv(netdev);
  	struct ice_vsi *vsi = np->vsi;
  	struct ice_pf *pf = vsi->back;
-	int err, i;
+	u16 qcount, offset;
+	int err, num_tc, i;

num_tc is defined as __u8 in include/uapi/linux/pkt_sched.h. No idea, if it?s useful to use the same type, or just unsigned int.

drivers/net/ethernet/intel/ice/ice_ethtool.c static u32 ice_get_rxfh_indir_size(struct net_device *netdev)

Quoted 9 lines
drivers/net/ethernet/intel/ice/ice_ethtool.c +7 -0
  	u8 *lut;
 
+	if (!test_bit(ICE_FLAG_RSS_ENA, pf->flags)) {
+		netdev_warn(netdev, "RSS is not supported on this VSI!\n");
+		return -EOPNOTSUPP;
+	}
+
+	if (rss_context && !ice_is_adq_active(pf)) {
+		netdev_err(netdev, "RSS context cannot be non-zero when ADQ

is not configured.\n");

Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_ethtool.c +7 -0
+		return -EINVAL;
+	}
+
+	qcount = vsi->mqprio_qopt.qopt.count[rss_context];
+	offset = vsi->mqprio_qopt.qopt.offset[rss_context];
+
+	if (rss_context && ice_is_adq_active(pf)) {

drivers/net/ethernet/intel/ice/ice_ethtool.c static u32 ice_get_rxfh_indir_size(struct net_device *netdev) · line 3148

Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_ethtool.c +10 -0
+		num_tc = vsi->mqprio_qopt.qopt.num_tc;
+		if (rss_context >= num_tc) {
+			netdev_err(netdev, "RSS context:%d  > num_tc:%d\n",
+				   rss_context, num_tc);
+			return -EINVAL;
+		}
+		/* Use channel VSI of given TC */
+		vsi = vsi->tc_map_vsi[rss_context];
+	}
+

Kind regards,

Paul

drivers/net/ethernet/intel/ice/ice_ethtool.c ice_get_rxfh(struct net_device *netdev, u32

Quoted 16 lines
drivers/net/ethernet/intel/ice/ice_ethtool.c +0 -6
  	if (hfunc)
  		*hfunc = ETH_RSS_HASH_TOP;
 
  	if (!indir)
  		return 0;
 
-	if (!test_bit(ICE_FLAG_RSS_ENA, pf->flags)) {
-		/* RSS not supported return error here */
-		netdev_warn(netdev, "RSS is not configured on this VSI!\n");
-		return -EIO;
-	}
-
  	lut = kzalloc(vsi->rss_table_size, GFP_KERNEL);
  	if (!lut)

return -ENOMEM;

drivers/net/ethernet/intel/ice/ice_ethtool.c +0 -0
@@ -3153,14 +3164,35 @@ ice_get_rxfh(struct net_device *netdev, u32

*indir, u8 *key, u8 *hfunc)

Quoted 43 lines
drivers/net/ethernet/intel/ice/ice_ethtool.c +21 -1
  	if (err)
  		goto out;
 
+	if (ice_is_adq_active(pf)) {
+		for (i = 0; i < vsi->rss_table_size; i++)
+			indir[i] = offset + lut[i] % qcount;
+		goto out;
+	}
+
  	for (i = 0; i < vsi->rss_table_size; i++)
-		indir[i] = (u32)(lut[i]);
+		indir[i] = lut[i];
 
  out:
  	kfree(lut);
  	return err;
  }
 
+/**
+ * ice_get_rxfh - get the Rx flow hash indirection table
+ * @netdev: network interface device structure
+ * @indir: indirection table
+ * @key: hash key
+ * @hfunc: hash function
+ *
+ * Reads the indirection table directly from the hardware.
+ */
+static int
+ice_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, u8
+*hfunc) {
+	return ice_get_rxfh_context(netdev, indir, key, hfunc, 0); }
+
  /**
   * ice_set_rxfh - set the Rx flow hash indirection table
   * @netdev: network interface device structure @@ -4102,6 +4134,7 @@

static const struct ethtool_ops ice_ethtool_ops = {
.set_pauseparam = ice_set_pauseparam,
.get_rxfh_key_size = ice_get_rxfh_key_size,
.get_rxfh_indir_size = ice_get_rxfh_indir_size,

drivers/net/ethernet/intel/ice/ice_ethtool.c +1 -0
+	.get_rxfh_context	= ice_get_rxfh_context,
  	.get_rxfh		= ice_get_rxfh,
  	.set_rxfh		= ice_set_rxfh,
  	.get_channels		= ice_get_channels,
#3 lore raw

PATCH 1/1 ice: Expose RSS indirection tables for queue groups via ethtool

In reply to Sudheer Mogilappagari

From: Sudheer Mogilappagari <[email protected]>
Date: Tue, 3 May 2022 06:24:28 -0700

Quoted 15 lines

From: Sridhar Samudrala <[email protected]>

When ADQ queue groups(TCs) are created via tc mqprio command, RSS contexts and associated RSS indirection tables are configured automatically per TC based on the queue ranges specified for each traffic class.

For ex:
tc qdisc add dev enp175s0f0 root mqprio num_tc 3 map 0 1 2 \
queues 2 at 0 8 at 2 4 at 10 hw 1 mode channel

will create 3 queue groups(TC 0-2) with queue ranges 2, 8 and 4 in 3 queue groups. Each queue group is associated with its own RSS context and RSS indirection table.

Quoted 6 lines

Add support to expose RSS indirection tables for all ADQ queue groups using ethtool RSS contexts interface.
ethtool -x enp175s0f0 context <tc-num>

You didn't answer to any of my comments or questions during the internal review, including the ones that Paul has just asked, and now you're posting the same version to IWL to get it accepted upstream.
That's not how it works, NAK.

Quoted 120 lines
---
 drivers/net/ethernet/intel/ice/ice_ethtool.c | 69 +++++++++++++++-----
 1 file changed, 51 insertions(+), 18 deletions(-)
drivers/net/ethernet/intel/ice/ice_ethtool.c +51 -18
index 476bd1c83c87..1e71b70f0e52 100644
@@ -3111,36 +3111,47 @@ static u32 ice_get_rxfh_indir_size(struct net_device *netdev)
 	return np->vsi->rss_table_size;
 }
 
-/**
- * ice_get_rxfh - get the Rx flow hash indirection table
- * @netdev: network interface device structure
- * @indir: indirection table
- * @key: hash key
- * @hfunc: hash function
- *
- * Reads the indirection table directly from the hardware.
- */
 static int
-ice_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, u8 *hfunc)
+ice_get_rxfh_context(struct net_device *netdev, u32 *indir,
+		     u8 *key, u8 *hfunc, u32 rss_context)
 {
 	struct ice_netdev_priv *np = netdev_priv(netdev);
 	struct ice_vsi *vsi = np->vsi;
 	struct ice_pf *pf = vsi->back;
-	int err, i;
+	u16 qcount, offset;
+	int err, num_tc, i;
 	u8 *lut;
 
+	if (!test_bit(ICE_FLAG_RSS_ENA, pf->flags)) {
+		netdev_warn(netdev, "RSS is not supported on this VSI!\n");
+		return -EOPNOTSUPP;
+	}
+
+	if (rss_context && !ice_is_adq_active(pf)) {
+		netdev_err(netdev, "RSS context cannot be non-zero when ADQ is not configured.\n");
+		return -EINVAL;
+	}
+
+	qcount = vsi->mqprio_qopt.qopt.count[rss_context];
+	offset = vsi->mqprio_qopt.qopt.offset[rss_context];
+
+	if (rss_context && ice_is_adq_active(pf)) {
+		num_tc = vsi->mqprio_qopt.qopt.num_tc;
+		if (rss_context >= num_tc) {
+			netdev_err(netdev, "RSS context:%d  > num_tc:%d\n",
+				   rss_context, num_tc);
+			return -EINVAL;
+		}
+		/* Use channel VSI of given TC */
+		vsi = vsi->tc_map_vsi[rss_context];
+	}
+
 	if (hfunc)
 		*hfunc = ETH_RSS_HASH_TOP;
 
 	if (!indir)
 		return 0;
 
-	if (!test_bit(ICE_FLAG_RSS_ENA, pf->flags)) {
-		/* RSS not supported return error here */
-		netdev_warn(netdev, "RSS is not configured on this VSI!\n");
-		return -EIO;
-	}
-
 	lut = kzalloc(vsi->rss_table_size, GFP_KERNEL);
 	if (!lut)
 		return -ENOMEM;
@@ -3153,14 +3164,35 @@ ice_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, u8 *hfunc)
 	if (err)
 		goto out;
 
+	if (ice_is_adq_active(pf)) {
+		for (i = 0; i < vsi->rss_table_size; i++)
+			indir[i] = offset + lut[i] % qcount;
+		goto out;
+	}
+
 	for (i = 0; i < vsi->rss_table_size; i++)
-		indir[i] = (u32)(lut[i]);
+		indir[i] = lut[i];
 
 out:
 	kfree(lut);
 	return err;
 }
 
+/**
+ * ice_get_rxfh - get the Rx flow hash indirection table
+ * @netdev: network interface device structure
+ * @indir: indirection table
+ * @key: hash key
+ * @hfunc: hash function
+ *
+ * Reads the indirection table directly from the hardware.
+ */
+static int
+ice_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, u8 *hfunc)
+{
+	return ice_get_rxfh_context(netdev, indir, key, hfunc, 0);
+}
+
 /**
  * ice_set_rxfh - set the Rx flow hash indirection table
  * @netdev: network interface device structure
@@ -4102,6 +4134,7 @@ static const struct ethtool_ops ice_ethtool_ops = {
 	.set_pauseparam		= ice_set_pauseparam,
 	.get_rxfh_key_size	= ice_get_rxfh_key_size,
 	.get_rxfh_indir_size	= ice_get_rxfh_indir_size,
+	.get_rxfh_context	= ice_get_rxfh_context,
 	.get_rxfh		= ice_get_rxfh,
 	.set_rxfh		= ice_set_rxfh,
 	.get_channels		= ice_get_channels,
Signature · 1 line
2.27.0

Thanks,
Al

#4 lore raw

PATCH 1/1 ice: Expose RSS indirection tables for queue groups via ethtool

Quoted 34 lines

-----Original Message-----
From: Lobakin, Alexandr <[email protected]>
Sent: Tuesday, May 3, 2022 8:29 AM
To: Mogilappagari, Sudheer <[email protected]>
Cc: Lobakin, Alexandr <[email protected]>; Samudrala, Sridhar <[email protected]>; Paul Menzel <[email protected]>; intel-wired-lan at osuosl.org
Subject: Re: [Intel-wired-lan] [PATCH net-next v1] ice: Expose RSS indirection tables for queue groups via ethtool

From: Sudheer Mogilappagari <[email protected]>
Date: Tue, 3 May 2022 06:24:28 -0700

Quoted 19 lines

From: Sridhar Samudrala <[email protected]>

When ADQ queue groups(TCs) are created via tc mqprio command, RSS contexts and associated RSS indirection tables are configured automatically per TC based on the queue ranges specified for each traffic class.

For ex:
tc qdisc add dev enp175s0f0 root mqprio num_tc 3 map 0 1 2 \
queues 2 at 0 8 at 2 4 at 10 hw 1 mode channel

will create 3 queue groups(TC 0-2) with queue ranges 2, 8 and 4 in 3 queue groups. Each queue group is associated with its own RSS context and RSS indirection table.

Add support to expose RSS indirection tables for all ADQ queue groups using ethtool RSS contexts interface.
ethtool -x enp175s0f0 context <tc-num>

Quoted 8 lines
Quoted 2 lines

You didn't answer to any of my comments or questions during the internal review, including the ones that Paul has just asked, and now you're posting the same version to IWL to get it accepted upstream. That's not how it works, NAK.

I had responded to your comments (on 4/22) and posted v2 (on 4/23). Posted here since there were no further comments. Will incorporate Paul's comments in v2.

Quoted 128 lines

drivers/net/ethernet/intel/ice/ice_ethtool.c static u32 ice_get_rxfh_indir_size(struct

Quoted 11 lines
---
 drivers/net/ethernet/intel/ice/ice_ethtool.c | 69
+++++++++++++++-----
 1 file changed, 51 insertions(+), 18 deletions(-)
drivers/net/ethernet/intel/ice/ice_ethtool.c +0 -0
index 476bd1c83c87..1e71b70f0e52 100644
@@ -3111,36 +3111,47 @@ static u32 ice_get_rxfh_indir_size(struct

net_device *netdev)

Quoted 23 lines
drivers/net/ethernet/intel/ice/ice_ethtool.c +3 -11
 	return np->vsi->rss_table_size;
 }
 
-/**
- * ice_get_rxfh - get the Rx flow hash indirection table
- * @netdev: network interface device structure
- * @indir: indirection table
- * @key: hash key
- * @hfunc: hash function
- *
- * Reads the indirection table directly from the hardware.
- */
 static int
-ice_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, u8
 *hfunc)
+ice_get_rxfh_context(struct net_device *netdev, u32 *indir,
+		     u8 *key, u8 *hfunc, u32 rss_context)
 {
 	struct ice_netdev_priv *np = netdev_priv(netdev);
 	struct ice_vsi *vsi = np->vsi;
 	struct ice_pf *pf = vsi->back;
-	int err, i;
+	u16 qcount, offset;

drivers/net/ethernet/intel/ice/ice_ethtool.c static u32 ice_get_rxfh_indir_size(struct net_device *netdev)

Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_ethtool.c +8 -0
+	int err, num_tc, i;
 	u8 *lut;
 
+	if (!test_bit(ICE_FLAG_RSS_ENA, pf->flags)) {
+		netdev_warn(netdev, "RSS is not supported on this VSI!\n");
+		return -EOPNOTSUPP;
+	}
+
+	if (rss_context && !ice_is_adq_active(pf)) {
+		netdev_err(netdev, "RSS context cannot be non-zero when ADQ

is not configured.\n");

drivers/net/ethernet/intel/ice/ice_ethtool.c ice_get_rxfh(struct net_device *netdev, u32

Quoted 33 lines
drivers/net/ethernet/intel/ice/ice_ethtool.c +17 -6
+		return -EINVAL;
+	}
+
+	qcount = vsi->mqprio_qopt.qopt.count[rss_context];
+	offset = vsi->mqprio_qopt.qopt.offset[rss_context];
+
+	if (rss_context && ice_is_adq_active(pf)) {
+		num_tc = vsi->mqprio_qopt.qopt.num_tc;
+		if (rss_context >= num_tc) {
+			netdev_err(netdev, "RSS context:%d  > num_tc:%d\n",
+				   rss_context, num_tc);
+			return -EINVAL;
+		}
+		/* Use channel VSI of given TC */
+		vsi = vsi->tc_map_vsi[rss_context];
+	}
+
 	if (hfunc)
 		*hfunc = ETH_RSS_HASH_TOP;
 
 	if (!indir)
 		return 0;
 
-	if (!test_bit(ICE_FLAG_RSS_ENA, pf->flags)) {
-		/* RSS not supported return error here */
-		netdev_warn(netdev, "RSS is not configured on this VSI!\n");
-		return -EIO;
-	}
-
 	lut = kzalloc(vsi->rss_table_size, GFP_KERNEL);
 	if (!lut)
drivers/net/ethernet/intel/ice/ice_ethtool.c +0 -0
 		return -ENOMEM;
@@ -3153,14 +3164,35 @@ ice_get_rxfh(struct net_device *netdev, u32

*indir, u8 *key, u8 *hfunc)

Quoted 44 lines
drivers/net/ethernet/intel/ice/ice_ethtool.c +21 -1
 	if (err)
 		goto out;
 
+	if (ice_is_adq_active(pf)) {
+		for (i = 0; i < vsi->rss_table_size; i++)
+			indir[i] = offset + lut[i] % qcount;
+		goto out;
+	}
+
 	for (i = 0; i < vsi->rss_table_size; i++)
-		indir[i] = (u32)(lut[i]);
+		indir[i] = lut[i];
 
 out:
 	kfree(lut);
 	return err;
 }
 
+/**
+ * ice_get_rxfh - get the Rx flow hash indirection table
+ * @netdev: network interface device structure
+ * @indir: indirection table
+ * @key: hash key
+ * @hfunc: hash function
+ *
+ * Reads the indirection table directly from the hardware.
+ */
+static int
+ice_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, u8
+*hfunc) {
+	return ice_get_rxfh_context(netdev, indir, key, hfunc, 0); }
+
 /**
  * ice_set_rxfh - set the Rx flow hash indirection table
  * @netdev: network interface device structure @@ -4102,6 +4134,7 @@

static const struct ethtool_ops ice_ethtool_ops = {

drivers/net/ethernet/intel/ice/ice_ethtool.c +1 -1
 	.set_pauseparam		= ice_set_pauseparam,
 	.get_rxfh_key_size	= ice_get_rxfh_key_size,
 	.get_rxfh_indir_size	= ice_get_rxfh_indir_size,
+	.get_rxfh_context	= ice_get_rxfh_context,
 	.get_rxfh		= ice_get_rxfh,
 	.set_rxfh		= ice_set_rxfh,
 	.get_channels		= ice_get_channels,
--
Quoted 1 line

2.27.0

Thanks,
Al

#5 lore raw

PATCH 1/1 ice: Expose RSS indirection tables for queue groups via ethtool

From: Sudheer Mogilappagari <[email protected]>
Date: Tue, 3 May 2022 16:04:12 +0000

Quoted 41 lines
Quoted 32 lines

-----Original Message-----
From: Lobakin, Alexandr <[email protected]>
Sent: Tuesday, May 3, 2022 8:29 AM
To: Mogilappagari, Sudheer <[email protected]>
Cc: Lobakin, Alexandr <[email protected]>; Samudrala, Sridhar <[email protected]>; Paul Menzel <[email protected]>; intel-wired-lan at osuosl.org
Subject: Re: [Intel-wired-lan] [PATCH net-next v1] ice: Expose RSS indirection tables for queue groups via ethtool

From: Sudheer Mogilappagari <[email protected]>
Date: Tue, 3 May 2022 06:24:28 -0700

Quoted 19 lines

From: Sridhar Samudrala <[email protected]>

When ADQ queue groups(TCs) are created via tc mqprio command, RSS contexts and associated RSS indirection tables are configured automatically per TC based on the queue ranges specified for each traffic class.

For ex:
tc qdisc add dev enp175s0f0 root mqprio num_tc 3 map 0 1 2 \
queues 2 at 0 8 at 2 4 at 10 hw 1 mode channel

will create 3 queue groups(TC 0-2) with queue ranges 2, 8 and 4 in 3 queue groups. Each queue group is associated with its own RSS context and RSS indirection table.

Add support to expose RSS indirection tables for all ADQ queue groups using ethtool RSS contexts interface.
ethtool -x enp175s0f0 context <tc-num>

Quoted 8 lines
Quoted 2 lines

You didn't answer to any of my comments or questions during the internal review, including the ones that Paul has just asked, and now you're posting the same version to IWL to get it accepted upstream. That's not how it works, NAK.

Quoted 3 lines

I had responded to your comments (on 4/22) and posted v2 (on 4/23). Posted here since there were no further comments. Will incorporate Paul's comments in v2.

Oh Gods, I'm super sorry. I completely overlooked your response. It's present in my inbox. Please ignore my mail, sorry again.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
---
 drivers/net/ethernet/intel/ice/ice_ethtool.c | 69
+++++++++++++++-----
 1 file changed, 51 insertions(+), 18 deletions(-)

[...]

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

--
2.27.0

Thanks,
Al

Thanks,
Al