FDB fixes for Felix and Ocelot switches
Subsystems (4)
Vladimir Oltean
maintainercover FDB fixes for Felix and Ocelot switches
From: Vladimir Oltean <[email protected]>
This series fixes the following problems:
- Dynamically learnt addresses never expiring (neither for Ocelot nor for Felix)
- Half of the FDB not visible in 'bridge fdb show' (for Felix only)
Vladimir Oltean (2):
net: dsa: ocelot: the MAC table on Felix is twice as large
net: mscc: ocelot: ANA_AUTOAGE_AGE_PERIOD holds a value in seconds,
not ms
drivers/net/dsa/ocelot/felix.c | 1 + drivers/net/dsa/ocelot/felix.h | 1 + drivers/net/dsa/ocelot/felix_vsc9959.c | 1 + drivers/net/ethernet/mscc/ocelot.c | 17 +++++++++++------ drivers/net/ethernet/mscc/ocelot_regs.c | 1 + include/soc/mscc/ocelot.h | 1 + 6 files changed, 16 insertions(+), 6 deletions(-)
Signature · 1 line
2.17.1
Vladimir Oltean
maintainerPATCH 1/2 net: dsa: ocelot: the MAC table on Felix is twice as large
From: Vladimir Oltean <[email protected]>
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.
--- drivers/net/dsa/ocelot/felix.c | 1 + drivers/net/dsa/ocelot/felix.h | 1 + drivers/net/dsa/ocelot/felix_vsc9959.c | 1 + drivers/net/ethernet/mscc/ocelot.c | 6 ++---- drivers/net/ethernet/mscc/ocelot_regs.c | 1 + include/soc/mscc/ocelot.h | 1 + 6 files changed, 7 insertions(+), 4 deletions(-)
drivers/net/dsa/ocelot/felix.c +1 -0
@@ -401,6 +401,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->vcap = felix->info->vcap; ocelot->ops = felix->info->ops;
drivers/net/dsa/ocelot/felix.h +1 -0
@@ -16,6 +16,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;
drivers/net/dsa/ocelot/felix_vsc9959.c +1 -0
@@ -1310,6 +1310,7 @@ struct felix_info felix_info_vsc9959 = { .num_stats = ARRAY_SIZE(vsc9959_stats_layout), .vcap = vsc9959_vcap_props, .shared_queue_sz = 128 * 1024, + .num_mact_rows = 2048, .num_ports = 6, .switch_pci_bar = 4, .imdio_pci_bar = 0,
drivers/net/ethernet/mscc/ocelot.c +2 -4
@@ -1038,10 +1038,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;
drivers/net/ethernet/mscc/ocelot_regs.c +1 -0
@@ -436,6 +436,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);
include/soc/mscc/ocelot.h +1 -0
@@ -513,6 +513,7 @@ struct ocelot {unsigned int num_stats;int shared_queue_sz; +int num_mact_rows;struct net_device *hw_bridge_dev;u16 bridge_mask;
Signature · 1 line
2.17.1
Re: [PATCH net 1/2] net: dsa: ocelot: the MAC table on Felix is twice as large
Quoted 5 lines · Vladimir Oltean
From: Vladimir Oltean <[email protected]>
When running 'bridge fdb dump' on Felix, sometimes learnt and static MAC addresses would appear, sometimes they wouldn't.
Quoted 8 lines
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 <[email protected]>
Signature · 1 line
Florian
Vladimir Oltean
maintainerPATCH 2/2 net: mscc: ocelot: ANA_AUTOAGE_AGE_PERIOD holds a value in seconds, not ms
In reply to Vladimir OlteanFrom: Vladimir Oltean <[email protected]>
One may notice that automatically-learnt entries 'never' expire, even though the bridge configures the address age period at 300 seconds.
Actually the value written to hardware corresponds to a time interval 1000 times higher than intended, i.e. 83 hours.
--- drivers/net/ethernet/mscc/ocelot.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/net/ethernet/mscc/ocelot.c +9 -2
@@ -1464,8 +1464,15 @@ static void ocelot_port_attr_stp_state_set(struct ocelot *ocelot, int port,void ocelot_set_ageing_time (struct ocelot *ocelot,unsigned int msecs) { -ocelot_write (ocelot,ANA_AUTOAGE_AGE_PERIOD (msecs /2 ), -ANA_AUTOAGE ); +unsigned int age_period =ANA_AUTOAGE_AGE_PERIOD (msecs /2000 ); + +/* Setting AGE_PERIOD to zero effectively disables automatic aging, +* which is clearly not what our intention is. So avoid that. +*/ +if (!age_period) + age_period =1 ; + +ocelot_rmw (ocelot, age_period,ANA_AUTOAGE_AGE_PERIOD_M ,ANA_AUTOAGE ); }EXPORT_SYMBOL (ocelot_set_ageing_time);
Signature · 1 line
2.17.1
Re: [PATCH net 2/2] net: mscc: ocelot: ANA_AUTOAGE_AGE_PERIOD holds a value in seconds, not ms
Quoted 10 lines · Vladimir Oltean
From: Vladimir Oltean <[email protected]>
One may notice that automatically-learnt entries 'never' expire, even though the bridge configures the address age period at 300 seconds.
Actually the value written to hardware corresponds to a time interval 1000 times higher than intended, i.e. 83 hours.
Fixes a556c76adc05 ("net: mscc: Add initial Ocelot switch support")Signed-off-by Vladimir Oltean <[email protected]>
Signature · 1 line
Florian
David Miller
maintainerFrom: Vladimir Oltean <[email protected]>
Date: Mon, 4 May 2020 01:20:25 +0300
Quoted 6 lines
From: Vladimir Oltean <[email protected]>
This series fixes the following problems:
- Dynamically learnt addresses never expiring (neither for Ocelot nor for Felix)
- Half of the FDB not visible in 'bridge fdb show' (for Felix only)
Series applied, thanks.