Messages in this thread Patch in this message | | | From | Oleksij Rempel <> | Subject | [PATCH v1 02/26] net: dsa: microchip: ksz8: ksz8_fdb_dump: fix port validation and VID information | Date | Mon, 28 Nov 2022 12:59:34 +0100 |
| |
The ksz8_fdb_dump() has multiple issues: - struct alu_struct was used only to store MAC address. - port value was misinterpreted as a bit mask - Filter ID was attempted to use as VID. FID can be used to get VID, but currently it is not supported. - by the attempt to use FID, was used not initialized alu.fid...
Before this patch, "bridge fdb" command was providing random results, which are fixed by this patch: - random vid information - assignment to wrong port
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> --- drivers/net/dsa/microchip/ksz8795.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c index 003b0ac2854c..e0530bc3bec0 100644 --- a/drivers/net/dsa/microchip/ksz8795.c +++ b/drivers/net/dsa/microchip/ksz8795.c @@ -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, ×tamp, &entries); - if (!ret && (member & BIT(port))) { - ret = cb(alu.mac, alu.fid, alu.is_static, data); + if (!ret && port == src_port) { + ret = cb(mac, 0, false, data); if (ret) break; } -- 2.30.2
| |