Skip to content

Commit 7942602

Browse files
committed
Merge branch 'net-dsa-b53-minor-fdb-related-fixes'
Jonas Gorski says: ==================== net: dsa: b53: minor fdb related fixes While investigating and fixing/implenting proper ARL support for bcm63xx, I encountered multiple minor issues in the current ARL implementation: * The ARL multicast support was not properly enabled for older chips, and instead a potentially reserved bit was toggled. * While traversing the ARL table, "Search done" triggered one final entry which will be invalid for 4 ARL bin chips, and failed to stop the search on chips with only one result register. * For chips where we have only one result register, we only traversed at most half the maximum entries. I also had a fix for IVL_SVL_SELECT which is only valid for some chips, but since this would only have an effect for !vlan_enabled, and we always have that enabled, it isn't really worth fixing (and rather drop the !vlan_enabled paths). ==================== Link: https://patch.msgid.link/20251102100758.28352-1-jonas.gorski@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents c732119 + e57723f commit 7942602

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

drivers/net/dsa/b53/b53_common.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -371,11 +371,11 @@ static void b53_set_forwarding(struct b53_device *dev, int enable)
371371
* frames should be flooded or not.
372372
*/
373373
b53_read8(dev, B53_CTRL_PAGE, B53_IP_MULTICAST_CTRL, &mgmt);
374-
mgmt |= B53_UC_FWD_EN | B53_MC_FWD_EN | B53_IPMC_FWD_EN;
374+
mgmt |= B53_UC_FWD_EN | B53_MC_FWD_EN | B53_IP_MC;
375375
b53_write8(dev, B53_CTRL_PAGE, B53_IP_MULTICAST_CTRL, mgmt);
376376
} else {
377377
b53_read8(dev, B53_CTRL_PAGE, B53_IP_MULTICAST_CTRL, &mgmt);
378-
mgmt |= B53_IP_MCAST_25;
378+
mgmt |= B53_IP_MC;
379379
b53_write8(dev, B53_CTRL_PAGE, B53_IP_MULTICAST_CTRL, mgmt);
380380
}
381381
}
@@ -2037,7 +2037,7 @@ static int b53_arl_search_wait(struct b53_device *dev)
20372037
do {
20382038
b53_read8(dev, B53_ARLIO_PAGE, offset, &reg);
20392039
if (!(reg & ARL_SRCH_STDN))
2040-
return 0;
2040+
return -ENOENT;
20412041

20422042
if (reg & ARL_SRCH_VLID)
20432043
return 0;
@@ -2087,13 +2087,16 @@ static int b53_fdb_copy(int port, const struct b53_arl_entry *ent,
20872087
int b53_fdb_dump(struct dsa_switch *ds, int port,
20882088
dsa_fdb_dump_cb_t *cb, void *data)
20892089
{
2090+
unsigned int count = 0, results_per_hit = 1;
20902091
struct b53_device *priv = ds->priv;
20912092
struct b53_arl_entry results[2];
2092-
unsigned int count = 0;
20932093
u8 offset;
20942094
int ret;
20952095
u8 reg;
20962096

2097+
if (priv->num_arl_bins > 2)
2098+
results_per_hit = 2;
2099+
20972100
mutex_lock(&priv->arl_mutex);
20982101

20992102
if (is5325(priv) || is5365(priv))
@@ -2115,7 +2118,7 @@ int b53_fdb_dump(struct dsa_switch *ds, int port,
21152118
if (ret)
21162119
break;
21172120

2118-
if (priv->num_arl_bins > 2) {
2121+
if (results_per_hit == 2) {
21192122
b53_arl_search_rd(priv, 1, &results[1]);
21202123
ret = b53_fdb_copy(port, &results[1], cb, data);
21212124
if (ret)
@@ -2125,7 +2128,7 @@ int b53_fdb_dump(struct dsa_switch *ds, int port,
21252128
break;
21262129
}
21272130

2128-
} while (count++ < b53_max_arl_entries(priv) / 2);
2131+
} while (count++ < b53_max_arl_entries(priv) / results_per_hit);
21292132

21302133
mutex_unlock(&priv->arl_mutex);
21312134

drivers/net/dsa/b53/b53_regs.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@
111111

112112
/* IP Multicast control (8 bit) */
113113
#define B53_IP_MULTICAST_CTRL 0x21
114-
#define B53_IP_MCAST_25 BIT(0)
115-
#define B53_IPMC_FWD_EN BIT(1)
114+
#define B53_IP_MC BIT(0)
116115
#define B53_UC_FWD_EN BIT(6)
117116
#define B53_MC_FWD_EN BIT(7)
118117

0 commit comments

Comments
 (0)