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 95240440F0; Tue, 28 May 2024 09:06:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D3EF540A84; Tue, 28 May 2024 09:05:52 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 93A4440DC9 for ; Tue, 28 May 2024 09:05:51 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44RMw3eR032176 for ; Tue, 28 May 2024 00:05:51 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=2 wpbpRB3uC+mhiXcn+HNNRVMLG2wM56AKSkj2g8CKno=; b=Jy5kvhbx2ntLvrTw8 b7mGidjXcaFCNd1NsVGQlqD4yx7awPVHm0py87CLNkUvKc8QGisubtp7ZA5DJSTt +ghMOipLNuOzH9c4/phQxCzLIaqpkbEKrO84x/pPaBCnzKGxPXxU3t1iUJdAO2ff I1NfrSmin3BAq5Z6+dpA7zJqsa1HYnZ1ywZ2N19CqkbkpMF4musbIKFx85JZtyYD n1LIo2iINq95Pz/zW+ie2S0GIjFBCWUqqUtO5ZYaImnImT9keZKaivdQVavFOVAe PjRSHCfJmc85+jKwL0ystmA3kBCHm3d6/xCjgZxtHRBUGfm+fKQUhFXrZwwzqK6h 7ESrA== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3ycqpykr21-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 28 May 2024 00:05:50 -0700 (PDT) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 28 May 2024 00:05:49 -0700 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Tue, 28 May 2024 00:05:49 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 32A643F709A; Tue, 28 May 2024 00:05:46 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Harman Kalra CC: , Subject: [PATCH v2 08/10] common/cnxk: add API to reset CGX stats Date: Tue, 28 May 2024 12:35:20 +0530 Message-ID: <20240528070522.3857626-8-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240528070522.3857626-1-ndabilpuram@marvell.com> References: <20240517074448.3146611-1-ndabilpuram@marvell.com> <20240528070522.3857626-1-ndabilpuram@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: A6jkZG73ppN6TquFFGLQjvU3vUI3qQz2 X-Proofpoint-ORIG-GUID: A6jkZG73ppN6TquFFGLQjvU3vUI3qQz2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-28_04,2024-05-27_01,2024-05-17_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: Sunil Kumar Kori Similar to NIX stats reset API, adding API to reset CGX stats. When user requests to reset the stats then it clears if nix_lf is PF otherwise silently discard the request. Signed-off-by: Sunil Kumar Kori --- drivers/common/cnxk/roc_nix.h | 1 + drivers/common/cnxk/roc_nix_mac.c | 29 +++++++++++++++++++++++++++++ drivers/common/cnxk/version.map | 1 + 3 files changed, 31 insertions(+) diff --git a/drivers/common/cnxk/roc_nix.h b/drivers/common/cnxk/roc_nix.h index 63bcd5b25e..25cf261348 100644 --- a/drivers/common/cnxk/roc_nix.h +++ b/drivers/common/cnxk/roc_nix.h @@ -849,6 +849,7 @@ int __roc_api roc_nix_mac_link_info_get_cb_register( void __roc_api roc_nix_mac_link_info_get_cb_unregister(struct roc_nix *roc_nix); int __roc_api roc_nix_q_err_cb_register(struct roc_nix *roc_nix, q_err_get_t sq_err_handle); void __roc_api roc_nix_q_err_cb_unregister(struct roc_nix *roc_nix); +int __roc_api roc_nix_mac_stats_reset(struct roc_nix *roc_nix); /* Ops */ int __roc_api roc_nix_switch_hdr_set(struct roc_nix *roc_nix, diff --git a/drivers/common/cnxk/roc_nix_mac.c b/drivers/common/cnxk/roc_nix_mac.c index 2d1c29dd66..f79aaec4a5 100644 --- a/drivers/common/cnxk/roc_nix_mac.c +++ b/drivers/common/cnxk/roc_nix_mac.c @@ -354,6 +354,35 @@ roc_nix_mac_max_rx_len_set(struct roc_nix *roc_nix, uint16_t maxlen) return rc; } +int +roc_nix_mac_stats_reset(struct roc_nix *roc_nix) +{ + struct nix *nix = roc_nix_to_nix_priv(roc_nix); + struct dev *dev = &nix->dev; + struct mbox *mbox = mbox_get(dev->mbox); + struct msg_req *req; + int rc = -ENOSPC; + + if (roc_model_is_cn10k()) { + rc = 0; + goto exit; + } + + if (roc_nix_is_vf_or_sdp(roc_nix)) { + rc = 0; + goto exit; + } + + req = mbox_alloc_msg_cgx_stats_rst(mbox); + if (req == NULL) + goto exit; + + rc = mbox_process(mbox); +exit: + mbox_put(mbox); + return rc; +} + int roc_nix_mac_link_cb_register(struct roc_nix *roc_nix, link_status_t link_update) { diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index e8d32b331e..e37c1c7b7d 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -308,6 +308,7 @@ INTERNAL { roc_nix_mac_mtu_set; roc_nix_mac_promisc_mode_enable; roc_nix_mac_rxtx_start_stop; + roc_nix_mac_stats_reset; roc_nix_max_pkt_len; roc_nix_mcast_list_free; roc_nix_mcast_list_setup; -- 2.25.1