patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com, stable@dpdk.org
Subject: [dpdk-stable] [PATCH v2 22/23] net/bnxt: fix Rx ring count limitation
Date: Thu, 28 Jun 2018 13:15:48 -0700	[thread overview]
Message-ID: <20180628201549.3507-23-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20180628201549.3507-1-ajit.khaparde@broadcom.com>

Fixed size of fw_grp_ids in VNIC is limiting the number of Rx rings
being created. With this patch we are allocating fw_grp_ids dynamically,
allowing us to get over this artificial limit.

Fixes: 9738793f28ec ("net/bnxt: add VNIC functions and structs")
Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 11 +++++++++++
 drivers/net/bnxt/bnxt_hwrm.c   |  5 ++++-
 drivers/net/bnxt/bnxt_vnic.c   |  5 +----
 drivers/net/bnxt/bnxt_vnic.h   |  6 +-----
 4 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 34c3d6ba3..a1f835ed9 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -250,6 +250,17 @@ static int bnxt_init_chip(struct bnxt *bp)
 	for (i = 0; i < bp->nr_vnics; i++) {
 		struct rte_eth_conf *dev_conf = &bp->eth_dev->data->dev_conf;
 		struct bnxt_vnic_info *vnic = &bp->vnic_info[i];
+		uint32_t size = sizeof(*vnic->fw_grp_ids) * bp->max_ring_grps;
+
+		vnic->fw_grp_ids = rte_zmalloc("vnic_fw_grp_ids", size, 0);
+		if (!vnic->fw_grp_ids) {
+			PMD_DRV_LOG(ERR,
+				    "Failed to alloc %d bytes for group ids\n",
+				    size);
+			rc = -ENOMEM;
+			goto err_out;
+		}
+		memset(vnic->fw_grp_ids, -1, size);
 
 		rc = bnxt_hwrm_vnic_alloc(bp, vnic);
 		if (rc) {
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index de04fe863..37aefbdc9 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -1319,8 +1319,9 @@ int bnxt_hwrm_vnic_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 	/* map ring groups to this vnic */
 	PMD_DRV_LOG(DEBUG, "Alloc VNIC. Start %x, End %x\n",
 		vnic->start_grp_id, vnic->end_grp_id);
-	for (i = vnic->start_grp_id, j = 0; i <= vnic->end_grp_id; i++, j++)
+	for (i = vnic->start_grp_id, j = 0; i < vnic->end_grp_id; i++, j++)
 		vnic->fw_grp_ids[j] = bp->grp_info[i].fw_grp_id;
+
 	vnic->dflt_ring_grp = bp->grp_info[vnic->start_grp_id].fw_grp_id;
 	vnic->rss_rule = (uint16_t)HWRM_NA_SIGNATURE;
 	vnic->cos_rule = (uint16_t)HWRM_NA_SIGNATURE;
@@ -2106,6 +2107,8 @@ void bnxt_free_all_hwrm_resources(struct bnxt *bp)
 		bnxt_hwrm_vnic_tpa_cfg(bp, vnic, false);
 
 		bnxt_hwrm_vnic_free(bp, vnic);
+
+		rte_free(vnic->fw_grp_ids);
 	}
 	/* Ring resources */
 	bnxt_free_all_hwrm_rings(bp);
diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c
index 19d06af55..c0577cd76 100644
--- a/drivers/net/bnxt/bnxt_vnic.c
+++ b/drivers/net/bnxt/bnxt_vnic.c
@@ -39,7 +39,7 @@ void bnxt_init_vnics(struct bnxt *bp)
 {
 	struct bnxt_vnic_info *vnic;
 	uint16_t max_vnics;
-	int i, j;
+	int i;
 
 	max_vnics = bp->max_vnics;
 	STAILQ_INIT(&bp->free_vnic_list);
@@ -52,9 +52,6 @@ void bnxt_init_vnics(struct bnxt *bp)
 		vnic->hash_mode =
 			HWRM_VNIC_RSS_CFG_INPUT_HASH_MODE_FLAGS_DEFAULT;
 
-		for (j = 0; j < MAX_QUEUES_PER_VNIC; j++)
-			vnic->fw_grp_ids[j] = (uint16_t)HWRM_NA_SIGNATURE;
-
 		prandom_bytes(vnic->rss_hash_key, HW_HASH_KEY_SIZE);
 		STAILQ_INIT(&vnic->filter);
 		STAILQ_INIT(&vnic->flow_list);
diff --git a/drivers/net/bnxt/bnxt_vnic.h b/drivers/net/bnxt/bnxt_vnic.h
index c521d7e5a..9029f78c3 100644
--- a/drivers/net/bnxt/bnxt_vnic.h
+++ b/drivers/net/bnxt/bnxt_vnic.h
@@ -15,13 +15,9 @@ struct bnxt_vnic_info {
 
 	uint16_t	fw_vnic_id; /* returned by Chimp during alloc */
 	uint16_t	rss_rule;
-#define MAX_NUM_TRAFFIC_CLASSES		8
-#define MAX_NUM_RSS_QUEUES_PER_VNIC	16
-#define MAX_QUEUES_PER_VNIC	(MAX_NUM_RSS_QUEUES_PER_VNIC + \
-				 MAX_NUM_TRAFFIC_CLASSES)
 	uint16_t	start_grp_id;
 	uint16_t	end_grp_id;
-	uint16_t	fw_grp_ids[MAX_QUEUES_PER_VNIC];
+	uint16_t	*fw_grp_ids;
 	uint16_t	dflt_ring_grp;
 	uint16_t	mru;
 	uint16_t	hash_type;
-- 
2.15.2 (Apple Git-101.1)

  parent reply	other threads:[~2018-06-28 20:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <f02289d7-4111-ab00-9ce9-00dd5c8b3c18@intel.com>
     [not found] ` <20180628201549.3507-1-ajit.khaparde@broadcom.com>
2018-06-28 20:15   ` [dpdk-stable] [PATCH v2 01/23] net/bnxt: fix clear port stats Ajit Khaparde
2018-06-28 20:15   ` [dpdk-stable] [PATCH v2 05/23] net/bnxt: fix dev close operation Ajit Khaparde
2018-06-28 20:15   ` [dpdk-stable] [PATCH v2 07/23] net/bnxt: fix HW Tx checksum offload check Ajit Khaparde
2018-06-28 20:15   ` [dpdk-stable] [PATCH v2 09/23] net/bnxt: fix Rx/Tx queue start/stop operations Ajit Khaparde
2018-06-28 20:15   ` [dpdk-stable] [PATCH v2 12/23] net/bnxt: check for invalid vnic id Ajit Khaparde
2018-06-28 20:15   ` [dpdk-stable] [PATCH v2 14/23] net/bnxt: fix Tx with multiple mbuf Ajit Khaparde
2018-06-28 20:15   ` [dpdk-stable] [PATCH v2 15/23] net/bnxt: revert reset of L2 filter id Ajit Khaparde
2018-06-28 20:15   ` [dpdk-stable] [PATCH v2 16/23] net/bnxt: check filter type before clearing it Ajit Khaparde
2018-06-28 20:15   ` [dpdk-stable] [PATCH v2 17/23] net/bnxt: fix set MTU Ajit Khaparde
2018-06-28 20:15   ` [dpdk-stable] [PATCH v2 18/23] net/bnxt: fix incorrect IO address handling in Tx Ajit Khaparde
2018-06-28 20:15   ` [dpdk-stable] [PATCH v2 20/23] net/bnxt: fix to move a flow to a different queue Ajit Khaparde
2018-06-28 20:15   ` Ajit Khaparde [this message]
2018-06-28 20:15   ` [dpdk-stable] [PATCH v2 23/23] net/bnxt: use correct flags during VLAN configuration Ajit Khaparde

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=20180628201549.3507-23-ajit.khaparde@broadcom.com \
    --to=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.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).