DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ivan Malov <ivan.malov@oktetlabs.ru>
To: dev@dpdk.org
Cc: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	Andy Moreton <amoreton@xilinx.com>
Subject: [PATCH 7/8] common/sfc_efx/base: support the even spread RSS mode
Date: Tue,  1 Feb 2022 11:50:01 +0300	[thread overview]
Message-ID: <20220201085002.320102-8-ivan.malov@oktetlabs.ru> (raw)
In-Reply-To: <20220201085002.320102-1-ivan.malov@oktetlabs.ru>

Riverhead boards support spreading traffic across the
specified number of queues without using indirections.
This mode is provided by a dedicated RSS context type.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
---
 drivers/common/sfc_efx/base/ef10_nic.c  | 22 +++++++++++++
 drivers/common/sfc_efx/base/ef10_rx.c   | 42 ++++++++++++++++++-------
 drivers/common/sfc_efx/base/efx.h       |  8 ++++-
 drivers/common/sfc_efx/base/efx_rx.c    |  6 +++-
 drivers/common/sfc_efx/base/siena_nic.c |  3 ++
 5 files changed, 67 insertions(+), 14 deletions(-)

diff --git a/drivers/common/sfc_efx/base/ef10_nic.c b/drivers/common/sfc_efx/base/ef10_nic.c
index cca31bc725..aa667309ab 100644
--- a/drivers/common/sfc_efx/base/ef10_nic.c
+++ b/drivers/common/sfc_efx/base/ef10_nic.c
@@ -1482,10 +1482,32 @@ ef10_get_datapath_caps(
 		encp->enc_rx_scale_tbl_max_nentries =
 		    MCDI_OUT_DWORD(req,
 			GET_CAPABILITIES_V9_OUT_RSS_MAX_INDIRECTION_TABLE_SIZE);
+
+		if (CAP_FLAGS3(req, RSS_EVEN_SPREADING)) {
+#define	RSS_MAX_EVEN_SPREADING_QUEUES				\
+	GET_CAPABILITIES_V9_OUT_RSS_MAX_EVEN_SPREADING_QUEUES
+			/*
+			 * The even spreading mode distributes traffic across
+			 * the specified number of queues without the need to
+			 * allocate precious indirection entry pool resources.
+			 */
+			encp->enc_rx_scale_even_spread_max_nqueues =
+			    MCDI_OUT_DWORD(req, RSS_MAX_EVEN_SPREADING_QUEUES);
+#undef RSS_MAX_EVEN_SPREADING_QUEUES
+		} else {
+			/* There is no support for the even spread contexts. */
+			encp->enc_rx_scale_even_spread_max_nqueues = 0;
+		}
 	} else {
 		encp->enc_rx_scale_indirection_max_nqueues = EFX_MAXRSS;
 		encp->enc_rx_scale_tbl_min_nentries = EFX_RSS_TBL_SIZE;
 		encp->enc_rx_scale_tbl_max_nentries = EFX_RSS_TBL_SIZE;
+
+		/*
+		 * Assume that there is no support
+		 * for the even spread contexts.
+		 */
+		encp->enc_rx_scale_even_spread_max_nqueues = 0;
 	}
 #endif /* EFSYS_OPT_RX_SCALE */
 
