mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00
This adds both the source and destination chain id to the information kept
for enabled port lookups.
This allows enabling and disabling a chain of lookups by walking the chain
information for a port.
This changes the way that VCAP lookups are enabled from userspace: instead
of one matchall rule that enables all the 4 Sparx5 IS2 lookups, you need a
matchall rule per lookup.
In practice that is done by adding one matchall rule in chain 0 to goto IS2
Lookup 0, and then for each lookup you add a rule per lookup (low priority)
that does a goto to the next lookup chain.
Examples:
If you want IS2 Lookup 0 to be enabled you add the same matchall filter as
before:
tc filter add dev eth12 ingress chain 0 prio 1000 handle 1000 matchall \
skip_sw action goto chain 8000000
If you also want to enable lookup 1 to 3 in IS2 and chain them you need
to add the following matchall filters:
tc filter add dev eth12 ingress chain 8000000 prio 1000 handle 1000 \
matchall skip_sw action goto chain 8100000
tc filter add dev eth12 ingress chain 8100000 prio 1000 handle 1000 \
matchall skip_sw action goto chain 8200000
tc filter add dev eth12 ingress chain 8200000 prio 1000 handle 1000 \
matchall skip_sw action goto chain 8300000
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: Steen Hegelund <steen.hegelund@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
51 lines
1.1 KiB
C
51 lines
1.1 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
#include "lan966x_main.h"
|
|
#include "vcap_api_client.h"
|
|
|
|
int lan966x_goto_port_add(struct lan966x_port *port,
|
|
int from_cid, int to_cid,
|
|
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,
|
|
from_cid, to_cid, 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;
|
|
}
|
|
|
|
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, 0,
|
|
goto_id, false);
|
|
if (err) {
|
|
NL_SET_ERR_MSG_MOD(extack, "Could not disable VCAP lookups");
|
|
return err;
|
|
}
|
|
|
|
return 0;
|
|
}
|