From patchwork Mon Dec 4 18:37:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Khaparde X-Patchwork-Id: 134818 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 C9B2A4366C; Mon, 4 Dec 2023 19:37:52 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 98B00427E8; Mon, 4 Dec 2023 19:37:28 +0100 (CET) Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by mails.dpdk.org (Postfix) with ESMTP id 1C194415D7 for ; Mon, 4 Dec 2023 19:37:26 +0100 (CET) Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-6ce3534bf44so1405028b3a.1 for ; Mon, 04 Dec 2023 10:37:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1701715045; x=1702319845; 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=2EEbzOpzHhIJwXBZNynL6cmfhWnsozKIKSxKH5nnOGc=; b=L6eSvoqyRv705z7MpeJafVIYXsDWv9l498HNQulaoqUHVf2eFgGEqIOkBvTrkvWcpO ICfVAVLtSCKLsTrVg+vR46tMicGAUGJQpn9tjmT24lQyt6vMBCtG95OB5rUsn0LVddl2 fzxIwa7glsIs9Zz723guNvQIAO2QpTfGq5OCs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701715045; x=1702319845; 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=2EEbzOpzHhIJwXBZNynL6cmfhWnsozKIKSxKH5nnOGc=; b=DhzJSW0LBPxMFiLmJtpA7Xz9/7tFPIXvsZtEehr9aIzLO1uCvLidG4yEZ6xknXkYDP 7+JgzH6e2Z5qOyI692ydHU1RNP35Yna1UgG1p0+XtmkhPkuyiPnbiQe+6n/NnYdqXVgl a+u+rByZbw6zcsTbeqoPIdisSveQE3HvZCGfaMB1oJojkmAy8NzntAcGL6/p71H3gXmD 5fsFfotpHXLugBB7bonxfuZiNsbl8Hei2LTd4XJ+M6doRK7ItUIX1kJEGESxARZolzM8 x1OVsNucyB1A330XZ2xGsh6ku0Oir12s47UzYSJu98+uT5s6DilJQByjbBQ7QhV7DJjU q9QQ== X-Gm-Message-State: AOJu0YxCb+WdvvznsvFIOjmM74DljrnRga8KsgEXb/BSmbG/kxM+yg3B p4adaBvkNxryW2z7XzUTGFmev0YkzB58usrP7Zo+ZMZrVYgKdsIrcz/1yKL/aYPvusA9UXmUfSi RXyoHr1ehGKN/hzsQhpQ/MZEy50YVNPPSOwnNJbjc2buL6z6iHv9EuJwh0sAitCJur8a8 X-Google-Smtp-Source: AGHT+IF75WK3eCBwkk5Usf7m3Y9KmnkU+egfj1GD02F4XS144De386lelKPbnF8umhp6MJIJ9aodnQ== X-Received: by 2002:a05:6a00:1149:b0:6c3:4bf2:7486 with SMTP id b9-20020a056a00114900b006c34bf27486mr180397pfm.7.1701715044769; Mon, 04 Dec 2023 10:37:24 -0800 (PST) Received: from C02GC2QQMD6T.wifi.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id s3-20020a056a00178300b006be5af77f06sm4236664pfg.2.2023.12.04.10.37.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 10:37:24 -0800 (PST) From: Ajit Khaparde To: dev@dpdk.org Cc: Somnath Kotur Subject: [PATCH 04/14] net/bnxt: use the correct COS queue for Tx Date: Mon, 4 Dec 2023 10:37:00 -0800 Message-Id: <20231204183710.86921-5-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20231204183710.86921-1-ajit.khaparde@broadcom.com> References: <20231204183710.86921-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 = \