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 A7F3B41DC3; Fri, 3 Mar 2023 09:11:13 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B081D42BD9; Fri, 3 Mar 2023 09:11:03 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 1596142BB1 for ; Fri, 3 Mar 2023 09:11:01 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32375Fm0026002 for ; Fri, 3 Mar 2023 00:11:01 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=WBBhS/aPmco+PzbDCJ6Ux4yaiS/a30B2+5qirFRhDa8=; b=Vfi3xB+mIaMvdkSRzPfJk4a+unarllBk48bi4xl5SP+dngiE7FLmbZI7F6gHqDpUPgCR 5PkJt2aQuqbSiml6MzOSa2msUcaWqkYsrqvH0JkMcFKBxPEx0p14hu8J+hfKMUMcBbKS UQlVLN4od51wF1t3FNiDWahZmgZyQaXGjsJdoQCRZPI0vJ7+wQ+9dLep5AsHOTn9849/ nOcXz8P1gNoL4OngHoWllcpAPFyhyUD0+5cjjuYTGhNybFgXg6Kh3Sv62q1+qohAfnKz 9oWtxfZvFkMN1iZylRHLmx92Fs/l+OtERQwRLVt7Qmf/praj/WPykV26SyH6EH8Do99l vA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3p2vg53dtu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Fri, 03 Mar 2023 00:11:00 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 3 Mar 2023 00:10:59 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.42 via Frontend Transport; Fri, 3 Mar 2023 00:10:59 -0800 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id AD5743F705E; Fri, 3 Mar 2023 00:10:55 -0800 (PST) From: Nithin Dabilpuram To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Kommula Shiva Shankar Subject: [PATCH 04/15] common/cnxk: add separate inline dev stats API Date: Fri, 3 Mar 2023 13:40:02 +0530 Message-ID: <20230303081013.589868-4-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230303081013.589868-1-ndabilpuram@marvell.com> References: <20230303081013.589868-1-ndabilpuram@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: zveVSO9jK-wZ554lU8BJbXDyvzH-OuKV X-Proofpoint-GUID: zveVSO9jK-wZ554lU8BJbXDyvzH-OuKV X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-03_01,2023-03-02_02,2023-02-09_01 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 From: Kommula Shiva Shankar This patch adds separate inline dev stats api, thus avoiding expensive nix xstats call Signed-off-by: Kommula Shiva Shankar --- drivers/common/cnxk/roc_nix_inl.h | 1 + drivers/common/cnxk/roc_nix_inl_dev.c | 33 +++++++++++++++++++++++++++ drivers/common/cnxk/version.map | 1 + 3 files changed, 35 insertions(+) diff --git a/drivers/common/cnxk/roc_nix_inl.h b/drivers/common/cnxk/roc_nix_inl.h index 220663568e..3bb37ce225 100644 --- a/drivers/common/cnxk/roc_nix_inl.h +++ b/drivers/common/cnxk/roc_nix_inl.h @@ -152,6 +152,7 @@ bool __roc_api roc_nix_inl_dev_is_probed(void); void __roc_api roc_nix_inl_dev_lock(void); void __roc_api roc_nix_inl_dev_unlock(void); int __roc_api roc_nix_inl_dev_xaq_realloc(uint64_t aura_handle); +int __roc_api roc_nix_inl_dev_stats_get(struct roc_nix_stats *stats); uint16_t __roc_api roc_nix_inl_dev_pffunc_get(void); /* NIX Inline Inbound API */ diff --git a/drivers/common/cnxk/roc_nix_inl_dev.c b/drivers/common/cnxk/roc_nix_inl_dev.c index 6f60961bc7..196a04db09 100644 --- a/drivers/common/cnxk/roc_nix_inl_dev.c +++ b/drivers/common/cnxk/roc_nix_inl_dev.c @@ -15,6 +15,8 @@ ROC_NIX_LF_RX_CFG_IP6_UDP_OPT | ROC_NIX_LF_RX_CFG_DIS_APAD | \ ROC_NIX_LF_RX_CFG_LEN_IL3 | ROC_NIX_LF_RX_CFG_LEN_OL3) +#define INL_NIX_RX_STATS(val) plt_read64(inl_dev->nix_base + NIX_LF_RX_STATX(val)) + extern uint32_t soft_exp_consumer_cnt; static bool soft_exp_poll_thread_exit = true; @@ -832,6 +834,37 @@ nix_inl_outb_poll_thread_setup(struct nix_inl_dev *inl_dev) return rc; } +int +roc_nix_inl_dev_stats_get(struct roc_nix_stats *stats) +{ + struct idev_cfg *idev = idev_get_cfg(); + struct nix_inl_dev *inl_dev = NULL; + + if (stats == NULL) + return NIX_ERR_PARAM; + + if (!idev && idev->nix_inl_dev) + inl_dev = idev->nix_inl_dev; + + if (!inl_dev) + return -EINVAL; + + stats->rx_octs = INL_NIX_RX_STATS(NIX_STAT_LF_RX_RX_OCTS); + stats->rx_ucast = INL_NIX_RX_STATS(NIX_STAT_LF_RX_RX_UCAST); + stats->rx_bcast = INL_NIX_RX_STATS(NIX_STAT_LF_RX_RX_BCAST); + stats->rx_mcast = INL_NIX_RX_STATS(NIX_STAT_LF_RX_RX_MCAST); + stats->rx_drop = INL_NIX_RX_STATS(NIX_STAT_LF_RX_RX_DROP); + stats->rx_drop_octs = INL_NIX_RX_STATS(NIX_STAT_LF_RX_RX_DROP_OCTS); + stats->rx_fcs = INL_NIX_RX_STATS(NIX_STAT_LF_RX_RX_FCS); + stats->rx_err = INL_NIX_RX_STATS(NIX_STAT_LF_RX_RX_ERR); + stats->rx_drop_bcast = INL_NIX_RX_STATS(NIX_STAT_LF_RX_RX_DRP_BCAST); + stats->rx_drop_mcast = INL_NIX_RX_STATS(NIX_STAT_LF_RX_RX_DRP_MCAST); + stats->rx_drop_l3_bcast = INL_NIX_RX_STATS(NIX_STAT_LF_RX_RX_DRP_L3BCAST); + stats->rx_drop_l3_mcast = INL_NIX_RX_STATS(NIX_STAT_LF_RX_RX_DRP_L3MCAST); + + return 0; +} + int roc_nix_inl_dev_init(struct roc_nix_inl_dev *roc_inl_dev) { diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index 5d2b75fb5a..6c69c425df 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -146,6 +146,7 @@ INTERNAL { roc_nix_inl_dev_fini; roc_nix_inl_dev_init; roc_nix_inl_dev_is_probed; + roc_nix_inl_dev_stats_get; roc_nix_inl_dev_lock; roc_nix_inl_dev_pffunc_get; roc_nix_inl_dev_rq; -- 2.25.1