diff --git a/drivers/common/sfc_efx/base/ef10_rx.c b/drivers/common/sfc_efx/base/ef10_rx.c
index 78af7300a0..afc9cf025f 100644
--- a/drivers/common/sfc_efx/base/ef10_rx.c
+++ b/drivers/common/sfc_efx/base/ef10_rx.c
@@ -23,30 +23,45 @@ efx_mcdi_rss_context_alloc(
 	efx_mcdi_req_t req;
 	EFX_MCDI_DECLARE_BUF(payload, MC_CMD_RSS_CONTEXT_ALLOC_V2_IN_LEN,
 		MC_CMD_RSS_CONTEXT_ALLOC_OUT_LEN);
+	uint32_t table_nentries_min;
+	uint32_t table_nentries_max;
+	uint32_t num_queues_max;
 	uint32_t rss_context;
 	uint32_t context_type;
 	efx_rc_t rc;
 
-	if (num_queues > encp->enc_rx_scale_indirection_max_nqueues) {
-		rc = EINVAL;
-		goto fail1;
-	}
-
-	if (table_nentries < encp->enc_rx_scale_tbl_min_nentries ||
-	    table_nentries > encp->enc_rx_scale_tbl_max_nentries ||
-	    !ISP2(table_nentries)) {
-		rc = EINVAL;
-		goto fail2;
-	}
-
 	switch (type) {
 	case EFX_RX_SCALE_EXCLUSIVE:
 		context_type = MC_CMD_RSS_CONTEXT_ALLOC_IN_TYPE_EXCLUSIVE;
+		num_queues_max = encp->enc_rx_scale_indirection_max_nqueues;
+		table_nentries_min = encp->enc_rx_scale_tbl_min_nentries;
+		table_nentries_max = encp->enc_rx_scale_tbl_max_nentries;
 		break;
 	case EFX_RX_SCALE_SHARED:
 		context_type = MC_CMD_RSS_CONTEXT_ALLOC_IN_TYPE_SHARED;
+		num_queues_max = encp->enc_rx_scale_indirection_max_nqueues;
+		table_nentries_min = encp->enc_rx_scale_tbl_min_nentries;
+		table_nentries_max = encp->enc_rx_scale_tbl_max_nentries;
+		break;
+	case EFX_RX_SCALE_EVEN_SPREAD:
+		context_type = MC_CMD_RSS_CONTEXT_ALLOC_IN_TYPE_EVEN_SPREADING;
+		num_queues_max = encp->enc_rx_scale_even_spread_max_nqueues;
+		table_nentries_min = 0;
+		table_nentries_max = 0;
 		break;
 	default:
+		rc = EINVAL;
+		goto fail1;
+	}
+
+	if (num_queues == 0 || num_queues > num_queues_max) {
+		rc = EINVAL;
+		goto fail2;
+	}
+
+	if (table_nentries < table_nentries_min ||
+	    table_nentries > table_nentries_max ||
+	    (table_nentries != 0 && !ISP2(table_nentries))) {
 		rc = EINVAL;
 		goto fail3;
 	}
@@ -69,6 +84,9 @@ efx_mcdi_rss_context_alloc(
 	 * indirection table offsets.
 	 * For shared contexts, the provided context will spread traffic over
 	 * NUM_QUEUES many queues.
+	 * For the even spread contexts, the provided context will spread
+	 * traffic over NUM_QUEUES many queues, but that will not involve
+	 * the use of precious indirection table resources in the adapter.
 	 */
 	MCDI_IN_SET_DWORD(req, RSS_CONTEXT_ALLOC_IN_NUM_QUEUES, num_queues);
 
diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h
index 4523829eb2..854527e0fd 100644
--- a/drivers/common/sfc_efx/base/efx.h
+++ b/drivers/common/sfc_efx/base/efx.h
@@ -1495,6 +1495,11 @@ typedef struct efx_nic_cfg_s {
 	uint32_t		enc_rx_buf_align_start;
 	uint32_t		enc_rx_buf_align_end;
 #if EFSYS_OPT_RX_SCALE
+	/*
+	 * The limit on how many queues an RSS context in the even spread
+	 * mode can span. When this mode is not supported, the value is 0.
+	 */
+	uint32_t		enc_rx_scale_even_spread_max_nqueues;
 	/*
 	 * The limit on how many queues an RSS indirection table can address.
 	 *
@@ -2784,7 +2789,8 @@ typedef enum efx_rx_hash_support_e {
 typedef enum efx_rx_scale_context_type_e {
 	EFX_RX_SCALE_UNAVAILABLE = 0,	/* No RX scale context */
 	EFX_RX_SCALE_EXCLUSIVE,		/* Writable key/indirection table */
-	EFX_RX_SCALE_SHARED		/* Read-only key/indirection table */
+	EFX_RX_SCALE_SHARED,		/* Read-only key/indirection table */
+	EFX_RX_SCALE_EVEN_SPREAD,	/* No indirection table, writable key */
 } efx_rx_scale_context_type_t;
 
 /*
diff --git a/drivers/common/sfc_efx/base/efx_rx.c b/drivers/common/sfc_efx/base/efx_rx.c
index d10b990259..45dc5d6c6d 100644
--- a/drivers/common/sfc_efx/base/efx_rx.c
+++ b/drivers/common/sfc_efx/base/efx_rx.c
@@ -504,6 +504,7 @@ efx_rx_scale_context_alloc(
 	__in		uint32_t num_queues,
 	__out		uint32_t *rss_contextp)
 {
+	uint32_t table_nentries = EFX_RSS_TBL_SIZE;
 	const efx_rx_ops_t *erxop = enp->en_erxop;
 	efx_rc_t rc;
 
@@ -515,8 +516,11 @@ efx_rx_scale_context_alloc(
 		goto fail1;
 	}
 
+	if (type == EFX_RX_SCALE_EVEN_SPREAD)
+		table_nentries = 0;
+
 	if ((rc = erxop->erxo_scale_context_alloc(enp, type, num_queues,
-			    EFX_RSS_TBL_SIZE, rss_contextp)) != 0) {
+			    table_nentries, rss_contextp)) != 0) {
 		goto fail2;
 	}
 
diff --git a/drivers/common/sfc_efx/base/siena_nic.c b/drivers/common/sfc_efx/base/siena_nic.c
index 5f6d298d3f..939551dbf5 100644
--- a/drivers/common/sfc_efx/base/siena_nic.c
+++ b/drivers/common/sfc_efx/base/siena_nic.c
@@ -121,6 +121,9 @@ siena_board_cfg(
 #if EFSYS_OPT_RX_SCALE
 	encp->enc_rx_scale_indirection_max_nqueues = EFX_MAXRSS;
 
+	/* There is no support for the even spread contexts. */
+	encp->enc_rx_scale_even_spread_max_nqueues = 0;
+
 	/* There is one RSS context per function */
 	encp->enc_rx_scale_max_exclusive_contexts = 1;
 
-- 
2.30.2


  parent reply	other threads:[~2022-02-01  8:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-01  8:49 [PATCH 0/8] net/sfc: improve flow action RSS support on EF100 boards Ivan Malov
2022-02-01  8:49 ` [PATCH 1/8] net/sfc: rework flow action RSS support Ivan Malov
2022-02-01  8:49 ` [PATCH 2/8] common/sfc_efx/base: query RSS queue span limit on Riverhead Ivan Malov
2022-02-01  8:49 ` [PATCH 3/8] net/sfc: use non-static queue span limit in flow action RSS Ivan Malov
2022-02-01  8:49 ` [PATCH 4/8] common/sfc_efx/base: revise name of RSS table entry count Ivan Malov
2022-02-01  8:49 ` [PATCH 5/8] common/sfc_efx/base: support selecting " Ivan Malov
2022-02-02 11:51   ` Ray Kinsella
2022-02-02 12:24     ` Ivan Malov
2022-02-01  8:50 ` [PATCH 6/8] net/sfc: use adaptive table entry count in flow action RSS Ivan Malov
2022-02-01  8:50 ` Ivan Malov [this message]
2022-02-01  8:50 ` [PATCH 8/8] net/sfc: use the even spread mode " Ivan Malov
2022-02-02 17:41 ` [PATCH 0/8] net/sfc: improve flow action RSS support on EF100 boards Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220201085002.320102-8-ivan.malov@oktetlabs.ru \
    --to=ivan.malov@oktetlabs.ru \
    --cc=amoreton@xilinx.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).