From: Kaiwen Deng <kaiwenx.deng@intel.com>
To: dev@dpdk.org
Cc: stable@dpdk.org, Kaiwen Deng <kaiwenx.deng@intel.com>,
Anatoly Burakov <anatoly.burakov@intel.com>,
Vladimir Medvedkin <vladimir.medvedkin@intel.com>,
Tiwei Bie <tiwei.bie@intel.com>,
Wenzhuo Lu <wenzhuo.lu@intel.com>
Subject: [PATCH] net/ixgbe: fix unexpected data in the xstats info
Date: Tue, 10 Jun 2025 13:42:25 +0800 [thread overview]
Message-ID: <20250610054225.988840-1-kaiwenx.deng@intel.com> (raw)
In-Reply-To: <20250520011316.561890-1-kaiwenx.deng@intel.com>
E610 device does not support MACsec.
This commit will excluding MACsec stats from the xstats info
display for E610 device.
Fixes: b35d309710fe ("net/ixgbe: add MACsec offload")
Cc: stable@dpdk.org
Signed-off-by: Kaiwen Deng <kaiwenx.deng@intel.com>
---
drivers/net/intel/ixgbe/ixgbe_ethdev.c | 121 ++++++++++++++-----------
1 file changed, 67 insertions(+), 54 deletions(-)
diff --git a/drivers/net/intel/ixgbe/ixgbe_ethdev.c b/drivers/net/intel/ixgbe/ixgbe_ethdev.c
index 0fa4898aba..130a23cd9d 100644
--- a/drivers/net/intel/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/intel/ixgbe/ixgbe_ethdev.c
@@ -3354,38 +3354,40 @@ ixgbe_read_stats_registers(struct ixgbe_hw *hw,
IXGBE_FDIRFSTAT) >> 16) & 0xFFFF;
}
/* MACsec Stats registers */
- macsec_stats->out_pkts_untagged += IXGBE_READ_REG(hw, IXGBE_LSECTXUT);
- macsec_stats->out_pkts_encrypted +=
- IXGBE_READ_REG(hw, IXGBE_LSECTXPKTE);
- macsec_stats->out_pkts_protected +=
- IXGBE_READ_REG(hw, IXGBE_LSECTXPKTP);
- macsec_stats->out_octets_encrypted +=
- IXGBE_READ_REG(hw, IXGBE_LSECTXOCTE);
- macsec_stats->out_octets_protected +=
- IXGBE_READ_REG(hw, IXGBE_LSECTXOCTP);
- macsec_stats->in_pkts_untagged += IXGBE_READ_REG(hw, IXGBE_LSECRXUT);
- macsec_stats->in_pkts_badtag += IXGBE_READ_REG(hw, IXGBE_LSECRXBAD);
- macsec_stats->in_pkts_nosci += IXGBE_READ_REG(hw, IXGBE_LSECRXNOSCI);
- macsec_stats->in_pkts_unknownsci +=
- IXGBE_READ_REG(hw, IXGBE_LSECRXUNSCI);
- macsec_stats->in_octets_decrypted +=
- IXGBE_READ_REG(hw, IXGBE_LSECRXOCTD);
- macsec_stats->in_octets_validated +=
- IXGBE_READ_REG(hw, IXGBE_LSECRXOCTV);
- macsec_stats->in_pkts_unchecked += IXGBE_READ_REG(hw, IXGBE_LSECRXUNCH);
- macsec_stats->in_pkts_delayed += IXGBE_READ_REG(hw, IXGBE_LSECRXDELAY);
- macsec_stats->in_pkts_late += IXGBE_READ_REG(hw, IXGBE_LSECRXLATE);
- for (i = 0; i < 2; i++) {
- macsec_stats->in_pkts_ok +=
- IXGBE_READ_REG(hw, IXGBE_LSECRXOK(i));
- macsec_stats->in_pkts_invalid +=
- IXGBE_READ_REG(hw, IXGBE_LSECRXINV(i));
- macsec_stats->in_pkts_notvalid +=
- IXGBE_READ_REG(hw, IXGBE_LSECRXNV(i));
- }
- macsec_stats->in_pkts_unusedsa += IXGBE_READ_REG(hw, IXGBE_LSECRXUNSA);
- macsec_stats->in_pkts_notusingsa +=
- IXGBE_READ_REG(hw, IXGBE_LSECRXNUSA);
+ if (hw->mac.type != ixgbe_mac_E610) {
+ macsec_stats->out_pkts_untagged += IXGBE_READ_REG(hw, IXGBE_LSECTXUT);
+ macsec_stats->out_pkts_encrypted +=
+ IXGBE_READ_REG(hw, IXGBE_LSECTXPKTE);
+ macsec_stats->out_pkts_protected +=
+ IXGBE_READ_REG(hw, IXGBE_LSECTXPKTP);
+ macsec_stats->out_octets_encrypted +=
+ IXGBE_READ_REG(hw, IXGBE_LSECTXOCTE);
+ macsec_stats->out_octets_protected +=
+ IXGBE_READ_REG(hw, IXGBE_LSECTXOCTP);
+ macsec_stats->in_pkts_untagged += IXGBE_READ_REG(hw, IXGBE_LSECRXUT);
+ macsec_stats->in_pkts_badtag += IXGBE_READ_REG(hw, IXGBE_LSECRXBAD);
+ macsec_stats->in_pkts_nosci += IXGBE_READ_REG(hw, IXGBE_LSECRXNOSCI);
+ macsec_stats->in_pkts_unknownsci +=
+ IXGBE_READ_REG(hw, IXGBE_LSECRXUNSCI);
+ macsec_stats->in_octets_decrypted +=
+ IXGBE_READ_REG(hw, IXGBE_LSECRXOCTD);
+ macsec_stats->in_octets_validated +=
+ IXGBE_READ_REG(hw, IXGBE_LSECRXOCTV);
+ macsec_stats->in_pkts_unchecked += IXGBE_READ_REG(hw, IXGBE_LSECRXUNCH);
+ macsec_stats->in_pkts_delayed += IXGBE_READ_REG(hw, IXGBE_LSECRXDELAY);
+ macsec_stats->in_pkts_late += IXGBE_READ_REG(hw, IXGBE_LSECRXLATE);
+ for (i = 0; i < 2; i++) {
+ macsec_stats->in_pkts_ok +=
+ IXGBE_READ_REG(hw, IXGBE_LSECRXOK(i));
+ macsec_stats->in_pkts_invalid +=
+ IXGBE_READ_REG(hw, IXGBE_LSECRXINV(i));
+ macsec_stats->in_pkts_notvalid +=
+ IXGBE_READ_REG(hw, IXGBE_LSECRXNV(i));
+ }
+ macsec_stats->in_pkts_unusedsa += IXGBE_READ_REG(hw, IXGBE_LSECRXUNSA);
+ macsec_stats->in_pkts_notusingsa +=
+ IXGBE_READ_REG(hw, IXGBE_LSECRXNUSA);
+ }
}
/*
@@ -3478,15 +3480,19 @@ ixgbe_dev_stats_reset(struct rte_eth_dev *dev)
(IXGBE_NB_TXQ_PRIO_STATS * IXGBE_NB_TXQ_PRIO_VALUES))
static unsigned
-ixgbe_xstats_calc_num(void)
+ixgbe_xstats_calc_num(struct rte_eth_dev *dev)
{
+ struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ if (hw->mac.type == ixgbe_mac_E610)
+ return IXGBE_XSTATS_CALC_NUM - IXGBE_NB_MACSEC_STATS;
return IXGBE_XSTATS_CALC_NUM;
}
-static int ixgbe_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
+static int ixgbe_dev_xstats_get_names(struct rte_eth_dev *dev,
struct rte_eth_xstat_name *xstats_names, __rte_unused unsigned int size)
{
- const unsigned cnt_stats = ixgbe_xstats_calc_num();
+ struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ const unsigned int cnt_stats = ixgbe_xstats_calc_num(dev);
unsigned stat, i, count;
if (xstats_names != NULL) {
@@ -3505,11 +3511,13 @@ static int ixgbe_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
}
/* MACsec Stats */
- for (i = 0; i < IXGBE_NB_MACSEC_STATS; i++) {
- strlcpy(xstats_names[count].name,
- rte_ixgbe_macsec_strings[i].name,
- sizeof(xstats_names[count].name));
- count++;
+ if (hw->mac.type != ixgbe_mac_E610) {
+ for (i = 0; i < IXGBE_NB_MACSEC_STATS; i++) {
+ strlcpy(xstats_names[count].name,
+ rte_ixgbe_macsec_strings[i].name,
+ sizeof(xstats_names[count].name));
+ count++;
+ }
}
/* RX Priority Stats */
@@ -3544,7 +3552,8 @@ static int ixgbe_dev_xstats_get_names_by_id(
unsigned int limit)
{
if (!ids) {
- const unsigned int cnt_stats = ixgbe_xstats_calc_num();
+ struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ const unsigned int cnt_stats = ixgbe_xstats_calc_num(dev);
unsigned int stat, i, count;
if (xstats_names != NULL) {
@@ -3563,11 +3572,13 @@ static int ixgbe_dev_xstats_get_names_by_id(
}
/* MACsec Stats */
- for (i = 0; i < IXGBE_NB_MACSEC_STATS; i++) {
- strlcpy(xstats_names[count].name,
- rte_ixgbe_macsec_strings[i].name,
- sizeof(xstats_names[count].name));
- count++;
+ if (hw->mac.type != ixgbe_mac_E610) {
+ for (i = 0; i < IXGBE_NB_MACSEC_STATS; i++) {
+ strlcpy(xstats_names[count].name,
+ rte_ixgbe_macsec_strings[i].name,
+ sizeof(xstats_names[count].name));
+ count++;
+ }
}
/* RX Priority Stats */
@@ -3643,7 +3654,7 @@ ixgbe_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats,
uint64_t total_missed_rx, total_qbrc, total_qprc, total_qprdc;
unsigned i, stat, count = 0;
- count = ixgbe_xstats_calc_num();
+ count = ixgbe_xstats_calc_num(dev);
if (n < count)
return count;
@@ -3672,11 +3683,13 @@ ixgbe_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats,
}
/* MACsec Stats */
- for (i = 0; i < IXGBE_NB_MACSEC_STATS; i++) {
- xstats[count].value = *(uint64_t *)(((char *)macsec_stats) +
- rte_ixgbe_macsec_strings[i].offset);
- xstats[count].id = count;
- count++;
+ if (hw->mac.type != ixgbe_mac_E610) {
+ for (i = 0; i < IXGBE_NB_MACSEC_STATS; i++) {
+ xstats[count].value = *(uint64_t *)(((char *)macsec_stats) +
+ rte_ixgbe_macsec_strings[i].offset);
+ xstats[count].id = count;
+ count++;
+ }
}
/* RX Priority Stats */
@@ -3719,7 +3732,7 @@ ixgbe_dev_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
uint64_t total_missed_rx, total_qbrc, total_qprc, total_qprdc;
unsigned int i, stat, count = 0;
- count = ixgbe_xstats_calc_num();
+ count = ixgbe_xstats_calc_num(dev);
if (!ids && n < count)
return count;
@@ -3803,7 +3816,7 @@ ixgbe_dev_xstats_reset(struct rte_eth_dev *dev)
IXGBE_DEV_PRIVATE_TO_MACSEC_STATS(
dev->data->dev_private);
- unsigned count = ixgbe_xstats_calc_num();
+ unsigned int count = ixgbe_xstats_calc_num(dev);
/* HW registers are cleared on read */
ixgbe_dev_xstats_get(dev, NULL, count);
--
2.34.1
next prev parent reply other threads:[~2025-06-10 6:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-20 1:13 [PATCH] net/intel: fix ixgbe get macsec stats Kaiwen Deng
2025-05-20 7:24 ` Xu, HailinX
2025-06-10 5:42 ` Kaiwen Deng [this message]
2025-06-10 11:12 ` [PATCH] net/ixgbe: fix unexpected data in the xstats info Bruce Richardson
2025-06-10 11:15 ` Bruce Richardson
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=20250610054225.988840-1-kaiwenx.deng@intel.com \
--to=kaiwenx.deng@intel.com \
--cc=anatoly.burakov@intel.com \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
--cc=tiwei.bie@intel.com \
--cc=vladimir.medvedkin@intel.com \
--cc=wenzhuo.lu@intel.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).