mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-14 06:35:12 +00:00
net: lan966x: add tc matchall goto action
Extend matchall with action goto. This is needed to enable the lookup in the VCAP. It is needed to connect chain 0 to a chain that is recognized by the HW. Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
3643abd6e6
commit
61caac2d1a
4 changed files with 70 additions and 1 deletions
|
@ -13,7 +13,7 @@ lan966x-switch-objs := lan966x_main.o lan966x_phylink.o lan966x_port.o \
|
||||||
lan966x_tbf.o lan966x_cbs.o lan966x_ets.o \
|
lan966x_tbf.o lan966x_cbs.o lan966x_ets.o \
|
||||||
lan966x_tc_matchall.o lan966x_police.o lan966x_mirror.o \
|
lan966x_tc_matchall.o lan966x_police.o lan966x_mirror.o \
|
||||||
lan966x_xdp.o lan966x_vcap_impl.o lan966x_vcap_ag_api.o \
|
lan966x_xdp.o lan966x_vcap_impl.o lan966x_vcap_ag_api.o \
|
||||||
lan966x_tc_flower.o
|
lan966x_tc_flower.o lan966x_goto.o
|
||||||
|
|
||||||
# Provide include files
|
# Provide include files
|
||||||
ccflags-y += -I$(srctree)/drivers/net/ethernet/microchip/vcap
|
ccflags-y += -I$(srctree)/drivers/net/ethernet/microchip/vcap
|
||||||
|
|
54
drivers/net/ethernet/microchip/lan966x/lan966x_goto.c
Normal file
54
drivers/net/ethernet/microchip/lan966x/lan966x_goto.c
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
// SPDX-License-Identifier: GPL-2.0+
|
||||||
|
|
||||||
|
#include "lan966x_main.h"
|
||||||
|
#include "vcap_api_client.h"
|
||||||
|
|
||||||
|
int lan966x_goto_port_add(struct lan966x_port *port,
|
||||||
|
struct flow_action_entry *act,
|
||||||
|
unsigned long goto_id,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
|
{
|
||||||
|
struct lan966x *lan966x = port->lan966x;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = vcap_enable_lookups(lan966x->vcap_ctrl, port->dev,
|
||||||
|
act->chain_index, goto_id,
|
||||||
|
true);
|
||||||
|
if (err == -EFAULT) {
|
||||||
|
NL_SET_ERR_MSG_MOD(extack, "Unsupported goto chain");
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (err == -EADDRINUSE) {
|
||||||
|
NL_SET_ERR_MSG_MOD(extack, "VCAP already enabled");
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
NL_SET_ERR_MSG_MOD(extack, "Could not enable VCAP lookups");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
port->tc.goto_id = goto_id;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int lan966x_goto_port_del(struct lan966x_port *port,
|
||||||
|
unsigned long goto_id,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
|
{
|
||||||
|
struct lan966x *lan966x = port->lan966x;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = vcap_enable_lookups(lan966x->vcap_ctrl, port->dev, 0,
|
||||||
|
goto_id, false);
|
||||||
|
if (err) {
|
||||||
|
NL_SET_ERR_MSG_MOD(extack, "Could not disable VCAP lookups");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
port->tc.goto_id = 0;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -320,6 +320,7 @@ struct lan966x_port_tc {
|
||||||
unsigned long police_id;
|
unsigned long police_id;
|
||||||
unsigned long ingress_mirror_id;
|
unsigned long ingress_mirror_id;
|
||||||
unsigned long egress_mirror_id;
|
unsigned long egress_mirror_id;
|
||||||
|
unsigned long goto_id;
|
||||||
struct flow_stats police_stat;
|
struct flow_stats police_stat;
|
||||||
struct flow_stats mirror_stat;
|
struct flow_stats mirror_stat;
|
||||||
};
|
};
|
||||||
|
@ -591,6 +592,14 @@ void lan966x_vcap_deinit(struct lan966x *lan966x);
|
||||||
int lan966x_tc_flower(struct lan966x_port *port,
|
int lan966x_tc_flower(struct lan966x_port *port,
|
||||||
struct flow_cls_offload *f);
|
struct flow_cls_offload *f);
|
||||||
|
|
||||||
|
int lan966x_goto_port_add(struct lan966x_port *port,
|
||||||
|
struct flow_action_entry *act,
|
||||||
|
unsigned long goto_id,
|
||||||
|
struct netlink_ext_ack *extack);
|
||||||
|
int lan966x_goto_port_del(struct lan966x_port *port,
|
||||||
|
unsigned long goto_id,
|
||||||
|
struct netlink_ext_ack *extack);
|
||||||
|
|
||||||
static inline void __iomem *lan_addr(void __iomem *base[],
|
static inline void __iomem *lan_addr(void __iomem *base[],
|
||||||
int id, int tinst, int tcnt,
|
int id, int tinst, int tcnt,
|
||||||
int gbase, int ginst,
|
int gbase, int ginst,
|
||||||
|
|
|
@ -23,6 +23,9 @@ static int lan966x_tc_matchall_add(struct lan966x_port *port,
|
||||||
case FLOW_ACTION_MIRRED:
|
case FLOW_ACTION_MIRRED:
|
||||||
return lan966x_mirror_port_add(port, act, f->cookie,
|
return lan966x_mirror_port_add(port, act, f->cookie,
|
||||||
ingress, f->common.extack);
|
ingress, f->common.extack);
|
||||||
|
case FLOW_ACTION_GOTO:
|
||||||
|
return lan966x_goto_port_add(port, act, f->cookie,
|
||||||
|
f->common.extack);
|
||||||
default:
|
default:
|
||||||
NL_SET_ERR_MSG_MOD(f->common.extack,
|
NL_SET_ERR_MSG_MOD(f->common.extack,
|
||||||
"Unsupported action");
|
"Unsupported action");
|
||||||
|
@ -43,6 +46,9 @@ static int lan966x_tc_matchall_del(struct lan966x_port *port,
|
||||||
f->cookie == port->tc.egress_mirror_id) {
|
f->cookie == port->tc.egress_mirror_id) {
|
||||||
return lan966x_mirror_port_del(port, ingress,
|
return lan966x_mirror_port_del(port, ingress,
|
||||||
f->common.extack);
|
f->common.extack);
|
||||||
|
} else if (f->cookie == port->tc.goto_id) {
|
||||||
|
return lan966x_goto_port_del(port, f->cookie,
|
||||||
|
f->common.extack);
|
||||||
} else {
|
} else {
|
||||||
NL_SET_ERR_MSG_MOD(f->common.extack,
|
NL_SET_ERR_MSG_MOD(f->common.extack,
|
||||||
"Unsupported action");
|
"Unsupported action");
|
||||||
|
|
Loading…
Reference in a new issue