dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
From: Lance Richardson <lance.richardson@broadcom.com>
To: dev@dpdk.org
Cc: ajit.khaparde@broadcom.com, ferruh.yigit@intel.com,
	maxime.coquelin@redhat.com, ktraynor@redhat.com,
	Lance Richardson <lance.richardson@broadcom.com>,
	stable@dpdk.org
Subject: [dpdk-dev] [PATCH v5 5/8] net/bnxt: fix RSS RETA indirection table ops
Date: Wed, 29 May 2019 17:02:24 -0400	[thread overview]
Message-ID: <20190529210227.17092-6-lance.richardson@broadcom.com> (raw)
In-Reply-To: <20190529210227.17092-1-lance.richardson@broadcom.com>

From: Ajit Khaparde <ajit.khaparde@broadcom.com>

We are trying to update the indirection table for all the VNICs.
We should update the table only for the default vnic0.

Fix the reta update function to only update table entries that are
selected by the update mask. Translate queue number to firmware
group ID when updating an entry.

Fix reta query op to only return table entries as identfied by the
provided mask. Translate firmware group IDs to queue numbers.

Removed extraneous code from bnxt_reta_query_op().

Fixes: d819382543f3 ("net/bnxt: add RSS redirection table operations")
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Rahul Gupta <rahul.gupta@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Cc: stable@dpdk.org
---
v3:
* Squashed three RSS RETA fix commits into one.

 drivers/net/bnxt/bnxt_ethdev.c | 92 +++++++++++++++++++++++++---------
 drivers/net/bnxt/bnxt_hwrm.c   |  1 +
 2 files changed, 70 insertions(+), 23 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index bccba445a..30dff72a6 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -618,12 +618,6 @@ static void bnxt_print_link_info(struct rte_eth_dev *eth_dev)
 			eth_dev->data->port_id);
 }
 
