public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: dsa: microchip: correct KSZ8795 static MAC table access
@ 2024-12-09 19:07 Jörg Sommer
  2024-12-09 19:11 ` kernel test robot
  2024-12-09 23:32 ` Sasha Levin
  0 siblings, 2 replies; 3+ messages in thread
From: Jörg Sommer @ 2024-12-09 19:07 UTC (permalink / raw)
  To: stable; +Cc: netdev, Tristram Ha, Michael Grzeschik

[Backport of 4bdf79d686b49ac49373b36466acfb93972c7d7c to v5.15]

The rewrite in 9f73e11250fb3948a8599d72318951d5e93b1eaf contained some
mistakes they where fixed with 4bdf79d686b49ac49373b36466acfb93972c7d7c in
master. The code in 4bdf to support the bit shift is only required for
KSZ8795, because support for KSZ8794 and KSZ8765 does not exist in v5.15.

Signed-off-by: Jörg Sommer <joerg@jo-so.de>
Cc: Tristram Ha <Tristram.Ha@microchip.com>
Cc: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
 drivers/net/dsa/microchip/ksz8795.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c
index c5142f86a3c7..ef88e26aedf2 100644
--- a/drivers/net/dsa/microchip/ksz8795.c
+++ b/drivers/net/dsa/microchip/ksz8795.c
@@ -25,6 +25,8 @@
 #include "ksz8795_reg.h"
 #include "ksz8.h"
 
+#define KSZ8795_CHIP_ID         0x09
+
 static const u8 ksz8795_regs[] = {
 	[REG_IND_CTRL_0]		= 0x6E,
 	[REG_IND_DATA_8]		= 0x70,
@@ -52,13 +54,13 @@ static const u32 ksz8795_masks[] = {
 	[STATIC_MAC_TABLE_VALID]	= BIT(21),
 	[STATIC_MAC_TABLE_USE_FID]	= BIT(23),
 	[STATIC_MAC_TABLE_FID]		= GENMASK(30, 24),
-	[STATIC_MAC_TABLE_OVERRIDE]	= BIT(26),
-	[STATIC_MAC_TABLE_FWD_PORTS]	= GENMASK(24, 20),
+	[STATIC_MAC_TABLE_OVERRIDE]	= BIT(22),
+	[STATIC_MAC_TABLE_FWD_PORTS]	= GENMASK(20, 16),
 	[DYNAMIC_MAC_TABLE_ENTRIES_H]	= GENMASK(6, 0),
-	[DYNAMIC_MAC_TABLE_MAC_EMPTY]	= BIT(8),
+	[DYNAMIC_MAC_TABLE_MAC_EMPTY]	= BIT(7),
 	[DYNAMIC_MAC_TABLE_NOT_READY]	= BIT(7),
 	[DYNAMIC_MAC_TABLE_ENTRIES]	= GENMASK(31, 29),
-	[DYNAMIC_MAC_TABLE_FID]		= GENMASK(26, 20),
+	[DYNAMIC_MAC_TABLE_FID]		= GENMASK(22, 16),
 	[DYNAMIC_MAC_TABLE_SRC_PORT]	= GENMASK(26, 24),
 	[DYNAMIC_MAC_TABLE_TIMESTAMP]	= GENMASK(28, 27),
 };
@@ -601,7 +603,13 @@ static int ksz8_r_sta_mac_table(struct ksz_device *dev, u16 addr,
 				shifts[STATIC_MAC_FWD_PORTS];
 		alu->is_override =
 			(data_hi & masks[STATIC_MAC_TABLE_OVERRIDE]) ? 1 : 0;
-		data_hi >>= 1;
+
+		/* KSZ8795 family switches have STATIC_MAC_TABLE_USE_FID and
+		 * STATIC_MAC_TABLE_FID definitions off by 1 when doing read on the
+		 * static MAC table compared to doing write.
+		 */
+		if (dev->chip_id == KSZ8795_CHIP_ID)
+			data_hi >>= 1;
 		alu->is_static = true;
 		alu->is_use_fid =
 			(data_hi & masks[STATIC_MAC_TABLE_USE_FID]) ? 1 : 0;
-- 
2.45.2


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

* Re: [PATCH] net: dsa: microchip: correct KSZ8795 static MAC table access
  2024-12-09 19:07 [PATCH] net: dsa: microchip: correct KSZ8795 static MAC table access Jörg Sommer
@ 2024-12-09 19:11 ` kernel test robot
  2024-12-09 23:32 ` Sasha Levin
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2024-12-09 19:11 UTC (permalink / raw)
  To: Jörg Sommer; +Cc: stable, oe-kbuild-all

Hi,

Thanks for your patch.

FYI: kernel test robot notices the stable kernel rule is not satisfied.

The check is based on https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html#option-1

Rule: add the tag "Cc: stable@vger.kernel.org" in the sign-off area to have the patch automatically included in the stable tree.
Subject: [PATCH] net: dsa: microchip: correct KSZ8795 static MAC table access
Link: https://lore.kernel.org/stable/b4a802ae7dfac66efa5175313228f0ba2fc769ef.1733771269.git.joerg%40jo-so.de

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




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

* Re: [PATCH] net: dsa: microchip: correct KSZ8795 static MAC table access
  2024-12-09 19:07 [PATCH] net: dsa: microchip: correct KSZ8795 static MAC table access Jörg Sommer
  2024-12-09 19:11 ` kernel test robot
@ 2024-12-09 23:32 ` Sasha Levin
  1 sibling, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2024-12-09 23:32 UTC (permalink / raw)
  To: stable; +Cc: Jörg Sommer, Sasha Levin

[ Sasha's backport helper bot ]

Hi,

Found matching upstream commit: 4bdf79d686b49ac49373b36466acfb93972c7d7c

WARNING: Author mismatch between patch and found commit:
Backport author: =?UTF-8?q?J=C3=B6rg=20Sommer?= <joerg@jo-so.de>
Commit author: Tristram Ha <Tristram.Ha@microchip.com>


Status in newer kernel trees:
6.12.y | Present (exact SHA1)

Note: The patch differs from the upstream commit:
---
Failed to apply patch cleanly, falling back to interdiff...
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.12.y       |  Failed     |  N/A       |
| stable/linux-6.6.y        |  Failed     |  N/A       |
| stable/linux-6.1.y        |  Failed     |  N/A       |
| stable/linux-5.15.y       |  Success    |  Success   |
| stable/linux-5.10.y       |  Failed     |  N/A       |
| stable/linux-5.4.y        |  Failed     |  N/A       |

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

end of thread, other threads:[~2024-12-09 23:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-09 19:07 [PATCH] net: dsa: microchip: correct KSZ8795 static MAC table access Jörg Sommer
2024-12-09 19:11 ` kernel test robot
2024-12-09 23:32 ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox