mirror of
git://git.openwrt.org/openwrt/openwrt.git
synced 2025-12-06 12:44:00 -05:00
Replace pending b53 fixes patches with the accepted ones from net-next for linux v6.19. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
121 lines
4.9 KiB
Diff
121 lines
4.9 KiB
Diff
From 3b08863469aa6028ac7c3120966f4e2f6051cf6b Mon Sep 17 00:00:00 2001
|
|
From: Jonas Gorski <jonas.gorski@gmail.com>
|
|
Date: Fri, 28 Nov 2025 09:06:23 +0100
|
|
Subject: [PATCH] net: dsa: b53: fix BCM5325/65 ARL entry multicast port masks
|
|
|
|
We currently use the mask 0xf for writing and reading b53_entry::port,
|
|
but this is only correct for unicast ARL entries. Multicast ARL entries
|
|
use a bitmask, and 0xf is not enough space for ports > 3, which includes
|
|
the CPU port.
|
|
|
|
So extend the mask accordingly to also fit port 4 (bit 4) and MII (bit
|
|
5). According to the datasheet the multicast port mask is [60:48],
|
|
making it 12 bit wide, but bits 60-55 are reserved anyway, and collide
|
|
with the priority field at [60:59], so I am not sure if this is valid.
|
|
Therefore leave it at the actual used range, [53:48].
|
|
|
|
The ARL search result register differs a bit, and there the mask is only
|
|
[52:48], so only spanning the user ports. The MII port bit is
|
|
contained in the Search Result Extension register. So create a separate
|
|
search result parse function that properly handles this.
|
|
|
|
Fixes: c45655386e53 ("net: dsa: b53: add support for FDB operations on 5325/5365")
|
|
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
|
|
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
|
|
Link: https://patch.msgid.link/20251128080625.27181-6-jonas.gorski@gmail.com
|
|
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
|
---
|
|
drivers/net/dsa/b53/b53_common.c | 4 +++-
|
|
drivers/net/dsa/b53/b53_priv.h | 25 +++++++++++++++++++++----
|
|
drivers/net/dsa/b53/b53_regs.h | 8 +++++++-
|
|
3 files changed, 31 insertions(+), 6 deletions(-)
|
|
|
|
--- a/drivers/net/dsa/b53/b53_common.c
|
|
+++ b/drivers/net/dsa/b53/b53_common.c
|
|
@@ -2099,10 +2099,12 @@ static void b53_arl_search_read_25(struc
|
|
struct b53_arl_entry *ent)
|
|
{
|
|
u64 mac_vid;
|
|
+ u8 ext;
|
|
|
|
+ b53_read8(dev, B53_ARLIO_PAGE, B53_ARL_SRCH_RSLT_EXT_25, &ext);
|
|
b53_read64(dev, B53_ARLIO_PAGE, B53_ARL_SRCH_RSTL_0_MACVID_25,
|
|
&mac_vid);
|
|
- b53_arl_to_entry_25(ent, mac_vid);
|
|
+ b53_arl_search_to_entry_25(ent, mac_vid, ext);
|
|
}
|
|
|
|
static void b53_arl_search_read_89(struct b53_device *dev, u8 idx,
|
|
--- a/drivers/net/dsa/b53/b53_priv.h
|
|
+++ b/drivers/net/dsa/b53/b53_priv.h
|
|
@@ -348,8 +348,8 @@ static inline void b53_arl_to_entry_25(s
|
|
ent->is_age = !!(mac_vid & ARLTBL_AGE_25);
|
|
ent->is_static = !!(mac_vid & ARLTBL_STATIC_25);
|
|
u64_to_ether_addr(mac_vid, ent->mac);
|
|
- ent->port = (mac_vid >> ARLTBL_DATA_PORT_ID_S_25) &
|
|
- ARLTBL_DATA_PORT_ID_MASK_25;
|
|
+ ent->port = (mac_vid & ARLTBL_DATA_PORT_ID_MASK_25) >>
|
|
+ ARLTBL_DATA_PORT_ID_S_25;
|
|
if (is_unicast_ether_addr(ent->mac) && ent->port == B53_CPU_PORT)
|
|
ent->port = B53_CPU_PORT_25;
|
|
ent->vid = (mac_vid >> ARLTBL_VID_S_65) & ARLTBL_VID_MASK_25;
|
|
@@ -388,8 +388,8 @@ static inline void b53_arl_from_entry_25
|
|
if (is_unicast_ether_addr(ent->mac) && ent->port == B53_CPU_PORT_25)
|
|
*mac_vid |= (u64)B53_CPU_PORT << ARLTBL_DATA_PORT_ID_S_25;
|
|
else
|
|
- *mac_vid |= (u64)(ent->port & ARLTBL_DATA_PORT_ID_MASK_25) <<
|
|
- ARLTBL_DATA_PORT_ID_S_25;
|
|
+ *mac_vid |= ((u64)ent->port << ARLTBL_DATA_PORT_ID_S_25) &
|
|
+ ARLTBL_DATA_PORT_ID_MASK_25;
|
|
*mac_vid |= (u64)(ent->vid & ARLTBL_VID_MASK_25) <<
|
|
ARLTBL_VID_S_65;
|
|
if (ent->is_valid)
|
|
@@ -414,6 +414,23 @@ static inline void b53_arl_from_entry_89
|
|
*fwd_entry |= ARLTBL_AGE_89;
|
|
}
|
|
|
|
+static inline void b53_arl_search_to_entry_25(struct b53_arl_entry *ent,
|
|
+ u64 mac_vid, u8 ext)
|
|
+{
|
|
+ memset(ent, 0, sizeof(*ent));
|
|
+ ent->is_valid = !!(mac_vid & ARLTBL_VALID_25);
|
|
+ ent->is_age = !!(mac_vid & ARLTBL_AGE_25);
|
|
+ ent->is_static = !!(mac_vid & ARLTBL_STATIC_25);
|
|
+ u64_to_ether_addr(mac_vid, ent->mac);
|
|
+ ent->vid = (mac_vid >> ARLTBL_VID_S_65) & ARLTBL_VID_MASK_25;
|
|
+ ent->port = (mac_vid & ARL_SRCH_RSLT_PORT_ID_MASK_25) >>
|
|
+ ARL_SRCH_RSLT_PORT_ID_S_25;
|
|
+ if (is_multicast_ether_addr(ent->mac) && (ext & ARL_SRCH_RSLT_EXT_MC_MII))
|
|
+ ent->port |= BIT(B53_CPU_PORT_25);
|
|
+ else if (!is_multicast_ether_addr(ent->mac) && ent->port == B53_CPU_PORT)
|
|
+ ent->port = B53_CPU_PORT_25;
|
|
+}
|
|
+
|
|
static inline void b53_arl_search_to_entry_63xx(struct b53_arl_entry *ent,
|
|
u64 mac_vid, u16 fwd_entry)
|
|
{
|
|
--- a/drivers/net/dsa/b53/b53_regs.h
|
|
+++ b/drivers/net/dsa/b53/b53_regs.h
|
|
@@ -328,7 +328,7 @@
|
|
#define ARLTBL_VID_MASK_25 0xff
|
|
#define ARLTBL_VID_MASK 0xfff
|
|
#define ARLTBL_DATA_PORT_ID_S_25 48
|
|
-#define ARLTBL_DATA_PORT_ID_MASK_25 0xf
|
|
+#define ARLTBL_DATA_PORT_ID_MASK_25 GENMASK_ULL(53, 48)
|
|
#define ARLTBL_VID_S_65 53
|
|
#define ARLTBL_AGE_25 BIT_ULL(61)
|
|
#define ARLTBL_STATIC_25 BIT_ULL(62)
|
|
@@ -374,6 +374,12 @@
|
|
|
|
/* Single register search result on 5325/5365 */
|
|
#define B53_ARL_SRCH_RSTL_0_MACVID_25 0x24
|
|
+#define ARL_SRCH_RSLT_PORT_ID_S_25 48
|
|
+#define ARL_SRCH_RSLT_PORT_ID_MASK_25 GENMASK_ULL(52, 48)
|
|
+
|
|
+/* BCM5325/5365 Search result extend register (8 bit) */
|
|
+#define B53_ARL_SRCH_RSLT_EXT_25 0x2c
|
|
+#define ARL_SRCH_RSLT_EXT_MC_MII BIT(2)
|
|
|
|
/* ARL Search Data Result (32 bit) */
|
|
#define B53_ARL_SRCH_RSTL_0 0x68
|