DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: Stephen Hurd <stephen.hurd@broadcom.com>
Subject: [dpdk-dev] [PATCH 11/28] bnxt: set the VMDQ pool size correctly
Date: Mon, 27 Mar 2017 22:48:46 -0500	[thread overview]
Message-ID: <20170328034903.41482-12-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20170328034903.41482-1-ajit.khaparde@broadcom.com>

Calculate the VMDQ pool size correctly:
For PFs the VMDQ count needs to be the minimum of all used and available
resources like vnic, l2 CTX, RSS CTX, or 64 (hard coded).
For VFs restrict the number of VMDQs to 1.
If VFs are enabled, only allocate a single vnic to each function.
This allows targeting a VF with a single L2 context.

In the future, we will enable VMDq on VFs.

We are essentially mapping VMDq pools to VNICs now.  If there are
no VFs, the PF can use all VNICs as VMDq pools.  If there are VFs,
each function (including the PF) will get a single VNIC.

Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 23 +++++++++++++++++++----
 drivers/net/bnxt/bnxt_rxq.c  |  8 +++++---
 2 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 0aa2234..6f76748 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -312,7 +312,7 @@ int bnxt_hwrm_func_qcaps(struct bnxt *bp)
 	if (BNXT_PF(bp)) {
 		bp->pf.port_id = resp->port_id;
 		bp->pf.first_vf_id = rte_le_to_cpu_16(resp->first_vf_id);
-		new_max_vfs = rte_le_to_cpu_16(resp->max_vfs);
+		new_max_vfs = bp->pdev->max_vfs;
 		if (new_max_vfs != bp->pf.max_vfs) {
 			if (bp->pf.vf_info)
 				rte_free(bp->pf.vf_info);
@@ -331,7 +331,15 @@ int bnxt_hwrm_func_qcaps(struct bnxt *bp)
 	bp->max_tx_rings = rte_le_to_cpu_16(resp->max_tx_rings);
 	bp->max_rx_rings = rte_le_to_cpu_16(resp->max_rx_rings);
 	bp->max_l2_ctx = rte_le_to_cpu_16(resp->max_l2_ctxs);
-	bp->max_vnics = rte_le_to_cpu_16(resp->max_vnics);
+	/* TODO: For now, do not support VMDq/RFS on VFs. */
+	if (BNXT_PF(bp)) {
+		if (bp->pf.max_vfs)
+			bp->max_vnics = 1;
+		else
+			bp->max_vnics = rte_le_to_cpu_16(resp->max_vnics);
+	} else {
+		bp->max_vnics = 1;
+	}
 	bp->max_stat_ctx = rte_le_to_cpu_16(resp->max_stat_ctx);
 	if (BNXT_PF(bp))
 		bp->pf.total_vnics = rte_le_to_cpu_16(resp->max_vnics);
@@ -1842,6 +1850,8 @@ static void populate_vf_func_cfg_req(struct bnxt *bp,
 	req->num_rx_rings = rte_cpu_to_le_16(bp->max_rx_rings / (num_vfs + 1));
 	req->num_l2_ctxs = rte_cpu_to_le_16(bp->max_l2_ctx / (num_vfs + 1));
 	req->num_vnics = rte_cpu_to_le_16(bp->max_vnics / (num_vfs + 1));
+	/* TODO: For now, do not support VMDq/RFS on VFs. */
+	req->num_vnics = rte_cpu_to_le_16(1);
 	req->num_hw_ring_grps =
 		rte_cpu_to_le_16(bp->max_ring_grps / (num_vfs + 1));
 }
@@ -1904,7 +1914,11 @@ static void reserve_resources_from_vf(struct bnxt *bp,
 	bp->max_tx_rings -= rte_le_to_cpu_16(resp->max_tx_rings);
 	bp->max_rx_rings -= rte_le_to_cpu_16(resp->max_rx_rings);
 	bp->max_l2_ctx -= rte_le_to_cpu_16(resp->max_l2_ctxs);
-	bp->max_vnics -= rte_le_to_cpu_16(resp->max_vnics);
+	/* TODO:
+	 * While not supporting VMDq with VFs, max_vnics is always
+	 * forced to 1 in this case
+	 */
+	//bp->max_vnics -= rte_le_to_cpu_16(esp->max_vnics);
 	bp->max_ring_grps -= rte_le_to_cpu_16(resp->max_hw_ring_grps);
 }
 
@@ -2025,7 +2039,8 @@ int bnxt_hwrm_allocate_vfs(struct bnxt *bp, int num_vfs)
 			RTE_LOG(ERR, PMD,
 				"Failed to initizlie VF %d.\n", i);
 			RTE_LOG(ERR, PMD,
-				"Not all VFs available.\n");
+				"Not all VFs available. (%d, %d)\n",
+				rc, resp->error_code);
 			break;
 		}
 
diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index cddf17d..6f72a1b 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -121,9 +121,11 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 		}
 		/* For each pool, allocate MACVLAN CFA rule & VNIC */
 		if (!pools) {
+			pools = RTE_MIN(bp->max_vnics,
+			    RTE_MIN(bp->max_l2_ctx,
+			     RTE_MIN(bp->max_rsscos_ctx, ETH_64_POOLS)));
 			RTE_LOG(ERR, PMD,
-				"VMDq pool not set, defaulted to 64\n");
-			pools = ETH_64_POOLS;
+			    "VMDq pool not set, defaulted to %d\n", pools);
 		}
 		nb_q_per_grp = bp->rx_cp_nr_rings / pools;
 		start_grp_id = 1;
