netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/5] net: migrate remaining drivers to dedicated _rxfh_context ops
@ 2025-07-02  3:06 Jakub Kicinski
  2025-07-02  3:06 ` [PATCH net-next v2 1/5] eth: otx2: migrate to the *_rxfh_context ops Jakub Kicinski
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Jakub Kicinski @ 2025-07-02  3:06 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, andrew,
	przemyslaw.kitszel, anthony.l.nguyen, sgoutham, gakula, sbhatta,
	bbhushan2, tariqt, mbloch, leon, gal, ecree.xilinx,
	Jakub Kicinski

Around a year ago Ed added dedicated ops for managing RSS contexts.
This significantly improved the clarity of the driver facing API.
Migrate the remaining 3 drivers and remove the old way of muxing
the RSS context operations via .set_rxfh().

v2:
 - [mlx5] remove hfunc local var in mlx5e_rxfh_hfunc_check()
 - [mlx5] make the get functions void and add WARN_ON_ONCE()
 - [patch 4] remove rxfh struct in netdev_rss_contexts_free()
v1: https://lore.kernel.org/20250630160953.1093267-1-kuba@kernel.org

Jakub Kicinski (5):
  eth: otx2: migrate to the *_rxfh_context ops
  eth: ice: drop the dead code related to rss_contexts
  eth: mlx5: migrate to the *_rxfh_context ops
  net: ethtool: remove the compat code for _rxfh_context ops
  net: ethtool: reduce indent for _rxfh_context ops

 .../marvell/octeontx2/nic/otx2_common.h       |   8 +-
 .../net/ethernet/mellanox/mlx5/core/en/rss.h  |   3 +-
 .../ethernet/mellanox/mlx5/core/en/rx_res.h   |   7 +-
 include/linux/ethtool.h                       |   4 -
 drivers/net/ethernet/intel/ice/ice_ethtool.c  |  28 +---
 .../marvell/octeontx2/nic/otx2_common.c       |  27 ++--
 .../marvell/octeontx2/nic/otx2_ethtool.c      | 137 +++++++++--------
 .../ethernet/marvell/octeontx2/nic/otx2_pf.c  |   6 +-
 .../ethernet/marvell/octeontx2/nic/otx2_xsk.c |   4 +-
 .../net/ethernet/mellanox/mlx5/core/en/rss.c  |   3 +-
 .../ethernet/mellanox/mlx5/core/en/rx_res.c   |  29 ++--
 .../ethernet/mellanox/mlx5/core/en_ethtool.c  | 145 ++++++++++++++----
 net/core/dev.c                                |  15 +-
 net/ethtool/ioctl.c                           |  68 ++------
 net/ethtool/rss.c                             |   3 +-
 15 files changed, 240 insertions(+), 247 deletions(-)

-- 
2.50.0


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH net-next v2 1/5] eth: otx2: migrate to the *_rxfh_context ops
  2025-07-02  3:06 [PATCH net-next v2 0/5] net: migrate remaining drivers to dedicated _rxfh_context ops Jakub Kicinski
@ 2025-07-02  3:06 ` Jakub Kicinski
  2025-07-04  7:14   ` [EXTERNAL] " Geethasowjanya Akula
  2025-07-02  3:06 ` [PATCH net-next v2 2/5] eth: ice: drop the dead code related to rss_contexts Jakub Kicinski
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Jakub Kicinski @ 2025-07-02  3:06 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, andrew,
	przemyslaw.kitszel, anthony.l.nguyen, sgoutham, gakula, sbhatta,
	bbhushan2, tariqt, mbloch, leon, gal, ecree.xilinx,
	Jakub Kicinski

otx2 only supports additional indirection tables (no separate keys
etc.) so the conversion to dedicated callbacks and core-allocated
context is mostly removing the code which stores the extra tables
in the driver. Core already stores the indirection tables for
additional contexts, and doesn't call .get for them.

One subtle change here is that we'll now start with the table
covering all queues, not directing all traffic to queue 0.
This is what core expects if the user doesn't pass the initial
indir table explicitly (there's a WARN_ON() in the core trying
to make sure driver authors don't forget to populate ctx to
defaults).

Drivers implementing .create_rxfh_context don't have to set
cap_rss_ctx_supported, so remove it.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 .../marvell/octeontx2/nic/otx2_common.h       |   8 +-
 .../marvell/octeontx2/nic/otx2_common.c       |  27 ++--
 .../marvell/octeontx2/nic/otx2_ethtool.c      | 137 ++++++++++--------
 .../ethernet/marvell/octeontx2/nic/otx2_pf.c  |   6 +-
 .../ethernet/marvell/octeontx2/nic/otx2_xsk.c |   4 +-
 5 files changed, 90 insertions(+), 92 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
index 6b59881f78e0..e3765b73c434 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
@@ -93,10 +93,6 @@ struct otx2_lmt_info {
 	u64 lmt_addr;
 	u16 lmt_id;
 };
-/* RSS configuration */
-struct otx2_rss_ctx {
-	u8  ind_tbl[MAX_RSS_INDIR_TBL_SIZE];
-};
 
 struct otx2_rss_info {
 	u8 enable;
@@ -104,7 +100,7 @@ struct otx2_rss_info {
 	u16 rss_size;
 #define RSS_HASH_KEY_SIZE	44   /* 352 bit key */
 	u8  key[RSS_HASH_KEY_SIZE];
-	struct otx2_rss_ctx	*rss_ctx[MAX_RSS_GROUPS];
+	u32 ind_tbl[MAX_RSS_INDIR_TBL_SIZE];
 };
 
 /* NIX (or NPC) RX errors */
@@ -1067,7 +1063,7 @@ int otx2_set_hw_capabilities(struct otx2_nic *pfvf);
 int otx2_rss_init(struct otx2_nic *pfvf);
 int otx2_set_flowkey_cfg(struct otx2_nic *pfvf);
 void otx2_set_rss_key(struct otx2_nic *pfvf);
-int otx2_set_rss_table(struct otx2_nic *pfvf, int ctx_id);
+int otx2_set_rss_table(struct otx2_nic *pfvf, int ctx_id, const u32 *ind_tbl);
 
 /* Mbox handlers */
 void mbox_handler_msix_offset(struct otx2_nic *pfvf,
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
index 9a10396e7504..f674729124e6 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
@@ -318,21 +318,20 @@ int otx2_set_flowkey_cfg(struct otx2_nic *pfvf)
 	return err;
 }
 
-int otx2_set_rss_table(struct otx2_nic *pfvf, int ctx_id)
+int otx2_set_rss_table(struct otx2_nic *pfvf, int ctx_id, const u32 *ind_tbl)
 {
 	struct otx2_rss_info *rss = &pfvf->hw.rss_info;
 	const int index = rss->rss_size * ctx_id;
 	struct mbox *mbox = &pfvf->mbox;
-	struct otx2_rss_ctx *rss_ctx;
 	struct nix_aq_enq_req *aq;
 	int idx, err;
 
 	mutex_lock(&mbox->lock);
-	rss_ctx = rss->rss_ctx[ctx_id];
+	ind_tbl = ind_tbl ?: rss->ind_tbl;
 	/* Get memory to put this msg */
 	for (idx = 0; idx < rss->rss_size; idx++) {
 		/* Ignore the queue if AF_XDP zero copy is enabled */
-		if (test_bit(rss_ctx->ind_tbl[idx], pfvf->af_xdp_zc_qidx))
+		if (test_bit(ind_tbl[idx], pfvf->af_xdp_zc_qidx))
 			continue;
 
 		aq = otx2_mbox_alloc_msg_nix_aq_enq(mbox);
@@ -352,7 +351,7 @@ int otx2_set_rss_table(struct otx2_nic *pfvf, int ctx_id)
 			}
 		}
 
-		aq->rss.rq = rss_ctx->ind_tbl[idx];
+		aq->rss.rq = ind_tbl[idx];
 
 		/* Fill AQ info */
 		aq->qidx = index + idx;
@@ -390,30 +389,22 @@ void otx2_set_rss_key(struct otx2_nic *pfvf)
 int otx2_rss_init(struct otx2_nic *pfvf)
 {
 	struct otx2_rss_info *rss = &pfvf->hw.rss_info;
-	struct otx2_rss_ctx *rss_ctx;
 	int idx, ret = 0;
 
-	rss->rss_size = sizeof(*rss->rss_ctx[DEFAULT_RSS_CONTEXT_GROUP]);
+	rss->rss_size = sizeof(*rss->ind_tbl);
 
 	/* Init RSS key if it is not setup already */
 	if (!rss->enable)
 		netdev_rss_key_fill(rss->key, sizeof(rss->key));
 	otx2_set_rss_key(pfvf);
 
-	if (!netif_is_rxfh_configured(pfvf->netdev)) {
-		/* Set RSS group 0 as default indirection table */
-		rss->rss_ctx[DEFAULT_RSS_CONTEXT_GROUP] = kzalloc(rss->rss_size,
-								  GFP_KERNEL);
-		if (!rss->rss_ctx[DEFAULT_RSS_CONTEXT_GROUP])
-			return -ENOMEM;
-
-		rss_ctx = rss->rss_ctx[DEFAULT_RSS_CONTEXT_GROUP];
+	if (!netif_is_rxfh_configured(pfvf->netdev))
 		for (idx = 0; idx < rss->rss_size; idx++)
-			rss_ctx->ind_tbl[idx] =
+			rss->ind_tbl[idx] =
 				ethtool_rxfh_indir_default(idx,
 							   pfvf->hw.rx_queues);
-	}
-	ret = otx2_set_rss_table(pfvf, DEFAULT_RSS_CONTEXT_GROUP);
+
+	ret = otx2_set_rss_table(pfvf, DEFAULT_RSS_CONTEXT_GROUP, NULL);
 	if (ret)
 		return ret;
 
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
index 20de517dfb09..998c734ff839 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
@@ -796,35 +796,75 @@ static u32 otx2_get_rxfh_indir_size(struct net_device *dev)
 	return  MAX_RSS_INDIR_TBL_SIZE;
 }
 
-static int otx2_rss_ctx_delete(struct otx2_nic *pfvf, int ctx_id)
+static int otx2_create_rxfh(struct net_device *dev,
+			    struct ethtool_rxfh_context *ctx,
+			    const struct ethtool_rxfh_param *rxfh,
+			    struct netlink_ext_ack *extack)
 {
-	struct otx2_rss_info *rss = &pfvf->hw.rss_info;
+	struct otx2_nic *pfvf = netdev_priv(dev);
+	struct otx2_rss_info *rss;
+	unsigned int queues;
+	u32 *ind_tbl;
+	int idx;
 
-	otx2_rss_ctx_flow_del(pfvf, ctx_id);
-	kfree(rss->rss_ctx[ctx_id]);
-	rss->rss_ctx[ctx_id] = NULL;
+	rss = &pfvf->hw.rss_info;
+	queues = pfvf->hw.rx_queues;
+
+	if (rxfh->hfunc && rxfh->hfunc != ETH_RSS_HASH_TOP)
+		return -EOPNOTSUPP;
+	ctx->hfunc = ETH_RSS_HASH_TOP;
+
+	if (!rss->enable) {
+		netdev_err(dev, "RSS is disabled, cannot change settings\n");
+		return -EIO;
+	}
+
+	ind_tbl = rxfh->indir;
+	if (!ind_tbl) {
+		ind_tbl = ethtool_rxfh_context_indir(ctx);
+		for (idx = 0; idx < rss->rss_size; idx++)
+			ind_tbl[idx] = ethtool_rxfh_indir_default(idx, queues);
+	}
+
+	otx2_set_rss_table(pfvf, rxfh->rss_context, ind_tbl);
+	return 0;
+}
+
+static int otx2_modify_rxfh(struct net_device *dev,
+			    struct ethtool_rxfh_context *ctx,
+			    const struct ethtool_rxfh_param *rxfh,
+			    struct netlink_ext_ack *extack)
+{
+	struct otx2_nic *pfvf = netdev_priv(dev);
+
+	if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
+	    rxfh->hfunc != ETH_RSS_HASH_TOP)
+		return -EOPNOTSUPP;
+
+	if (!pfvf->hw.rss_info.enable) {
+		netdev_err(dev, "RSS is disabled, cannot change settings\n");
+		return -EIO;
+	}
+
+	if (rxfh->indir)
+		otx2_set_rss_table(pfvf, rxfh->rss_context, rxfh->indir);
 
 	return 0;
 }
 
