From patchwork Tue Oct 26 05:05:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venkat Duvvuru X-Patchwork-Id: 102846 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 BEC49A0C47; Tue, 26 Oct 2021 07:07:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 446804119E; Tue, 26 Oct 2021 07:06:51 +0200 (CEST) Received: from relay.smtp-ext.broadcom.com (lpdvsmtp11.broadcom.com [192.19.166.231]) by mails.dpdk.org (Postfix) with ESMTP id 86EC34118B for ; Tue, 26 Oct 2021 07:06:19 +0200 (CEST) Received: from S60.dhcp.broadcom.net (unknown [10.123.66.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by relay.smtp-ext.broadcom.com (Postfix) with ESMTPS id D02D37DC2; Mon, 25 Oct 2021 22:06:17 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com D02D37DC2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1635224778; bh=pe2rCkzJEYbRxPlty9xcWi6S7wYfpQ6iuKiHiSgXfAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nyP7wCOsJrDqaoQTQf/ZQOeMFnqpa5VSIo3sKQ9CFjEFC6jnEwUpViepQ5zMrHMlk RvoYBLeamZTXlbVt4R9OmZpZ7Tb8OuaU2JyHvWSu5RZ9kr/+VsUwFpZxO1ORaj6dsc fuZZ3r2Y5wR7BlBPH+OSMpUjN+f2EA12bEWmAI3E= From: Venkat Duvvuru To: dev@dpdk.org Cc: Kishore Padmanabha , Venkat Duvvuru Date: Tue, 26 Oct 2021 10:35:38 +0530 Message-Id: <20211026050547.14692-11-venkatkumar.duvvuru@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211026050547.14692-1-venkatkumar.duvvuru@broadcom.com> References: <20211001055909.27276-1-venkatkumar.duvvuru@broadcom.com> <20211026050547.14692-1-venkatkumar.duvvuru@broadcom.com> Subject: [dpdk-dev] [PATCH v2 10/19] net/bnxt: remove accumulation of stats devargs argument 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" From: Kishore Padmanabha The accumulation of flow counters is not determined by the application device arguments instead it is dictated by the platform capabilities whether to do software based accumulation or not. Change-Id: I7275a0ed6ab089358e0a95f43d6291ec65ebe030 Signed-off-by: Kishore Padmanabha Signed-off-by: Venkat Duvvuru Reviewed-by: Ajit Khaparde Reviewed-by: Michael Baucom --- drivers/net/bnxt/bnxt.h | 3 -- drivers/net/bnxt/bnxt_ethdev.c | 53 ---------------------------- drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 8 ----- drivers/net/bnxt/tf_ulp/bnxt_ulp.h | 1 - drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c | 12 +++---- 5 files changed, 4 insertions(+), 73 deletions(-) diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index 5c064fd119..5cc4a5afae 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -718,11 +718,8 @@ struct bnxt { uint32_t flags2; #define BNXT_FLAGS2_PTP_TIMESYNC_ENABLED BIT(0) #define BNXT_FLAGS2_PTP_ALARM_SCHEDULED BIT(1) -#define BNXT_FLAGS2_ACCUM_STATS_EN BIT(2) #define BNXT_P5_PTP_TIMESYNC_ENABLED(bp) \ ((bp)->flags2 & BNXT_FLAGS2_PTP_TIMESYNC_ENABLED) -#define BNXT_ACCUM_STATS_EN(bp) \ - ((bp)->flags2 & BNXT_FLAGS2_ACCUM_STATS_EN) uint16_t chip_num; #define CHIP_NUM_58818 0xd818 diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 8c72ab8fd1..070f69d8e9 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -87,7 +87,6 @@ static const struct rte_pci_id bnxt_pci_id_map[] = { { .vendor_id = 0, /* sentinel */ }, }; -#define BNXT_DEVARG_ACCUM_STATS "accum-stats" #define BNXT_DEVARG_FLOW_XSTAT "flow-xstat" #define BNXT_DEVARG_MAX_NUM_KFLOWS "max-num-kflows" #define BNXT_DEVARG_REPRESENTOR "representor" @@ -101,7 +100,6 @@ static const struct rte_pci_id bnxt_pci_id_map[] = { static const char *const bnxt_dev_args[] = { BNXT_DEVARG_REPRESENTOR, - BNXT_DEVARG_ACCUM_STATS, BNXT_DEVARG_FLOW_XSTAT, BNXT_DEVARG_MAX_NUM_KFLOWS, BNXT_DEVARG_REP_BASED_PF, @@ -114,12 +112,6 @@ static const char *const bnxt_dev_args[] = { NULL }; -/* - * accum-stats == false to disable flow counter accumulation - * accum-stats == true to enable flow counter accumulation - */ -#define BNXT_DEVARG_ACCUM_STATS_INVALID(accum_stats) ((accum_stats) > 1) - /* * app-id = an non-negative 8-bit number */ @@ -5299,45 +5291,6 @@ static int bnxt_init_resources(struct bnxt *bp, bool reconfig_dev) return 0; } -static int -bnxt_parse_devarg_accum_stats(__rte_unused const char *key, - const char *value, void *opaque_arg) -{ - struct bnxt *bp = opaque_arg; - unsigned long accum_stats; - char *end = NULL; - - if (!value || !opaque_arg) { - PMD_DRV_LOG(ERR, - "Invalid parameter passed to accum-stats devargs.\n"); - return -EINVAL; - } - - accum_stats = strtoul(value, &end, 10); - if (end == NULL || *end != '\0' || - (accum_stats == ULONG_MAX && errno == ERANGE)) { - PMD_DRV_LOG(ERR, - "Invalid parameter passed to accum-stats devargs.\n"); - return -EINVAL; - } - - if (BNXT_DEVARG_ACCUM_STATS_INVALID(accum_stats)) { - PMD_DRV_LOG(ERR, - "Invalid value passed to accum-stats devargs.\n"); - return -EINVAL; - } - - if (accum_stats) { - bp->flags2 |= BNXT_FLAGS2_ACCUM_STATS_EN; - PMD_DRV_LOG(INFO, "Host-based accum-stats feature enabled.\n"); - } else { - bp->flags2 &= ~BNXT_FLAGS2_ACCUM_STATS_EN; - PMD_DRV_LOG(INFO, "Host-based accum-stats feature disabled.\n"); - } - - return 0; -} - static int bnxt_parse_devarg_flow_xstat(__rte_unused const char *key, const char *value, void *opaque_arg) @@ -5690,12 +5643,6 @@ bnxt_parse_dev_args(struct bnxt *bp, struct rte_devargs *devargs) if (ret) goto err; - /* - * Handler for "accum-stats" devarg. - * Invoked as for ex: "-a 0000:00:0d.0,accum-stats=1" - */ - rte_kvargs_process(kvlist, BNXT_DEVARG_ACCUM_STATS, - bnxt_parse_devarg_accum_stats, bp); /* * Handler for "max_num_kflows" devarg. * Invoked as for ex: "-a 000:00:0d.0,max_num_kflows=32" diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c index 2ac1a8625f..7deacd1f3e 100644 --- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c +++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c @@ -1490,14 +1490,6 @@ bnxt_ulp_port_init(struct bnxt *bp) goto jump_to_error; } - /* 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", - bp->eth_dev->data->port_id, - bp->ulp_ctx->cfg_data->accum_stats); - /* set the unicast mode */ if (bnxt_ulp_cntxt_ptr2_ulp_flags_get(bp->ulp_ctx, &ulp_flags)) { BNXT_TF_DBG(ERR, "Error in getting ULP context flags\n"); diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h index 960a5a0c93..17c6898196 100644 --- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h +++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h @@ -92,7 +92,6 @@ struct bnxt_ulp_data { #define BNXT_ULP_TUN_ENTRY_INVALID -1 #define BNXT_ULP_MAX_TUN_CACHE_ENTRIES 16 struct bnxt_tun_cache_entry tun_tbl[BNXT_ULP_MAX_TUN_CACHE_ENTRIES]; - bool accum_stats; uint8_t app_id; uint8_t num_shared_clients; struct bnxt_flow_app_tun_ent app_tun[BNXT_ULP_MAX_TUN_CACHE_ENTRIES]; diff --git a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c index d6b4f93d31..92243083b5 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c +++ b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c @@ -396,21 +396,17 @@ static int ulp_get_single_flow_stat(struct bnxt_ulp_context *ctxt, return rc; } - /* TBD - Get PKT/BYTE COUNT SHIFT/MASK from Template */ + /* PKT/BYTE COUNT SHIFT/MASK are device specific */ sw_cntr_indx = hw_cntr_id - fc_info->shadow_hw_tbl[dir].start_idx; sw_acc_tbl_entry = &fc_info->sw_acc_tbl[dir][sw_cntr_indx]; + /* Some dpdk applications may accumulate the flow counters while some * may not. In cases where the application is accumulating the counters * the PMD need not do the accumulation itself and viceversa to report * the correct flow counters. */ - if (ctxt->cfg_data->accum_stats) { - sw_acc_tbl_entry->pkt_count += FLOW_CNTR_PKTS(stats, dparms); - sw_acc_tbl_entry->byte_count += FLOW_CNTR_BYTES(stats, dparms); - } else { - sw_acc_tbl_entry->pkt_count = FLOW_CNTR_PKTS(stats, dparms); - sw_acc_tbl_entry->byte_count = FLOW_CNTR_BYTES(stats, dparms); - } + sw_acc_tbl_entry->pkt_count += FLOW_CNTR_PKTS(stats, dparms); + sw_acc_tbl_entry->byte_count += FLOW_CNTR_BYTES(stats, dparms); /* Update the parent counters if it is child flow */ if (sw_acc_tbl_entry->pc_flow_idx & FLOW_CNTR_PC_FLOW_VALID) {