DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rasesh Mody <rasesh.mody@qlogic.com>
To: <bruce.richardson@intel.com>
Cc: <dev@dpdk.org>, <Dept-EngDPDKDev@qlogic.com>,
	Sony Chacko <sony.chacko@qlogic.com>
Subject: [dpdk-dev] [PATCH v2 1/9] qede: add support for setting hash configuration
Date: Wed, 15 Jun 2016 22:47:03 -0700	[thread overview]
Message-ID: <1466056031-23225-2-git-send-email-rasesh.mody@qlogic.com> (raw)
In-Reply-To: <1466056031-23225-1-git-send-email-rasesh.mody@qlogic.com>

From: Sony Chacko <sony.chacko@qlogic.com>

Add support for setting hash configuration based on adapter capability
and update corresponding NIC documentation.

Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
---
 doc/guides/nics/overview.rst   |    2 +-
 doc/guides/nics/qede.rst       |    3 +--
 drivers/net/qede/qede_eth_if.h |    1 +
 drivers/net/qede/qede_ethdev.c |   43 ++++++++++++++++++++++++++++++++++++++++
 drivers/net/qede/qede_rxtx.c   |   42 +++++++++++++++++++++++++++------------
 5 files changed, 75 insertions(+), 16 deletions(-)

diff --git a/doc/guides/nics/overview.rst b/doc/guides/nics/overview.rst
index 2200171..2327f5e 100644
--- a/doc/guides/nics/overview.rst
+++ b/doc/guides/nics/overview.rst
@@ -102,7 +102,7 @@ Most of these differences are summarized below.
    Unicast MAC filter     Y Y     Y   Y Y Y Y Y Y Y Y Y Y Y Y Y     Y Y         Y Y       Y Y
    Multicast MAC filter   Y Y         Y Y Y Y Y             Y Y     Y Y         Y Y       Y Y
    RSS hash                     Y   Y Y Y Y Y Y Y   Y Y Y Y Y Y Y Y Y Y         Y Y
-   RSS key update                   Y   Y Y Y Y Y   Y Y Y Y Y Y Y Y   Y
+   RSS key update                   Y   Y Y Y Y Y   Y Y Y Y Y Y Y Y   Y         Y Y
    RSS reta update                  Y   Y Y Y Y Y   Y Y Y Y Y Y Y Y   Y
    VMDq                                 Y Y     Y   Y Y     Y Y
    SR-IOV                   Y       Y   Y Y     Y   Y Y             Y Y           Y
diff --git a/doc/guides/nics/qede.rst b/doc/guides/nics/qede.rst
index 9ff3d1d..c5fbd83 100644
--- a/doc/guides/nics/qede.rst
+++ b/doc/guides/nics/qede.rst
@@ -51,7 +51,7 @@ Supported Features
 - VLAN offload - Filtering and stripping
 - Stateless checksum offloads (IPv4/TCP/UDP)
 - Multiple Rx/Tx queues (queue-pairs)
-- RSS (with default table/key)
+- RSS (with user configurable table/key)
 - TSS
 - Multiple MAC address
 - Default pause flow control
@@ -61,7 +61,6 @@ Non-supported Features
 ----------------------
 
 - Scatter-Gather Rx/Tx frames
-- User configurable RETA table/key
 - Unequal number of Rx/Tx queues
 - MTU change (dynamic)
 - SR-IOV PF