-static int otx2_rss_ctx_create(struct otx2_nic *pfvf,
-			       u32 *rss_context)
+static int otx2_remove_rxfh(struct net_device *dev,
+			    struct ethtool_rxfh_context *ctx,
+			    u32 rss_context,
+			    struct netlink_ext_ack *extack)
 {
-	struct otx2_rss_info *rss = &pfvf->hw.rss_info;
-	u8 ctx;
+	struct otx2_nic *pfvf = netdev_priv(dev);
 
-	for (ctx = 0; ctx < MAX_RSS_GROUPS; ctx++) {
-		if (!rss->rss_ctx[ctx])
-			break;
+	if (!pfvf->hw.rss_info.enable) {
+		netdev_err(dev, "RSS is disabled, cannot change settings\n");
+		return -EIO;
 	}
-	if (ctx == MAX_RSS_GROUPS)
-		return -EINVAL;
-
-	rss->rss_ctx[ctx] = kzalloc(sizeof(*rss->rss_ctx[ctx]), GFP_KERNEL);
-	if (!rss->rss_ctx[ctx])
-		return -ENOMEM;
-	*rss_context = ctx;
 
+	otx2_rss_ctx_flow_del(pfvf, rss_context);
 	return 0;
 }
 
@@ -833,23 +873,14 @@ static int otx2_set_rxfh(struct net_device *dev,
 			 struct ethtool_rxfh_param *rxfh,
 			 struct netlink_ext_ack *extack)
 {
-	u32 rss_context = DEFAULT_RSS_CONTEXT_GROUP;
 	struct otx2_nic *pfvf = netdev_priv(dev);
-	struct otx2_rss_ctx *rss_ctx;
 	struct otx2_rss_info *rss;
-	int ret, idx;
+	int idx;
 
 	if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
 	    rxfh->hfunc != ETH_RSS_HASH_TOP)
 		return -EOPNOTSUPP;
 
-	if (rxfh->rss_context)
-		rss_context = rxfh->rss_context;
-
-	if (rss_context != ETH_RXFH_CONTEXT_ALLOC &&
-	    rss_context >= MAX_RSS_GROUPS)
-		return -EINVAL;
-
 	rss = &pfvf->hw.rss_info;
 
 	if (!rss->enable) {
@@ -861,21 +892,12 @@ static int otx2_set_rxfh(struct net_device *dev,
 		memcpy(rss->key, rxfh->key, sizeof(rss->key));
 		otx2_set_rss_key(pfvf);
 	}
-	if (rxfh->rss_delete)
-		return otx2_rss_ctx_delete(pfvf, rss_context);
 
-	if (rss_context == ETH_RXFH_CONTEXT_ALLOC) {
-		ret = otx2_rss_ctx_create(pfvf, &rss_context);
-		rxfh->rss_context = rss_context;
-		if (ret)
-			return ret;
-	}
 	if (rxfh->indir) {
-		rss_ctx = rss->rss_ctx[rss_context];
 		for (idx = 0; idx < rss->rss_size; idx++)
-			rss_ctx->ind_tbl[idx] = rxfh->indir[idx];
+			rss->ind_tbl[idx] = rxfh->indir[idx];
 	}
-	otx2_set_rss_table(pfvf, rss_context);
+	otx2_set_rss_table(pfvf, DEFAULT_RSS_CONTEXT_GROUP, NULL);
 
 	return 0;
 }
@@ -884,9 +906,7 @@ static int otx2_set_rxfh(struct net_device *dev,
 static int otx2_get_rxfh(struct net_device *dev,
 			 struct ethtool_rxfh_param *rxfh)
 {
-	u32 rss_context = DEFAULT_RSS_CONTEXT_GROUP;
 	struct otx2_nic *pfvf = netdev_priv(dev);
-	struct otx2_rss_ctx *rss_ctx;
 	struct otx2_rss_info *rss;
 	u32 *indir = rxfh->indir;
 	int idx, rx_queues;
@@ -894,32 +914,21 @@ static int otx2_get_rxfh(struct net_device *dev,
 	rss = &pfvf->hw.rss_info;
 
 	rxfh->hfunc = ETH_RSS_HASH_TOP;
-	if (rxfh->rss_context)
-		rss_context = rxfh->rss_context;
-
 	if (!indir)
 		return 0;
 
-	if (!rss->enable && rss_context == DEFAULT_RSS_CONTEXT_GROUP) {
+	if (!rss->enable) {
 		rx_queues = pfvf->hw.rx_queues;
 		for (idx = 0; idx < MAX_RSS_INDIR_TBL_SIZE; idx++)
 			indir[idx] = ethtool_rxfh_indir_default(idx, rx_queues);
 		return 0;
 	}
-	if (rss_context >= MAX_RSS_GROUPS)
-		return -ENOENT;
 
-	rss_ctx = rss->rss_ctx[rss_context];
-	if (!rss_ctx)
-		return -ENOENT;
-
-	if (indir) {
-		for (idx = 0; idx < rss->rss_size; idx++) {
-			/* Ignore if the rx queue is AF_XDP zero copy enabled */
-			if (test_bit(rss_ctx->ind_tbl[idx], pfvf->af_xdp_zc_qidx))
-				continue;
-			indir[idx] = rss_ctx->ind_tbl[idx];
-		}
+	for (idx = 0; idx < rss->rss_size; idx++) {
+		/* Ignore if the rx queue is AF_XDP zero copy enabled */
+		if (test_bit(rss->ind_tbl[idx], pfvf->af_xdp_zc_qidx))
+			continue;
+		indir[idx] = rss->ind_tbl[idx];
 	}
 	if (rxfh->key)
 		memcpy(rxfh->key, rss->key, sizeof(rss->key));
@@ -1307,12 +1316,12 @@ static void otx2_get_fec_stats(struct net_device *netdev,
 }
 
 static const struct ethtool_ops otx2_ethtool_ops = {
-	.cap_rss_ctx_supported	= true,
 	.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
 				     ETHTOOL_COALESCE_MAX_FRAMES |
 				     ETHTOOL_COALESCE_USE_ADAPTIVE,
 	.supported_ring_params  = ETHTOOL_RING_USE_RX_BUF_LEN |
 				  ETHTOOL_RING_USE_CQE_SIZE,
+	.rxfh_max_num_contexts	= MAX_RSS_GROUPS,
 	.get_link		= otx2_get_link,
 	.get_drvinfo		= otx2_get_drvinfo,
 	.get_strings		= otx2_get_strings,
@@ -1332,6 +1341,9 @@ static const struct ethtool_ops otx2_ethtool_ops = {
 	.set_rxfh		= otx2_set_rxfh,
 	.get_rxfh_fields	= otx2_get_rss_hash_opts,
 	.set_rxfh_fields	= otx2_set_rss_hash_opts,
+	.create_rxfh_context	= otx2_create_rxfh,
+	.modify_rxfh_context	= otx2_modify_rxfh,
+	.remove_rxfh_context	= otx2_remove_rxfh,
 	.get_msglevel		= otx2_get_msglevel,
 	.set_msglevel		= otx2_set_msglevel,
 	.get_pauseparam		= otx2_get_pauseparam,
@@ -1426,12 +1438,12 @@ static int otx2vf_get_link_ksettings(struct net_device *netdev,
 }
 
 static const struct ethtool_ops otx2vf_ethtool_ops = {
-	.cap_rss_ctx_supported	= true,
 	.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
 				     ETHTOOL_COALESCE_MAX_FRAMES |
 				     ETHTOOL_COALESCE_USE_ADAPTIVE,
 	.supported_ring_params  = ETHTOOL_RING_USE_RX_BUF_LEN |
 				  ETHTOOL_RING_USE_CQE_SIZE,
+	.rxfh_max_num_contexts	= MAX_RSS_GROUPS,
 	.get_link		= otx2_get_link,
 	.get_drvinfo		= otx2vf_get_drvinfo,
 	.get_strings		= otx2vf_get_strings,
@@ -1447,6 +1459,9 @@ static const struct ethtool_ops otx2vf_ethtool_ops = {
 	.set_rxfh		= otx2_set_rxfh,
 	.get_rxfh_fields	= otx2_get_rss_hash_opts,
 	.set_rxfh_fields	= otx2_set_rss_hash_opts,
+	.create_rxfh_context	= otx2_create_rxfh,
+	.modify_rxfh_context	= otx2_modify_rxfh,
+	.remove_rxfh_context	= otx2_remove_rxfh,
 	.get_ringparam		= otx2_get_ringparam,
 	.set_ringparam		= otx2_set_ringparam,
 	.get_coalesce		= otx2_get_coalesce,
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
index 4e2d1206e1b0..b23585c5e5c2 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
@@ -2158,7 +2158,6 @@ int otx2_stop(struct net_device *netdev)
 	struct otx2_nic *pf = netdev_priv(netdev);
 	struct otx2_cq_poll *cq_poll = NULL;
 	struct otx2_qset *qset = &pf->qset;
-	struct otx2_rss_info *rss;
 	int qidx, vec, wrk;
 
 	/* If the DOWN flag is set resources are already freed */
@@ -2176,10 +2175,7 @@ int otx2_stop(struct net_device *netdev)
 	otx2_rxtx_enable(pf, false);
 
 	/* Clear RSS enable flag */
-	rss = &pf->hw.rss_info;
-	rss->enable = false;
-	if (!netif_is_rxfh_configured(netdev))
-		kfree(rss->rss_ctx[DEFAULT_RSS_CONTEXT_GROUP]);
+	pf->hw.rss_info.enable = false;
 
 	/* Cleanup Queue IRQ */
 	vec = pci_irq_vector(pf->pdev,
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_xsk.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_xsk.c
index b328aae23d73..7d67b4cbaf71 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_xsk.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_xsk.c
@@ -132,7 +132,7 @@ int otx2_xsk_pool_enable(struct otx2_nic *pf, struct xsk_buff_pool *pool, u16 qi
 	set_bit(qidx, pf->af_xdp_zc_qidx);
 	otx2_clean_up_rq(pf, qidx);
 	/* Reconfigure RSS table as 'qidx' cannot be part of RSS now */
-	otx2_set_rss_table(pf, DEFAULT_RSS_CONTEXT_GROUP);
+	otx2_set_rss_table(pf, DEFAULT_RSS_CONTEXT_GROUP, NULL);
 	/* Kick start the NAPI context so that receiving will start */
 	return otx2_xsk_wakeup(pf->netdev, qidx, XDP_WAKEUP_RX);
 }
@@ -153,7 +153,7 @@ int otx2_xsk_pool_disable(struct otx2_nic *pf, u16 qidx)
 	clear_bit(qidx, pf->af_xdp_zc_qidx);
 	xsk_pool_dma_unmap(pool, DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_WEAK_ORDERING);
 	/* Reconfigure RSS table as 'qidx' now need to be part of RSS now */
-	otx2_set_rss_table(pf, DEFAULT_RSS_CONTEXT_GROUP);
+	otx2_set_rss_table(pf, DEFAULT_RSS_CONTEXT_GROUP, NULL);
 
 	return 0;
 }
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH net-next v2 2/5] eth: ice: drop the dead code related to rss_contexts
  2025-07-02  3:06 [PATCH net-next v2 0/5] net: migrate remaining drivers to dedicated _rxfh_context ops Jakub Kicinski
  2025-07-02  3:06 ` [PATCH net-next v2 1/5] eth: otx2: migrate to the *_rxfh_context ops Jakub Kicinski
@ 2025-07-02  3:06 ` Jakub Kicinski
  2025-07-02  3:06 ` [PATCH net-next v2 3/5] eth: mlx5: migrate to the *_rxfh_context ops Jakub Kicinski
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: Jakub Kicinski @ 2025-07-02  3:06 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, andrew,
	przemyslaw.kitszel, anthony.l.nguyen, sgoutham, gakula, sbhatta,
	bbhushan2, tariqt, mbloch, leon, gal, ecree.xilinx,
	Jakub Kicinski

ICE appears to have some odd form of rss_context use plumbed
in for .get_rxfh. The .set_rxfh side does not support creating
contexts, however, so this must be dead code. For at least a year
now (since commit 7964e7884643 ("net: ethtool: use the tracking
array for get_rxfh on custom RSS contexts")) we have not been
calling .get_rxfh with a non-zero rss_context. We just get
the info from the RSS XArray under dev->ethtool.

Remove what must be dead code in the driver, clear the support flags.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 drivers/net/ethernet/intel/ice/ice_ethtool.c | 28 +++-----------------
 1 file changed, 3 insertions(+), 25 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
index ea7e8b879b48..e54221fba849 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
@@ -3591,11 +3591,10 @@ static int
 ice_get_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rxfh)
 {
 	struct ice_netdev_priv *np = netdev_priv(netdev);
-	u32 rss_context = rxfh->rss_context;
 	struct ice_vsi *vsi = np->vsi;
 	struct ice_pf *pf = vsi->back;
 	u16 qcount, offset;
-	int err, num_tc, i;
+	int err, i;
 	u8 *lut;
 
 	if (!test_bit(ICE_FLAG_RSS_ENA, pf->flags)) {
@@ -3603,24 +3602,8 @@ ice_get_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rxfh)
 		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];
-	}
+	qcount = vsi->mqprio_qopt.qopt.count[0];
+	offset = vsi->mqprio_qopt.qopt.offset[0];
 
 	rxfh->hfunc = ETH_RSS_HASH_TOP;
 	if (vsi->rss_hfunc == ICE_AQ_VSI_Q_OPT_RSS_HASH_SYM_TPLZ)
@@ -3680,9 +3663,6 @@ ice_set_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rxfh,
 	    rxfh->hfunc != ETH_RSS_HASH_TOP)
 		return -EOPNOTSUPP;
 
-	if (rxfh->rss_context)
-		return -EOPNOTSUPP;
-
 	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");
@@ -4750,12 +4730,10 @@ static int ice_repr_ethtool_reset(struct net_device *dev, u32 *flags)
 }
 
 static const struct ethtool_ops ice_ethtool_ops = {
-	.cap_rss_ctx_supported  = true,
 	.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
 				     ETHTOOL_COALESCE_USE_ADAPTIVE |
 				     ETHTOOL_COALESCE_RX_USECS_HIGH,
 	.supported_input_xfrm	= RXH_XFRM_SYM_XOR,
-	.rxfh_per_ctx_key	= true,
 	.get_link_ksettings	= ice_get_link_ksettings,
 	.set_link_ksettings	= ice_set_link_ksettings,
 	.get_fec_stats		= ice_get_fec_stats,
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH net-next v2 3/5] eth: mlx5: migrate to the *_rxfh_context ops
  2025-07-02  3:06 [PATCH net-next v2 0/5] net: migrate remaining drivers to dedicated _rxfh_context ops Jakub Kicinski
  2025-07-02  3:06 ` [PATCH net-next v2 1/5] eth: otx2: migrate to the *_rxfh_context ops Jakub Kicinski
  2025-07-02  3:06 ` [PATCH net-next v2 2/5] eth: ice: drop the dead code related to rss_contexts Jakub Kicinski
@ 2025-07-02  3:06 ` Jakub Kicinski
  2025-07-03 12:22   ` Gal Pressman
                     ` (2 more replies)
  2025-07-02  3:06 ` [PATCH net-next v2 4/5] net: ethtool: remove the compat code for _rxfh_context ops Jakub Kicinski
  2025-07-02  3:06 ` [PATCH net-next v2 5/5] net: ethtool: reduce indent " Jakub Kicinski
  4 siblings, 3 replies; 13+ messages in thread
From: Jakub Kicinski @ 2025-07-02  3:06 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, andrew,
	przemyslaw.kitszel, anthony.l.nguyen, sgoutham, gakula, sbhatta,
	bbhushan2, tariqt, mbloch, leon, gal, ecree.xilinx,
	Jakub Kicinski

Convert mlx5 to dedicated RXFH ops. This is a fairly shallow
conversion, TBH, most of the driver code stays as is, but we
let the core allocate the context ID for the driver.

mlx5e_rx_res_rss_get_rxfh() and friends are made void, since
core only calls the driver for context 0. The second call
is right after context creation so it must exist (tm).

Tested with drivers/net/hw/rss_ctx.py on MCX6.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
v2:
 - remove hfunc local var in mlx5e_rxfh_hfunc_check()
 - make the get functions void and add WARN_ON_ONCE()
v1: https://lore.kernel.org/20250630160953.1093267-4-kuba@kernel.org
---
 .../net/ethernet/mellanox/mlx5/core/en/rss.h  |   3 +-
 .../ethernet/mellanox/mlx5/core/en/rx_res.h   |   7 +-
 .../net/ethernet/mellanox/mlx5/core/en/rss.c  |   3 +-
 .../ethernet/mellanox/mlx5/core/en/rx_res.c   |  29 ++--
 .../ethernet/mellanox/mlx5/core/en_ethtool.c  | 145 ++++++++++++++----
 5 files changed, 130 insertions(+), 57 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/rss.h b/drivers/net/ethernet/mellanox/mlx5/core/en/rss.h
index 8ac902190010..c6c1b2847cf5 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/rss.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rss.h
@@ -47,7 +47,8 @@ void mlx5e_rss_disable(struct mlx5e_rss *rss);
 
 int mlx5e_rss_packet_merge_set_param(struct mlx5e_rss *rss,
 				     struct mlx5e_packet_merge_param *pkt_merge_param);
-int mlx5e_rss_get_rxfh(struct mlx5e_rss *rss, u32 *indir, u8 *key, u8 *hfunc, bool *symmetric);
+void mlx5e_rss_get_rxfh(struct mlx5e_rss *rss, u32 *indir, u8 *key, u8 *hfunc,
+			bool *symmetric);
 int mlx5e_rss_set_rxfh(struct mlx5e_rss *rss, const u32 *indir,
 		       const u8 *key, const u8 *hfunc, const bool *symmetric,
 		       u32 *rqns, u32 *vhca_ids, unsigned int num_rqns);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.h b/drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.h
index 3e09d91281af..1d049e2aa264 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.h
@@ -48,8 +48,9 @@ void mlx5e_rx_res_xsk_update(struct mlx5e_rx_res *res, struct mlx5e_channels *ch
 
 /* Configuration API */
 void mlx5e_rx_res_rss_set_indir_uniform(struct mlx5e_rx_res *res, unsigned int nch);
-int mlx5e_rx_res_rss_get_rxfh(struct mlx5e_rx_res *res, u32 rss_idx,
-			      u32 *indir, u8 *key, u8 *hfunc, bool *symmetric);
+void mlx5e_rx_res_rss_get_rxfh(struct mlx5e_rx_res *res, u32 rss_idx,
+			       u32 *indir, u8 *key, u8 *hfunc,
+			       bool *symmetric);
 int mlx5e_rx_res_rss_set_rxfh(struct mlx5e_rx_res *res, u32 rss_idx,
 			      const u32 *indir, const u8 *key, const u8 *hfunc,
 			      const bool *symmetric);
@@ -61,7 +62,7 @@ int mlx5e_rx_res_rss_set_hash_fields(struct mlx5e_rx_res *res, u32 rss_idx,
 int mlx5e_rx_res_packet_merge_set_param(struct mlx5e_rx_res *res,
 					struct mlx5e_packet_merge_param *pkt_merge_param);
 
-int mlx5e_rx_res_rss_init(struct mlx5e_rx_res *res, u32 *rss_idx, unsigned int init_nch);
+int mlx5e_rx_res_rss_init(struct mlx5e_rx_res *res, u32 rss_idx, unsigned int init_nch);
 int mlx5e_rx_res_rss_destroy(struct mlx5e_rx_res *res, u32 rss_idx);
 int mlx5e_rx_res_rss_cnt(struct mlx5e_rx_res *res);
 int mlx5e_rx_res_rss_index(struct mlx5e_rx_res *res, struct mlx5e_rss *rss);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/rss.c b/drivers/net/ethernet/mellanox/mlx5/core/en/rss.c
index 74cd111ee320..5d8964c46e9c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/rss.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rss.c
@@ -567,7 +567,8 @@ int mlx5e_rss_packet_merge_set_param(struct mlx5e_rss *rss,
 	return final_err;
 }
 
-int mlx5e_rss_get_rxfh(struct mlx5e_rss *rss, u32 *indir, u8 *key, u8 *hfunc, bool *symmetric)
+void mlx5e_rss_get_rxfh(struct mlx5e_rss *rss, u32 *indir, u8 *key, u8 *hfunc,
+			bool *symmetric)
 {
 	if (indir)
 		memcpy(indir, rss->indir.table,
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.c b/drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.c
index 5fcbe47337b0..4bdb4060e861 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.c
@@ -71,17 +71,12 @@ static int mlx5e_rx_res_rss_init_def(struct mlx5e_rx_res *res,
 	return 0;
 }
 
-int mlx5e_rx_res_rss_init(struct mlx5e_rx_res *res, u32 *rss_idx, unsigned int init_nch)
+int mlx5e_rx_res_rss_init(struct mlx5e_rx_res *res, u32 rss_idx, unsigned int init_nch)
 {
 	bool inner_ft_support = res->features & MLX5E_RX_RES_FEATURE_INNER_FT;
 	struct mlx5e_rss *rss;
-	int i;
 
-	for (i = 1; i < MLX5E_MAX_NUM_RSS; i++)
-		if (!res->rss[i])
-			break;
-
-	if (i == MLX5E_MAX_NUM_RSS)
+	if (WARN_ON_ONCE(res->rss[rss_idx]))
 		return -ENOSPC;
 
 	rss = mlx5e_rss_init(res->mdev, inner_ft_support, res->drop_rqn,
@@ -97,8 +92,7 @@ int mlx5e_rx_res_rss_init(struct mlx5e_rx_res *res, u32 *rss_idx, unsigned int i
 		mlx5e_rss_enable(rss, res->rss_rqns, vhca_ids, res->rss_nch);
 	}
 
-	res->rss[i] = rss;
-	*rss_idx = i;
+	res->rss[rss_idx] = rss;
 
 	return 0;
 }
@@ -193,19 +187,18 @@ void mlx5e_rx_res_rss_set_indir_uniform(struct mlx5e_rx_res *res, unsigned int n
 	mlx5e_rss_set_indir_uniform(res->rss[0], nch);
 }
 
-int mlx5e_rx_res_rss_get_rxfh(struct mlx5e_rx_res *res, u32 rss_idx,
-			      u32 *indir, u8 *key, u8 *hfunc, bool *symmetric)
+void mlx5e_rx_res_rss_get_rxfh(struct mlx5e_rx_res *res, u32 rss_idx,
+			       u32 *indir, u8 *key, u8 *hfunc, bool *symmetric)
 {
 	struct mlx5e_rss *rss;
 
-	if (rss_idx >= MLX5E_MAX_NUM_RSS)
-		return -EINVAL;
+	rss = NULL;
+	if (rss_idx < MLX5E_MAX_NUM_RSS)
+		rss = res->rss[rss_idx];
+	if (WARN_ON_ONCE(!rss))
+		return;
 
-	rss = res->rss[rss_idx];
-	if (!rss)
-		return -ENOENT;
-
-	return mlx5e_rss_get_rxfh(rss, indir, key, hfunc, symmetric);
+	mlx5e_rss_get_rxfh(rss, indir, key, hfunc, symmetric);
 }
 
 int mlx5e_rx_res_rss_set_rxfh(struct mlx5e_rx_res *res, u32 rss_idx,
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index 995eedf7a51a..d507366d773e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -1480,61 +1480,55 @@ static u32 mlx5e_get_rxfh_indir_size(struct net_device *netdev)
 static int mlx5e_get_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rxfh)
 {
 	struct mlx5e_priv *priv = netdev_priv(netdev);
-	u32 rss_context = rxfh->rss_context;
 	bool symmetric;
-	int err;
 
 	mutex_lock(&priv->state_lock);
-	err = mlx5e_rx_res_rss_get_rxfh(priv->rx_res, rss_context,
-					rxfh->indir, rxfh->key, &rxfh->hfunc, &symmetric);
+	mlx5e_rx_res_rss_get_rxfh(priv->rx_res, 0, rxfh->indir, rxfh->key,
+				  &rxfh->hfunc, &symmetric);
 	mutex_unlock(&priv->state_lock);
 
-	if (err)
-		return err;
-
 	if (symmetric)
 		rxfh->input_xfrm = RXH_XFRM_SYM_OR_XOR;
 
 	return 0;
 }
 
-static int mlx5e_set_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxfh,
+static int mlx5e_rxfh_hfunc_check(struct mlx5e_priv *priv,
+				  const struct ethtool_rxfh_param *rxfh)
+{
+	unsigned int count;
+
+	count = priv->channels.params.num_channels;
+
+	if (rxfh->hfunc == ETH_RSS_HASH_XOR) {
+		unsigned int xor8_max_channels = mlx5e_rqt_max_num_channels_allowed_for_xor8();
+
+		if (count > xor8_max_channels) {
+			netdev_err(priv->netdev, "%s: Cannot set RSS hash function to XOR, current number of channels (%d) exceeds the maximum allowed for XOR8 RSS hfunc (%d)\n",
+				   __func__, count, xor8_max_channels);
+			return -EINVAL;
+		}
+	}
+
+	return 0;
+}
+
+static int mlx5e_set_rxfh(struct net_device *dev,
+			  struct ethtool_rxfh_param *rxfh,
 			  struct netlink_ext_ack *extack)
 {
 	bool symmetric = rxfh->input_xfrm == RXH_XFRM_SYM_OR_XOR;
 	struct mlx5e_priv *priv = netdev_priv(dev);
-	u32 *rss_context = &rxfh->rss_context;
 	u8 hfunc = rxfh->hfunc;
-	unsigned int count;
 	int err;
 
 	mutex_lock(&priv->state_lock);
 
-	count = priv->channels.params.num_channels;
-
-	if (hfunc == ETH_RSS_HASH_XOR) {
-		unsigned int xor8_max_channels = mlx5e_rqt_max_num_channels_allowed_for_xor8();
-
-		if (count > xor8_max_channels) {
-			err = -EINVAL;
-			netdev_err(priv->netdev, "%s: Cannot set RSS hash function to XOR, current number of channels (%d) exceeds the maximum allowed for XOR8 RSS hfunc (%d)\n",
-				   __func__, count, xor8_max_channels);
-			goto unlock;
-		}
-	}
-
-	if (*rss_context && rxfh->rss_delete) {
-		err = mlx5e_rx_res_rss_destroy(priv->rx_res, *rss_context);
+	err = mlx5e_rxfh_hfunc_check(priv, rxfh);
+	if (err)
 		goto unlock;
-	}
 
-	if (*rss_context == ETH_RXFH_CONTEXT_ALLOC) {
-		err = mlx5e_rx_res_rss_init(priv->rx_res, rss_context, count);
-		if (err)
-			goto unlock;
-	}
-
-	err = mlx5e_rx_res_rss_set_rxfh(priv->rx_res, *rss_context,
+	err = mlx5e_rx_res_rss_set_rxfh(priv->rx_res, rxfh->rss_context,
 					rxfh->indir, rxfh->key,
 					hfunc == ETH_RSS_HASH_NO_CHANGE ? NULL : &hfunc,
 					rxfh->input_xfrm == RXH_XFRM_NO_CHANGE ? NULL : &symmetric);
@@ -1544,6 +1538,86 @@ static int mlx5e_set_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxf
 	return err;
 }
 
+static int mlx5e_create_rxfh_context(struct net_device *dev,
+				     struct ethtool_rxfh_context *ctx,
+				     const struct ethtool_rxfh_param *rxfh,
+				     struct netlink_ext_ack *extack)
+{
+	bool symmetric = rxfh->input_xfrm == RXH_XFRM_SYM_OR_XOR;
+	struct mlx5e_priv *priv = netdev_priv(dev);
+	u8 hfunc = rxfh->hfunc;
+	int err;
+
+	mutex_lock(&priv->state_lock);
+
+	err = mlx5e_rxfh_hfunc_check(priv, rxfh);
+	if (err)
+		goto unlock;
+
+	err = mlx5e_rx_res_rss_init(priv->rx_res, rxfh->rss_context,
+				    priv->channels.params.num_channels);
+	if (err)
+		goto unlock;
+
+	err = mlx5e_rx_res_rss_set_rxfh(priv->rx_res, rxfh->rss_context,
+					rxfh->indir, rxfh->key,
+					hfunc == ETH_RSS_HASH_NO_CHANGE ? NULL : &hfunc,
+					rxfh->input_xfrm == RXH_XFRM_NO_CHANGE ? NULL : &symmetric);
+	if (err)
+		goto unlock;
+
+	mlx5e_rx_res_rss_get_rxfh(priv->rx_res, rxfh->rss_context,
+				  ethtool_rxfh_context_indir(ctx),
+				  ethtool_rxfh_context_key(ctx),
+				  &ctx->hfunc, &symmetric);
+	if (symmetric)
+		ctx->input_xfrm = RXH_XFRM_SYM_OR_XOR;
+
+unlock:
+	mutex_unlock(&priv->state_lock);
+	return err;
+}
+
+static int mlx5e_modify_rxfh_context(struct net_device *dev,
+				     struct ethtool_rxfh_context *ctx,
+				     const struct ethtool_rxfh_param *rxfh,
+				     struct netlink_ext_ack *extack)
+{
+	bool symmetric = rxfh->input_xfrm == RXH_XFRM_SYM_OR_XOR;
+	struct mlx5e_priv *priv = netdev_priv(dev);
+	u8 hfunc = rxfh->hfunc;
+	int err;
+
+	mutex_lock(&priv->state_lock);
+
+	err = mlx5e_rxfh_hfunc_check(priv, rxfh);
+	if (err)
+		goto unlock;
+
+	err = mlx5e_rx_res_rss_set_rxfh(priv->rx_res, rxfh->rss_context,
+					rxfh->indir, rxfh->key,
+					hfunc == ETH_RSS_HASH_NO_CHANGE ? NULL : &hfunc,
+					rxfh->input_xfrm == RXH_XFRM_NO_CHANGE ? NULL : &symmetric);
+
+unlock:
+	mutex_unlock(&priv->state_lock);
+	return err;
+}
+
+static int mlx5e_remove_rxfh_context(struct net_device *dev,
+				     struct ethtool_rxfh_context *ctx,
+				     u32 rss_context,
+				     struct netlink_ext_ack *extack)
+{
+	struct mlx5e_priv *priv = netdev_priv(dev);
+	int err;
+
+	mutex_lock(&priv->state_lock);
+	err = mlx5e_rx_res_rss_destroy(priv->rx_res, rss_context);
+	mutex_unlock(&priv->state_lock);
+	return err;
+}
+
 #define MLX5E_PFC_PREVEN_AUTO_TOUT_MSEC		100
 #define MLX5E_PFC_PREVEN_TOUT_MAX_MSEC		8000
 #define MLX5E_PFC_PREVEN_MINOR_PRECENT		85
@@ -2654,9 +2728,9 @@ static void mlx5e_get_ts_stats(struct net_device *netdev,
 
 const struct ethtool_ops mlx5e_ethtool_ops = {
 	.cap_link_lanes_supported = true,
-	.cap_rss_ctx_supported	= true,
 	.rxfh_per_ctx_fields	= true,
 	.rxfh_per_ctx_key	= true,
+	.rxfh_max_num_contexts	= MLX5E_MAX_NUM_RSS,
 	.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
 				     ETHTOOL_COALESCE_MAX_FRAMES |
 				     ETHTOOL_COALESCE_USE_ADAPTIVE |
@@ -2685,6 +2759,9 @@ const struct ethtool_ops mlx5e_ethtool_ops = {
 	.set_rxfh          = mlx5e_set_rxfh,
 	.get_rxfh_fields   = mlx5e_get_rxfh_fields,
 	.set_rxfh_fields   = mlx5e_set_rxfh_fields,
+	.create_rxfh_context	= mlx5e_create_rxfh_context,
+	.modify_rxfh_context	= mlx5e_modify_rxfh_context,
+	.remove_rxfh_context	= mlx5e_remove_rxfh_context,
 	.get_rxnfc         = mlx5e_get_rxnfc,
 	.set_rxnfc         = mlx5e_set_rxnfc,
 	.get_tunable       = mlx5e_get_tunable,
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH net-next v2 4/5] net: ethtool: remove the compat code for _rxfh_context ops
  2025-07-02  3:06 [PATCH net-next v2 0/5] net: migrate remaining drivers to dedicated _rxfh_context ops Jakub Kicinski
                   ` (2 preceding siblings ...)
  2025-07-02  3:06 ` [PATCH net-next v2 3/5] eth: mlx5: migrate to the *_rxfh_context ops Jakub Kicinski
@ 2025-07-02  3:06 ` Jakub Kicinski
  2025-07-02 18:54   ` Edward Cree
  2025-07-02  3:06 ` [PATCH net-next v2 5/5] net: ethtool: reduce indent " Jakub Kicinski
  4 siblings, 1 reply; 13+ messages in thread
From: Jakub Kicinski @ 2025-07-02  3:06 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, andrew,
	przemyslaw.kitszel, anthony.l.nguyen, sgoutham, gakula, sbhatta,
	bbhushan2, tariqt, mbloch, leon, gal, ecree.xilinx,
	Jakub Kicinski

All drivers are now converted to dedicated _rxfh_context ops.
Remove the use of >set_rxfh() to manage additional contexts.

Reviewed-by: Gal Pressman <gal@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
v2:
 - remove rxfh struct in netdev_rss_contexts_free()
v1: https://lore.kernel.org/20250630160953.1093267-5-kuba@kernel.org
---
 include/linux/ethtool.h |  4 ----
 net/core/dev.c          | 15 +--------------
 net/ethtool/ioctl.c     | 39 +++------------------------------------
 net/ethtool/rss.c       |  3 +--
 4 files changed, 5 insertions(+), 56 deletions(-)

diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 59877fd2a1d3..de5bd76a400c 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -865,9 +865,6 @@ struct kernel_ethtool_ts_info {
  * @supported_input_xfrm: supported types of input xfrm from %RXH_XFRM_*.
  * @cap_link_lanes_supported: indicates if the driver supports lanes
  *	parameter.
- * @cap_rss_ctx_supported: indicates if the driver supports RSS
- *	contexts via legacy API, drivers implementing @create_rxfh_context
- *	do not have to set this bit.
  * @rxfh_per_ctx_fields: device supports selecting different header fields
  *	for Rx hash calculation and RSS for each additional context.
  * @rxfh_per_ctx_key: device supports setting different RSS key for each
@@ -1100,7 +1097,6 @@ struct kernel_ethtool_ts_info {
 struct ethtool_ops {
 	u32     supported_input_xfrm:8;
 	u32     cap_link_lanes_supported:1;
-	u32     cap_rss_ctx_supported:1;
 	u32	rxfh_per_ctx_fields:1;
 	u32	rxfh_per_ctx_key:1;
 	u32	cap_rss_rxnfc_adds:1;
diff --git a/net/core/dev.c b/net/core/dev.c
index 7ee808eb068e..ee32d87eb411 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -11978,21 +11978,8 @@ static void netdev_rss_contexts_free(struct net_device *dev)
 
 	mutex_lock(&dev->ethtool->rss_lock);
 	xa_for_each(&dev->ethtool->rss_ctx, context, ctx) {
-		struct ethtool_rxfh_param rxfh;
-
-		rxfh.indir = ethtool_rxfh_context_indir(ctx);
-		rxfh.key = ethtool_rxfh_context_key(ctx);
-		rxfh.hfunc = ctx->hfunc;
-		rxfh.input_xfrm = ctx->input_xfrm;
-		rxfh.rss_context = context;
-		rxfh.rss_delete = true;
-
 		xa_erase(&dev->ethtool->rss_ctx, context);
-		if (dev->ethtool_ops->create_rxfh_context)
-			dev->ethtool_ops->remove_rxfh_context(dev, ctx,
-							      context, NULL);
-		else
-			dev->ethtool_ops->set_rxfh(dev, &rxfh, NULL);
+		dev->ethtool_ops->remove_rxfh_context(dev, ctx, context, NULL);
 		kfree(ctx);
 	}
 	xa_destroy(&dev->ethtool->rss_ctx);
diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c
index b6d96e562c9a..17dbda6afd96 100644
--- a/net/ethtool/ioctl.c
+++ b/net/ethtool/ioctl.c
@@ -1391,8 +1391,7 @@ static noinline_for_stack int ethtool_get_rxfh(struct net_device *dev,
 	if (rxfh.rsvd8[0] || rxfh.rsvd8[1] || rxfh.rsvd32)
 		return -EINVAL;
 	/* Most drivers don't handle rss_context, check it's 0 as well */
-	if (rxfh.rss_context && !(ops->cap_rss_ctx_supported ||
-				  ops->create_rxfh_context))
+	if (rxfh.rss_context && !ops->create_rxfh_context)
 		return -EOPNOTSUPP;
 
 	rxfh.indir_size = rxfh_dev.indir_size;
@@ -1534,8 +1533,7 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev,
 	if (rxfh.rsvd8[0] || rxfh.rsvd8[1] || rxfh.rsvd32)
 		return -EINVAL;
 	/* Most drivers don't handle rss_context, check it's 0 as well */
-	if (rxfh.rss_context && !(ops->cap_rss_ctx_supported ||
-				  ops->create_rxfh_context))
+	if (rxfh.rss_context && !ops->create_rxfh_context)
 		return -EOPNOTSUPP;
 	/* Check input data transformation capabilities */
 	if (rxfh.input_xfrm && rxfh.input_xfrm != RXH_XFRM_SYM_XOR &&
@@ -1670,7 +1668,7 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev,
 	rxfh_dev.rss_context = rxfh.rss_context;
 	rxfh_dev.input_xfrm = rxfh.input_xfrm;
 
-	if (rxfh.rss_context && ops->create_rxfh_context) {
+	if (rxfh.rss_context) {
 		if (create) {
 			ret = ops->create_rxfh_context(dev, ctx, &rxfh_dev,
 						       extack);
@@ -1712,37 +1710,6 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev,
 		else if (rxfh.indir_size != ETH_RXFH_INDIR_NO_CHANGE)
 			dev->priv_flags |= IFF_RXFH_CONFIGURED;
 	}
-	/* Update rss_ctx tracking */
-	if (create && !ops->create_rxfh_context) {
-		/* driver uses old API, it chose context ID */
-		if (WARN_ON(xa_load(&dev->ethtool->rss_ctx, rxfh_dev.rss_context))) {
-			/* context ID reused, our tracking is screwed */
-			kfree(ctx);
-			goto out_unlock;
-		}
-		/* Allocate the exact ID the driver gave us */
-		if (xa_is_err(xa_store(&dev->ethtool->rss_ctx, rxfh_dev.rss_context,
-				       ctx, GFP_KERNEL))) {
-			kfree(ctx);
-			goto out_unlock;
-		}
-
-		/* Fetch the defaults for the old API, in the new API drivers
-		 * should write defaults into ctx themselves.
-		 */
-		rxfh_dev.indir = (u32 *)rss_config;
-		rxfh_dev.indir_size = dev_indir_size;
-
-		rxfh_dev.key = rss_config + indir_bytes;
-		rxfh_dev.key_size = dev_key_size;
-
-		ret = ops->get_rxfh(dev, &rxfh_dev);
-		if (WARN_ON(ret)) {
-			xa_erase(&dev->ethtool->rss_ctx, rxfh.rss_context);
-			kfree(ctx);
-			goto out_unlock;
-		}
-	}
 	if (rxfh_dev.rss_delete) {
 		WARN_ON(xa_erase(&dev->ethtool->rss_ctx, rxfh.rss_context) != ctx);
 		kfree(ctx);
diff --git a/net/ethtool/rss.c b/net/ethtool/rss.c
index e717f23cbc10..4e8ca2c38175 100644
--- a/net/ethtool/rss.c
+++ b/net/ethtool/rss.c
@@ -163,8 +163,7 @@ rss_prepare_data(const struct ethnl_req_info *req_base,
 		return -EOPNOTSUPP;
 
 	/* Some drivers don't handle rss_context */
-	if (request->rss_context &&
-	    !ops->cap_rss_ctx_supported && !ops->create_rxfh_context)
+	if (request->rss_context && !ops->create_rxfh_context)
 		return -EOPNOTSUPP;
 
 	mutex_lock(&dev->ethtool->rss_lock);
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH net-next v2 5/5] net: ethtool: reduce indent for _rxfh_context ops
  2025-07-02  3:06 [PATCH net-next v2 0/5] net: migrate remaining drivers to dedicated _rxfh_context ops Jakub Kicinski
                   ` (3 preceding siblings ...)
  2025-07-02  3:06 ` [PATCH net-next v2 4/5] net: ethtool: remove the compat code for _rxfh_context ops Jakub Kicinski
@ 2025-07-02  3:06 ` Jakub Kicinski
  2025-07-02 18:57   ` Edward Cree
  4 siblings, 1 reply; 13+ messages in thread
From: Jakub Kicinski @ 2025-07-02  3:06 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, andrew,
	przemyslaw.kitszel, anthony.l.nguyen, sgoutham, gakula, sbhatta,
	bbhushan2, tariqt, mbloch, leon, gal, ecree.xilinx,
	Jakub Kicinski

Now that we don't have the compat code we can reduce the indent
a little. No functional changes.

Reviewed-by: Gal Pressman <gal@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 net/ethtool/ioctl.c | 31 +++++++++++++------------------
 1 file changed, 13 insertions(+), 18 deletions(-)

diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c
index 17dbda6afd96..fcd2a9a20527 100644
--- a/net/ethtool/ioctl.c
+++ b/net/ethtool/ioctl.c
@@ -1668,25 +1668,20 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev,
 	rxfh_dev.rss_context = rxfh.rss_context;
 	rxfh_dev.input_xfrm = rxfh.input_xfrm;
 
-	if (rxfh.rss_context) {
-		if (create) {
-			ret = ops->create_rxfh_context(dev, ctx, &rxfh_dev,
-						       extack);
-			/* Make sure driver populates defaults */
-			WARN_ON_ONCE(!ret && !rxfh_dev.key &&
-				     ops->rxfh_per_ctx_key &&
-				     !memchr_inv(ethtool_rxfh_context_key(ctx),
-						 0, ctx->key_size));
-		} else if (rxfh_dev.rss_delete) {
-			ret = ops->remove_rxfh_context(dev, ctx,
-						       rxfh.rss_context,
-						       extack);
-		} else {
-			ret = ops->modify_rxfh_context(dev, ctx, &rxfh_dev,
-						       extack);
-		}
-	} else {
+	if (!rxfh.rss_context) {
 		ret = ops->set_rxfh(dev, &rxfh_dev, extack);
+	} else if (create) {
+		ret = ops->create_rxfh_context(dev, ctx, &rxfh_dev, extack);
+		/* Make sure driver populates defaults */
+		WARN_ON_ONCE(!ret && !rxfh_dev.key &&
+			     ops->rxfh_per_ctx_key &&
+			     !memchr_inv(ethtool_rxfh_context_key(ctx),
+					 0, ctx->key_size));
+	} else if (rxfh_dev.rss_delete) {
+		ret = ops->remove_rxfh_context(dev, ctx,
+					       rxfh.rss_context, extack);
+	} else {
+		ret = ops->modify_rxfh_context(dev, ctx, &rxfh_dev, extack);
 	}
 	if (ret) {
 		if (create) {
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH net-next v2 4/5] net: ethtool: remove the compat code for _rxfh_context ops
  2025-07-02  3:06 ` [PATCH net-next v2 4/5] net: ethtool: remove the compat code for _rxfh_context ops Jakub Kicinski
@ 2025-07-02 18:54   ` Edward Cree
  0 siblings, 0 replies; 13+ messages in thread
From: Edward Cree @ 2025-07-02 18:54 UTC (permalink / raw)
  To: Jakub Kicinski, davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, andrew,
	przemyslaw.kitszel, anthony.l.nguyen, sgoutham, gakula, sbhatta,
	bbhushan2, tariqt, mbloch, leon, gal

On 02/07/2025 04:06, Jakub Kicinski wrote:
> All drivers are now converted to dedicated _rxfh_context ops.
> Remove the use of >set_rxfh() to manage additional contexts.
> 
> Reviewed-by: Gal Pressman <gal@nvidia.com>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
...
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 7ee808eb068e..ee32d87eb411 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
...
> @@ -1670,7 +1668,7 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev,
>  	rxfh_dev.rss_context = rxfh.rss_context;
>  	rxfh_dev.input_xfrm = rxfh.input_xfrm;
>  
> -	if (rxfh.rss_context && ops->create_rxfh_context) {
> +	if (rxfh.rss_context) {
>  		if (create) {
>  			ret = ops->create_rxfh_context(dev, ctx, &rxfh_dev,
>  						       extack);

A few lines after this we have
	if (ret) {
		if (create) {
			/* failed to create, free our new tracking entry */
			if (ops->create_rxfh_context)
				xa_erase(&dev->ethtool->rss_ctx, rxfh.rss_context);
			kfree(ctx);
		}
		goto out;
	}
AFAICT that 'if (ops->create_rxfh_context)' guard can also go, because it's
 only false in the compat case.

> @@ -1712,37 +1710,6 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev,
>  		else if (rxfh.indir_size != ETH_RXFH_INDIR_NO_CHANGE)
>  			dev->priv_flags |= IFF_RXFH_CONFIGURED;
>  	}
> -	/* Update rss_ctx tracking */

This comment applies to not just the code being removed, but also the part
 below that (if(delete), else if (ctx)) that's retained, please keep it.

Other than that this looks good.  (Patches 1-3 look plausible but I don't
 feel competent to review those drivers to the level of giving tags.)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH net-next v2 5/5] net: ethtool: reduce indent for _rxfh_context ops
  2025-07-02  3:06 ` [PATCH net-next v2 5/5] net: ethtool: reduce indent " Jakub Kicinski
@ 2025-07-02 18:57   ` Edward Cree
  0 siblings, 0 replies; 13+ messages in thread
From: Edward Cree @ 2025-07-02 18:57 UTC (permalink / raw)
  To: Jakub Kicinski, davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, andrew,
	przemyslaw.kitszel, anthony.l.nguyen, sgoutham, gakula, sbhatta,
	bbhushan2, tariqt, mbloch, leon, gal

On 02/07/2025 04:06, Jakub Kicinski wrote:
> Now that we don't have the compat code we can reduce the indent
> a little. No functional changes.
> 
> Reviewed-by: Gal Pressman <gal@nvidia.com>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Edward Cree <ecree.xilinx@gmail.com>

...
> +	} else if (create) {
> +		ret = ops->create_rxfh_context(dev, ctx, &rxfh_dev, extack);
> +		/* Make sure driver populates defaults */
> +		WARN_ON_ONCE(!ret && !rxfh_dev.key &&
> +			     ops->rxfh_per_ctx_key &&
> +			     !memchr_inv(ethtool_rxfh_context_key(ctx),
> +					 0, ctx->key_size));

While we're here can we unsplit any of these lines without going over 80?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH net-next v2 3/5] eth: mlx5: migrate to the *_rxfh_context ops
  2025-07-02  3:06 ` [PATCH net-next v2 3/5] eth: mlx5: migrate to the *_rxfh_context ops Jakub Kicinski
@ 2025-07-03 12:22   ` Gal Pressman
  2025-07-07 18:19     ` Jakub Kicinski
  2025-07-03 17:35   ` kernel test robot
  2025-07-05  3:24   ` kernel test robot
  2 siblings, 1 reply; 13+ messages in thread
From: Gal Pressman @ 2025-07-03 12:22 UTC (permalink / raw)
  To: Jakub Kicinski, davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, andrew,
	przemyslaw.kitszel, anthony.l.nguyen, sgoutham, gakula, sbhatta,
	bbhushan2, tariqt, mbloch, leon, ecree.xilinx

On 02/07/2025 6:06, Jakub Kicinski wrote:
> Convert mlx5 to dedicated RXFH ops. This is a fairly shallow
> conversion, TBH, most of the driver code stays as is, but we
> let the core allocate the context ID for the driver.
> 
> mlx5e_rx_res_rss_get_rxfh() and friends are made void, since
> core only calls the driver for context 0. The second call
> is right after context creation so it must exist (tm).
> 
> Tested with drivers/net/hw/rss_ctx.py on MCX6.
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> v2:
>  - remove hfunc local var in mlx5e_rxfh_hfunc_check()
>  - make the get functions void and add WARN_ON_ONCE()
> v1: https://lore.kernel.org/20250630160953.1093267-4-kuba@kernel.org
> ---
> -int mlx5e_rss_get_rxfh(struct mlx5e_rss *rss, u32 *indir, u8 *key, u8 *hfunc, bool *symmetric)
> +void mlx5e_rss_get_rxfh(struct mlx5e_rss *rss, u32 *indir, u8 *key, u8 *hfunc,
> +			bool *symmetric)

I assume this doesn't compile, you didn't remove the return statement at
the end of the function.

>  {
>  	if (indir)
>  		memcpy(indir, rss->indir.table,

...

> -int mlx5e_rx_res_rss_get_rxfh(struct mlx5e_rx_res *res, u32 rss_idx,
> -			      u32 *indir, u8 *key, u8 *hfunc, bool *symmetric)
> +void mlx5e_rx_res_rss_get_rxfh(struct mlx5e_rx_res *res, u32 rss_idx,
> +			       u32 *indir, u8 *key, u8 *hfunc, bool *symmetric)
>  {
>  	struct mlx5e_rss *rss;
>  
> -	if (rss_idx >= MLX5E_MAX_NUM_RSS)
> -		return -EINVAL;
> +	rss = NULL;

Nit, would be nicer to initialize to NULL in the variable declaration.

> +	if (rss_idx < MLX5E_MAX_NUM_RSS)
> +		rss = res->rss[rss_idx];
> +	if (WARN_ON_ONCE(!rss))
> +		return;
>  
> -	rss = res->rss[rss_idx];
> -	if (!rss)
> -		return -ENOENT;
> -
> -	return mlx5e_rss_get_rxfh(rss, indir, key, hfunc, symmetric);
> +	mlx5e_rss_get_rxfh(rss, indir, key, hfunc, symmetric);
>  }

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH net-next v2 3/5] eth: mlx5: migrate to the *_rxfh_context ops
  2025-07-02  3:06 ` [PATCH net-next v2 3/5] eth: mlx5: migrate to the *_rxfh_context ops Jakub Kicinski
  2025-07-03 12:22   ` Gal Pressman
@ 2025-07-03 17:35   ` kernel test robot
  2025-07-05  3:24   ` kernel test robot
  2 siblings, 0 replies; 13+ messages in thread
From: kernel test robot @ 2025-07-03 17:35 UTC (permalink / raw)
  To: Jakub Kicinski, davem
  Cc: oe-kbuild-all, netdev, edumazet, pabeni, andrew+netdev, horms,
	andrew, przemyslaw.kitszel, anthony.l.nguyen, sgoutham, gakula,
	sbhatta, bbhushan2, tariqt, mbloch, leon, gal, ecree.xilinx,
	Jakub Kicinski

Hi Jakub,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Jakub-Kicinski/eth-otx2-migrate-to-the-_rxfh_context-ops/20250702-110737
base:   net-next/main
patch link:    https://lore.kernel.org/r/20250702030606.1776293-4-kuba%40kernel.org
patch subject: [PATCH net-next v2 3/5] eth: mlx5: migrate to the *_rxfh_context ops
config: x86_64-rhel-9.4 (https://download.01.org/0day-ci/archive/20250704/202507040129.gR5UyINU-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250704/202507040129.gR5UyINU-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202507040129.gR5UyINU-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/net/ethernet/mellanox/mlx5/core/en/rss.c: In function 'mlx5e_rss_get_rxfh':
>> drivers/net/ethernet/mellanox/mlx5/core/en/rss.c:587:16: warning: 'return' with a value, in function returning void [-Wreturn-type]
     587 |         return 0;
         |                ^
   drivers/net/ethernet/mellanox/mlx5/core/en/rss.c:570:6: note: declared here
     570 | void mlx5e_rss_get_rxfh(struct mlx5e_rss *rss, u32 *indir, u8 *key, u8 *hfunc,
         |      ^~~~~~~~~~~~~~~~~~


vim +/return +587 drivers/net/ethernet/mellanox/mlx5/core/en/rss.c

25307a91cb50a0 Tariq Toukan   2021-08-16  569  
540d484b812cad Jakub Kicinski 2025-07-01  570  void mlx5e_rss_get_rxfh(struct mlx5e_rss *rss, u32 *indir, u8 *key, u8 *hfunc,
540d484b812cad Jakub Kicinski 2025-07-01  571  			bool *symmetric)
25307a91cb50a0 Tariq Toukan   2021-08-16  572  {
25307a91cb50a0 Tariq Toukan   2021-08-16  573  	if (indir)
cae8e6dea27923 Adham Faris    2023-10-12  574  		memcpy(indir, rss->indir.table,
74a8dadac17e2b Adham Faris    2023-10-12  575  		       rss->indir.actual_table_size * sizeof(*rss->indir.table));
25307a91cb50a0 Tariq Toukan   2021-08-16  576  
25307a91cb50a0 Tariq Toukan   2021-08-16  577  	if (key)
25307a91cb50a0 Tariq Toukan   2021-08-16  578  		memcpy(key, rss->hash.toeplitz_hash_key,
25307a91cb50a0 Tariq Toukan   2021-08-16  579  		       sizeof(rss->hash.toeplitz_hash_key));
25307a91cb50a0 Tariq Toukan   2021-08-16  580  
25307a91cb50a0 Tariq Toukan   2021-08-16  581  	if (hfunc)
25307a91cb50a0 Tariq Toukan   2021-08-16  582  		*hfunc = rss->hash.hfunc;
25307a91cb50a0 Tariq Toukan   2021-08-16  583  
4d20c9f2db83a0 Gal Pressman   2025-02-24  584  	if (symmetric)
4d20c9f2db83a0 Gal Pressman   2025-02-24  585  		*symmetric = rss->hash.symmetric;
4d20c9f2db83a0 Gal Pressman   2025-02-24  586  
25307a91cb50a0 Tariq Toukan   2021-08-16 @587  	return 0;
25307a91cb50a0 Tariq Toukan   2021-08-16  588  }
25307a91cb50a0 Tariq Toukan   2021-08-16  589  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [EXTERNAL] [PATCH net-next v2 1/5] eth: otx2: migrate to the *_rxfh_context ops
  2025-07-02  3:06 ` [PATCH net-next v2 1/5] eth: otx2: migrate to the *_rxfh_context ops Jakub Kicinski
@ 2025-07-04  7:14   ` Geethasowjanya Akula
  0 siblings, 0 replies; 13+ messages in thread
From: Geethasowjanya Akula @ 2025-07-04  7:14 UTC (permalink / raw)
  To: Jakub Kicinski, davem@davemloft.net
  Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
	andrew+netdev@lunn.ch, horms@kernel.org, andrew@lunn.ch,
	przemyslaw.kitszel@intel.com, anthony.l.nguyen@intel.com,
	Sunil Kovvuri Goutham, Subbaraya Sundeep Bhatta, Bharat Bhushan,
	tariqt@nvidia.com, mbloch@nvidia.com, leon@kernel.org,
	gal@nvidia.com, ecree.xilinx@gmail.com



>-----Original Message-----
>From: Jakub Kicinski <kuba@kernel.org>
>Sent: Wednesday, July 2, 2025 8:36 AM
>To: davem@davemloft.net
>Cc: netdev@vger.kernel.org; edumazet@google.com; pabeni@redhat.com;
>andrew+netdev@lunn.ch; horms@kernel.org; andrew@lunn.ch;
>przemyslaw.kitszel@intel.com; anthony.l.nguyen@intel.com; Sunil Kovvuri
>Goutham <sgoutham@marvell.com>; Geethasowjanya Akula
><gakula@marvell.com>; Subbaraya Sundeep Bhatta <sbhatta@marvell.com>;
>Bharat Bhushan <bbhushan2@marvell.com>; tariqt@nvidia.com;
>mbloch@nvidia.com; leon@kernel.org; gal@nvidia.com;
>ecree.xilinx@gmail.com; Jakub Kicinski <kuba@kernel.org>
>Subject: [EXTERNAL] [PATCH net-next v2 1/5] eth: otx2: migrate to the
>*_rxfh_context ops
>
>otx2 only supports additional indirection tables (no separate keys
>etc.) so the conversion to dedicated callbacks and core-allocated context is
>mostly removing the code which stores the extra tables in the driver. Core
>already stores the indirection tables for additional contexts, and doesn't call
>.get for them.
>
>One subtle change here is that we'll now start with the table covering all
>queues, not directing all traffic to queue 0.
>This is what core expects if the user doesn't pass the initial indir table explicitly
>(there's a WARN_ON() in the core trying to make sure driver authors don't
>forget to populate ctx to defaults).
>
>Drivers implementing .create_rxfh_context don't have to set
>cap_rss_ctx_supported, so remove it.
>
>Signed-off-by: Jakub Kicinski <kuba@kernel.org>
>---
> .../marvell/octeontx2/nic/otx2_common.h       |   8 +-
> .../marvell/octeontx2/nic/otx2_common.c       |  27 ++--
> .../marvell/octeontx2/nic/otx2_ethtool.c      | 137 ++++++++++--------
> .../ethernet/marvell/octeontx2/nic/otx2_pf.c  |   6 +-
> .../ethernet/marvell/octeontx2/nic/otx2_xsk.c |   4 +-
> 5 files changed, 90 insertions(+), 92 deletions(-)
>
>diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
>b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
>index 6b59881f78e0..e3765b73c434 100644
>--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
>+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
>@@ -93,10 +93,6 @@ struct otx2_lmt_info {
> 	u64 lmt_addr;
> 	u16 lmt_id;
> };
>-/* RSS configuration */
>-struct otx2_rss_ctx {
>-	u8  ind_tbl[MAX_RSS_INDIR_TBL_SIZE];
>-};
>
> struct otx2_rss_info {
> 	u8 enable;
>@@ -104,7 +100,7 @@ struct otx2_rss_info {
> 	u16 rss_size;
> #define RSS_HASH_KEY_SIZE	44   /* 352 bit key */
> 	u8  key[RSS_HASH_KEY_SIZE];
>-	struct otx2_rss_ctx	*rss_ctx[MAX_RSS_GROUPS];
>+	u32 ind_tbl[MAX_RSS_INDIR_TBL_SIZE];
> };
>
> /* NIX (or NPC) RX errors */
>@@ -1067,7 +1063,7 @@ int otx2_set_hw_capabilities(struct otx2_nic *pfvf);
>int otx2_rss_init(struct otx2_nic *pfvf);  int otx2_set_flowkey_cfg(struct
>otx2_nic *pfvf);  void otx2_set_rss_key(struct otx2_nic *pfvf); -int
>otx2_set_rss_table(struct otx2_nic *pfvf, int ctx_id);
>+int otx2_set_rss_table(struct otx2_nic *pfvf, int ctx_id, const u32
>+*ind_tbl);
>
> /* Mbox handlers */
> void mbox_handler_msix_offset(struct otx2_nic *pfvf, diff --git
>a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
>b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
>index 9a10396e7504..f674729124e6 100644
>--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
>+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
>@@ -318,21 +318,20 @@ int otx2_set_flowkey_cfg(struct otx2_nic *pfvf)
> 	return err;
> }
>
>-int otx2_set_rss_table(struct otx2_nic *pfvf, int ctx_id)
>+int otx2_set_rss_table(struct otx2_nic *pfvf, int ctx_id, const u32
>+*ind_tbl)
> {
> 	struct otx2_rss_info *rss = &pfvf->hw.rss_info;
> 	const int index = rss->rss_size * ctx_id;
> 	struct mbox *mbox = &pfvf->mbox;
>-	struct otx2_rss_ctx *rss_ctx;
> 	struct nix_aq_enq_req *aq;
> 	int idx, err;
>
> 	mutex_lock(&mbox->lock);
>-	rss_ctx = rss->rss_ctx[ctx_id];
>+	ind_tbl = ind_tbl ?: rss->ind_tbl;
> 	/* Get memory to put this msg */
> 	for (idx = 0; idx < rss->rss_size; idx++) {
> 		/* Ignore the queue if AF_XDP zero copy is enabled */
>-		if (test_bit(rss_ctx->ind_tbl[idx], pfvf->af_xdp_zc_qidx))
>+		if (test_bit(ind_tbl[idx], pfvf->af_xdp_zc_qidx))
> 			continue;
>
> 		aq = otx2_mbox_alloc_msg_nix_aq_enq(mbox);
>@@ -352,7 +351,7 @@ int otx2_set_rss_table(struct otx2_nic *pfvf, int ctx_id)
> 			}
> 		}
>
>-		aq->rss.rq = rss_ctx->ind_tbl[idx];
>+		aq->rss.rq = ind_tbl[idx];
>
> 		/* Fill AQ info */
> 		aq->qidx = index + idx;
>@@ -390,30 +389,22 @@ void otx2_set_rss_key(struct otx2_nic *pfvf)  int
>otx2_rss_init(struct otx2_nic *pfvf)  {
> 	struct otx2_rss_info *rss = &pfvf->hw.rss_info;
>-	struct otx2_rss_ctx *rss_ctx;
> 	int idx, ret = 0;
>
>-	rss->rss_size = sizeof(*rss->rss_ctx[DEFAULT_RSS_CONTEXT_GROUP]);
>+	rss->rss_size = sizeof(*rss->ind_tbl);
>
> 	/* Init RSS key if it is not setup already */
> 	if (!rss->enable)
> 		netdev_rss_key_fill(rss->key, sizeof(rss->key));
> 	otx2_set_rss_key(pfvf);
>
>-	if (!netif_is_rxfh_configured(pfvf->netdev)) {
>-		/* Set RSS group 0 as default indirection table */
>-		rss->rss_ctx[DEFAULT_RSS_CONTEXT_GROUP] = kzalloc(rss-
>>rss_size,
>-								  GFP_KERNEL);
>-		if (!rss->rss_ctx[DEFAULT_RSS_CONTEXT_GROUP])
>-			return -ENOMEM;
>-
>-		rss_ctx = rss->rss_ctx[DEFAULT_RSS_CONTEXT_GROUP];
>+	if (!netif_is_rxfh_configured(pfvf->netdev))
> 		for (idx = 0; idx < rss->rss_size; idx++)
>-			rss_ctx->ind_tbl[idx] =
>+			rss->ind_tbl[idx] =
> 				ethtool_rxfh_indir_default(idx,
> 							   pfvf->hw.rx_queues);
>-	}
>-	ret = otx2_set_rss_table(pfvf, DEFAULT_RSS_CONTEXT_GROUP);
>+
>+	ret = otx2_set_rss_table(pfvf, DEFAULT_RSS_CONTEXT_GROUP, NULL);
> 	if (ret)
> 		return ret;
>
>diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
>b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
>index 20de517dfb09..998c734ff839 100644
>--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
>+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
>@@ -796,35 +796,75 @@ static u32 otx2_get_rxfh_indir_size(struct net_device
>*dev)
> 	return  MAX_RSS_INDIR_TBL_SIZE;
> }
>
>-static int otx2_rss_ctx_delete(struct otx2_nic *pfvf, int ctx_id)
>+static int otx2_create_rxfh(struct net_device *dev,
>+			    struct ethtool_rxfh_context *ctx,
>+			    const struct ethtool_rxfh_param *rxfh,
>+			    struct netlink_ext_ack *extack)
> {
>-	struct otx2_rss_info *rss = &pfvf->hw.rss_info;
>+	struct otx2_nic *pfvf = netdev_priv(dev);
>+	struct otx2_rss_info *rss;
>+	unsigned int queues;
>+	u32 *ind_tbl;
>+	int idx;
>
>-	otx2_rss_ctx_flow_del(pfvf, ctx_id);
>-	kfree(rss->rss_ctx[ctx_id]);
>-	rss->rss_ctx[ctx_id] = NULL;
>+	rss = &pfvf->hw.rss_info;
>+	queues = pfvf->hw.rx_queues;
>+
>+	if (rxfh->hfunc && rxfh->hfunc != ETH_RSS_HASH_TOP)
>+		return -EOPNOTSUPP;
>+	ctx->hfunc = ETH_RSS_HASH_TOP;
>+
>+	if (!rss->enable) {
>+		netdev_err(dev, "RSS is disabled, cannot change settings\n");
>+		return -EIO;
>+	}
>+
>+	ind_tbl = rxfh->indir;
>+	if (!ind_tbl) {
>+		ind_tbl = ethtool_rxfh_context_indir(ctx);
>+		for (idx = 0; idx < rss->rss_size; idx++)
>+			ind_tbl[idx] = ethtool_rxfh_indir_default(idx, queues);
>+	}
>+
>+	otx2_set_rss_table(pfvf, rxfh->rss_context, ind_tbl);
Not a strong requirement, but it might be worth checking the return value here.



>+	return 0;
>+}
>+
>+static int otx2_modify_rxfh(struct net_device *dev,
>+			    struct ethtool_rxfh_context *ctx,
>+			    const struct ethtool_rxfh_param *rxfh,
>+			    struct netlink_ext_ack *extack)
>+{
>+	struct otx2_nic *pfvf = netdev_priv(dev);
>+
>+	if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
>+	    rxfh->hfunc != ETH_RSS_HASH_TOP)
>+		return -EOPNOTSUPP;
>+
>+	if (!pfvf->hw.rss_info.enable) {
>+		netdev_err(dev, "RSS is disabled, cannot change settings\n");
>+		return -EIO;
>+	}
>+
>+	if (rxfh->indir)
>+		otx2_set_rss_table(pfvf, rxfh->rss_context, rxfh->indir);
>
> 	return 0;
> }
>
>-static int otx2_rss_ctx_create(struct otx2_nic *pfvf,
>-			       u32 *rss_context)
>+static int otx2_remove_rxfh(struct net_device *dev,
>+			    struct ethtool_rxfh_context *ctx,
>+			    u32 rss_context,
>+			    struct netlink_ext_ack *extack)
> {
>-	struct otx2_rss_info *rss = &pfvf->hw.rss_info;
>-	u8 ctx;
>+	struct otx2_nic *pfvf = netdev_priv(dev);
>
>-	for (ctx = 0; ctx < MAX_RSS_GROUPS; ctx++) {
>-		if (!rss->rss_ctx[ctx])
>-			break;
>+	if (!pfvf->hw.rss_info.enable) {
>+		netdev_err(dev, "RSS is disabled, cannot change settings\n");
>+		return -EIO;
> 	}
>-	if (ctx == MAX_RSS_GROUPS)
>-		return -EINVAL;
>-
>-	rss->rss_ctx[ctx] = kzalloc(sizeof(*rss->rss_ctx[ctx]), GFP_KERNEL);
>-	if (!rss->rss_ctx[ctx])
>-		return -ENOMEM;
>-	*rss_context = ctx;
>
>+	otx2_rss_ctx_flow_del(pfvf, rss_context);
> 	return 0;
> }
>
>@@ -833,23 +873,14 @@ static int otx2_set_rxfh(struct net_device *dev,
> 			 struct ethtool_rxfh_param *rxfh,
> 			 struct netlink_ext_ack *extack)
> {
>-	u32 rss_context = DEFAULT_RSS_CONTEXT_GROUP;
> 	struct otx2_nic *pfvf = netdev_priv(dev);
>-	struct otx2_rss_ctx *rss_ctx;
> 	struct otx2_rss_info *rss;
>-	int ret, idx;
>+	int idx;
>
> 	if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
> 	    rxfh->hfunc != ETH_RSS_HASH_TOP)
> 		return -EOPNOTSUPP;
>
>-	if (rxfh->rss_context)
>-		rss_context = rxfh->rss_context;
>-
>-	if (rss_context != ETH_RXFH_CONTEXT_ALLOC &&
>-	    rss_context >= MAX_RSS_GROUPS)
>-		return -EINVAL;
>-
> 	rss = &pfvf->hw.rss_info;
>
> 	if (!rss->enable) {
>@@ -861,21 +892,12 @@ static int otx2_set_rxfh(struct net_device *dev,
> 		memcpy(rss->key, rxfh->key, sizeof(rss->key));
> 		otx2_set_rss_key(pfvf);
> 	}
>-	if (rxfh->rss_delete)
>-		return otx2_rss_ctx_delete(pfvf, rss_context);
>
>-	if (rss_context == ETH_RXFH_CONTEXT_ALLOC) {
>-		ret = otx2_rss_ctx_create(pfvf, &rss_context);
>-		rxfh->rss_context = rss_context;
>-		if (ret)
>-			return ret;
>-	}
> 	if (rxfh->indir) {
>-		rss_ctx = rss->rss_ctx[rss_context];
> 		for (idx = 0; idx < rss->rss_size; idx++)
>-			rss_ctx->ind_tbl[idx] = rxfh->indir[idx];
>+			rss->ind_tbl[idx] = rxfh->indir[idx];
> 	}
>-	otx2_set_rss_table(pfvf, rss_context);
>+	otx2_set_rss_table(pfvf, DEFAULT_RSS_CONTEXT_GROUP, NULL);
>
> 	return 0;
> }
>@@ -884,9 +906,7 @@ static int otx2_set_rxfh(struct net_device *dev,  static
>int otx2_get_rxfh(struct net_device *dev,
> 			 struct ethtool_rxfh_param *rxfh)
> {
>-	u32 rss_context = DEFAULT_RSS_CONTEXT_GROUP;
> 	struct otx2_nic *pfvf = netdev_priv(dev);
>-	struct otx2_rss_ctx *rss_ctx;
> 	struct otx2_rss_info *rss;
> 	u32 *indir = rxfh->indir;
> 	int idx, rx_queues;
>@@ -894,32 +914,21 @@ static int otx2_get_rxfh(struct net_device *dev,
> 	rss = &pfvf->hw.rss_info;
>
> 	rxfh->hfunc = ETH_RSS_HASH_TOP;
>-	if (rxfh->rss_context)
>-		rss_context = rxfh->rss_context;
>-
> 	if (!indir)
> 		return 0;
>
>-	if (!rss->enable && rss_context == DEFAULT_RSS_CONTEXT_GROUP) {
>+	if (!rss->enable) {
> 		rx_queues = pfvf->hw.rx_queues;
> 		for (idx = 0; idx < MAX_RSS_INDIR_TBL_SIZE; idx++)
> 			indir[idx] = ethtool_rxfh_indir_default(idx, rx_queues);
> 		return 0;
> 	}
>-	if (rss_context >= MAX_RSS_GROUPS)
>-		return -ENOENT;
>
>-	rss_ctx = rss->rss_ctx[rss_context];
>-	if (!rss_ctx)
>-		return -ENOENT;
>-
>-	if (indir) {
>-		for (idx = 0; idx < rss->rss_size; idx++) {
>-			/* Ignore if the rx queue is AF_XDP zero copy enabled
>*/
>-			if (test_bit(rss_ctx->ind_tbl[idx], pfvf-
>>af_xdp_zc_qidx))
>-				continue;
>-			indir[idx] = rss_ctx->ind_tbl[idx];
>-		}
>+	for (idx = 0; idx < rss->rss_size; idx++) {
>+		/* Ignore if the rx queue is AF_XDP zero copy enabled */
>+		if (test_bit(rss->ind_tbl[idx], pfvf->af_xdp_zc_qidx))
>+			continue;
>+		indir[idx] = rss->ind_tbl[idx];
> 	}
> 	if (rxfh->key)
> 		memcpy(rxfh->key, rss->key, sizeof(rss->key)); @@ -1307,12
>+1316,12 @@ static void otx2_get_fec_stats(struct net_device *netdev,  }
>
> static const struct ethtool_ops otx2_ethtool_ops = {
>-	.cap_rss_ctx_supported	= true,
> 	.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
> 				     ETHTOOL_COALESCE_MAX_FRAMES |
> 				     ETHTOOL_COALESCE_USE_ADAPTIVE,
> 	.supported_ring_params  = ETHTOOL_RING_USE_RX_BUF_LEN |
> 				  ETHTOOL_RING_USE_CQE_SIZE,
>+	.rxfh_max_num_contexts	= MAX_RSS_GROUPS,
> 	.get_link		= otx2_get_link,
> 	.get_drvinfo		= otx2_get_drvinfo,
> 	.get_strings		= otx2_get_strings,
>@@ -1332,6 +1341,9 @@ static const struct ethtool_ops otx2_ethtool_ops = {
> 	.set_rxfh		= otx2_set_rxfh,
> 	.get_rxfh_fields	= otx2_get_rss_hash_opts,
> 	.set_rxfh_fields	= otx2_set_rss_hash_opts,
>+	.create_rxfh_context	= otx2_create_rxfh,
>+	.modify_rxfh_context	= otx2_modify_rxfh,
>+	.remove_rxfh_context	= otx2_remove_rxfh,
> 	.get_msglevel		= otx2_get_msglevel,
> 	.set_msglevel		= otx2_set_msglevel,
> 	.get_pauseparam		= otx2_get_pauseparam,
>@@ -1426,12 +1438,12 @@ static int otx2vf_get_link_ksettings(struct
>net_device *netdev,  }
>
> static const struct ethtool_ops otx2vf_ethtool_ops = {
>-	.cap_rss_ctx_supported	= true,
> 	.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
> 				     ETHTOOL_COALESCE_MAX_FRAMES |
> 				     ETHTOOL_COALESCE_USE_ADAPTIVE,
> 	.supported_ring_params  = ETHTOOL_RING_USE_RX_BUF_LEN |
> 				  ETHTOOL_RING_USE_CQE_SIZE,
>+	.rxfh_max_num_contexts	= MAX_RSS_GROUPS,
> 	.get_link		= otx2_get_link,
> 	.get_drvinfo		= otx2vf_get_drvinfo,
> 	.get_strings		= otx2vf_get_strings,
>@@ -1447,6 +1459,9 @@ static const struct ethtool_ops otx2vf_ethtool_ops = {
> 	.set_rxfh		= otx2_set_rxfh,
> 	.get_rxfh_fields	= otx2_get_rss_hash_opts,
> 	.set_rxfh_fields	= otx2_set_rss_hash_opts,
>+	.create_rxfh_context	= otx2_create_rxfh,
>+	.modify_rxfh_context	= otx2_modify_rxfh,
>+	.remove_rxfh_context	= otx2_remove_rxfh,
> 	.get_ringparam		= otx2_get_ringparam,
> 	.set_ringparam		= otx2_set_ringparam,
> 	.get_coalesce		= otx2_get_coalesce,
>diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
>b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
>index 4e2d1206e1b0..b23585c5e5c2 100644
>--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
>+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
>@@ -2158,7 +2158,6 @@ int otx2_stop(struct net_device *netdev)
> 	struct otx2_nic *pf = netdev_priv(netdev);
> 	struct otx2_cq_poll *cq_poll = NULL;
> 	struct otx2_qset *qset = &pf->qset;
>-	struct otx2_rss_info *rss;
> 	int qidx, vec, wrk;
>
> 	/* If the DOWN flag is set resources are already freed */ @@ -2176,10
>+2175,7 @@ int otx2_stop(struct net_device *netdev)
> 	otx2_rxtx_enable(pf, false);
>
> 	/* Clear RSS enable flag */
>-	rss = &pf->hw.rss_info;
>-	rss->enable = false;
>-	if (!netif_is_rxfh_configured(netdev))
>-		kfree(rss->rss_ctx[DEFAULT_RSS_CONTEXT_GROUP]);
>+	pf->hw.rss_info.enable = false;
>
> 	/* Cleanup Queue IRQ */
> 	vec = pci_irq_vector(pf->pdev,
>diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_xsk.c
>b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_xsk.c
>index b328aae23d73..7d67b4cbaf71 100644
>--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_xsk.c
>+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_xsk.c
>@@ -132,7 +132,7 @@ int otx2_xsk_pool_enable(struct otx2_nic *pf, struct
>xsk_buff_pool *pool, u16 qi
> 	set_bit(qidx, pf->af_xdp_zc_qidx);
> 	otx2_clean_up_rq(pf, qidx);
> 	/* Reconfigure RSS table as 'qidx' cannot be part of RSS now */
>-	otx2_set_rss_table(pf, DEFAULT_RSS_CONTEXT_GROUP);
>+	otx2_set_rss_table(pf, DEFAULT_RSS_CONTEXT_GROUP, NULL);
> 	/* Kick start the NAPI context so that receiving will start */
> 	return otx2_xsk_wakeup(pf->netdev, qidx, XDP_WAKEUP_RX);  } @@ -
>153,7 +153,7 @@ int otx2_xsk_pool_disable(struct otx2_nic *pf, u16 qidx)
> 	clear_bit(qidx, pf->af_xdp_zc_qidx);
> 	xsk_pool_dma_unmap(pool, DMA_ATTR_SKIP_CPU_SYNC |
>DMA_ATTR_WEAK_ORDERING);
> 	/* Reconfigure RSS table as 'qidx' now need to be part of RSS now */
>-	otx2_set_rss_table(pf, DEFAULT_RSS_CONTEXT_GROUP);
>+	otx2_set_rss_table(pf, DEFAULT_RSS_CONTEXT_GROUP, NULL);
>
> 	return 0;
> }
>--
>2.50.0
Tested-by: Geetha sowjanya <gakula@marvell.com>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH net-next v2 3/5] eth: mlx5: migrate to the *_rxfh_context ops
  2025-07-02  3:06 ` [PATCH net-next v2 3/5] eth: mlx5: migrate to the *_rxfh_context ops Jakub Kicinski
  2025-07-03 12:22   ` Gal Pressman
  2025-07-03 17:35   ` kernel test robot
@ 2025-07-05  3:24   ` kernel test robot
  2 siblings, 0 replies; 13+ messages in thread
From: kernel test robot @ 2025-07-05  3:24 UTC (permalink / raw)
  To: Jakub Kicinski, davem
  Cc: oe-kbuild-all, netdev, edumazet, pabeni, andrew+netdev, horms,
	andrew, przemyslaw.kitszel, anthony.l.nguyen, sgoutham, gakula,
	sbhatta, bbhushan2, tariqt, mbloch, leon, gal, ecree.xilinx,
	Jakub Kicinski

Hi Jakub,

kernel test robot noticed the following build errors:

[auto build test ERROR on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Jakub-Kicinski/eth-otx2-migrate-to-the-_rxfh_context-ops/20250702-110737
base:   net-next/main
patch link:    https://lore.kernel.org/r/20250702030606.1776293-4-kuba%40kernel.org
patch subject: [PATCH net-next v2 3/5] eth: mlx5: migrate to the *_rxfh_context ops
config: arc-allmodconfig (https://download.01.org/0day-ci/archive/20250705/202507051125.6hx5EsC9-lkp@intel.com/config)
compiler: arc-linux-gcc (GCC) 15.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250705/202507051125.6hx5EsC9-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202507051125.6hx5EsC9-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/net/ethernet/mellanox/mlx5/core/en/rss.c: In function 'mlx5e_rss_get_rxfh':
>> drivers/net/ethernet/mellanox/mlx5/core/en/rss.c:587:16: error: 'return' with a value, in function returning void [-Wreturn-mismatch]
     587 |         return 0;
         |                ^
   drivers/net/ethernet/mellanox/mlx5/core/en/rss.c:570:6: note: declared here
     570 | void mlx5e_rss_get_rxfh(struct mlx5e_rss *rss, u32 *indir, u8 *key, u8 *hfunc,
         |      ^~~~~~~~~~~~~~~~~~


vim +/return +587 drivers/net/ethernet/mellanox/mlx5/core/en/rss.c

25307a91cb50a0 Tariq Toukan   2021-08-16  569  
540d484b812cad Jakub Kicinski 2025-07-01  570  void mlx5e_rss_get_rxfh(struct mlx5e_rss *rss, u32 *indir, u8 *key, u8 *hfunc,
540d484b812cad Jakub Kicinski 2025-07-01  571  			bool *symmetric)
25307a91cb50a0 Tariq Toukan   2021-08-16  572  {
25307a91cb50a0 Tariq Toukan   2021-08-16  573  	if (indir)
cae8e6dea27923 Adham Faris    2023-10-12  574  		memcpy(indir, rss->indir.table,
74a8dadac17e2b Adham Faris    2023-10-12  575  		       rss->indir.actual_table_size * sizeof(*rss->indir.table));
25307a91cb50a0 Tariq Toukan   2021-08-16  576  
25307a91cb50a0 Tariq Toukan   2021-08-16  577  	if (key)
25307a91cb50a0 Tariq Toukan   2021-08-16  578  		memcpy(key, rss->hash.toeplitz_hash_key,
25307a91cb50a0 Tariq Toukan   2021-08-16  579  		       sizeof(rss->hash.toeplitz_hash_key));
25307a91cb50a0 Tariq Toukan   2021-08-16  580  
25307a91cb50a0 Tariq Toukan   2021-08-16  581  	if (hfunc)
25307a91cb50a0 Tariq Toukan   2021-08-16  582  		*hfunc = rss->hash.hfunc;
25307a91cb50a0 Tariq Toukan   2021-08-16  583  
4d20c9f2db83a0 Gal Pressman   2025-02-24  584  	if (symmetric)
4d20c9f2db83a0 Gal Pressman   2025-02-24  585  		*symmetric = rss->hash.symmetric;
4d20c9f2db83a0 Gal Pressman   2025-02-24  586  
25307a91cb50a0 Tariq Toukan   2021-08-16 @587  	return 0;
25307a91cb50a0 Tariq Toukan   2021-08-16  588  }
25307a91cb50a0 Tariq Toukan   2021-08-16  589  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH net-next v2 3/5] eth: mlx5: migrate to the *_rxfh_context ops
  2025-07-03 12:22   ` Gal Pressman
@ 2025-07-07 18:19     ` Jakub Kicinski
  0 siblings, 0 replies; 13+ messages in thread
From: Jakub Kicinski @ 2025-07-07 18:19 UTC (permalink / raw)
  To: Gal Pressman
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms, andrew,
	przemyslaw.kitszel, anthony.l.nguyen, sgoutham, gakula, sbhatta,
	bbhushan2, tariqt, mbloch, leon, ecree.xilinx

On Thu, 3 Jul 2025 15:22:41 +0300 Gal Pressman wrote:
> > -int mlx5e_rss_get_rxfh(struct mlx5e_rss *rss, u32 *indir, u8 *key, u8 *hfunc, bool *symmetric)
> > +void mlx5e_rss_get_rxfh(struct mlx5e_rss *rss, u32 *indir, u8 *key, u8 *hfunc,
> > +			bool *symmetric)  
> 
> I assume this doesn't compile, you didn't remove the return statement at
> the end of the function.

My bad. I was build testing drivers/net/ethernet/mellanox/mlx5/ which
doesn't have a Makefile..

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2025-07-07 18:19 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-02  3:06 [PATCH net-next v2 0/5] net: migrate remaining drivers to dedicated _rxfh_context ops Jakub Kicinski
2025-07-02  3:06 ` [PATCH net-next v2 1/5] eth: otx2: migrate to the *_rxfh_context ops Jakub Kicinski
2025-07-04  7:14   ` [EXTERNAL] " Geethasowjanya Akula
2025-07-02  3:06 ` [PATCH net-next v2 2/5] eth: ice: drop the dead code related to rss_contexts Jakub Kicinski
2025-07-02  3:06 ` [PATCH net-next v2 3/5] eth: mlx5: migrate to the *_rxfh_context ops Jakub Kicinski
2025-07-03 12:22   ` Gal Pressman
2025-07-07 18:19     ` Jakub Kicinski
2025-07-03 17:35   ` kernel test robot
2025-07-05  3:24   ` kernel test robot
2025-07-02  3:06 ` [PATCH net-next v2 4/5] net: ethtool: remove the compat code for _rxfh_context ops Jakub Kicinski
2025-07-02 18:54   ` Edward Cree
2025-07-02  3:06 ` [PATCH net-next v2 5/5] net: ethtool: reduce indent " Jakub Kicinski
2025-07-02 18:57   ` Edward Cree

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).