[PATCH 04/14] net/bnxt: use the correct COS queue for Tx
Ajit Khaparde
ajit.khaparde at broadcom.com
Mon Dec 4 19:37:00 CET 2023
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 at broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur at 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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4218 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mails.dpdk.org/archives/dev/attachments/20231204/eccf8877/attachment.bin>
More information about the dev
mailing list