diff --git a/drivers/net/qede/qede_eth_if.h b/drivers/net/qede/qede_eth_if.h
index 61f677c..26968eb 100644
--- a/drivers/net/qede/qede_eth_if.h
+++ b/drivers/net/qede/qede_eth_if.h
@@ -53,6 +53,7 @@ struct qed_dev_eth_info {
 struct qed_update_vport_rss_params {
 	uint16_t rss_ind_table[128];
 	uint32_t rss_key[10];
+	u8 rss_caps;
 };
 
 struct qed_stop_rxq_params {
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 1273fd3..84ff6f8 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -753,6 +753,47 @@ qede_dev_supported_ptypes_get(struct rte_eth_dev *eth_dev)
 	return NULL;
 }
 
+int qede_rss_hash_update(struct rte_eth_dev *eth_dev,
+			 struct rte_eth_rss_conf *rss_conf)
+{
+	struct qed_update_vport_params vport_update_params;
+	struct qede_dev *qdev = eth_dev->data->dev_private;
+	struct ecore_dev *edev = &qdev->edev;
+	uint8_t rss_caps;
+	uint32_t *key = (uint32_t *)rss_conf->rss_key;
+	uint64_t hf = rss_conf->rss_hf;
+	int i;
+
+	if (hf == 0)
+		DP_ERR(edev, "hash function 0 will disable RSS\n");
+
+	rss_caps = 0;
+	rss_caps |= (hf & ETH_RSS_IPV4)              ? ECORE_RSS_IPV4 : 0;
+	rss_caps |= (hf & ETH_RSS_IPV6)              ? ECORE_RSS_IPV6 : 0;
+	rss_caps |= (hf & ETH_RSS_IPV6_EX)           ? ECORE_RSS_IPV6 : 0;
+	rss_caps |= (hf & ETH_RSS_NONFRAG_IPV4_TCP)  ? ECORE_RSS_IPV4_TCP : 0;
+	rss_caps |= (hf & ETH_RSS_NONFRAG_IPV6_TCP)  ? ECORE_RSS_IPV6_TCP : 0;
+	rss_caps |= (hf & ETH_RSS_IPV6_TCP_EX)       ? ECORE_RSS_IPV6_TCP : 0;
+
+	/* If the mapping doesn't fit any supported, return */
+	if (rss_caps == 0 && hf != 0)
+		return -EINVAL;
+
+	memset(&vport_update_params, 0, sizeof(vport_update_params));
+
+	if (key != NULL)
+		memcpy(qdev->rss_params.rss_key, rss_conf->rss_key,
+		       rss_conf->rss_key_len);
+
+	qdev->rss_params.rss_caps = rss_caps;
+	memcpy(&vport_update_params.rss_params, &qdev->rss_params,
+	       sizeof(vport_update_params.rss_params));
+	vport_update_params.update_rss_flg = 1;
+	vport_update_params.vport_id = 0;
+
+	return qdev->ops->vport_update(edev, &vport_update_params);
+}
+
 static const struct eth_dev_ops qede_eth_dev_ops = {
 	.dev_configure = qede_dev_configure,
 	.dev_infos_get = qede_dev_info_get,
@@ -780,6 +821,7 @@ static const struct eth_dev_ops qede_eth_dev_ops = {
 	.flow_ctrl_set = qede_flow_ctrl_set,
 	.flow_ctrl_get = qede_flow_ctrl_get,
 	.dev_supported_ptypes_get = qede_dev_supported_ptypes_get,
+	.rss_hash_update = qede_rss_hash_update,
 };
 
 static const struct eth_dev_ops qede_eth_vf_dev_ops = {
@@ -804,6 +846,7 @@ static const struct eth_dev_ops qede_eth_vf_dev_ops = {
 	.vlan_offload_set = qede_vlan_offload_set,
 	.vlan_filter_set = qede_vlan_filter_set,
 	.dev_supported_ptypes_get = qede_dev_supported_ptypes_get,
+	.rss_hash_update = qede_rss_hash_update,
 };
 
 static void qede_update_pf_params(struct ecore_dev *edev)
diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
index 94f3c78..ccce5fd 100644
--- a/drivers/net/qede/qede_rxtx.c
+++ b/drivers/net/qede/qede_rxtx.c
@@ -532,13 +532,18 @@ static int
 qede_config_rss(struct rte_eth_dev *eth_dev,
 		struct qed_update_vport_rss_params *rss_params)
 {
+	struct rte_eth_rss_conf rss_conf;
 	enum rte_eth_rx_mq_mode mode = eth_dev->data->dev_conf.rxmode.mq_mode;
-	struct rte_eth_rss_conf rss_conf =
-	    eth_dev->data->dev_conf.rx_adv_conf.rss_conf;
 	struct qede_dev *qdev = eth_dev->data->dev_private;
 	struct ecore_dev *edev = &qdev->edev;
+	uint8_t rss_caps;
 	unsigned int i;
+	uint64_t hf;
+	uint32_t *key;
 
+	rss_conf = eth_dev->data->dev_conf.rx_adv_conf.rss_conf;
+	key = (uint32_t *)rss_conf.rss_key;
+	hf = rss_conf.rss_hf;
 	PMD_INIT_FUNC_TRACE(edev);
 
 	/* Check if RSS conditions are met.
@@ -553,16 +558,12 @@ qede_config_rss(struct rte_eth_dev *eth_dev,
 
 	DP_INFO(edev, "RSS flag is set\n");
 
-	if (rss_conf.rss_hf == 0) {
-		DP_NOTICE(edev, false, "No RSS hash function to apply\n");
-		return -EINVAL;
-	}
+	if (rss_conf.rss_hf == 0)
+		DP_NOTICE(edev, false, "RSS hash function = 0, disables RSS\n");
 
-	if (rss_conf.rss_key != NULL) {
-		DP_NOTICE(edev, false,
-			  "User provided RSS key is not supported\n");
-		return -EINVAL;
-	}
+	if (rss_conf.rss_key != NULL)
+		memcpy(qdev->rss_params.rss_key, rss_conf.rss_key,
+		       rss_conf.rss_key_len);
 
 	memset(rss_params, 0, sizeof(*rss_params));
 
@@ -570,8 +571,23 @@ qede_config_rss(struct rte_eth_dev *eth_dev,
 		rss_params->rss_ind_table[i] = qede_rxfh_indir_default(i,
 							QEDE_RSS_CNT(qdev));
 
-	qede_prandom_bytes(rss_params->rss_key,
-			   sizeof(rss_params->rss_key));
+	/* key and protocols */
+	if (rss_conf.rss_key == NULL)
+		qede_prandom_bytes(rss_params->rss_key,
+				   sizeof(rss_params->rss_key));
+	else
+		memcpy(rss_params->rss_key, rss_conf.rss_key,
+		       rss_conf.rss_key_len);
+
+	rss_caps = 0;
+	rss_caps |= (hf & ETH_RSS_IPV4)              ? ECORE_RSS_IPV4 : 0;
+	rss_caps |= (hf & ETH_RSS_IPV6)              ? ECORE_RSS_IPV6 : 0;
+	rss_caps |= (hf & ETH_RSS_IPV6_EX)           ? ECORE_RSS_IPV6 : 0;
+	rss_caps |= (hf & ETH_RSS_NONFRAG_IPV4_TCP)  ? ECORE_RSS_IPV4_TCP : 0;
+	rss_caps |= (hf & ETH_RSS_NONFRAG_IPV6_TCP)  ? ECORE_RSS_IPV6_TCP : 0;
+	rss_caps |= (hf & ETH_RSS_IPV6_TCP_EX)       ? ECORE_RSS_IPV6_TCP : 0;
+
+	rss_params->rss_caps = rss_caps;
 
 	DP_INFO(edev, "RSS check passes\n");
 
-- 
1.7.10.3

  reply	other threads:[~2016-06-16  5:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-16  5:47 [dpdk-dev] [PATCH v2 0/9] qede: update qede PMD to 1.1.0.1 Rasesh Mody
2016-06-16  5:47 ` Rasesh Mody [this message]
2016-06-16  5:47 ` [dpdk-dev] [PATCH v2 2/9] qede: add support for getting rss hash configuration Rasesh Mody
2016-06-16  5:47 ` [dpdk-dev] [PATCH v2 3/9] qede: add support for setting rss redirection table Rasesh Mody
2016-06-16  5:47 ` [dpdk-dev] [PATCH v2 4/9] qede: add support for querying " Rasesh Mody
2016-06-16  5:47 ` [dpdk-dev] [PATCH v2 5/9] qede: add support for setting the MTU Rasesh Mody
2016-06-23 15:45   ` Bruce Richardson
2016-06-16  5:47 ` [dpdk-dev] [PATCH v2 6/9] qede: add support for xstats Rasesh Mody
2016-06-28 14:31   ` Thomas Monjalon
2016-06-29  0:08     ` Rasesh Mody
2016-06-16  5:47 ` [dpdk-dev] [PATCH v2 7/9] qede: add 100g mode support Rasesh Mody
2016-06-16  5:47 ` [dpdk-dev] [PATCH v2 8/9] qede: update vport filter settings Rasesh Mody
2016-06-23 15:46   ` Bruce Richardson
2016-06-16  5:47 ` [dpdk-dev] [PATCH v2 9/9] qede: update version to 8.7.9.0_1.1.0.1 Rasesh Mody
2016-06-23 15:49 ` [dpdk-dev] [PATCH v2 0/9] qede: update qede PMD to 1.1.0.1 Bruce Richardson

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=1466056031-23225-2-git-send-email-rasesh.mody@qlogic.com \
    --to=rasesh.mody@qlogic.com \
    --cc=Dept-EngDPDKDev@qlogic.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=sony.chacko@qlogic.com \
    /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).