net: dsa: microchip: add support for fdb and mdb management
Subsystems (5)
PATCH v12 12/13 net: dsa: microchip: add support for fdb and mdb management
From: Prasanna Vengateshan <[email protected]>
Support for fdb_add, mdb_add, fdb_del, mdb_del and fdb_dump operations. ALU1 and ALU2 are used for fdb operations.
fdb_add: find any existing entries and update the port map. if ALU1 write is failed and attempt to write ALU2.
If ALU2 is also failed then exit. Clear WRITE_FAIL for both ALU1 & ALU2.
fdb_del: find the matching entry and clear the respective port in the port map by writing the ALU tables
fdb_dump: read and dump 2 ALUs up to last entry. ALU_START bit is used to find the last entry. If the read is timed out, then pass the error message.
mdb_add: Find the empty slot in ALU and update the port map & mac address by writing the ALU
mdb_del: find the matching entry and delete the respective port in port map by writing the ALU
For MAC address, could not use upper_32_bits() & lower_32_bits() as per Vladimir proposal since it gets accessed in terms of 16bits. I tried to have common API to get 16bits based on index but shifting seems to be straight-forward.
--- drivers/net/dsa/microchip/lan937x_dev.h | 19 + drivers/net/dsa/microchip/lan937x_main.c | 515 +++++++++++++++++++++++ 2 files changed, 534 insertions(+)
drivers/net/dsa/microchip/lan937x_dev.h +19 -0
@@ -85,6 +85,25 @@ enum lan937x_mib_list { lan937x_mib_tx_discard, }; +struct lan_alu_struct { +/* entry 1 */ +u32 is_static:1 ; +u32 is_src_filter:1 ; +u32 is_dst_filter:1 ; +u32 prio_age:3 ; +u32 _reserv_0_1:23 ; +u32 mstp:3 ; +/* entry 2 */ +u32 is_override:1 ; +u32 is_use_fid:1 ; +u32 _reserv_1_1:22 ; +u32 port_forward:8 ; +/* entry 3 & 4*/ +u32 _reserv_2_1:9 ; +u32 fid:7 ; +u8 mac[ETH_ALEN ]; +}; +extern const struct dsa_switch_ops lan937x_switch_ops;extern const struct ksz_dev_ops lan937x_dev_ops;extern const struct mib_names lan937x_mib_names[];
drivers/net/dsa/microchip/lan937x_main.c +515 -0
533 lines not on this page · raw message
Signature · 1 line
2.33.0