aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/dsa/microchip/ksz_common.c
diff options
context:
space:
mode:
authorArkadi Sharshevsky <arkadis@mellanox.com>2017-08-06 09:15:49 -0400
committerDavid S. Miller <davem@davemloft.net>2017-08-07 17:48:48 -0400
commit2bedde1abbef5eec211308f0293dd7681b0513ec (patch)
treeace07f76bb5f82da40815297675d6e8a9a9a3c02 /drivers/net/dsa/microchip/ksz_common.c
parentdc0cbff3ff9fe331160c2be2b3f47564e247137d (diff)
net: dsa: Move FDB dump implementation inside DSA
>From all switchdev devices only DSA requires special FDB dump. This is due to lack of ability for syncing the hardware learned FDBs with the bridge. Due to this it is removed from switchdev and moved inside DSA. Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/microchip/ksz_common.c')
-rw-r--r--drivers/net/dsa/microchip/ksz_common.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index 4de9d90a4bb3..56cd6d365352 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -805,12 +805,11 @@ static void convert_alu(struct alu_struct *alu, u32 *alu_table)
805} 805}
806 806
807static int ksz_port_fdb_dump(struct dsa_switch *ds, int port, 807static int ksz_port_fdb_dump(struct dsa_switch *ds, int port,
808 struct switchdev_obj_port_fdb *fdb, 808 dsa_fdb_dump_cb_t *cb, void *data)
809 switchdev_obj_dump_cb_t *cb)
810{ 809{
811 struct ksz_device *dev = ds->priv; 810 struct ksz_device *dev = ds->priv;
812 int ret = 0; 811 int ret = 0;
813 u32 data; 812 u32 ksz_data;
814 u32 alu_table[4]; 813 u32 alu_table[4];
815 struct alu_struct alu; 814 struct alu_struct alu;
816 int timeout; 815 int timeout;
@@ -823,8 +822,8 @@ static int ksz_port_fdb_dump(struct dsa_switch *ds, int port,
823 do { 822 do {
824 timeout = 1000; 823 timeout = 1000;
825 do { 824 do {
826 ksz_read32(dev, REG_SW_ALU_CTRL__4, &data); 825 ksz_read32(dev, REG_SW_ALU_CTRL__4, &ksz_data);
827 if ((data & ALU_VALID) || !(data & ALU_START)) 826 if ((ksz_data & ALU_VALID) || !(ksz_data & ALU_START))
828 break; 827 break;
829 usleep_range(1, 10); 828 usleep_range(1, 10);
830 } while (timeout-- > 0); 829 } while (timeout-- > 0);
@@ -841,18 +840,11 @@ static int ksz_port_fdb_dump(struct dsa_switch *ds, int port,
841 convert_alu(&alu, alu_table); 840 convert_alu(&alu, alu_table);
842 841
843 if (alu.port_forward & BIT(port)) { 842 if (alu.port_forward & BIT(port)) {
844 fdb->vid = alu.fid; 843 ret = cb(alu.mac, alu.fid, alu.is_static, data);
845 if (alu.is_static)
846 fdb->ndm_state = NUD_NOARP;
847 else
848 fdb->ndm_state = NUD_REACHABLE;
849 ether_addr_copy(fdb->addr, alu.mac);
850
851 ret = cb(&fdb->obj);
852 if (ret) 844 if (ret)
853 goto exit; 845 goto exit;
854 } 846 }
855 } while (data & ALU_START); 847 } while (ksz_data & ALU_START);
856 848
857exit: 849exit:
858 850