From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (unknown [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 05DC5460AA; Fri, 17 Jan 2025 03:04:09 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D1D7F41101; Fri, 17 Jan 2025 03:03:51 +0100 (CET) Received: from lf-1-18.ptr.blmpb.com (lf-1-18.ptr.blmpb.com [103.149.242.18]) by mails.dpdk.org (Postfix) with ESMTP id DB3AF4027A for ; Fri, 17 Jan 2025 03:03:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=feishu2403070942; d=yunsilicon.com; t=1737079423; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=xWvUqL8k+seGlEY1GeL6deUBcbWpVqqNUpuzTkDivL0=; b=KMxrJf/oE7ruE/dKhN5ZUbyUWIneGNODpUnRqh3YO/986v0exJyvbklaLPW+RJJPK/Jh2n WQGTjgLjQ/1VJm55LrO8CpSUdy+lPBww2RJzIHAcGRc5KBl6YBezsUBY+YqZXp4qPrFdXv 8ECPejC3RtTMc1iD18LPqy+xNLL5aBTnw/fKBXE+ZFQpHoe+0UMpB6EG5KakU++yLI+E6L d2efzyfqsoouZ75jTs8A9xLEzMkVrBeE31PGEjKHQWsAHbOW5kYjzmmOzQNdy0vwgPgMF0 2VeyuVrFZSOWfg8dns8bfk9tPQnTD4p6/Yc1WJ4kAZPwvVomw1aqXgK38vfx/A== Date: Fri, 17 Jan 2025 10:03:41 +0800 Subject: Re: [PATCH v5 13/15] net/xsc: add basic stats ops From: "WanRenyong" X-Lms-Return-Path: Message-Id: <0152ed61-0955-4d29-8480-57cf97597aa6@yunsilicon.com> To: "Stephen Hemminger" Cc: , , , , , , , , Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=b4a1ab5ff36a3183ab83b4005fe44cb17ddb84ea3a95e1467722599fac9e 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 --b4a1ab5ff36a3183ab83b4005fe44cb17ddb84ea3a95e1467722599fac9e Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 On 2025/1/17 1:58, Stephen Hemminger wrote: > =C2=A0 On Tue, 07 Jan 2025 10:50:09 +0800 > "WanRenyong" =C2=A0wrote: >=20 >=20 > =C2=A0 =C2=A0 Implement xsc ethdev basic statatics ops. >=20 >=20 > Signed-off-by: WanRenyong > --- > =C2=A0doc/guides/nics/features/xsc.ini |=C2=A0 1 + > =C2=A0drivers/net/xsc/xsc_ethdev.c =C2=A0 =C2=A0 | 75 +++++++++++++++++++= +++++++++++++ > =C2=A02 files changed, 76 insertions(+) >=20 >=20 > diff --git a/doc/guides/nics/features/xsc.ini b/doc/guides/nics/features/= xsc.ini > index 772c6418c4..eb88517104 100644 > --- a/doc/guides/nics/features/xsc.ini > +++ b/doc/guides/nics/features/xsc.ini > @@ -11,6 +11,7 @@ L3 checksum offload=C2=A0 =3D Y > =C2=A0L4 checksum offload=C2=A0 =3D Y > =C2=A0Inner L3 checksum =C2=A0=C2=A0 =3D Y > =C2=A0Inner L4 checksum =C2=A0=C2=A0 =3D Y > +Basic stats =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 =3D Y > =C2=A0Linux =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 =3D Y > =C2=A0ARMv8 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 =3D Y > =C2=A0x86-64 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D Y > =C2=A0 =C2=A0 The driver is also doing per-queue stats. > Mind of I just add that here as well. >=20 >=20 > The definition of what that means was updated to be: >=20 >=20 > Stats per queue > --------------- >=20 >=20 > Supports per queue stats: q_ipackets, q_opackets, q_ibytes, q_obytes, q_e= rrors. > Statistics only supplied for first ``RTE_ETHDEV_QUEUE_STAT_CNTRS`` (16) q= ueues. >=20 >=20 > =C2=A0 =C2=A0Yes, thanks for your reminder, I will add it next time. > =C2=A0 =C2=A0 =C2=A0 diff --git a/drivers/net/xsc/xsc_ethdev.c b/drivers/net/xsc/xsc_ethdev.c > index 9cfb07b023..000e27222d 100644 > --- a/drivers/net/xsc/xsc_ethdev.c > +++ b/drivers/net/xsc/xsc_ethdev.c > @@ -444,6 +444,79 @@ xsc_ethdev_tx_queue_setup(struct rte_eth_dev *dev, u= int16_t idx, uint16_t desc, > =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 return 0; > =C2=A0} > =C2=A0 +static int > +xsc_ethdev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stat= s) > +{ > + =C2=A0 =C2=A0 =C2=A0=C2=A0 struct xsc_ethdev_priv *priv =3D TO_XSC_ETHD= EV_PRIV(dev); > + =C2=A0 =C2=A0 =C2=A0=C2=A0 uint32_t rxqs_n =3D priv->num_rq; > + =C2=A0 =C2=A0 =C2=A0=C2=A0 uint32_t txqs_n =3D priv->num_sq; > + =C2=A0 =C2=A0 =C2=A0=C2=A0 uint32_t i, idx; > + =C2=A0 =C2=A0 =C2=A0=C2=A0 struct xsc_rxq_data *rxq; > + =C2=A0 =C2=A0 =C2=A0=C2=A0 struct xsc_txq_data *txq; > + > + =C2=A0 =C2=A0 =C2=A0=C2=A0 for (i =3D 0; i < rxqs_n; ++i) { > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 rxq =3D xsc_rxq_= get(priv, i); > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 if (unlikely(rxq= =3D=3D NULL)) > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0=C2=A0 continue; > + > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 idx =3D rxq->idx= ; > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 if (idx < RTE_ET= HDEV_QUEUE_STAT_CNTRS) { > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0=C2=A0 stats->q_ipackets[idx] +=3D rxq->stats.rx_pkts; > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0=C2=A0 stats->q_ibytes[idx] +=3D rxq->stats.rx_bytes; > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0=C2=A0 stats->q_errors[idx] +=3D (rxq->stats.rx_errors + > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 rxq->stats.rx_nombuf); > =C2=A0 =C2=A0 Paren not needed here, but ok. > =C2=A0 =C2=A0Agree with you, I will remove it next time. > =C2=A0 =C2=A0 --=C2=A0 Thanks, WanRenyong --b4a1ab5ff36a3183ab83b4005fe44cb17ddb84ea3a95e1467722599fac9e Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=UTF-8
On 2025/1/17 1:58, Stephen Hemminger= wrote:
=C2=A0
On Tue, 07 Jan 2025 10:50:09 +0800
"WanRenyong" <wanry= @yunsilicon.com>=C2=A0wrote:

=C2=A0
=C2=A0
Implement xsc ethdev basic statatics ops.

Signed-off-by: WanRenyong <wanry@yunsilicon.com>
---
=C2=A0doc/guides/nics/features/xsc.ini |= =C2=A0 1 +
=C2=A0drivers/net/xsc/xsc_ethdev.c =C2=A0 =C2=A0 | 75 +++++++++++++++= +++++++++++++++++
=C2=A02 files changed, 76 insertions(+)

diff --git a/doc/guides/ni= cs/features/xsc.ini b/doc/guides/nics/features/xsc.ini
index 772c6418c4..eb88517= 104 100644
--- a/doc/guides/nics/features/xsc.ini
+++ b/doc/guides/nics/features/xs= c.ini
@@ -11,6 +11,7 @@ L3 checksum offload=C2=A0 =3D Y
=C2=A0L4 checksum offload=C2= =A0 =3D Y
=C2=A0Inner L3 checksum =C2=A0=C2=A0 =3D Y
=C2=A0Inner L4 checksum =C2=A0= =C2=A0 =3D Y
+Basic stats =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 =3D Y
=C2=A0Linux =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 =3D Y
=C2=A0ARMv8 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 =3D Y
=C2=A0x86-64 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D Y
=C2=A0
=C2=A0
The driver is also doing per-queue stats.
Mind of I just add that here as w= ell.
=
The definition of what that means was updated to be:

Stats per queue
--------------= -
Su= pports per queue stats: q_ipackets, q_opackets, q_ibytes, q_obytes, q_error= s.
St= atistics only supplied for first ``RTE_ETHDEV_QUEUE_STAT_CNTRS`` (16) queue= s.
<= span>=C2=A0
=C2=A0Yes, thanks for y= our reminder, I will add it next time.
=C2=A0
=C2=A0
=C2=A0
diff --git a/drivers/net/xsc/xsc_ethdev.c b/drivers/net/xsc/xsc_ethdev.c=
inde= x 9cfb07b023..000e27222d 100644
--- a/drivers/net/xsc/xsc_ethdev.c
+++ b/drivers/net/= xsc/xsc_ethdev.c
@@ -444,6 +444,79 @@ xsc_ethdev_tx_queue_setup(struct rte_eth_d= ev *dev, uint16_t idx, uint16_t desc,
=C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 return 0= ;
=C2= =A0}
= =C2=A0
+static int
+xsc_ethdev_stats_get(struct rte_eth_dev *dev, struct rte_eth_sta= ts *stats)
+{
+ =C2=A0 =C2=A0 =C2=A0=C2=A0 struct xsc_ethdev_priv *priv =3D TO_XSC_ET= HDEV_PRIV(dev);
+ =C2=A0 =C2=A0 =C2=A0=C2=A0 uint32_t rxqs_n =3D priv->num_rq= ;
+ = =C2=A0 =C2=A0 =C2=A0=C2=A0 uint32_t txqs_n =3D priv->num_sq;
+ =C2=A0 =C2=A0 = =C2=A0=C2=A0 uint32_t i, idx;
+ =C2=A0 =C2=A0 =C2=A0=C2=A0 struct xsc_rxq_data *= rxq;
= + =C2=A0 =C2=A0 =C2=A0=C2=A0 struct xsc_txq_data *txq;
+
+ =C2=A0 =C2=A0 =C2=A0=C2=A0= for (i =3D 0; i < rxqs_n; ++i) {
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0=C2=A0 rxq =3D xsc_rxq_get(priv, i);
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0=C2=A0 if (unlikely(rxq =3D=3D NULL))
+ =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 continue;
<= div dir=3D"auto" style=3D"font-size: 14px; padding-left: 12px;">++ =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 idx =3D rxq->idx;+ =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 if (idx < RTE_ETHDEV_QUEUE_= STAT_CNTRS) {
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0=C2=A0 stats->q_ipackets[idx] +=3D rxq->stats.rx_pkts;
+ =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 stats->q_ibytes[idx] +=3D rxq->stats.rx_bytes;
+ =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 stats-= >q_errors[idx] +=3D (rxq->stats.rx_errors +
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rxq->= stats.rx_nombuf);
=C2=A0
=C2=A0
Paren not needed here, but ok.
=C2=A0
=C2=A0Agree with you, I= will remove it next time.
=C2=A0
=C2=A0


--=C2=A0
Thanks,
WanRenyong
--b4a1ab5ff36a3183ab83b4005fe44cb17ddb84ea3a95e1467722599fac9e--