From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C289AA0C5E; Thu, 4 Nov 2021 22:59:16 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 31FC24279B; Thu, 4 Nov 2021 22:59:02 +0100 (CET) Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by mails.dpdk.org (Postfix) with ESMTP id 86F5842757 for ; Thu, 4 Nov 2021 22:58:58 +0100 (CET) Received: by mail-pf1-f175.google.com with SMTP id y20so7139505pfi.4 for ; Thu, 04 Nov 2021 14:58:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version; bh=KXrzehf50yNODF9vQ9egt33+prLBsTXzIJQCsKHkHMY=; b=N1N/IJDE2bgdihm3sRQxai5+ftT4UnfsjciqNkOKw4J2GM8dsLyhhAgWs2zFVZ7JaY PTTRV0UV1TndCxLVM6n8ip101XE3vKvvrUV6u9juovkNAxWqvWZiiEeMRmptDeXyUSzY YYc5YuZRK+txZKLiuj4thtEUkqnpZA3EPGaQo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version; bh=KXrzehf50yNODF9vQ9egt33+prLBsTXzIJQCsKHkHMY=; b=g800Qm/qNmi5LcRNU7Dt8jH4qu2ZucnHWSNnvK1lLmogWlM3Pach05Z4Foo2Sq2CO9 vbRsIxZHvepbHb1jPaVJNAdHOE3kcqHHcZzxaY55Ab1jgFnLFPYVEPPPo5lO49pjPzii iJNerpdi8hQ616gIy6/BAECV12APtiGdIOhTIFCuAR78eaeJaw3RjiEXLzLYiWjsjPjF LBhxRzlSQBTCLq4dZGbbNS7aEbUDKesMYB5Kg34C1zlls05h2vD6cMfiBm+QkFsyN8oF plfeFhZjWMAD+Py1/dw3t6A8qySerrmck9YCNtHKcehPp+EXXepwMNeIB1MMuiYueI1j TmOA== X-Gm-Message-State: AOAM532F3lf8Tc2aBhebgvEZ5LtGXrhgKycF+8LUnhK2n42fhu46FFM5 NOa6pZ/4f8fcyOsaISMx5ranu1LGejmY+vdeN2Wg18ZGXLUUopzidbeyFotSKamDcAT1WneAmVe y/2QTgg8uFpX+iNqRe6kFRvkxfluUw6JGOPHWUlkYSNEOUDkU8VBOQeXnIaLrg90= X-Google-Smtp-Source: ABdhPJzS3meARFLBm+5TZhsOS5D4amk3tkC+5cTepIH07fSKxPW7CyFIPfJypz2O97Q5MwUZfO72uw== X-Received: by 2002:a63:8f4a:: with SMTP id r10mr40378447pgn.337.1636063137520; Thu, 04 Nov 2021 14:58:57 -0700 (PDT) Received: from C02GC2QQMD6T.wifi.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id pg5sm8532242pjb.26.2021.11.04.14.58.56 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Nov 2021 14:58:56 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: Farah Smith , Kishore Padmanabha , Venkat Duvvuru , Randy Schacher , Shahaji Bhosle Date: Thu, 4 Nov 2021 14:58:28 -0700 Message-Id: <20211104215846.58672-5-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20211104215846.58672-1-ajit.khaparde@broadcom.com> References: <20211103005251.25524-1-ajit.khaparde@broadcom.com> <20211104215846.58672-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="0000000000002a145005cffda257" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [dpdk-dev] [PATCH v5 04/22] net/bnxt: add clear on read support 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 Sender: "dev" --0000000000002a145005cffda257 Content-Transfer-Encoding: 8bit From: Farah Smith Add clear on read stats support for Thor. Currently, the flow stats are not cleared after they are read from the FW. This patch adds support for clear on read. Since clear on read support is added for flow stats in Thor, the flow accumulation is enabled on Thor as well. Signed-off-by: Farah Smith Signed-off-by: Kishore Padmanabha Signed-off-by: Venkat Duvvuru Reviewed-by: Randy Schacher Reviewed-by: Shahaji Bhosle Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/tf_core/tf_msg.c | 24 ++++++++++++++++++++---- drivers/net/bnxt/tf_core/tf_msg.h | 6 ++++-- drivers/net/bnxt/tf_core/tf_tbl.c | 6 ++++-- drivers/net/bnxt/tf_core/tf_tbl_sram.c | 13 +++++++++++-- drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 3 ++- 5 files changed, 41 insertions(+), 11 deletions(-) diff --git a/drivers/net/bnxt/tf_core/tf_msg.c b/drivers/net/bnxt/tf_core/tf_msg.c index 0fbb2fe837..ea6e2af7ce 100644 --- a/drivers/net/bnxt/tf_core/tf_msg.c +++ b/drivers/net/bnxt/tf_core/tf_msg.c @@ -1851,7 +1851,8 @@ tf_msg_get_tbl_entry(struct tf *tfp, uint16_t hcapi_type, uint16_t size, uint8_t *data, - uint32_t index) + uint32_t index, + bool clear_on_read) { int rc; struct hwrm_tf_tbl_type_get_input req = { 0 }; @@ -1860,6 +1861,7 @@ tf_msg_get_tbl_entry(struct tf *tfp, uint8_t fw_session_id; struct tf_dev_info *dev; struct tf_session *tfs; + uint32_t flags = 0; /* Retrieve the session information */ rc = tf_session_get_session_internal(tfp, &tfs); @@ -1889,10 +1891,16 @@ tf_msg_get_tbl_entry(struct tf *tfp, strerror(-rc)); return rc; } + flags = (dir == TF_DIR_TX ? + HWRM_TF_TBL_TYPE_GET_INPUT_FLAGS_DIR_TX : + HWRM_TF_TBL_TYPE_GET_INPUT_FLAGS_DIR_RX); + + if (clear_on_read) + flags |= HWRM_TF_TBL_TYPE_GET_INPUT_FLAGS_CLEAR_ON_READ; /* Populate the request */ req.fw_session_id = tfp_cpu_to_le_32(fw_session_id); - req.flags = tfp_cpu_to_le_16(dir); + req.flags = tfp_cpu_to_le_16(flags); req.type = tfp_cpu_to_le_32(hcapi_type); req.index = tfp_cpu_to_le_32(index); @@ -2105,7 +2113,8 @@ tf_msg_bulk_get_tbl_entry(struct tf *tfp, uint32_t starting_idx, uint16_t num_entries, uint16_t entry_sz_in_bytes, - uint64_t physical_mem_addr) + uint64_t physical_mem_addr, + bool clear_on_read) { int rc; struct tfp_send_msg_parms parms = { 0 }; @@ -2115,6 +2124,7 @@ tf_msg_bulk_get_tbl_entry(struct tf *tfp, uint8_t fw_session_id; struct tf_dev_info *dev; struct tf_session *tfs; + uint32_t flags = 0; /* Retrieve the session information */ rc = tf_session_get_session(tfp, &tfs); @@ -2144,10 +2154,16 @@ tf_msg_bulk_get_tbl_entry(struct tf *tfp, strerror(-rc)); return rc; } + flags = (dir == TF_DIR_TX ? + HWRM_TF_TBL_TYPE_BULK_GET_INPUT_FLAGS_DIR_TX : + HWRM_TF_TBL_TYPE_BULK_GET_INPUT_FLAGS_DIR_RX); + + if (clear_on_read) + flags |= HWRM_TF_TBL_TYPE_BULK_GET_INPUT_FLAGS_CLEAR_ON_READ; /* Populate the request */ req.fw_session_id = tfp_cpu_to_le_32(fw_session_id); - req.flags = tfp_cpu_to_le_16(dir); + req.flags = tfp_cpu_to_le_16(flags); req.type = tfp_cpu_to_le_32(hcapi_type); req.start_index = tfp_cpu_to_le_32(starting_idx); req.num_entries = tfp_cpu_to_le_32(num_entries); diff --git a/drivers/net/bnxt/tf_core/tf_msg.h b/drivers/net/bnxt/tf_core/tf_msg.h index b26b15bfa3..718bc2f3b2 100644 --- a/drivers/net/bnxt/tf_core/tf_msg.h +++ b/drivers/net/bnxt/tf_core/tf_msg.h @@ -652,7 +652,8 @@ int tf_msg_get_tbl_entry(struct tf *tfp, uint16_t hcapi_type, uint16_t size, uint8_t *data, - uint32_t index); + uint32_t index, + bool clear_on_read); /* HWRM Tunneled messages */ @@ -704,7 +705,8 @@ int tf_msg_bulk_get_tbl_entry(struct tf *tfp, uint32_t starting_idx, uint16_t num_entries, uint16_t entry_sz_in_bytes, - uint64_t physical_mem_addr); + uint64_t physical_mem_addr, + bool clear_on_read); /** * Sends Set message of a IF Table Type element to the firmware. diff --git a/drivers/net/bnxt/tf_core/tf_tbl.c b/drivers/net/bnxt/tf_core/tf_tbl.c index 0a8720e7b6..12eca36491 100644 --- a/drivers/net/bnxt/tf_core/tf_tbl.c +++ b/drivers/net/bnxt/tf_core/tf_tbl.c @@ -441,7 +441,8 @@ tf_tbl_get(struct tf *tfp, hcapi_type, parms->data_sz_in_bytes, parms->data, - parms->idx); + parms->idx, + false); if (rc) { TFP_DRV_LOG(ERR, "%s, Get failed, type:%s, rc:%s\n", @@ -526,7 +527,8 @@ tf_tbl_bulk_get(struct tf *tfp, parms->starting_idx, parms->num_entries, parms->entry_sz_in_bytes, - parms->physical_mem_addr); + parms->physical_mem_addr, + false); if (rc) { TFP_DRV_LOG(ERR, "%s, Bulk get failed, type:%s, rc:%s\n", diff --git a/drivers/net/bnxt/tf_core/tf_tbl_sram.c b/drivers/net/bnxt/tf_core/tf_tbl_sram.c index 636811bc2d..567f912dfa 100644 --- a/drivers/net/bnxt/tf_core/tf_tbl_sram.c +++ b/drivers/net/bnxt/tf_core/tf_tbl_sram.c @@ -539,6 +539,7 @@ tf_tbl_sram_get(struct tf *tfp, struct tf_tbl_sram_get_info_parms iparms = { 0 }; struct tf_sram_mgr_is_allocated_parms aparms = { 0 }; void *sram_handle = NULL; + bool clear_on_read = false; TF_CHECK_PARMS3(tfp, parms, parms->data); @@ -608,6 +609,8 @@ tf_tbl_sram_get(struct tf *tfp, strerror(-rc)); return rc; } + if (parms->type == TF_TBL_TYPE_ACT_STATS_64) + clear_on_read = true; /* Get the entry */ rc = tf_msg_get_tbl_entry(tfp, @@ -615,7 +618,8 @@ tf_tbl_sram_get(struct tf *tfp, hcapi_type, parms->data_sz_in_bytes, parms->data, - parms->idx); + parms->idx, + clear_on_read); if (rc) { TFP_DRV_LOG(ERR, "%s, Get failed, type:%s, rc:%s\n", @@ -643,6 +647,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp, struct tf_sram_mgr_is_allocated_parms aparms = { 0 }; bool allocated = false; void *sram_handle = NULL; + bool clear_on_read = false; TF_CHECK_PARMS2(tfp, parms); @@ -728,6 +733,9 @@ tf_tbl_sram_bulk_get(struct tf *tfp, return rc; } + if (parms->type == TF_TBL_TYPE_ACT_STATS_64) + clear_on_read = true; + /* Get the entries */ rc = tf_msg_bulk_get_tbl_entry(tfp, parms->dir, @@ -735,7 +743,8 @@ tf_tbl_sram_bulk_get(struct tf *tfp, parms->starting_idx, parms->num_entries, parms->entry_sz_in_bytes, - parms->physical_mem_addr); + parms->physical_mem_addr, + clear_on_read); if (rc) { TFP_DRV_LOG(ERR, "%s, Bulk get failed, type:%s, rc:%s\n", diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c index dbc8a3c5bb..f1763e2519 100644 --- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c +++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c @@ -1483,7 +1483,8 @@ bnxt_ulp_port_init(struct bnxt *bp) goto jump_to_error; } - if (devid != BNXT_ULP_DEVICE_ID_THOR && BNXT_ACCUM_STATS_EN(bp)) + /* set the accumulation of the stats */ + if (BNXT_ACCUM_STATS_EN(bp)) bp->ulp_ctx->cfg_data->accum_stats = true; BNXT_TF_DBG(DEBUG, "BNXT Port:%d ULP port init, accum_stats:%d\n", -- 2.30.1 (Apple Git-130) --0000000000002a145005cffda257--