All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: Somnath Kotur <somnath.kotur@broadcom.com>
Subject: [PATCH v2 04/14] net/bnxt: use the correct COS queue for Tx
Date: Sat,  9 Dec 2023 17:24:45 -0800	[thread overview]
Message-ID: <20231210012455.20229-5-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20231210012455.20229-1-ajit.khaparde@broadcom.com>

[-- Attachment #1: Type: text/plain, Size: 5315 bytes --]

Earlier the firmware was configuring single lossy COS profiles for Tx.
But now more than one profiles is possible.
Identify the profile a NIC driver should use based on the profile type
hint provided in queue_cfg_info.

If the firmware does not set the bit to use profile type,
then we will use the older method to pick the COS queue for Tx.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/bnxt.h      |  1 +
 drivers/net/bnxt/bnxt_hwrm.c | 56 ++++++++++++++++++++++++++++++++++--
 drivers/net/bnxt/bnxt_hwrm.h |  7 +++++
 3 files changed, 62 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 0e01b1d4ba..542ef13f7c 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -311,6 +311,7 @@ struct bnxt_link_info {
 struct bnxt_cos_queue_info {
 	uint8_t	id;
 	uint8_t	profile;
+	uint8_t	profile_type;
 };
 
 struct rte_flow {
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 0a31b984e6..fe9e629892 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -1544,7 +1544,7 @@ int bnxt_hwrm_port_phy_qcaps(struct bnxt *bp)
 	return 0;
 }
 
-static bool bnxt_find_lossy_profile(struct bnxt *bp)
+static bool _bnxt_find_lossy_profile(struct bnxt *bp)
 {
 	int i = 0;
 
@@ -1558,6 +1558,41 @@ static bool bnxt_find_lossy_profile(struct bnxt *bp)
 	return false;
 }
 
+static bool _bnxt_find_lossy_nic_profile(struct bnxt *bp)
+{
+	int i = 0, j = 0;
+
+	for (i = 0; i < BNXT_COS_QUEUE_COUNT; i++) {
+		for (j = 0; j < BNXT_COS_QUEUE_COUNT; j++) {
+			if (bp->tx_cos_queue[i].profile ==
+			    HWRM_QUEUE_SERVICE_PROFILE_LOSSY &&
+			    bp->tx_cos_queue[j].profile_type ==
+			    HWRM_QUEUE_SERVICE_PROFILE_TYPE_NIC) {
+				bp->tx_cosq_id[0] = bp->tx_cos_queue[i].id;
+				return true;
+			}
+		}
+	}
+	return false;
+}
+
+static bool bnxt_find_lossy_profile(struct bnxt *bp, bool use_prof_type)
+{
+	int i;
+
+	for (i = 0; i < BNXT_COS_QUEUE_COUNT; i++) {
+		PMD_DRV_LOG(DEBUG, "profile %d, profile_id %d, type %d\n",
+			    bp->tx_cos_queue[i].profile,
+			    bp->tx_cos_queue[i].id,
+			    bp->tx_cos_queue[i].profile_type);
+	}
+
+	if (use_prof_type)
+		return _bnxt_find_lossy_nic_profile(bp);
+	else
+		return _bnxt_find_lossy_profile(bp);
+}
+
 static void bnxt_find_first_valid_profile(struct bnxt *bp)
 {
 	int i = 0;
@@ -1579,6 +1614,7 @@ int bnxt_hwrm_queue_qportcfg(struct bnxt *bp)
 	struct hwrm_queue_qportcfg_input req = {.req_type = 0 };
 	struct hwrm_queue_qportcfg_output *resp = bp->hwrm_cmd_resp_addr;
 	uint32_t dir = HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_TX;
+	bool use_prof_type = false;
 	int i;
 
 get_rx_info:
@@ -1590,10 +1626,15 @@ int bnxt_hwrm_queue_qportcfg(struct bnxt *bp)
 	    !(bp->vnic_cap_flags & BNXT_VNIC_CAP_COS_CLASSIFY))
 		req.drv_qmap_cap =
 			HWRM_QUEUE_QPORTCFG_INPUT_DRV_QMAP_CAP_ENABLED;
+
 	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
 
 	HWRM_CHECK_RESULT();
 
+	if (resp->queue_cfg_info &
+	    HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_CFG_INFO_USE_PROFILE_TYPE)
+		use_prof_type = true;
+
 	if (dir == HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_TX) {
 		GET_TX_QUEUE_INFO(0);
 		GET_TX_QUEUE_INFO(1);
@@ -1603,6 +1644,16 @@ int bnxt_hwrm_queue_qportcfg(struct bnxt *bp)
 		GET_TX_QUEUE_INFO(5);
 		GET_TX_QUEUE_INFO(6);
 		GET_TX_QUEUE_INFO(7);
+		if (use_prof_type) {
+			GET_TX_QUEUE_TYPE_INFO(0);
+			GET_TX_QUEUE_TYPE_INFO(1);
+			GET_TX_QUEUE_TYPE_INFO(2);
+			GET_TX_QUEUE_TYPE_INFO(3);
+			GET_TX_QUEUE_TYPE_INFO(4);
+			GET_TX_QUEUE_TYPE_INFO(5);
+			GET_TX_QUEUE_TYPE_INFO(6);
+			GET_TX_QUEUE_TYPE_INFO(7);
+		}
 	} else  {
 		GET_RX_QUEUE_INFO(0);
 		GET_RX_QUEUE_INFO(1);
@@ -1636,11 +1687,12 @@ int bnxt_hwrm_queue_qportcfg(struct bnxt *bp)
 			 * operations, ideally we should look to use LOSSY.
 			 * If not found, fallback to the first valid profile
 			 */
-			if (!bnxt_find_lossy_profile(bp))
+			if (!bnxt_find_lossy_profile(bp, use_prof_type))
 				bnxt_find_first_valid_profile(bp);
 
 		}
 	}
+	PMD_DRV_LOG(DEBUG, "Tx COS Queue ID %d\n", bp->tx_cosq_id[0]);
 
 	bp->max_tc = resp->max_configurable_queues;
 	bp->max_lltc = resp->max_configurable_lossless_queues;
diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h
index 68384bc757..f9fa6cf73a 100644
--- a/drivers/net/bnxt/bnxt_hwrm.h
+++ b/drivers/net/bnxt/bnxt_hwrm.h
@@ -46,6 +46,9 @@ struct hwrm_func_qstats_output;
 #define HWRM_QUEUE_SERVICE_PROFILE_UNKNOWN \
 	HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_UNKNOWN
 
+#define HWRM_QUEUE_SERVICE_PROFILE_TYPE_NIC \
+	HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_TYPE_NIC
+
 #define HWRM_FUNC_RESOURCE_QCAPS_OUTPUT_VF_RESV_STRATEGY_MINIMAL_STATIC \
 	HWRM_FUNC_RESOURCE_QCAPS_OUTPUT_VF_RESERVATION_STRATEGY_MINIMAL_STATIC
 #define HWRM_FUNC_RESOURCE_QCAPS_OUTPUT_VF_RESV_STRATEGY_MAXIMAL \
@@ -74,6 +77,10 @@ struct hwrm_func_qstats_output;
 	bp->tx_cos_queue[x].profile =	\
 		resp->queue_id##x##_service_profile
 
+#define GET_TX_QUEUE_TYPE_INFO(x) \
+	bp->tx_cos_queue[x].profile_type =	\
+		resp->queue_id##x##_service_profile_type
+
 #define GET_RX_QUEUE_INFO(x) \
 	bp->rx_cos_queue[x].id = resp->queue_id##x; \
 	bp->rx_cos_queue[x].profile =	\
-- 
2.39.2 (Apple Git-143)


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]

  parent reply	other threads:[~2023-12-10  1:32 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-10  1:24 [PATCH v2 00/14] support new 5760X P7 devices Ajit Khaparde
2023-12-10  1:24 ` [PATCH v2 01/14] net/bnxt: refactor epoch setting Ajit Khaparde
2023-12-10  1:24 ` [PATCH v2 02/14] net/bnxt: update HWRM API Ajit Khaparde
2023-12-10  1:24 ` [PATCH v2 03/14] net/bnxt: log a message when multicast promisc mode changes Ajit Khaparde
2023-12-10 17:56   ` Stephen Hemminger
2023-12-10 22:58     ` Ajit Khaparde
2023-12-10  1:24 ` Ajit Khaparde [this message]
2023-12-10  1:24 ` [PATCH v2 05/14] net/bnxt: refactor mem zone allocation Ajit Khaparde
2023-12-10  1:24 ` [PATCH v2 06/14] net/bnxt: add support for p7 device family Ajit Khaparde
2023-12-10  1:24 ` [PATCH v2 07/14] net/bnxt: refactor code to support P7 devices Ajit Khaparde
2023-12-10  1:24 ` [PATCH v2 08/14] net/bnxt: fix array overflow Ajit Khaparde
2023-12-10  1:24 ` [PATCH v2 09/14] net/bnxt: add support for backing store v2 Ajit Khaparde
2023-12-10  1:24 ` [PATCH v2 10/14] net/bnxt: refactor the ulp initialization Ajit Khaparde
2023-12-10  1:24 ` [PATCH v2 11/14] net/bnxt: modify sending new HWRM commands to firmware Ajit Khaparde
2023-12-10  1:24 ` [PATCH v2 12/14] net/bnxt: retry HWRM ver get if the command fails Ajit Khaparde
2023-12-10  1:24 ` [PATCH v2 13/14] net/bnxt: cap ring resources for P7 devices Ajit Khaparde
2023-12-10  1:24 ` [PATCH v2 14/14] net/bnxt: add support for v3 Rx completion Ajit Khaparde
2023-12-13  5:33 ` [PATCH v2 00/14] support new 5760X P7 devices Ajit Khaparde
2023-12-13  7:57   ` David Marchand
2023-12-13 14:49     ` Ajit Khaparde
2023-12-13 19:09       ` 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=20231210012455.20229-5-ajit.khaparde@broadcom.com \
    --to=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=somnath.kotur@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.