DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nithin Dabilpuram <ndabilpuram@marvell.com>
To: Nithin Dabilpuram <ndabilpuram@marvell.com>,
	Kiran Kumar K <kirankumark@marvell.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	Satha Rao <skoteshwar@marvell.com>,
	Harman Kalra <hkalra@marvell.com>
Cc: <jerinj@marvell.com>, <dev@dpdk.org>
Subject: [PATCH 08/10] common/cnxk: add API to reset CGX stats
Date: Fri, 17 May 2024 13:14:46 +0530	[thread overview]
Message-ID: <20240517074448.3146611-8-ndabilpuram@marvell.com> (raw)
In-Reply-To: <20240517074448.3146611-1-ndabilpuram@marvell.com>

From: Sunil Kumar Kori <skori@marvell.com>

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 <skori@marvell.com>
---
 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


  parent reply	other threads:[~2024-05-17  7:45 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-17  7:44 [PATCH 01/10] common/cnxk: sync VF root weight with kernel Nithin Dabilpuram
2024-05-17  7:44 ` [PATCH 02/10] net/cnxk: set VF default root schedule weight Nithin Dabilpuram
2024-05-17  7:44 ` [PATCH 03/10] net/cnxk: fix extbuf handling for multisegment packet Nithin Dabilpuram
2024-05-17  7:44 ` [PATCH 04/10] common/cnxk: override UDP encap ports with session data Nithin Dabilpuram
2024-05-17  7:44 ` [PATCH 05/10] net/cnxk: update SA userdata and keep original cookie Nithin Dabilpuram
2024-05-17  7:44 ` [PATCH 06/10] net/cnxk: add option to disable custom meta aura Nithin Dabilpuram
2024-05-27 17:29   ` Jerin Jacob
2024-05-17  7:44 ` [PATCH 07/10] net/cnxk: fix issue with outbound security higher pkt burst Nithin Dabilpuram
2024-05-17  7:44 ` Nithin Dabilpuram [this message]
2024-05-17  7:44 ` [PATCH 09/10] net/cnxk: clear CGX stats during xstats reset Nithin Dabilpuram
2024-05-27 17:28   ` Jerin Jacob
2024-05-17  7:44 ` [PATCH 10/10] net/cnxk: define CPT HW result format for PMD API Nithin Dabilpuram
2024-05-27 17:27   ` Jerin Jacob
2024-05-28  7:05 ` [PATCH v2 01/10] common/cnxk: sync VF root weight with kernel Nithin Dabilpuram
2024-05-28  7:05   ` [PATCH v2 02/10] net/cnxk: set VF default root schedule weight Nithin Dabilpuram
2024-05-28  7:05   ` [PATCH v2 03/10] net/cnxk: fix extbuf handling for multisegment packet Nithin Dabilpuram
2024-05-28  7:05   ` [PATCH v2 04/10] common/cnxk: override UDP encap ports with session data Nithin Dabilpuram
2024-05-28  7:05   ` [PATCH v2 05/10] net/cnxk: update SA userdata and keep original cookie Nithin Dabilpuram
2024-05-28  7:05   ` [PATCH v2 06/10] net/cnxk: add option to disable custom meta aura Nithin Dabilpuram
2024-05-28  7:05   ` [PATCH v2 07/10] net/cnxk: fix issue with outbound security higher pkt burst Nithin Dabilpuram
2024-05-28  7:05   ` [PATCH v2 08/10] common/cnxk: add API to reset CGX stats Nithin Dabilpuram
2024-05-28  7:05   ` [PATCH v2 09/10] net/cnxk: fix xstats reset Nithin Dabilpuram
2024-05-28  7:05   ` [PATCH v2 10/10] net/cnxk: define CPT HW result format for PMD API Nithin Dabilpuram
2024-05-28 16:03     ` Jerin Jacob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240517074448.3146611-8-ndabilpuram@marvell.com \
    --to=ndabilpuram@marvell.com \
    --cc=dev@dpdk.org \
    --cc=hkalra@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=skori@marvell.com \
    --cc=skoteshwar@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).