Skip to content

Commit 21ce7f3

Browse files
vladimirolteandavem330
authored andcommitted
net: dsa: ocelot: the MAC table on Felix is twice as large
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: 5605194 ("net: dsa: ocelot: add driver for Felix switch family") Signed-off-by: Vladimir Oltean <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0ba83aa commit 21ce7f3

File tree

6 files changed

+7
-4
lines changed

6 files changed

+7
-4
lines changed

drivers/net/dsa/ocelot/felix.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports)
400400
ocelot->stats_layout = felix->info->stats_layout;
401401
ocelot->num_stats = felix->info->num_stats;
402402
ocelot->shared_queue_sz = felix->info->shared_queue_sz;
403+
ocelot->num_mact_rows = felix->info->num_mact_rows;
403404
ocelot->vcap_is2_keys = felix->info->vcap_is2_keys;
404405
ocelot->vcap_is2_actions= felix->info->vcap_is2_actions;
405406
ocelot->vcap = felix->info->vcap;

drivers/net/dsa/ocelot/felix.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ struct felix_info {
1515
const u32 *const *map;
1616
const struct ocelot_ops *ops;
1717
int shared_queue_sz;
18+
int num_mact_rows;
1819
const struct ocelot_stat_layout *stats_layout;
1920
unsigned int num_stats;
2021
int num_ports;

drivers/net/dsa/ocelot/felix_vsc9959.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,7 @@ struct felix_info felix_info_vsc9959 = {
12201220
.vcap_is2_actions = vsc9959_vcap_is2_actions,
12211221
.vcap = vsc9959_vcap_props,
12221222
.shared_queue_sz = 128 * 1024,
1223+
.num_mact_rows = 2048,
12231224
.num_ports = 6,
12241225
.switch_pci_bar = 4,
12251226
.imdio_pci_bar = 0,

drivers/net/ethernet/mscc/ocelot.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,10 +1031,8 @@ int ocelot_fdb_dump(struct ocelot *ocelot, int port,
10311031
{
10321032
int i, j;
10331033

1034-
/* Loop through all the mac tables entries. There are 1024 rows of 4
1035-
* entries.
1036-
*/
1037-
for (i = 0; i < 1024; i++) {
1034+
/* Loop through all the mac tables entries. */
1035+
for (i = 0; i < ocelot->num_mact_rows; i++) {
10381036
for (j = 0; j < 4; j++) {
10391037
struct ocelot_mact_entry entry;
10401038
bool is_static;

drivers/net/ethernet/mscc/ocelot_regs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ int ocelot_chip_init(struct ocelot *ocelot, const struct ocelot_ops *ops)
431431
ocelot->stats_layout = ocelot_stats_layout;
432432
ocelot->num_stats = ARRAY_SIZE(ocelot_stats_layout);
433433
ocelot->shared_queue_sz = 224 * 1024;
434+
ocelot->num_mact_rows = 1024;
434435
ocelot->ops = ops;
435436

436437
ret = ocelot_regfields_init(ocelot, ocelot_regfields);

include/soc/mscc/ocelot.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,7 @@ struct ocelot {
502502
unsigned int num_stats;
503503

504504
int shared_queue_sz;
505+
int num_mact_rows;
505506

506507
struct net_device *hw_bridge_dev;
507508
u16 bridge_mask;

0 commit comments

Comments
 (0)