netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: dsa: yt921x: Fix MIB attribute table
@ 2025-11-18  9:12 David Yang
  2025-11-18 14:10 ` Maxime Chevallier
  2025-11-18 16:49 ` Andrew Lunn
  0 siblings, 2 replies; 3+ messages in thread
From: David Yang @ 2025-11-18  9:12 UTC (permalink / raw)
  To: netdev
  Cc: David Yang, Andrew Lunn, Vladimir Oltean, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-kernel

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: dsa: yt921x: Fix MIB attribute table
  2025-11-18  9:12 [PATCH net-next] net: dsa: yt921x: Fix MIB attribute table David Yang
@ 2025-11-18 14:10 ` Maxime Chevallier
  2025-11-18 16:49 ` Andrew Lunn
  1 sibling, 0 replies; 3+ messages in thread
From: Maxime Chevallier @ 2025-11-18 14:10 UTC (permalink / raw)
  To: David Yang, netdev
  Cc: Andrew Lunn, Vladimir Oltean, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, linux-kernel

Hi David,

On 18/11/2025 10:12, David Yang wrote:
> 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>

Even if this is fixing a patch that's still in net-next, you may want to
add a fixes tag, as this is a bugfix :/

Maxime

> ---
>  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);


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: dsa: yt921x: Fix MIB attribute table
  2025-11-18  9:12 [PATCH net-next] net: dsa: yt921x: Fix MIB attribute table David Yang
  2025-11-18 14:10 ` Maxime Chevallier
@ 2025-11-18 16:49 ` Andrew Lunn
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2025-11-18 16:49 UTC (permalink / raw)
  To: David Yang
  Cc: netdev, Vladimir Oltean, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, linux-kernel

On Tue, Nov 18, 2025 at 05:12:33PM +0800, David Yang wrote:
> 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 */

How is this described in the datasheet? Maybe add #defines for each
location? At could mean you don't need the comment, since the #define
documents what it is.

> @@ -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;

And that is a different thing, has nothing to do with holes. This
should be mentioned in the commit message.

    Andrew

---
pw-bot: cr

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-11-18 16:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-18  9:12 [PATCH net-next] net: dsa: yt921x: Fix MIB attribute table David Yang
2025-11-18 14:10 ` Maxime Chevallier
2025-11-18 16:49 ` Andrew Lunn

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).