-static int bnxt_dev_lsc_intr_setup(struct rte_eth_dev *eth_dev)
-{
-	bnxt_print_link_info(eth_dev);
-	return 0;
-}
-
 /*
  * Determine whether the current configuration requires support for scattered
  * receive; return 1 if scattered receive is required and 0 if not.
@@ -977,30 +971,72 @@ static void bnxt_allmulticast_disable_op(struct rte_eth_dev *eth_dev)
 	bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL);
 }
 
+/* Return bnxt_rx_queue pointer corresponding to a given rxq. */
+static struct bnxt_rx_queue *bnxt_qid_to_rxq(struct bnxt *bp, uint16_t qid)
+{
+	if (qid >= bp->rx_nr_rings)
+		return NULL;
+
+	return bp->eth_dev->data->rx_queues[qid];
+}
+
+/* Return rxq corresponding to a given rss table ring/group ID. */
+static uint16_t bnxt_rss_to_qid(struct bnxt *bp, uint16_t fwr)
+{
+	unsigned int i;
+
+	for (i = 0; i < bp->rx_nr_rings; i++) {
+		if (bp->grp_info[i].fw_grp_id == fwr)
+			return i;
+	}
+
+	return INVALID_HW_RING_ID;
+}
+
 static int bnxt_reta_update_op(struct rte_eth_dev *eth_dev,
 			    struct rte_eth_rss_reta_entry64 *reta_conf,
 			    uint16_t reta_size)
 {
 	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
 	struct rte_eth_conf *dev_conf = &bp->eth_dev->data->dev_conf;
-	struct bnxt_vnic_info *vnic;
+	struct bnxt_vnic_info *vnic = &bp->vnic_info[0];
+	uint16_t tbl_size = HW_HASH_INDEX_SIZE;
+	uint16_t idx, sft;
 	int i;
 
+	if (!vnic->rss_table)
+		return -EINVAL;
+
 	if (!(dev_conf->rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG))
 		return -EINVAL;
 
-	if (reta_size != HW_HASH_INDEX_SIZE) {
+	if (reta_size != tbl_size) {
 		PMD_DRV_LOG(ERR, "The configured hash table lookup size "
 			"(%d) must equal the size supported by the hardware "
-			"(%d)\n", reta_size, HW_HASH_INDEX_SIZE);
+			"(%d)\n", reta_size, tbl_size);
 		return -EINVAL;
 	}
-	/* Update the RSS VNIC(s) */
-	for (i = 0; i < bp->max_vnics; i++) {
-		vnic = &bp->vnic_info[i];
-		memcpy(vnic->rss_table, reta_conf, reta_size);
-		bnxt_hwrm_vnic_rss_cfg(bp, vnic);
+
+	for (i = 0; i < reta_size; i++) {
+		struct bnxt_rx_queue *rxq;
+
+		idx = i / RTE_RETA_GROUP_SIZE;
+		sft = i % RTE_RETA_GROUP_SIZE;
+
+		if (!(reta_conf[idx].mask & (1ULL << sft)))
+			continue;
+
+		rxq = bnxt_qid_to_rxq(bp, reta_conf[idx].reta[sft]);
+		if (!rxq) {
+			PMD_DRV_LOG(ERR, "Invalid ring in reta_conf.\n");
+			return -EINVAL;
+		}
+
+		vnic->rss_table[i] =
+		    vnic->fw_grp_ids[reta_conf[idx].reta[sft]];
 	}
+
+	bnxt_hwrm_vnic_rss_cfg(bp, vnic);
 	return 0;
 }
 
@@ -1010,8 +1046,8 @@ static int bnxt_reta_query_op(struct rte_eth_dev *eth_dev,
 {
 	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
 	struct bnxt_vnic_info *vnic = &bp->vnic_info[0];
-	struct rte_intr_handle *intr_handle
-		= &bp->pdev->intr_handle;
+	uint16_t tbl_size = HW_HASH_INDEX_SIZE;
+	uint16_t idx, sft, i;
 
 	/* Retrieve from the default VNIC */
 	if (!vnic)
@@ -1019,18 +1055,28 @@ static int bnxt_reta_query_op(struct rte_eth_dev *eth_dev,
 	if (!vnic->rss_table)
 		return -EINVAL;
 
-	if (reta_size != HW_HASH_INDEX_SIZE) {
+	if (reta_size != tbl_size) {
 		PMD_DRV_LOG(ERR, "The configured hash table lookup size "
 			"(%d) must equal the size supported by the hardware "
-			"(%d)\n", reta_size, HW_HASH_INDEX_SIZE);
+			"(%d)\n", reta_size, tbl_size);
 		return -EINVAL;
 	}
-	/* EW - need to revisit here copying from uint64_t to uint16_t */
-	memcpy(reta_conf, vnic->rss_table, reta_size);
 
-	if (rte_intr_allow_others(intr_handle)) {
-		if (eth_dev->data->dev_conf.intr_conf.lsc != 0)
-			bnxt_dev_lsc_intr_setup(eth_dev);
+	for (idx = 0, i = 0; i < reta_size; i++) {
+		idx = i / RTE_RETA_GROUP_SIZE;
+		sft = i % RTE_RETA_GROUP_SIZE;
+
+		if (reta_conf[idx].mask & (1ULL << sft)) {
+			uint16_t qid;
+
+			qid = bnxt_rss_to_qid(bp, vnic->rss_table[i]);
+
+			if (qid == INVALID_HW_RING_ID) {
+				PMD_DRV_LOG(ERR, "Inv. entry in rss table.\n");
+				return -EINVAL;
+			}
+			reta_conf[idx].reta[sft] = qid;
+		}
 	}
 
 	return 0;
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index c5aca89b2..0c6af1622 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -1607,6 +1607,7 @@ int bnxt_hwrm_vnic_rss_cfg(struct bnxt *bp,
 	req.hash_key_tbl_addr =
 	    rte_cpu_to_le_64(vnic->rss_hash_key_dma_addr);
 	req.rss_ctx_idx = rte_cpu_to_le_16(vnic->rss_rule);
+	req.vnic_id = rte_cpu_to_le_16(vnic->fw_vnic_id);
 
 	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
 
-- 
2.17.1


  parent reply	other threads:[~2019-05-29 21:03 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-21 21:39 [dpdk-dev] [PATCH 00/11] bnxt patchset Ajit Khaparde
2019-05-21 21:39 ` [dpdk-dev] [PATCH 01/11] net/bnxt: move tx bd checking to header file Ajit Khaparde
2019-05-23 11:44   ` Maxime Coquelin
2019-05-21 21:39 ` [dpdk-dev] [PATCH 02/11] net/bnxt: compute and store scattered RX status Ajit Khaparde
2019-05-23 11:47   ` Maxime Coquelin
2019-05-21 21:39 ` [dpdk-dev] [PATCH 03/11] net/bnxt: implement vector mode driver Ajit Khaparde
2019-05-23 12:18   ` Maxime Coquelin
2019-05-23 19:23     ` Lance Richardson
2019-05-21 21:39 ` [dpdk-dev] [PATCH 04/11] net/bnxt: fix double counting VLAN tags Ajit Khaparde
2019-05-23 12:21   ` Maxime Coquelin
2019-05-23 18:53     ` Lance Richardson
2019-05-21 21:39 ` [dpdk-dev] [PATCH 05/11] net/bnxt: fix RSS reta indirection table update Ajit Khaparde
2019-05-21 21:39 ` [dpdk-dev] [PATCH 06/11] net/bnxt: use reta update mask and translate qid to grp id Ajit Khaparde
2019-05-21 21:39 ` [dpdk-dev] [PATCH 07/11] net/bnxt: fix reta query op Ajit Khaparde
2019-05-21 21:39 ` [dpdk-dev] [PATCH 08/11] net/bnxt: update HWRM API Ajit Khaparde
2019-05-21 21:39 ` [dpdk-dev] [PATCH 09/11] net/bnxt: update HWRM version Ajit Khaparde
2019-05-21 21:39 ` [dpdk-dev] [PATCH 10/11] net/bnxt: HWRM version update Ajit Khaparde
2019-05-21 21:39 ` [dpdk-dev] [PATCH 11/11] net/bnxt: update release notes for bnxt Ajit Khaparde
2019-05-24 14:49 ` [dpdk-dev] [PATCH v2 00/10] bnxt patchset Lance Richardson
2019-05-24 14:49   ` [dpdk-dev] [PATCH v2 01/10] net/bnxt: move tx bd checking to header file Lance Richardson
2019-05-27  9:36     ` Ferruh Yigit
2019-05-27 15:24       ` Ferruh Yigit
2019-05-27 18:50         ` Lance Richardson
2019-05-24 14:49   ` [dpdk-dev] [PATCH v2 02/10] net/bnxt: compute and store scattered RX status Lance Richardson
2019-05-24 14:49   ` [dpdk-dev] [PATCH v2 03/10] net/bnxt: implement vector mode driver Lance Richardson
2019-05-28  9:05     ` Ferruh Yigit
2019-05-28  9:08     ` Ferruh Yigit
2019-05-28 11:23       ` Lance Richardson
2019-05-24 14:49   ` [dpdk-dev] [PATCH v2 04/10] net/bnxt: fix RSS reta indirection table update Lance Richardson
2019-05-24 14:49   ` [dpdk-dev] [PATCH v2 05/10] net/bnxt: use reta update mask and translate qid to grp id Lance Richardson
2019-05-24 14:49   ` [dpdk-dev] [PATCH v2 06/10] net/bnxt: fix reta query op Lance Richardson
2019-05-24 14:49   ` [dpdk-dev] [PATCH v2 07/10] net/bnxt: update HWRM API Lance Richardson
2019-05-24 14:49   ` [dpdk-dev] [PATCH v2 08/10] net/bnxt: update HWRM version Lance Richardson
2019-05-24 14:49   ` [dpdk-dev] [PATCH v2 09/10] net/bnxt: HWRM version update Lance Richardson
2019-05-28  9:12     ` Ferruh Yigit
2019-05-28 15:06       ` Lance Richardson
2019-05-24 14:49   ` [dpdk-dev] [PATCH v2 10/10] net/bnxt: update release notes for bnxt Lance Richardson
2019-05-28  9:15     ` Ferruh Yigit
2019-05-28  9:19   ` [dpdk-dev] [PATCH v2 00/10] bnxt patchset Ferruh Yigit
2019-05-28 15:11     ` Lance Richardson
2019-05-28 19:23 ` [dpdk-dev] [PATCH v3 0/8] " Lance Richardson
2019-05-28 19:23   ` [dpdk-dev] [PATCH v3 1/8] net/bnxt: update release notes for bnxt Lance Richardson
2019-05-28 19:23   ` [dpdk-dev] [PATCH v3 2/8] net/bnxt: move Tx bd checking to header file Lance Richardson
2019-05-28 19:23   ` [dpdk-dev] [PATCH v3 3/8] net/bnxt: compute and store scattered Rx status Lance Richardson
2019-05-28 19:23   ` [dpdk-dev] [PATCH v3 4/8] net/bnxt: implement vector mode driver Lance Richardson
2019-05-29  6:48     ` Maxime Coquelin
2019-05-29 13:19       ` Lance Richardson
2019-05-28 19:23   ` [dpdk-dev] [PATCH v3 5/8] net/bnxt: fix RSS RETA indirection table ops Lance Richardson
2019-05-28 19:23   ` [dpdk-dev] [PATCH v3 6/8] net/bnxt: update HWRM API to version 1.10.0.19 Lance Richardson
2019-05-28 19:23   ` [dpdk-dev] [PATCH v3 7/8] net/bnxt: update HWRM API to version 1.10.0.48 Lance Richardson
2019-05-28 19:23   ` [dpdk-dev] [PATCH v3 8/8] net/bnxt: update HWRM API to version 1.10.0.74 Lance Richardson
2019-05-29 15:02 ` [dpdk-dev] [PATCH v4 0/8] bnxt patchset Lance Richardson
2019-05-29 15:02   ` [dpdk-dev] [PATCH v4 1/8] net/bnxt: update release notes for bnxt Lance Richardson
2019-05-29 18:16     ` Kevin Traynor
2019-05-29 20:28       ` Lance Richardson
2019-05-29 20:35         ` Lance Richardson
2019-05-29 20:38           ` Lance Richardson
2019-05-29 15:02   ` [dpdk-dev] [PATCH v4 2/8] net/bnxt: move Tx bd checking to header file Lance Richardson
2019-05-29 15:02   ` [dpdk-dev] [PATCH v4 3/8] net/bnxt: compute and store scattered Rx status Lance Richardson
2019-05-29 15:02   ` [dpdk-dev] [PATCH v4 4/8] net/bnxt: implement vector mode driver Lance Richardson
2019-05-29 15:02   ` [dpdk-dev] [PATCH v4 5/8] net/bnxt: fix RSS RETA indirection table ops Lance Richardson
2019-05-29 15:02   ` [dpdk-dev] [PATCH v4 6/8] net/bnxt: update HWRM API to version 1.10.0.19 Lance Richardson
2019-05-29 15:02   ` [dpdk-dev] [PATCH v4 7/8] net/bnxt: update HWRM API to version 1.10.0.48 Lance Richardson
2019-05-29 15:02   ` [dpdk-dev] [PATCH v4 8/8] net/bnxt: update HWRM API to version 1.10.0.74 Lance Richardson
2019-05-29 21:02 ` [dpdk-dev] [PATCH v5 0/8] bnxt patchset Lance Richardson
2019-05-29 21:02   ` [dpdk-dev] [PATCH v5 1/8] net/bnxt: update release notes for bnxt Lance Richardson
2019-05-29 21:02   ` [dpdk-dev] [PATCH v5 2/8] net/bnxt: move Tx bd checking to header file Lance Richardson
2019-05-29 21:02   ` [dpdk-dev] [PATCH v5 3/8] net/bnxt: compute and store scattered Rx status Lance Richardson
2019-05-29 21:02   ` [dpdk-dev] [PATCH v5 4/8] net/bnxt: implement vector mode driver Lance Richardson
2019-05-29 21:02   ` Lance Richardson [this message]
2019-05-29 21:02   ` [dpdk-dev] [PATCH v5 6/8] net/bnxt: update HWRM API to version 1.10.0.19 Lance Richardson
2019-05-29 21:02   ` [dpdk-dev] [PATCH v5 7/8] net/bnxt: update HWRM API to version 1.10.0.48 Lance Richardson
2019-05-29 21:02   ` [dpdk-dev] [PATCH v5 8/8] net/bnxt: update HWRM API to version 1.10.0.74 Lance Richardson
2019-06-04 16:07   ` [dpdk-dev] [PATCH v5 0/8] bnxt patchset Ferruh Yigit
2019-06-14 15:34     ` 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=20190529210227.17092-6-lance.richardson@broadcom.com \
    --to=lance.richardson@broadcom.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=ktraynor@redhat.com \
    --cc=maxime.coquelin@redhat.com \
    --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).