@@ -134,7 +136,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 			vnic = bnxt_alloc_vnic(bp);
 			if (!vnic) {
 				RTE_LOG(ERR, PMD,
-					"VNIC alloc failed\n");
+					"VNIC %d alloc failed\n", i);
 				rc = -ENOMEM;
 				goto err_out;
 			}
-- 
2.10.1 (Apple Git-78)

  parent reply	other threads:[~2017-03-28  3:49 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-28  3:48 [dpdk-dev] [PATCH 00/28] bnxt: new features, bug fixes and more Ajit Khaparde
2017-03-28  3:48 ` [dpdk-dev] [PATCH 01/28] bnxt: add hwrm_func_cfg_input/output structures Ajit Khaparde
2017-03-28  3:48 ` [dpdk-dev] [PATCH 02/28] bnxt: add code to support PF, VF configuration Ajit Khaparde
2017-03-28  3:48 ` [dpdk-dev] [PATCH 03/28] bnxt: add additonal HWRM debug info to error messages Ajit Khaparde
2017-03-28  3:48 ` [dpdk-dev] [PATCH 04/28] bnxt: add new HWRM commands Ajit Khaparde
2017-03-28  3:48 ` [dpdk-dev] [PATCH 05/28] bnxt: add support for PF/VF communications Ajit Khaparde
2017-05-11 17:00   ` Ferruh Yigit
2017-05-11 17:07     ` Ajit Khaparde
2017-03-28  3:48 ` [dpdk-dev] [PATCH 06/28] bnxt: add new HWRM commands to query VNIC info Ajit Khaparde
2017-03-28  3:48 ` [dpdk-dev] [PATCH 07/28] bnxt: add functions for tx_loopback and queues_drop_en Ajit Khaparde
2017-03-28  3:48 ` [dpdk-dev] [PATCH 08/28] bnxt: support setting VF mac address Ajit Khaparde
2017-03-28  3:48 ` [dpdk-dev] [PATCH 09/28] bnxt: add code to support VF QOS configuration Ajit Khaparde
2017-03-28  3:48 ` [dpdk-dev] [PATCH 10/28] bnxt: support for VF VLAN filtering Ajit Khaparde
2017-03-28  3:48 ` Ajit Khaparde [this message]
2017-03-28  3:48 ` [dpdk-dev] [PATCH 12/28] bnxt: improve some of the log messages Ajit Khaparde
2017-03-28  3:48 ` [dpdk-dev] [PATCH 13/28] bnxt: fix interrupt handler Ajit Khaparde
2017-03-28  3:48 ` [dpdk-dev] [PATCH 14/28] bnxt: Add support for udp_tunnel_port_add/del dev_ops Ajit Khaparde
2017-03-28  3:48 ` [dpdk-dev] [PATCH 15/28] bnxt: Update tx offload capabilities Ajit Khaparde
2017-03-28  3:48 ` [dpdk-dev] [PATCH 16/28] bnxt: add support for set VF MAC anti spoof Ajit Khaparde
2017-03-28  3:48 ` [dpdk-dev] [PATCH 17/28] bnxt: implement VF VLAN stripq functionality Ajit Khaparde
2017-03-28  3:48 ` [dpdk-dev] [PATCH 18/28] bnxt: support lack of huge pages Ajit Khaparde
2017-03-28  3:48 ` [dpdk-dev] [PATCH 19/28] bnxt: add code to configure a default VF VLAN Ajit Khaparde
2017-03-28  3:48 ` [dpdk-dev] [PATCH 20/28] bnxt: Add support to set VF rxmode Ajit Khaparde
2017-03-28  3:48 ` [dpdk-dev] [PATCH 21/28] bnxt: Add VF stats get/reset functions Ajit Khaparde
2017-03-28  3:48 ` [dpdk-dev] [PATCH 22/28] bnxt: Add newlines to all RTE_LOG() format strings Ajit Khaparde
2017-03-28  3:48 ` [dpdk-dev] [PATCH 23/28] bnxt: Add support for VLAN filter and strip dev_ops Ajit Khaparde
2017-03-28  3:48 ` [dpdk-dev] [PATCH 24/28] bnxt: Add support for mac_addr_set dev_op Ajit Khaparde
2017-03-28  3:49 ` [dpdk-dev] [PATCH 25/28] bnxt: add support for xstats Ajit Khaparde
2017-03-28  3:49 ` [dpdk-dev] [PATCH 26/28] bnxt: use only long BDs in Tx path Ajit Khaparde
2017-03-28  3:49 ` [dpdk-dev] [PATCH 27/28] bnxt: add support for set_mc_addr_list dev_op Ajit Khaparde
2017-03-28  3:49 ` [dpdk-dev] [PATCH 28/28] bnxt: update to HWRM version 1.7.4 Ajit Khaparde
2017-03-29 12:14 ` [dpdk-dev] [PATCH 00/28] bnxt: new features, bug fixes and more Ferruh Yigit
2017-03-29 15:45   ` Ferruh Yigit
2017-03-29 19:31   ` 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=20170328034903.41482-12-ajit.khaparde@broadcom.com \
    --to=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=stephen.hurd@broadcom.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).