summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/microchip/lan966x/lan966x_tc_matchall.c
diff options
context:
space:
mode:
authorHoratiu Vultur <horatiu.vultur@microchip.com>2022-09-30 10:35:40 +0200
committerDavid S. Miller <davem@davemloft.net>2022-10-03 12:46:46 +0100
commitb69e95397c3ca8c596da006fa16076b54c54d1d4 (patch)
treec3d2b996b512d14be827bbaf42360a42a035d822 /drivers/net/ethernet/microchip/lan966x/lan966x_tc_matchall.c
parent5390334b59a3a011f1e9eff2d3023b0e407dd61b (diff)
downloadlinux-stable-b69e95397c3ca8c596da006fa16076b54c54d1d4.tar.gz
linux-stable-b69e95397c3ca8c596da006fa16076b54c54d1d4.tar.bz2
linux-stable-b69e95397c3ca8c596da006fa16076b54c54d1d4.zip
net: lan966x: Add port mirroring support using tc-matchall
Add support for port mirroring. It is possible to mirror only one port at a time and it is possible to have both ingress and egress mirroring. Frames injected by the CPU don't get egress mirrored because they are bypassing the analyzer module. Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/microchip/lan966x/lan966x_tc_matchall.c')
-rw-r--r--drivers/net/ethernet/microchip/lan966x/lan966x_tc_matchall.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_tc_matchall.c b/drivers/net/ethernet/microchip/lan966x/lan966x_tc_matchall.c
index dc065b556ef7..7368433b9277 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_tc_matchall.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_tc_matchall.c
@@ -20,6 +20,9 @@ static int lan966x_tc_matchall_add(struct lan966x_port *port,
return lan966x_police_port_add(port, &f->rule->action, act,
f->cookie, ingress,
f->common.extack);
+ case FLOW_ACTION_MIRRED:
+ return lan966x_mirror_port_add(port, act, f->cookie,
+ ingress, f->common.extack);
default:
NL_SET_ERR_MSG_MOD(f->common.extack,
"Unsupported action");
@@ -36,6 +39,10 @@ static int lan966x_tc_matchall_del(struct lan966x_port *port,
if (f->cookie == port->tc.police_id) {
return lan966x_police_port_del(port, f->cookie,
f->common.extack);
+ } else if (f->cookie == port->tc.ingress_mirror_id ||
+ f->cookie == port->tc.egress_mirror_id) {
+ return lan966x_mirror_port_del(port, ingress,
+ f->common.extack);
} else {
NL_SET_ERR_MSG_MOD(f->common.extack,
"Unsupported action");
@@ -51,6 +58,9 @@ static int lan966x_tc_matchall_stats(struct lan966x_port *port,
{
if (f->cookie == port->tc.police_id) {
lan966x_police_port_stats(port, &f->stats);
+ } else if (f->cookie == port->tc.ingress_mirror_id ||
+ f->cookie == port->tc.egress_mirror_id) {
+ lan966x_mirror_port_stats(port, &f->stats, ingress);
} else {
NL_SET_ERR_MSG_MOD(f->common.extack,
"Unsupported action");