Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b5962294 authored by Horatiu Vultur's avatar Horatiu Vultur Committed by David S. Miller
Browse files

net: mscc: ocelot: Add support for tcam



Add ACL support using the TCAM. Using ACL it is possible to create rules
in hardware to filter/redirect frames.

Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6345266a
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -132,11 +132,12 @@
			      <0x1270000 0x100>,
			      <0x1280000 0x100>,
			      <0x1800000 0x80000>,
			      <0x1880000 0x10000>;
			      <0x1880000 0x10000>,
			      <0x1060000 0x10000>;
			reg-names = "sys", "rew", "qs", "port0", "port1",
				    "port2", "port3", "port4", "port5", "port6",
				    "port7", "port8", "port9", "port10", "qsys",
				    "ana";
				    "ana", "s2";
			interrupts = <21 22>;
			interrupt-names = "xtr", "inj";

+1 −1
Original line number Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0 OR MIT)
obj-$(CONFIG_MSCC_OCELOT_SWITCH) += mscc_ocelot_common.o
mscc_ocelot_common-y := ocelot.o ocelot_io.o
mscc_ocelot_common-y += ocelot_regs.o ocelot_tc.o ocelot_police.o
mscc_ocelot_common-y += ocelot_regs.o ocelot_tc.o ocelot_police.o ocelot_ace.o
obj-$(CONFIG_MSCC_OCELOT_SWITCH_OCELOT) += ocelot_board.o
+13 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include <net/switchdev.h>

#include "ocelot.h"
#include "ocelot_ace.h"

#define TABLE_UPDATE_SLEEP_US 10
#define TABLE_UPDATE_TIMEOUT_US 100000
@@ -130,6 +131,13 @@ static void ocelot_mact_init(struct ocelot *ocelot)
	ocelot_write(ocelot, MACACCESS_CMD_INIT, ANA_TABLES_MACACCESS);
}

static void ocelot_vcap_enable(struct ocelot *ocelot, struct ocelot_port *port)
{
	ocelot_write_gix(ocelot, ANA_PORT_VCAP_S2_CFG_S2_ENA |
			 ANA_PORT_VCAP_S2_CFG_S2_IP6_CFG(0xa),
			 ANA_PORT_VCAP_S2_CFG, port->chip_port);
}

static inline u32 ocelot_vlant_read_vlanaccess(struct ocelot *ocelot)
{
	return ocelot_read(ocelot, ANA_TABLES_VLANACCESS);
@@ -1662,6 +1670,9 @@ int ocelot_probe_port(struct ocelot *ocelot, u8 port,
	/* Basic L2 initialization */
	ocelot_vlan_port_apply(ocelot, ocelot_port);

	/* Enable vcap lookups */
	ocelot_vcap_enable(ocelot, ocelot_port);

	return 0;

err_register_netdev:
@@ -1696,6 +1707,7 @@ int ocelot_init(struct ocelot *ocelot)

	ocelot_mact_init(ocelot);
	ocelot_vlan_init(ocelot);
	ocelot_ace_init(ocelot);

	for (port = 0; port < ocelot->num_phys_ports; port++) {
		/* Clear all counters (5 groups) */
@@ -1808,6 +1820,7 @@ void ocelot_deinit(struct ocelot *ocelot)
{
	destroy_workqueue(ocelot->stats_queue);
	mutex_destroy(&ocelot->stats_lock);
	ocelot_ace_deinit();
}
EXPORT_SYMBOL(ocelot_deinit);

+8 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ enum ocelot_target {
	QSYS,
	REW,
	SYS,
	S2,
	HSIO,
	TARGET_MAX,
};
@@ -335,6 +336,13 @@ enum ocelot_reg {
	SYS_CM_DATA_RD,
	SYS_CM_OP,
	SYS_CM_DATA,
	S2_CORE_UPDATE_CTRL = S2 << TARGET_OFFSET,
	S2_CORE_MV_CFG,
	S2_CACHE_ENTRY_DAT,
	S2_CACHE_MASK_DAT,
	S2_CACHE_ACTION_DAT,
	S2_CACHE_CNT_DAT,
	S2_CACHE_TG_DAT,
};

enum ocelot_regfield {
+777 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading