net: dsa: mv88e6xxx: Add partial support for TCAM entries
Subsystems (5)
v8 cover net: dsa: mv88e6xxx: Add partial support for TCAM entries
This series adds partial Ternary Content Addressable Memory (TCAM) for the mv88e6390 and mv88e6393 family of switches. TCAM entries allow the switch to match the first 48 or 96 bytes of a frame and take actions on matched frames.
This patch introduces a subset of the available TCAM functionality. Matching on ip addresses/protocol and trapping to the cpu.
Eg. to trap traffic with destination ip 224.0.1.129 to the cpu:
tc qdisc add dev p1 clsact
tc filter add dev p1 ingress protocol ip flower skip_sw \
dst_ip 224.0.1.129 action trap
Review of the mv88e6xxx changes have brought to light something in cls_flower:
When adding a classifier with an ipv4 address both FLOW_DISSECTOR_KEY_IPV4_ADDRS and FLOW_DISSECTOR_KEY_IPV6_ADDRS bits are set in dissector->used_keys.
A change was made to address this.
---
Changes in v8:
- add teardown function for tcflower to free entries in the tcam list
- Link to v7: https://lore.kernel.org/r/[email protected]
Changes in v7:
- clear register field before setting it
- fix name inconsistency of mv88e6xx_flower_parse_key
- use defines for spv and spv_mask register fields
- Link to v6: https://lore.kernel.org/r/[email protected]
Changes in v6:
- add num_tcam_entries in chip info and check this is not exceeded when
adding an entry
- fix use after free in error path of tcam entry deletion
- fix copy/paste mistake in comment
- Link to v5: https://lore.kernel.org/r/[email protected]
Changes in v5:
- changes to cls_flower to only set the correct
FLOW_DISSECTOR_KEY_IPV*_ADDRS bits
- Link to v4: https://lore.kernel.org/r/[email protected]
Changes in v4:
- return -ENOMEM on allocation failure
- fix double mv88e6xxx_reg_unlock
- return -EOPNOTSUPP for unsupported addr_type
- improve error handling in mv88e6xxx_tcam_entry_del
- Link to v3: https://lore.kernel.org/r/[email protected]
Changes in v3:
- move locking to top level functions
- use defines for match field offsets
- use correct comment style
- remove warning used for debugging
- rename rc variables to err
- limit line length to 80 characters
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in RFC-v2:
- moved tcam_addr to chip info struct and remove tcam_support field
- added 6393-specific tcam ops that write the TCAM extension register
- rename the defines for TCAM registers to be consistent
- reverse christmas tree variable declarations
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Cedric Jehasse (2):
net/sched: cls_flower: remove unions from fl_flow_key
net: dsa: mv88e6xxx: Add partial support for TCAM entries
drivers/net/dsa/mv88e6xxx/Makefile | 2 + drivers/net/dsa/mv88e6xxx/chip.c | 35 ++++ drivers/net/dsa/mv88e6xxx/chip.h | 52 ++++++ drivers/net/dsa/mv88e6xxx/port.c | 28 ++- drivers/net/dsa/mv88e6xxx/port.h | 7 +- drivers/net/dsa/mv88e6xxx/tcam.c | 338 +++++++++++++++++++++++++++++++++++ drivers/net/dsa/mv88e6xxx/tcam.h | 41 +++++ drivers/net/dsa/mv88e6xxx/tcflower.c | 167 +++++++++++++++++ drivers/net/dsa/mv88e6xxx/tcflower.h | 14 ++ net/sched/cls_flower.c | 12 +- 10 files changed, 686 insertions(+), 10 deletions(-)
---
base-commit: cd51b40495c09b92beea6893663b3d0ed7605e81
change-id: 20260213-net-next-mv88e6xxx-tcam-f65be16008fb
Best regards,
Signature · 1 line
Cedric Jehasse <[email protected]>
PATCH v8 1/2 net/sched: cls_flower: remove unions from fl_flow_key
When creating a flower classifier with an ipv4 address the flow_dissector has both FLOW_DISSECTOR_KEY_IPV4_ADDRS and FLOW_DISSECTOR_KEY_IPV6_ADDRS bits set in used_keys. This happens because ipv4/ipv6 fields are a union and FL_KEY_SET_IF_MASKED() will interpret either being set as both.
Removing the unions fixes this behavior without needing special handling for union fields.
Example of a command that caused FLOW_DISSECTOR_KEY_IPV4_ADDRS and FLOW_DISSECTOR_KEY_IPV6_ADDRS to be set:
tc filter add dev p1 ingress protocol ip flower skip_sw \
dst_ip 224.0.1.129 action trap
--- net/sched/cls_flower.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
net/sched/cls_flower.c +4 -8
@@ -59,18 +59,14 @@ struct fl_flow_key {struct flow_dissector_key_eth_addrs eth;struct flow_dissector_key_vlan vlan;struct flow_dissector_key_vlan cvlan; -union { -struct flow_dissector_key_ipv4_addrs ipv4; -struct flow_dissector_key_ipv6_addrs ipv6; - }; +struct flow_dissector_key_ipv4_addrs ipv4; +struct flow_dissector_key_ipv6_addrs ipv6;struct flow_dissector_key_ports tp;struct flow_dissector_key_icmp icmp;struct flow_dissector_key_arp arp;struct flow_dissector_key_keyid enc_key_id; -union { -struct flow_dissector_key_ipv4_addrs enc_ipv4; -struct flow_dissector_key_ipv6_addrs enc_ipv6; - }; +struct flow_dissector_key_ipv4_addrs enc_ipv4; +struct flow_dissector_key_ipv6_addrs enc_ipv6;struct flow_dissector_key_ports enc_tp;struct flow_dissector_key_mpls mpls;struct flow_dissector_key_tcp tcp;
Signature · 1 line
2.43.0
Simon Horman
reviewerRe: [PATCH net-next v8 1/2] net/sched: cls_flower: remove unions from fl_flow_key
Quoted 11 lines · On Wed, Mar 11, 2026 at 11:46:18AM +0100, Cedric Jehasse via B4 Relay wrote:
From: Cedric Jehasse <[email protected]>
When creating a flower classifier with an ipv4 address the
flow_dissectorhas bothFLOW_DISSECTOR_KEY_IPV4_ADDRSandFLOW_DISSECTOR_KEY_IPV6_ADDRSbits set inused_keys. This happens because ipv4/ipv6 fields are a union andFL_KEY_SET_IF_MASKED()will interpret either being set as both.Removing the unions fixes this behavior without needing special handling for union fields.
Quoted 6 lines
Example of a command that caused
FLOW_DISSECTOR_KEY_IPV4_ADDRSandFLOW_DISSECTOR_KEY_IPV6_ADDRSto be set:
tc filter add dev p1 ingress protocol ip flowerskip_sw\dst_ip 224.0.1.129 action trapSigned-off-by Cedric Jehasse <[email protected]>
Hi Cedric,
This doesn't seem to be the right approach to me.
It seems to me that the use of a union is intentional here, as either IPv4 or IPv6 addresses can be present in each case - never both. And that control.addr_type and enc_control.addr_type are intended to allow differentiation of the address type in use for each of these unions.
Quoted 36 lines
--- net/sched/cls_flower.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)net/sched/cls_flower.c +4
-8@@ -59,18 +59,14 @@ struct fl_flow_key {struct flow_dissector_key_eth_addrs eth;struct flow_dissector_key_vlan vlan;struct flow_dissector_key_vlan cvlan; -union { -struct flow_dissector_key_ipv4_addrs ipv4; -struct flow_dissector_key_ipv6_addrs ipv6; - }; +struct flow_dissector_key_ipv4_addrs ipv4; +struct flow_dissector_key_ipv6_addrs ipv6;struct flow_dissector_key_ports tp;struct flow_dissector_key_icmp icmp;struct flow_dissector_key_arp arp;struct flow_dissector_key_keyid enc_key_id; -union { -struct flow_dissector_key_ipv4_addrs enc_ipv4; -struct flow_dissector_key_ipv6_addrs enc_ipv6; - }; +struct flow_dissector_key_ipv4_addrs enc_ipv4; +struct flow_dissector_key_ipv6_addrs enc_ipv6;struct flow_dissector_key_ports enc_tp;struct flow_dissector_key_mpls mpls;struct flow_dissector_key_tcp tcp;Signature · 2 lines
-- 2.43.0
Re: [PATCH net-next v8 1/2] net/sched: cls_flower: remove unions from fl_flow_key
Quoted 19 lines · On Wed, Mar 11, 2026 at 11:46:18AM +0100, Cedric Jehasse via B4 Relay wrote:
Quoted 11 lines
From: Cedric Jehasse <[email protected]>
When creating a flower classifier with an ipv4 address the
flow_dissectorhas bothFLOW_DISSECTOR_KEY_IPV4_ADDRSandFLOW_DISSECTOR_KEY_IPV6_ADDRSbits set inused_keys. This happens because ipv4/ipv6 fields are a union andFL_KEY_SET_IF_MASKED()will interpret either being set as both.Removing the unions fixes this behavior without needing special handling for union fields.
Quoted 6 lines
Example of a command that caused
FLOW_DISSECTOR_KEY_IPV4_ADDRSandFLOW_DISSECTOR_KEY_IPV6_ADDRSto be set:
tc filter add dev p1 ingress protocol ip flowerskip_sw\dst_ip 224.0.1.129 action trapSigned-off-by Cedric Jehasse <[email protected]>
Quoted 8 lines
Hi Cedric,
This doesn't seem to be the right approach to me.
It seems to me that the use of a union is intentional here, as either IPv4 or IPv6 addresses can be present in each case - never both. And that control.addr_type and enc_control.addr_type are intended to allow differentiation of the address type in use for each of these unions.
I chose this approach because keeping the unions required special handling for these union keys. Removing the union it keeps the code simpler.
I understand the union exists because IPv4 and IPv6 addresses are mutually exclusive, but some other keys are also mutually exclusive (e.g. arp and icmp key wil never be present at the same time)
Jakub Kicinski
maintainerRe: [PATCH net-next v8 1/2] net/sched: cls_flower: remove unions from fl_flow_key
In reply to Simon HormanQuoted 4 lines · On Fri, 13 Mar 2026 13:26:51 +0000 Simon Horman wrote:
It seems to me that the use of a union is intentional here, as either IPv4 or IPv6 addresses can be present in each case - never both. And that control.addr_type and enc_control.addr_type are intended to allow differentiation of the address type in use for each of these unions.
My reading was that the initial author simply wanted to save space in the struct.
As the commit message explains this leads to complications in the logic which sets the keys. The alternative is to complicate FL_KEY_SET_IF_MASKED - doable, but given that the union feels like a micro-optimization in the first place the simpler approach of separating fields seems okay too? (TBH my mind also initially went down the FL_KEY_SET_IF_MASKED rabbit hole but once I saw the simplicity of Cedric's patch I changed my mind)
Simon Horman
reviewerRe: [PATCH net-next v8 1/2] net/sched: cls_flower: remove unions from fl_flow_key
Quoted 9 lines · Jakub Kicinski
Quoted 4 lines · On Fri, 13 Mar 2026 13:26:51 +0000 Simon Horman wrote:
It seems to me that the use of a union is intentional here, as either IPv4 or IPv6 addresses can be present in each case - never both. And that control.addr_type and enc_control.addr_type are intended to allow differentiation of the address type in use for each of these unions.
My reading was that the initial author simply wanted to save space in the struct.
Quoted 7 lines
As the commit message explains this leads to complications in the logic which sets the keys. The alternative is to complicate
FL_KEY_SET_IF_MASKED- doable, but given that the union feels like a micro-optimization in the first place the simpler approach of separating fields seems okay too? (TBH my mind also initially went down theFL_KEY_SET_IF_MASKEDrabbit hole but once I saw the simplicity of Cedric's patch I changed my mind)
Sure, now this has been put to me more than once I agree.
But if we go this way, then can we also simplify some of the existing logic? As a follow-up?
Jakub Kicinski
maintainerRe: [PATCH net-next v8 1/2] net/sched: cls_flower: remove unions from fl_flow_key
Quoted 18 lines · On Mon, 16 Mar 2026 08:34:47 +0000 Simon Horman wrote:
Quoted 9 lines · Jakub Kicinski
Quoted 4 lines · On Fri, 13 Mar 2026 13:26:51 +0000 Simon Horman wrote:
It seems to me that the use of a union is intentional here, as either IPv4 or IPv6 addresses can be present in each case - never both. And that control.addr_type and enc_control.addr_type are intended to allow differentiation of the address type in use for each of these unions.
My reading was that the initial author simply wanted to save space in the struct.
Quoted 7 lines
As the commit message explains this leads to complications in the logic which sets the keys. The alternative is to complicate
FL_KEY_SET_IF_MASKED- doable, but given that the union feels like a micro-optimization in the first place the simpler approach of separating fields seems okay too? (TBH my mind also initially went down theFL_KEY_SET_IF_MASKEDrabbit hole but once I saw the simplicity of Cedric's patch I changed my mind)
Quoted 4 lines
Sure, now this has been put to me more than once I agree.
But if we go this way, then can we also simplify some of the existing logic? As a follow-up?
Which logic do you have in mind? Sorry if I'm being slow.
Simon Horman
reviewerRe: [PATCH net-next v8 1/2] net/sched: cls_flower: remove unions from fl_flow_key
Quoted 19 lines · Jakub Kicinski
Quoted 18 lines · On Mon, 16 Mar 2026 08:34:47 +0000 Simon Horman wrote:
Quoted 16 lines · Jakub Kicinski
Quoted 4 lines · On Fri, 13 Mar 2026 13:26:51 +0000 Simon Horman wrote:
It seems to me that the use of a union is intentional here, as either IPv4 or IPv6 addresses can be present in each case - never both. And that control.addr_type and enc_control.addr_type are intended to allow differentiation of the address type in use for each of these unions.
My reading was that the initial author simply wanted to save space in the struct.
As the commit message explains this leads to complications in the logic which sets the keys. The alternative is to complicate
FL_KEY_SET_IF_MASKED- doable, but given that the union feels like a micro-optimization in the first place the simpler approach of separating fields seems okay too? (TBH my mind also initially went down theFL_KEY_SET_IF_MASKEDrabbit hole but once I saw the simplicity of Cedric's patch I changed my mind)
Quoted 6 lines
Quoted 4 lines
Sure, now this has been put to me more than once I agree.
But if we go this way, then can we also simplify some of the existing logic? As a follow-up?
Which logic do you have in mind? Sorry if I'm being slow.
Sorry for being vague.
Let me do my homework and come back if I have a concrete suggestion.
PATCH v8 2/2 net: dsa: mv88e6xxx: Add partial support for TCAM entries
In reply to Cedric JehasseThis patch adds partial Ternary Content Addressable Memory (TCAM) for the mv88e6390 and mv88e6393 family of switches. TCAM entries allow the switch to match the first 48 or 96 bytes of a frame and take actions on matched frames.
This patch introduces a subset of the available TCAM functionality. Matching on ip addresses/protocol and trapping to the cpu.
Eg. to trap traffic with destination ip 224.0.1.129 to the cpu:
tc qdisc add dev p1 clsact
tc filter add dev p1 ingress protocol ip flower skip_sw \
dst_ip 224.0.1.129 action trap
--- drivers/net/dsa/mv88e6xxx/Makefile | 2 + drivers/net/dsa/mv88e6xxx/chip.c | 35 ++++ drivers/net/dsa/mv88e6xxx/chip.h | 52 ++++++ drivers/net/dsa/mv88e6xxx/port.c | 28 ++- drivers/net/dsa/mv88e6xxx/port.h | 7 +- drivers/net/dsa/mv88e6xxx/tcam.c | 338 +++++++++++++++++++++++++++++++++++ drivers/net/dsa/mv88e6xxx/tcam.h | 41 +++++ drivers/net/dsa/mv88e6xxx/tcflower.c | 167 +++++++++++++++++ drivers/net/dsa/mv88e6xxx/tcflower.h | 14 ++ 9 files changed, 682 insertions(+), 2 deletions(-)
drivers/net/dsa/mv88e6xxx/Makefile +2 -0
@@ -21,6 +21,8 @@ mv88e6xxx-objs += serdes.o mv88e6xxx-objs += smi.o mv88e6xxx-objs += switchdev.o mv88e6xxx-objs += trace.o +mv88e6xxx-objs += tcflower.o +mv88e6xxx-objs += tcam.o # for tracing framework to find trace.h CFLAGS_trace.o := -I$(src)
drivers/net/dsa/mv88e6xxx/chip.c +35 -0
@@ -43,6 +43,8 @@#include "ptp.h" #include "serdes.h" #include "smi.h" +#include "tcam.h" +#include "tcflower.h" static void assert_reg_lock (struct mv88e6xxx_chip *chip) {
@@ -3560,6 +3562,11 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port)if (err)return err; } +if (chip->info->ops->port_enable_tcam) { + err = chip->info->ops->port_enable_tcam (chip, port); +if (err) +return err; + }if (chip->info->ops->port_tag_remap) { err = chip->info->ops->port_tag_remap (chip, port);
@@ -3938,6 +3945,14 @@ static int mv88e6xxx_mdios_register(struct mv88e6xxx_chip *chip)return 0 ; } +static int mv88e6xxx_tcam_setup (struct mv88e6xxx_chip *chip) +{ +if (!mv88e6xxx_has_tcam (chip)) +return 0 ; + +return chip->info->ops->tcam_ops->flush_tcam (chip); +} +static void mv88e6xxx_teardown (struct dsa_switch *ds) {struct mv88e6xxx_chip *chip = ds->priv;
@@ -3947,6 +3962,7 @@ static void mv88e6xxx_teardown(struct dsa_switch *ds)mv88e6xxx_teardown_devlink_regions_global (ds);mv88e6xxx_hwtstamp_free (chip);mv88e6xxx_ptp_free (chip); +mv88e6xxx_flower_teardown (chip);mv88e6xxx_mdios_unregister (chip); }
@@ -4083,6 +4099,10 @@ static int mv88e6xxx_setup(struct dsa_switch *ds)if (err) goto unlock; + err =mv88e6xxx_tcam_setup (chip); +if (err) + goto unlock; + unlock:mv88e6xxx_reg_unlock (chip);
@@ -5134,6 +5154,7 @@ static const struct mv88e6xxx_ops mv88e6290_ops = { .ptp_ops = &mv88e6390_ptp_ops, .phylink_get_caps = mv88e6390_phylink_get_caps, .pcs_ops = &mv88e6390_pcs_ops, + .tcam_ops = &mv88e6390_tcam_ops, };static const struct mv88e6xxx_ops mv88e6320_ops = {
@@ -5525,6 +5546,7 @@ static const struct mv88e6xxx_ops mv88e6390_ops = { .serdes_get_regs = mv88e6390_serdes_get_regs, .phylink_get_caps = mv88e6390_phylink_get_caps, .pcs_ops = &mv88e6390_pcs_ops, + .tcam_ops = &mv88e6390_tcam_ops, };static const struct mv88e6xxx_ops mv88e6390x_ops = {
@@ -5621,6 +5643,7 @@ static const struct mv88e6xxx_ops mv88e6393x_ops = { .port_set_cmode = mv88e6393x_port_set_cmode, .port_setup_message_port = mv88e6xxx_setup_message_port, .port_set_upstream_port = mv88e6393x_port_set_upstream_port, + .port_enable_tcam = mv88e6xxx_port_enable_tcam, .stats_snapshot = mv88e6390_g1_stats_snapshot, .stats_set_histogram = mv88e6390_g1_stats_set_histogram, .stats_get_sset_count = mv88e6320_stats_get_sset_count,
@@ -5652,6 +5675,7 @@ static const struct mv88e6xxx_ops mv88e6393x_ops = { .ptp_ops = &mv88e6352_ptp_ops, .phylink_get_caps = mv88e6393x_phylink_get_caps, .pcs_ops = &mv88e6393x_pcs_ops, + .tcam_ops = &mv88e6393_tcam_ops, };static const struct mv88e6xxx_info mv88e6xxx_table[] = {
@@ -6125,6 +6149,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_databases = 4096, .num_ports = 11, /* 10 + Z80 */ .num_internal_phys = 8, + .num_tcam_entries = 256, .internal_phys_offset = 1, .max_vid = 8191, .max_sid = 63,
@@ -6132,6 +6157,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .phy_base_addr = 0x0, .global1_addr = 0x1b, .global2_addr = 0x1c, + .tcam_addr = 0x1f, .age_time_coeff = 3750, .g1_irqs = 10, .g2_irqs = 14,
@@ -6227,12 +6253,14 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_ports = 11, /* 10 + Z80 */ .num_internal_phys = 9, .num_gpio = 16, + .num_tcam_entries = 256, .max_vid = 8191, .max_sid = 63, .port_base_addr = 0x0, .phy_base_addr = 0x0, .global1_addr = 0x1b, .global2_addr = 0x1c, + .tcam_addr = 0x1f, .age_time_coeff = 3750, .g1_irqs = 9, .g2_irqs = 14,
@@ -6439,12 +6467,14 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_ports = 11, /* 10 + Z80 */ .num_internal_phys = 9, .num_gpio = 16, + .num_tcam_entries = 256, .max_vid = 8191, .max_sid = 63, .port_base_addr = 0x0, .phy_base_addr = 0x0, .global1_addr = 0x1b, .global2_addr = 0x1c, + .tcam_addr = 0x1f, .age_time_coeff = 3750, .g1_irqs = 9, .g2_irqs = 14,
@@ -6490,6 +6520,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_databases = 4096, .num_ports = 11, /* 10 + Z80 */ .num_internal_phys = 8, + .num_tcam_entries = 256, .internal_phys_offset = 1, .max_vid = 8191, .max_sid = 63,
@@ -6497,6 +6528,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .phy_base_addr = 0x0, .global1_addr = 0x1b, .global2_addr = 0x1c, + .tcam_addr = 0x1f, .age_time_coeff = 3750, .g1_irqs = 10, .g2_irqs = 14,
@@ -6589,6 +6621,7 @@ static struct mv88e6xxx_chip *mv88e6xxx_alloc_chip(struct device *dev)INIT_LIST_HEAD (&chip->mdios);idr_init (&chip->policies);INIT_LIST_HEAD (&chip->msts); +INIT_LIST_HEAD (&chip->tcam.entries);return chip; }
@@ -7184,6 +7217,8 @@ static const struct dsa_switch_ops mv88e6xxx_switch_ops = { .port_hwtstamp_get = mv88e6xxx_port_hwtstamp_get, .port_txtstamp = mv88e6xxx_port_txtstamp, .port_rxtstamp = mv88e6xxx_port_rxtstamp, + .cls_flower_add = mv88e6xxx_cls_flower_add, + .cls_flower_del = mv88e6xxx_cls_flower_del, .get_ts_info = mv88e6xxx_get_ts_info, .devlink_param_get = mv88e6xxx_devlink_param_get, .devlink_param_set = mv88e6xxx_devlink_param_set,
drivers/net/dsa/mv88e6xxx/chip.h +52 -0
100 lines not on this page · raw message
drivers/net/dsa/mv88e6xxx/port.c +27 -1
@@ -1380,7 +1380,33 @@ int mv88e6xxx_port_disable_learn_limit(struct mv88e6xxx_chip *chip, int port)int mv88e6xxx_port_disable_pri_override (struct mv88e6xxx_chip *chip,int port) { -return mv88e6xxx_port_write (chip, port,MV88E6XXX_PORT_PRI_OVERRIDE ,0 ); +u16 reg; +int err; + + err =mv88e6xxx_port_read (chip, port,MV88E6XXX_PORT_PRI_OVERRIDE , + ®); +if (err) +return err; + + reg &=MV88E6XXX_PORT_PRI_OVERRIDE_TCAM_MODE_MASK ; +return mv88e6xxx_port_write (chip, port,MV88E6XXX_PORT_PRI_OVERRIDE , + reg); +} + +int mv88e6xxx_port_enable_tcam (struct mv88e6xxx_chip *chip,int port) +{ +u16 reg; +int err; + + err =mv88e6xxx_port_read (chip, port,MV88E6XXX_PORT_PRI_OVERRIDE , + ®); +if (err) +return err; + + reg &= ~MV88E6XXX_PORT_PRI_OVERRIDE_TCAM_MODE_MASK ; + reg |=MV88E6XXX_PORT_PRI_OVERRIDE_TCAM_MODE_96_BYTE ; +return mv88e6xxx_port_write (chip, port,MV88E6XXX_PORT_PRI_OVERRIDE , + reg); }/* Offset 0x0E: Policy & MGMT Control Register for FAMILY 6191X 6193X 6393X */
drivers/net/dsa/mv88e6xxx/port.h +6 -1
@@ -254,7 +254,10 @@#define MV88E6XXX_PORT_ATU_CTL 0x0c/* Offset 0x0D: Priority Override Register */ -#define MV88E6XXX_PORT_PRI_OVERRIDE 0x0d +#define MV88E6XXX_PORT_PRI_OVERRIDE 0x0d +#define MV88E6XXX_PORT_PRI_OVERRIDE_TCAM_MODE_MASK 0x0003 +#define MV88E6XXX_PORT_PRI_OVERRIDE_TCAM_MODE_48_BYTE 0x0001 +#define MV88E6XXX_PORT_PRI_OVERRIDE_TCAM_MODE_96_BYTE 0x0002/* Offset 0x0E: Policy Control Register */ #define MV88E6XXX_PORT_POLICY_CTL 0x0e
@@ -608,4 +611,6 @@ int mv88e6xxx_port_hidden_wait(struct mv88e6xxx_chip *chip);int mv88e6xxx_port_hidden_read (struct mv88e6xxx_chip *chip,int block,int port,int reg,u16 *val); +int mv88e6xxx_port_enable_tcam (struct mv88e6xxx_chip *chip,int port); +#endif /* _MV88E6XXX_PORT_H */
drivers/net/dsa/mv88e6xxx/tcam.c new file +338 -0
338 lines not on this page · raw message
drivers/net/dsa/mv88e6xxx/tcam.h new file +41 -0
41 lines not on this page · raw message
drivers/net/dsa/mv88e6xxx/tcflower.c new file +167 -0
167 lines not on this page · raw message
drivers/net/dsa/mv88e6xxx/tcflower.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +/* +* Copyright (c) 2026 Luminex Network Intelligence +*/ +#ifndef _MV88E6XXX_TCFLOWER_H_ +#define _MV88E6XXX_TCFLOWER_H_ + +int mv88e6xxx_cls_flower_add (struct dsa_switch *ds,int port, +struct flow_cls_offload *cls,bool ingress); +int mv88e6xxx_cls_flower_del (struct dsa_switch *ds,int port, +struct flow_cls_offload *cls,bool ingress); +void mv88e6xxx_flower_teardown (struct mv88e6xxx_chip *chip); +#endif
Signature · 1 line
2.43.0
This series was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Quoted 9 lines · On Wed, 11 Mar 2026 11:46:17 +0100 you wrote:
This series adds partial Ternary Content Addressable Memory (TCAM) for the mv88e6390 and mv88e6393 family of switches. TCAM entries allow the switch to match the first 48 or 96 bytes of a frame and take actions on matched frames.
This patch introduces a subset of the available TCAM functionality. Matching on ip addresses/protocol and trapping to the cpu.
[...]
Here is the summary with links:
- [net-next,v8,1/2] net/sched: cls_flower: remove unions from fl_flow_key
https://git.kernel.org/netdev/net-next/c/b513dde96c0a - [net-next,v8,2/2] net: dsa: mv88e6xxx: Add partial support for TCAM entries https://git.kernel.org/netdev/net-next/c/639f1dcfde55
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html