DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Cc: Ivan Malov <ivan.malov@oktetlabs.ru>, <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH v2 5/8] net/sfc: process RSS settings on Rx configure step
Date: Thu, 19 Apr 2018 17:41:49 +0100	[thread overview]
Message-ID: <1524156112-28615-6-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1524156112-28615-1-git-send-email-arybchenko@solarflare.com>

From: Ivan Malov <ivan.malov@oktetlabs.ru>

One may submit advanced RSS settings as part of
rte_eth_conf to customise RSS configuration from
the very beginning. Currently the driver does not
check that piece of settings and proceeds with
default choices for RSS hash functions and RSS key.

This patch implements the required processing.

Fixes: 4ec1fc3ba881 ("net/sfc: add basic stubs for RSS support on driver attach")
Cc: stable@dpdk.org

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/sfc_rx.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c
index 734ce24..fca3931 100644
--- a/drivers/net/sfc/sfc_rx.c
+++ b/drivers/net/sfc/sfc_rx.c
@@ -1189,6 +1189,41 @@ sfc_efx_to_rte_hash_type(efx_rx_hash_type_t efx_hash_types)
 
 #if EFSYS_OPT_RX_SCALE
 static int
+sfc_rx_process_adv_conf_rss(struct sfc_adapter *sa,
+			    struct rte_eth_rss_conf *conf)
+{
+	efx_rx_hash_type_t efx_hash_types = sa->rss_hash_types;
+
+	if (sa->rss_support != EFX_RX_SCALE_EXCLUSIVE) {
+		if ((conf->rss_hf != 0 && conf->rss_hf != SFC_RSS_OFFLOADS) ||
+		    conf->rss_key != NULL)
+			return EINVAL;
+	}
+
+	if (conf->rss_hf != 0) {
+		if ((conf->rss_hf & ~SFC_RSS_OFFLOADS) != 0) {
+			sfc_err(sa, "unsupported hash functions requested");
+			return EINVAL;
+		}
+
+		efx_hash_types = sfc_rte_to_efx_hash_type(conf->rss_hf);
+	}
+
+	if (conf->rss_key != NULL) {
+		if (conf->rss_key_len != sizeof(sa->rss_key)) {
+			sfc_err(sa, "RSS key size is wrong (should be %lu)",
+				sizeof(sa->rss_key));
+			return EINVAL;
+		}
+		rte_memcpy(sa->rss_key, conf->rss_key, sizeof(sa->rss_key));
+	}
+
+	sa->rss_hash_types = efx_hash_types;
+
+	return 0;
+}
+
+static int
 sfc_rx_rss_config(struct sfc_adapter *sa)
 {
 	int rc = 0;
@@ -1416,16 +1451,23 @@ sfc_rx_configure(struct sfc_adapter *sa)
 			   MIN(sa->rxq_count, EFX_MAXRSS) : 0;
 
 	if (sa->rss_channels > 0) {
+		struct rte_eth_rss_conf *adv_conf_rss;
 		unsigned int sw_index;
 
 		for (sw_index = 0; sw_index < EFX_RSS_TBL_SIZE; ++sw_index)
 			sa->rss_tbl[sw_index] = sw_index % sa->rss_channels;
+
+		adv_conf_rss = &dev_conf->rx_adv_conf.rss_conf;
+		rc = sfc_rx_process_adv_conf_rss(sa, adv_conf_rss);
+		if (rc != 0)
+			goto fail_rx_process_adv_conf_rss;
 	}
 #endif
 
 done:
 	return 0;
 
+fail_rx_process_adv_conf_rss:
 fail_rx_qinit_info:
 fail_rxqs_realloc:
 fail_rxqs_alloc:
-- 
2.7.4

  parent reply	other threads:[~2018-04-19 16:42 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-06 17:21 [dpdk-dev] [PATCH 0/7] net/sfc: RSS improvements Andrew Rybchenko
2018-04-06 17:21 ` [dpdk-dev] [PATCH 1/7] net/sfc/base: add a new means to control RSS hash Andrew Rybchenko
2018-04-19 16:17   ` Andrew Rybchenko
2018-04-06 17:21 ` [dpdk-dev] [PATCH 2/7] net/sfc/base: support more RSS hash configurations Andrew Rybchenko
2018-04-06 17:21 ` [dpdk-dev] [PATCH 3/7] net/sfc/base: honour packed stream RSS restriction Andrew Rybchenko
2018-04-06 17:21 ` [dpdk-dev] [PATCH 4/7] net/sfc: process RSS settings on Rx configure step Andrew Rybchenko
2018-04-06 17:21 ` [dpdk-dev] [PATCH 5/7] net/sfc: remove conditional compilation for RSS Andrew Rybchenko
2018-04-06 17:21 ` [dpdk-dev] [PATCH 6/7] net/sfc: factor out RSS fields from adapter info Andrew Rybchenko
2018-04-06 17:21 ` [dpdk-dev] [PATCH 7/7] net/sfc: convert to the advanced EFX RSS interface Andrew Rybchenko
2018-04-19 16:41 ` [dpdk-dev] [PATCH v2 0/8] net/sfc: RSS improvements Andrew Rybchenko
2018-04-19 16:41   ` [dpdk-dev] [PATCH v2 1/8] net/sfc/base: cope with clang warning on negative shift Andrew Rybchenko
2018-04-19 16:41   ` [dpdk-dev] [PATCH v2 2/8] net/sfc/base: add a new means to control RSS hash Andrew Rybchenko
2018-04-19 16:41   ` [dpdk-dev] [PATCH v2 3/8] net/sfc/base: support more RSS hash configurations Andrew Rybchenko
2018-04-19 16:41   ` [dpdk-dev] [PATCH v2 4/8] net/sfc/base: honour packed stream RSS restriction Andrew Rybchenko
2018-04-19 16:41   ` Andrew Rybchenko [this message]
2018-04-19 16:41   ` [dpdk-dev] [PATCH v2 6/8] net/sfc: remove conditional compilation for RSS Andrew Rybchenko
2018-04-19 16:41   ` [dpdk-dev] [PATCH v2 7/8] net/sfc: factor out RSS fields from adapter info Andrew Rybchenko
2018-04-19 16:41   ` [dpdk-dev] [PATCH v2 8/8] net/sfc: convert to the advanced EFX RSS interface Andrew Rybchenko
2018-04-25 17:41   ` [dpdk-dev] [PATCH v2 0/8] net/sfc: RSS improvements Andrew Rybchenko
2018-04-25 17:51 ` [dpdk-dev] [PATCH v3 " Andrew Rybchenko
2018-04-25 17:51   ` [dpdk-dev] [PATCH v3 1/8] net/sfc/base: cope with clang warning on negative shift Andrew Rybchenko
2018-04-25 17:51   ` [dpdk-dev] [PATCH v3 2/8] net/sfc/base: add a new means to control RSS hash Andrew Rybchenko
2018-04-25 17:51   ` [dpdk-dev] [PATCH v3 3/8] net/sfc/base: support more RSS hash configurations Andrew Rybchenko
2018-04-25 17:51   ` [dpdk-dev] [PATCH v3 4/8] net/sfc/base: honour packed stream RSS restriction Andrew Rybchenko
2018-04-25 17:51   ` [dpdk-dev] [PATCH v3 5/8] net/sfc: process RSS settings on Rx configure step Andrew Rybchenko
2018-04-25 17:51   ` [dpdk-dev] [PATCH v3 6/8] net/sfc: remove conditional compilation for RSS Andrew Rybchenko
2018-04-25 17:51   ` [dpdk-dev] [PATCH v3 7/8] net/sfc: factor out RSS fields from adapter info Andrew Rybchenko
2018-04-25 17:51   ` [dpdk-dev] [PATCH v3 8/8] net/sfc: convert to the advanced EFX RSS interface Andrew Rybchenko
2018-04-25 23:19   ` [dpdk-dev] [PATCH v3 0/8] net/sfc: RSS improvements 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=1524156112-28615-6-git-send-email-arybchenko@solarflare.com \
    --to=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    --cc=ivan.malov@oktetlabs.ru \
    --cc=stable@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).