From patchwork Mon Dec 11 17:10:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Khaparde X-Patchwork-Id: 135031 X-Patchwork-Delegate: ajit.khaparde@broadcom.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id F3F77436C8; Mon, 11 Dec 2023 18:11:51 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 64F0442D96; Mon, 11 Dec 2023 18:11:30 +0100 (CET) Received: from mail-qk1-f176.google.com (mail-qk1-f176.google.com [209.85.222.176]) by mails.dpdk.org (Postfix) with ESMTP id 0BD9142D96 for ; Mon, 11 Dec 2023 18:11:29 +0100 (CET) Received: by mail-qk1-f176.google.com with SMTP id af79cd13be357-77f3c4914e5so252681985a.3 for ; Mon, 11 Dec 2023 09:11:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1702314688; x=1702919488; darn=dpdk.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=TJQrFf1wqELfrzUcAHqojml3xW6Mxws8imFhGIFOEEw=; b=ZaFEDkFA5+l9IcoKw6p2m9uGSVuVa3WWcvb56UXm2oWW67By392CjhnqXESknbrFbG hY8VdYq9kzK696SJktsBcx56xkVf1sARNk6z8eZq2GgkwQQqmZWiMqicEhDL9jbu5mU+ PQ0lelHI4LUo17Nk2ZqduJWk0A+y97LIAMBl4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702314688; x=1702919488; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TJQrFf1wqELfrzUcAHqojml3xW6Mxws8imFhGIFOEEw=; b=ovWqr1GRhNF79EthNIPcPP+1SFlO/iPaFLMFAHGWhgbT5beIc2JlovzzPCg0v/bUFg qrS8CL9mVQ/LqV8c9CuY87D8gNGl/P3serDOPaY+VkknLjcMrLh1y61PHR5kyuf/vzEb U+hlJ5g/3+/Ag8L2Shrf0iYtvkx0kYxPxwvMHl9FLP+fk7QamkO5DRmpbyoyDBs39JSd MFlcxWkfzhtrGC6XZe7iGS/Zj88t3Bd7P53UuGB+YmlV59eZdXJ5R9i2B4YZRcUgORaw EjxsDNrxvuejmdgptX0HvAw4WyJq9ELr+b9dbUcR2qKD6/INHdExKEayjile15qk30Dv EkeQ== X-Gm-Message-State: AOJu0YzrKeKAy3/goaipDVx8KEwU31aGwkdNXoo6BBFPwwkiGhwHzcRm eX1nngogN4+v1iNbmKMEIU/HceRGFVpqr72sBpC2fAx+s1WShPN35i7k9xIB0ALhpgCvNIovL4p fPPdMfnYQ8rBdJqP3TSW6wBAW0BmhCaqse2tUm8BD3XN+rpg/x19q+sMfoqnpbKEuqlDm X-Google-Smtp-Source: AGHT+IF72AqYaORbrOe1DO8au6d9kg/LrWCDFckFsQ59fx9ezAlM4jjypEbGNXvHMjwsFXsh8jnYmw== X-Received: by 2002:a05:620a:63c4:b0:77e:fba3:4f40 with SMTP id pw4-20020a05620a63c400b0077efba34f40mr7026683qkn.150.1702314687893; Mon, 11 Dec 2023 09:11:27 -0800 (PST) Received: from C02GC2QQMD6T.wifi.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id qz16-20020a05620a8c1000b0077efdfbd730sm3094581qkn.34.2023.12.11.09.11.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 09:11:26 -0800 (PST) From: Ajit Khaparde To: dev@dpdk.org Cc: Somnath Kotur Subject: [PATCH v3 04/14] net/bnxt: use the correct COS queue for Tx Date: Mon, 11 Dec 2023 09:10:59 -0800 Message-Id: <20231211171109.89716-5-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20231211171109.89716-1-ajit.khaparde@broadcom.com> References: <20231211171109.89716-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 Reviewed-by: Somnath Kotur --- 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 = \