[PATCH v1 11/26] net: dsa: microchip: ksz8: ksz8_fdb_dump: dump static MAC table

From: Oleksij Rempel
Date: Mon Nov 28 2022 - 07:00:59 EST


Extend fdb_dump with static MAC table dump.

Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
---
drivers/net/dsa/microchip/ksz8795.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c
index 308b46bb2ce5..392f6cb1f706 100644
--- a/drivers/net/dsa/microchip/ksz8795.c
+++ b/drivers/net/dsa/microchip/ksz8795.c
@@ -952,6 +952,23 @@ int ksz8_fdb_dump(struct ksz_device *dev, int port,
u16 i, entries = 0;
int ret;

+ for (i = 0; i < dev->info->num_statics; i++) {
+ struct alu_struct alu;
+
+ ret = ksz8_r_sta_mac_table(dev, i, &alu);
+ if (ret == -ENXIO)
+ continue;
+ if (ret)
+ return ret;
+
+ if (!(alu.port_forward & BIT(port)))
+ continue;
+
+ ret = cb(alu.mac, 0, true, data);
+ if (ret)
+ return ret;
+ }
+
for (i = 0; i < KSZ8_DYN_MAC_ENTRIES; i++) {
u8 mac[ETH_ALEN];
u8 src_port;
--
2.30.2