]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
net: dsa: microchip: ksz8: fix ksz8_fdb_dump()
authorOleksij Rempel <o.rempel@pengutronix.de>
Fri, 24 Mar 2023 08:06:03 +0000 (09:06 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 25 Mar 2023 11:17:32 +0000 (11:17 +0000)
Before this patch, the ksz8_fdb_dump() function had several issues, such
as uninitialized variables and incorrect usage of source port as a bit
mask. These problems caused inaccurate reporting of vid information and
port assignment in the bridge fdb.

Fixes: e587be759e6e ("net: dsa: microchip: update fdb add/del/dump in ksz_common")
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Acked-by: Arun Ramadoss <arun.ramadoss@microchip.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/microchip/ksz8795.c

index 003b0ac2854c97c5c9f4c8c84ca20c642dab1259..3fffd5da8d3b0b9da74756824952d1c2a4616879 100644 (file)
@@ -958,15 +958,14 @@ int ksz8_fdb_dump(struct ksz_device *dev, int port,
        u16 entries = 0;
        u8 timestamp = 0;
        u8 fid;
-       u8 member;
-       struct alu_struct alu;
+       u8 src_port;
+       u8 mac[ETH_ALEN];
 
        do {
-               alu.is_static = false;
-               ret = ksz8_r_dyn_mac_table(dev, i, alu.mac, &fid, &member,
+               ret = ksz8_r_dyn_mac_table(dev, i, mac, &fid, &src_port,
                                           &timestamp, &entries);
-               if (!ret && (member & BIT(port))) {
-                       ret = cb(alu.mac, alu.fid, alu.is_static, data);
+               if (!ret && port == src_port) {
+                       ret = cb(mac, fid, false, data);
                        if (ret)
                                break;
                }