net: dsa: ocelot: the MAC table on Felix is twice as large
authorVladimir Oltean <vladimir.oltean@nxp.com>
Sun, 3 May 2020 22:20:26 +0000 (01:20 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 May 2020 06:22:00 +0000 (08:22 +0200)
[ Upstream commit 21ce7f3e16fbf89faaf149cfe0f730edfc553914 ]

When running 'bridge fdb dump' on Felix, sometimes learnt and static MAC
addresses would appear, sometimes they wouldn't.

Turns out, the MAC table has 4096 entries on VSC7514 (Ocelot) and 8192
entries on VSC9959 (Felix), so the existing code from the Ocelot common
library only dumped half of Felix's MAC table. They are both organized
as a 4-way set-associative TCAM, so we just need a single variable
indicating the correct number of rows.

Fixes: 56051948773e ("net: dsa: ocelot: add driver for Felix switch family")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/dsa/ocelot/felix.c
drivers/net/dsa/ocelot/felix.h
drivers/net/dsa/ocelot/felix_vsc9959.c
drivers/net/ethernet/mscc/ocelot.c
drivers/net/ethernet/mscc/ocelot_regs.c
include/soc/mscc/ocelot.h

index 9e895ab586d5acb4042bf19b706cd21b83b00657..a7780c06fa65b53a995f5878ada344f0edf0e64d 100644 (file)
@@ -397,6 +397,7 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports)
        ocelot->stats_layout    = felix->info->stats_layout;
        ocelot->num_stats       = felix->info->num_stats;
        ocelot->shared_queue_sz = felix->info->shared_queue_sz;
+       ocelot->num_mact_rows   = felix->info->num_mact_rows;
        ocelot->ops             = felix->info->ops;
 
        port_phy_modes = kcalloc(num_phys_ports, sizeof(phy_interface_t),
index 3a7580015b621b21dea0a5fcffdc3e7a300a8e87..8771d40324f101220423be38ed7a953149083cb1 100644 (file)
@@ -15,6 +15,7 @@ struct felix_info {
        const u32 *const                *map;
        const struct ocelot_ops         *ops;
        int                             shared_queue_sz;
+       int                             num_mact_rows;
        const struct ocelot_stat_layout *stats_layout;
        unsigned int                    num_stats;
        int                             num_ports;
index 2c812b481778c32ba9b7364d3e726039cf4e6bd3..edc1a67c002b6f135117bbefc6896df2f7affa5a 100644 (file)
@@ -1090,6 +1090,7 @@ struct felix_info felix_info_vsc9959 = {
        .stats_layout           = vsc9959_stats_layout,
        .num_stats              = ARRAY_SIZE(vsc9959_stats_layout),
        .shared_queue_sz        = 128 * 1024,
+       .num_mact_rows          = 2048,
        .num_ports              = 6,
        .switch_pci_bar         = 4,
        .imdio_pci_bar          = 0,
index b14286dc49fb5feb14a575e7b21ff7a1326c4a22..33ef8690eafe927d7edd1b67eafc69147cb4ab5b 100644 (file)
@@ -1016,10 +1016,8 @@ int ocelot_fdb_dump(struct ocelot *ocelot, int port,
 {
        int i, j;
 
-       /* Loop through all the mac tables entries. There are 1024 rows of 4
-        * entries.
-        */
-       for (i = 0; i < 1024; i++) {
+       /* Loop through all the mac tables entries. */
+       for (i = 0; i < ocelot->num_mact_rows; i++) {
                for (j = 0; j < 4; j++) {
                        struct ocelot_mact_entry entry;
                        bool is_static;
index b88b5899b22736fdc44f4dc7da04453282012d95..7d4fd1b6addaf2aba2e662614d275a1e38580c9f 100644 (file)
@@ -431,6 +431,7 @@ int ocelot_chip_init(struct ocelot *ocelot, const struct ocelot_ops *ops)
        ocelot->stats_layout = ocelot_stats_layout;
        ocelot->num_stats = ARRAY_SIZE(ocelot_stats_layout);
        ocelot->shared_queue_sz = 224 * 1024;
+       ocelot->num_mact_rows = 1024;
        ocelot->ops = ops;
 
        ret = ocelot_regfields_init(ocelot, ocelot_regfields);
index f8e1955c86f14c805f0fd7bfdbccceb87b460643..7b5382e10bd2974b73409dc52bce1c74db0aa487 100644 (file)
@@ -437,6 +437,7 @@ struct ocelot {
        unsigned int                    num_stats;
 
        int                             shared_queue_sz;
+       int                             num_mact_rows;
 
        struct net_device               *hw_bridge_dev;
        u16                             bridge_mask;