public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Yang <mmyangfl@gmail.com>
To: netdev@vger.kernel.org
Cc: David Yang <mmyangfl@gmail.com>, Andrew Lunn <andrew@lunn.ch>,
	Vladimir Oltean <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH net-next] net: dsa: yt921x: Fix MIB attribute table
Date: Tue, 18 Nov 2025 17:12:33 +0800	[thread overview]
Message-ID: <20251118091237.2208994-1-mmyangfl@gmail.com> (raw)

There are holes in the MIB field I didn't notice, leading to wrong
statistics after stress tests.

Signed-off-by: David Yang <mmyangfl@gmail.com>
---
 drivers/net/dsa/yt921x.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/net/dsa/yt921x.c b/drivers/net/dsa/yt921x.c
index 944988e29127..97fc6085f4d0 100644
--- a/drivers/net/dsa/yt921x.c
+++ b/drivers/net/dsa/yt921x.c
@@ -56,13 +56,13 @@ static const struct yt921x_mib_desc yt921x_mib_descs[] = {
 
 	MIB_DESC(1, 0x30, NULL),	/* RxPktSz1024To1518 */
 	MIB_DESC(1, 0x34, NULL),	/* RxPktSz1519ToMax */
-	MIB_DESC(2, 0x38, NULL),	/* RxGoodBytes */
-	/* 0x3c */
+	/* 0x38 unused */
+	MIB_DESC(2, 0x3c, NULL),	/* RxGoodBytes */
 
-	MIB_DESC(2, 0x40, "RxBadBytes"),
-	/* 0x44 */
-	MIB_DESC(2, 0x48, NULL),	/* RxOverSzErr */
-	/* 0x4c */
+	/* 0x40 */
+	MIB_DESC(2, 0x44, "RxBadBytes"),
+	/* 0x48 */
+	MIB_DESC(1, 0x4c, NULL),	/* RxOverSzErr */
 
 	MIB_DESC(1, 0x50, NULL),	/* RxDropped */
 	MIB_DESC(1, 0x54, NULL),	/* TxBroadcast */
@@ -79,10 +79,10 @@ static const struct yt921x_mib_desc yt921x_mib_descs[] = {
 	MIB_DESC(1, 0x78, NULL),	/* TxPktSz1024To1518 */
 	MIB_DESC(1, 0x7c, NULL),	/* TxPktSz1519ToMax */
 
-	MIB_DESC(2, 0x80, NULL),	/* TxGoodBytes */
-	/* 0x84 */
-	MIB_DESC(2, 0x88, NULL),	/* TxCollision */
-	/* 0x8c */
+	/* 0x80 unused */
+	MIB_DESC(2, 0x84, NULL),	/* TxGoodBytes */
+	/* 0x88 */
+	MIB_DESC(1, 0x8c, NULL),	/* TxCollision */
 
 	MIB_DESC(1, 0x90, NULL),	/* TxExcessiveCollistion */
 	MIB_DESC(1, 0x94, NULL),	/* TxMultipleCollision */
@@ -705,7 +705,7 @@ static int yt921x_read_mib(struct yt921x_priv *priv, int port)
 			res = yt921x_reg_read(priv, reg + 4, &val1);
 			if (res)
 				break;
-			val = ((u64)val0 << 32) | val1;
+			val = ((u64)val1 << 32) | val0;
 		}
 
 		WRITE_ONCE(*valp, val);
-- 
2.51.0


             reply	other threads:[~2025-11-18  9:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-18  9:12 David Yang [this message]
2025-11-18 14:10 ` [PATCH net-next] net: dsa: yt921x: Fix MIB attribute table Maxime Chevallier
2025-11-18 16:49 ` Andrew Lunn

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=20251118091237.2208994-1-mmyangfl@gmail.com \
    --to=mmyangfl@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.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