* Re: [PATCH v5 13/15] net/xsc: add basic stats ops
@ 2025-01-17 2:03 WanRenyong
0 siblings, 0 replies; 4+ messages in thread
From: WanRenyong @ 2025-01-17 2:03 UTC (permalink / raw)
To: Stephen Hemminger
Cc: dev, ferruh.yigit, thomas, qianr, nana, zhangxx, xudw, jacky, weihg
[-- Attachment #1: Type: text/plain, Size: 2978 bytes --]
On 2025/1/17 1:58, Stephen Hemminger wrote:
>
On Tue, 07 Jan 2025 10:50:09 +0800
> "WanRenyong" <wanry@yunsilicon.com><wanry@yunsilicon.com> wrote:
>
>
>
Implement xsc ethdev basic statatics ops.
>
>
> Signed-off-by: WanRenyong <wanry@yunsilicon.com><wanry@yunsilicon.com>
> ---
> doc/guides/nics/features/xsc.ini | 1 +
> drivers/net/xsc/xsc_ethdev.c | 75 ++++++++++++++++++++++++++++++++
> 2 files changed, 76 insertions(+)
>
>
> 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 = Y
> L4 checksum offload = Y
> Inner L3 checksum = Y
> Inner L4 checksum = Y
> +Basic stats = Y
> Linux = Y
> ARMv8 = Y
> x86-64 = Y
>
The driver is also doing per-queue stats.
> Mind of I just add that here as well.
>
>
> The definition of what that means was updated to be:
>
>
> Stats per queue
> ---------------
>
>
> Supports per queue stats: q_ipackets, q_opackets, q_ibytes, q_obytes, q_errors.
> Statistics only supplied for first ``RTE_ETHDEV_QUEUE_STAT_CNTRS`` (16) queues.
>
>
>
Yes, thanks for your reminder, I will add it next time.
>
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, uint16_t idx, uint16_t desc,
> return 0;
> }
>
+static int
> +xsc_ethdev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
> +{
> + struct xsc_ethdev_priv *priv = TO_XSC_ETHDEV_PRIV(dev);
> + uint32_t rxqs_n = priv->num_rq;
> + uint32_t txqs_n = priv->num_sq;
> + uint32_t i, idx;
> + struct xsc_rxq_data *rxq;
> + struct xsc_txq_data *txq;
> +
> + for (i = 0; i < rxqs_n; ++i) {
> + rxq = xsc_rxq_get(priv, i);
> + if (unlikely(rxq == NULL))
> + continue;
> +
> + idx = rxq->idx;
> + if (idx < RTE_ETHDEV_QUEUE_STAT_CNTRS) {
> + stats->q_ipackets[idx] += rxq->stats.rx_pkts;
> + stats->q_ibytes[idx] += rxq->stats.rx_bytes;
> + stats->q_errors[idx] += (rxq->stats.rx_errors +
> + rxq->stats.rx_nombuf);
>
Paren not needed here, but ok.
>
Agree with you, I will remove it next time.
>
--
Thanks,
WanRenyong
[-- Attachment #2: Type: text/html, Size: 10692 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v5 00/15] XSC PMD for Yunsilicon NICs
@ 2025-01-07 2:50 WanRenyong
2025-01-07 2:50 ` [PATCH v5 13/15] net/xsc: add basic stats ops WanRenyong
0 siblings, 1 reply; 4+ messages in thread
From: WanRenyong @ 2025-01-07 2:50 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, thomas, stephen, qianr, nana, zhangxx, zhangxx,
xudw, jacky, weihg
This xsc PMD (**librte_net_xsc**) provides poll mode driver for
Yunsilicon metaScale serials NICs.
Features:
---------
- MTU update
- TSO
- RSS hash
- RSS key update
- RSS reta update
- L3 checksum offload
- L4 checksum offload
- Inner L3 checksum
- Inner L4 checksum
- Basic stats
Support NICs:
-------------
- metaScale-200S Single QSFP56 Port 200GE SmartNIC
- metaScale-200 Quad QSFP28 Ports 100GE SmartNIC
- metaScale-50 Dual QSFP28 Port 25GE SmartNIC
- metaScale-100Q Quad QSFP28 Port 25GE SmartNIC
---
v5:
* fix compilation errors.
* fix coding style issue with misspelling.
* remove some unnecessary parameter checks.
* remove unnecessary call of rte_wmb.
* Rearrange elements in structure to avoid holes.
v4:
* Based on the review comments from previous versions, reconstruct the xsc PMD to eliminate
the dependency on rdma core library and proprietary kernel driver, while adding support for
the vfio kernel driver.
v3:
* fix compilation errors
v2:
* fix checkpatch warnings and errors
---
WanRenyong (15):
net/xsc: add xsc PMD framework
net/xsc: add xsc device initialization
net/xsc: add xsc mailbox
net/xsc: add xsc dev ops to support VFIO driver
net/xsc: add PCT interfaces
net/xsc: initialize xsc representors
net/xsc: add ethdev configure and RSS ops
net/xsc: add Rx and Tx queue setup
net/xsc: add ethdev start
net/xsc: add ethdev stop and close
net/xsc: add ethdev Rx burst
net/xsc: add ethdev Tx burst
net/xsc: add basic stats ops
net/xsc: add ethdev infos get
net/xsc: add ethdev link and MTU ops
.mailmap | 5 +
MAINTAINERS | 10 +
doc/guides/nics/features/xsc.ini | 18 +
doc/guides/nics/index.rst | 1 +
doc/guides/nics/xsc.rst | 31 +
doc/guides/rel_notes/release_25_03.rst | 4 +
drivers/net/meson.build | 1 +
drivers/net/xsc/meson.build | 17 +
drivers/net/xsc/xsc_cmd.h | 387 +++++++++++
drivers/net/xsc/xsc_defs.h | 100 +++
drivers/net/xsc/xsc_dev.c | 397 +++++++++++
drivers/net/xsc/xsc_dev.h | 184 +++++
drivers/net/xsc/xsc_ethdev.c | 918 +++++++++++++++++++++++++
drivers/net/xsc/xsc_ethdev.h | 63 ++
drivers/net/xsc/xsc_log.h | 24 +
drivers/net/xsc/xsc_np.c | 492 +++++++++++++
drivers/net/xsc/xsc_np.h | 154 +++++
drivers/net/xsc/xsc_rx.c | 512 ++++++++++++++
drivers/net/xsc/xsc_rx.h | 65 ++
drivers/net/xsc/xsc_rxtx.h | 191 +++++
drivers/net/xsc/xsc_tx.c | 354 ++++++++++
drivers/net/xsc/xsc_tx.h | 62 ++
drivers/net/xsc/xsc_vfio.c | 746 ++++++++++++++++++++
drivers/net/xsc/xsc_vfio_mbox.c | 691 +++++++++++++++++++
drivers/net/xsc/xsc_vfio_mbox.h | 142 ++++
25 files changed, 5569 insertions(+)
create mode 100644 doc/guides/nics/features/xsc.ini
create mode 100644 doc/guides/nics/xsc.rst
create mode 100644 drivers/net/xsc/meson.build
create mode 100644 drivers/net/xsc/xsc_cmd.h
create mode 100644 drivers/net/xsc/xsc_defs.h
create mode 100644 drivers/net/xsc/xsc_dev.c
create mode 100644 drivers/net/xsc/xsc_dev.h
create mode 100644 drivers/net/xsc/xsc_ethdev.c
create mode 100644 drivers/net/xsc/xsc_ethdev.h
create mode 100644 drivers/net/xsc/xsc_log.h
create mode 100644 drivers/net/xsc/xsc_np.c
create mode 100644 drivers/net/xsc/xsc_np.h
create mode 100644 drivers/net/xsc/xsc_rx.c
create mode 100644 drivers/net/xsc/xsc_rx.h
create mode 100644 drivers/net/xsc/xsc_rxtx.h
create mode 100644 drivers/net/xsc/xsc_tx.c
create mode 100644 drivers/net/xsc/xsc_tx.h
create mode 100644 drivers/net/xsc/xsc_vfio.c
create mode 100644 drivers/net/xsc/xsc_vfio_mbox.c
create mode 100644 drivers/net/xsc/xsc_vfio_mbox.h
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v5 13/15] net/xsc: add basic stats ops
2025-01-07 2:50 [PATCH v5 00/15] XSC PMD for Yunsilicon NICs WanRenyong
@ 2025-01-07 2:50 ` WanRenyong
2025-01-16 17:58 ` Stephen Hemminger
0 siblings, 1 reply; 4+ messages in thread
From: WanRenyong @ 2025-01-07 2:50 UTC (permalink / raw)
To: dev
Cc: ferruh.yigit, thomas, stephen, qianr, nana, zhangxx, zhangxx,
xudw, jacky, weihg
Implement xsc ethdev basic statatics ops.
Signed-off-by: WanRenyong <wanry@yunsilicon.com>
---
doc/guides/nics/features/xsc.ini | 1 +
drivers/net/xsc/xsc_ethdev.c | 75 ++++++++++++++++++++++++++++++++
2 files changed, 76 insertions(+)
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 = Y
L4 checksum offload = Y
Inner L3 checksum = Y
Inner L4 checksum = Y
+Basic stats = Y
Linux = Y
ARMv8 = Y
x86-64 = Y
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, uint16_t idx, uint16_t desc,
return 0;
}
+static int
+xsc_ethdev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
+{
+ struct xsc_ethdev_priv *priv = TO_XSC_ETHDEV_PRIV(dev);
+ uint32_t rxqs_n = priv->num_rq;
+ uint32_t txqs_n = priv->num_sq;
+ uint32_t i, idx;
+ struct xsc_rxq_data *rxq;
+ struct xsc_txq_data *txq;
+
+ for (i = 0; i < rxqs_n; ++i) {
+ rxq = xsc_rxq_get(priv, i);
+ if (unlikely(rxq == NULL))
+ continue;
+
+ idx = rxq->idx;
+ if (idx < RTE_ETHDEV_QUEUE_STAT_CNTRS) {
+ stats->q_ipackets[idx] += rxq->stats.rx_pkts;
+ stats->q_ibytes[idx] += rxq->stats.rx_bytes;
+ stats->q_errors[idx] += (rxq->stats.rx_errors +
+ rxq->stats.rx_nombuf);
+ }
+ stats->ipackets += rxq->stats.rx_pkts;
+ stats->ibytes += rxq->stats.rx_bytes;
+ stats->ierrors += rxq->stats.rx_errors;
+ stats->rx_nombuf += rxq->stats.rx_nombuf;
+ }
+
+ for (i = 0; i < txqs_n; ++i) {
+ txq = xsc_txq_get(priv, i);
+ if (unlikely(txq == NULL))
+ continue;
+
+ idx = txq->idx;
+ if (idx < RTE_ETHDEV_QUEUE_STAT_CNTRS) {
+ stats->q_opackets[idx] += txq->stats.tx_pkts;
+ stats->q_obytes[idx] += txq->stats.tx_bytes;
+ stats->q_errors[idx] += txq->stats.tx_errors;
+ }
+ stats->opackets += txq->stats.tx_pkts;
+ stats->obytes += txq->stats.tx_bytes;
+ stats->oerrors += txq->stats.tx_errors;
+ }
+
+ return 0;
+}
+
+static int
+xsc_ethdev_stats_reset(struct rte_eth_dev *dev)
+{
+ struct xsc_ethdev_priv *priv = TO_XSC_ETHDEV_PRIV(dev);
+ uint32_t rxqs_n = priv->num_rq;
+ uint32_t txqs_n = priv->num_sq;
+ uint32_t i;
+ struct xsc_rxq_data *rxq;
+ struct xsc_txq_data *txq;
+
+ for (i = 0; i < rxqs_n; ++i) {
+ rxq = xsc_rxq_get(priv, i);
+ if (unlikely(rxq == NULL))
+ continue;
+ memset(&rxq->stats, 0, sizeof(struct xsc_rxq_stats));
+ }
+ for (i = 0; i < txqs_n; ++i) {
+ txq = xsc_txq_get(priv, i);
+ if (unlikely(txq == NULL))
+ continue;
+ memset(&txq->stats, 0, sizeof(struct xsc_txq_stats));
+ }
+
+ return 0;
+}
+
static int
xsc_ethdev_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index)
{
@@ -475,6 +548,8 @@ const struct eth_dev_ops xsc_eth_dev_ops = {
.dev_start = xsc_ethdev_start,
.dev_stop = xsc_ethdev_stop,
.dev_close = xsc_ethdev_close,
+ .stats_get = xsc_ethdev_stats_get,
+ .stats_reset = xsc_ethdev_stats_reset,
.rx_queue_setup = xsc_ethdev_rx_queue_setup,
.tx_queue_setup = xsc_ethdev_tx_queue_setup,
.rx_queue_release = xsc_ethdev_rxq_release,
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v5 13/15] net/xsc: add basic stats ops
2025-01-07 2:50 ` [PATCH v5 13/15] net/xsc: add basic stats ops WanRenyong
@ 2025-01-16 17:58 ` Stephen Hemminger
2025-01-17 2:00 ` WanRenyong
0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2025-01-16 17:58 UTC (permalink / raw)
To: WanRenyong
Cc: dev, ferruh.yigit, thomas, qianr, nana, zhangxx, xudw, jacky, weihg
On Tue, 07 Jan 2025 10:50:09 +0800
"WanRenyong" <wanry@yunsilicon.com> wrote:
> Implement xsc ethdev basic statatics ops.
>
> Signed-off-by: WanRenyong <wanry@yunsilicon.com>
> ---
> doc/guides/nics/features/xsc.ini | 1 +
> drivers/net/xsc/xsc_ethdev.c | 75 ++++++++++++++++++++++++++++++++
> 2 files changed, 76 insertions(+)
>
> 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 = Y
> L4 checksum offload = Y
> Inner L3 checksum = Y
> Inner L4 checksum = Y
> +Basic stats = Y
> Linux = Y
> ARMv8 = Y
> x86-64 = Y
The driver is also doing per-queue stats.
Mind of I just add that here as well.
The definition of what that means was updated to be:
Stats per queue
---------------
Supports per queue stats: q_ipackets, q_opackets, q_ibytes, q_obytes, q_errors.
Statistics only supplied for first ``RTE_ETHDEV_QUEUE_STAT_CNTRS`` (16) queues.
> 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, uint16_t idx, uint16_t desc,
> return 0;
> }
>
> +static int
> +xsc_ethdev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
> +{
> + struct xsc_ethdev_priv *priv = TO_XSC_ETHDEV_PRIV(dev);
> + uint32_t rxqs_n = priv->num_rq;
> + uint32_t txqs_n = priv->num_sq;
> + uint32_t i, idx;
> + struct xsc_rxq_data *rxq;
> + struct xsc_txq_data *txq;
> +
> + for (i = 0; i < rxqs_n; ++i) {
> + rxq = xsc_rxq_get(priv, i);
> + if (unlikely(rxq == NULL))
> + continue;
> +
> + idx = rxq->idx;
> + if (idx < RTE_ETHDEV_QUEUE_STAT_CNTRS) {
> + stats->q_ipackets[idx] += rxq->stats.rx_pkts;
> + stats->q_ibytes[idx] += rxq->stats.rx_bytes;
> + stats->q_errors[idx] += (rxq->stats.rx_errors +
> + rxq->stats.rx_nombuf);
Paren not needed here, but ok.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v5 13/15] net/xsc: add basic stats ops
2025-01-16 17:58 ` Stephen Hemminger
@ 2025-01-17 2:00 ` WanRenyong
0 siblings, 0 replies; 4+ messages in thread
From: WanRenyong @ 2025-01-17 2:00 UTC (permalink / raw)
To: Stephen Hemminger
Cc: dev, ferruh.yigit, thomas, qianr, nana, zhangxx, xudw, jacky, weihg
On 2025/1/17 1:58, Stephen Hemminger wrote:
> On Tue, 07 Jan 2025 10:50:09 +0800
> "WanRenyong" <wanry@yunsilicon.com> wrote:
>
>> Implement xsc ethdev basic statatics ops.
>>
>> Signed-off-by: WanRenyong <wanry@yunsilicon.com>
>> ---
>> doc/guides/nics/features/xsc.ini | 1 +
>> drivers/net/xsc/xsc_ethdev.c | 75 ++++++++++++++++++++++++++++++++
>> 2 files changed, 76 insertions(+)
>>
>> 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 = Y
>> L4 checksum offload = Y
>> Inner L3 checksum = Y
>> Inner L4 checksum = Y
>> +Basic stats = Y
>> Linux = Y
>> ARMv8 = Y
>> x86-64 = Y
> The driver is also doing per-queue stats.
> Mind of I just add that here as well.
>
> The definition of what that means was updated to be:
>
> Stats per queue
> ---------------
>
> Supports per queue stats: q_ipackets, q_opackets, q_ibytes, q_obytes, q_errors.
> Statistics only supplied for first ``RTE_ETHDEV_QUEUE_STAT_CNTRS`` (16) queues.
>
Yes,thanks for your reminder, I will add it next.
>> 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, uint16_t idx, uint16_t desc,
>> return 0;
>> }
>>
>> +static int
>> +xsc_ethdev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
>> +{
>> + struct xsc_ethdev_priv *priv = TO_XSC_ETHDEV_PRIV(dev);
>> + uint32_t rxqs_n = priv->num_rq;
>> + uint32_t txqs_n = priv->num_sq;
>> + uint32_t i, idx;
>> + struct xsc_rxq_data *rxq;
>> + struct xsc_txq_data *txq;
>> +
>> + for (i = 0; i < rxqs_n; ++i) {
>> + rxq = xsc_rxq_get(priv, i);
>> + if (unlikely(rxq == NULL))
>> + continue;
>> +
>> + idx = rxq->idx;
>> + if (idx < RTE_ETHDEV_QUEUE_STAT_CNTRS) {
>> + stats->q_ipackets[idx] += rxq->stats.rx_pkts;
>> + stats->q_ibytes[idx] += rxq->stats.rx_bytes;
>> + stats->q_errors[idx] += (rxq->stats.rx_errors +
>> + rxq->stats.rx_nombuf);
> Paren not needed here, but ok.
OK, agree with you, I will remove them next.
--
Thanks,
WanRenyong
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-01-17 2:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-17 2:03 [PATCH v5 13/15] net/xsc: add basic stats ops WanRenyong
-- strict thread matches above, loose matches on Subject: below --
2025-01-07 2:50 [PATCH v5 00/15] XSC PMD for Yunsilicon NICs WanRenyong
2025-01-07 2:50 ` [PATCH v5 13/15] net/xsc: add basic stats ops WanRenyong
2025-01-16 17:58 ` Stephen Hemminger
2025-01-17 2:00 ` WanRenyong
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).