ocelot.c (a14e6b69f393d651913edcbe4ec0dec27b8b4b40) ocelot.c (5cad43a52ee3caf451cd645baa4beb53a1733dae)
1// SPDX-License-Identifier: (GPL-2.0 OR MIT)
2/*
3 * Microsemi Ocelot Switch driver
4 *
5 * Copyright (c) 2017 Microsemi Corporation
6 */
7#include <linux/dsa/ocelot.h>
8#include <linux/if_bridge.h>

--- 1327 unchanged lines hidden (view full) ---

1336 mac[5] = (macl >> 0) & 0xff;
1337
1338 entry->vid = (mach >> 16) & 0xfff;
1339 ether_addr_copy(entry->mac, mac);
1340
1341 return 0;
1342}
1343
1// SPDX-License-Identifier: (GPL-2.0 OR MIT)
2/*
3 * Microsemi Ocelot Switch driver
4 *
5 * Copyright (c) 2017 Microsemi Corporation
6 */
7#include <linux/dsa/ocelot.h>
8#include <linux/if_bridge.h>

--- 1327 unchanged lines hidden (view full) ---

1336 mac[5] = (macl >> 0) & 0xff;
1337
1338 entry->vid = (mach >> 16) & 0xfff;
1339 ether_addr_copy(entry->mac, mac);
1340
1341 return 0;
1342}
1343
1344int ocelot_mact_flush(struct ocelot *ocelot, int port)
1345{
1346 int err;
1347
1348 mutex_lock(&ocelot->mact_lock);
1349
1350 /* Program ageing filter for a single port */
1351 ocelot_write(ocelot, ANA_ANAGEFIL_PID_EN | ANA_ANAGEFIL_PID_VAL(port),
1352 ANA_ANAGEFIL);
1353
1354 /* Flushing dynamic FDB entries requires two successive age scans */
1355 ocelot_write(ocelot,
1356 ANA_TABLES_MACACCESS_MAC_TABLE_CMD(MACACCESS_CMD_AGE),
1357 ANA_TABLES_MACACCESS);
1358
1359 err = ocelot_mact_wait_for_completion(ocelot);
1360 if (err) {
1361 mutex_unlock(&ocelot->mact_lock);
1362 return err;
1363 }
1364
1365 /* And second... */
1366 ocelot_write(ocelot,
1367 ANA_TABLES_MACACCESS_MAC_TABLE_CMD(MACACCESS_CMD_AGE),
1368 ANA_TABLES_MACACCESS);
1369
1370 err = ocelot_mact_wait_for_completion(ocelot);
1371
1372 /* Restore ageing filter */
1373 ocelot_write(ocelot, 0, ANA_ANAGEFIL);
1374
1375 mutex_unlock(&ocelot->mact_lock);
1376
1377 return err;
1378}
1379EXPORT_SYMBOL_GPL(ocelot_mact_flush);
1380
1344int ocelot_fdb_dump(struct ocelot *ocelot, int port,
1345 dsa_fdb_dump_cb_t *cb, void *data)
1346{
1347 int err = 0;
1348 int i, j;
1349
1350 /* We could take the lock just around ocelot_mact_read, but doing so
1351 * thousands of times in a row seems rather pointless and inefficient.

--- 1436 unchanged lines hidden ---
1381int ocelot_fdb_dump(struct ocelot *ocelot, int port,
1382 dsa_fdb_dump_cb_t *cb, void *data)
1383{
1384 int err = 0;
1385 int i, j;
1386
1387 /* We could take the lock just around ocelot_mact_read, but doing so
1388 * thousands of times in a row seems rather pointless and inefficient.

--- 1436 unchanged lines hidden ---