mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-25 08:21:14 +00:00
48 lines
1.7 KiB
Diff
48 lines
1.7 KiB
Diff
|
From 61e9b19f6e6174afa7540f0b468a69bc940b91d4 Mon Sep 17 00:00:00 2001
|
||
|
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||
|
Date: Mon, 1 Aug 2022 21:23:49 +0200
|
||
|
Subject: [PATCH 738/768] net: dsa: lantiq_gswip: Consistently use macros for
|
||
|
the mac bridge table
|
||
|
|
||
|
Introduce a new GSWIP_TABLE_MAC_BRIDGE_PORT macro and use it throughout
|
||
|
the driver. Also update GSWIP_TABLE_MAC_BRIDGE_STATIC to use the BIT()
|
||
|
macro. This makes the driver code easier to understand.
|
||
|
|
||
|
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||
|
---
|
||
|
drivers/net/dsa/lantiq_gswip.c | 9 ++++++---
|
||
|
1 file changed, 6 insertions(+), 3 deletions(-)
|
||
|
|
||
|
--- a/drivers/net/dsa/lantiq_gswip.c
|
||
|
+++ b/drivers/net/dsa/lantiq_gswip.c
|
||
|
@@ -236,7 +236,8 @@
|
||
|
#define GSWIP_TABLE_ACTIVE_VLAN 0x01
|
||
|
#define GSWIP_TABLE_VLAN_MAPPING 0x02
|
||
|
#define GSWIP_TABLE_MAC_BRIDGE 0x0b
|
||
|
-#define GSWIP_TABLE_MAC_BRIDGE_STATIC 0x01 /* Static not, aging entry */
|
||
|
+#define GSWIP_TABLE_MAC_BRIDGE_STATIC BIT(0) /* Static not, aging entry */
|
||
|
+#define GSWIP_TABLE_MAC_BRIDGE_PORT GENMASK(7, 4) /* Port on learned entries */
|
||
|
|
||
|
#define XRX200_GPHY_FW_ALIGN (16 * 1024)
|
||
|
|
||
|
@@ -1300,7 +1301,8 @@ static void gswip_port_fast_age(struct d
|
||
|
if (mac_bridge.val[1] & GSWIP_TABLE_MAC_BRIDGE_STATIC)
|
||
|
continue;
|
||
|
|
||
|
- if (((mac_bridge.val[0] & GENMASK(7, 4)) >> 4) != port)
|
||
|
+ if (port != FIELD_GET(GSWIP_TABLE_MAC_BRIDGE_PORT,
|
||
|
+ mac_bridge.val[0]))
|
||
|
continue;
|
||
|
|
||
|
mac_bridge.valid = false;
|
||
|
@@ -1438,7 +1440,8 @@ static int gswip_port_fdb_dump(struct ds
|
||
|
return err;
|
||
|
}
|
||
|
} else {
|
||
|
- if (((mac_bridge.val[0] & GENMASK(7, 4)) >> 4) == port) {
|
||
|
+ if (port == FIELD_GET(GSWIP_TABLE_MAC_BRIDGE_PORT,
|
||
|
+ mac_bridge.val[0])) {
|
||
|
err = cb(addr, 0, false, data);
|
||
|
if (err)
|
||
|
return err;
|