From: Vladimir Oltean <vladimir.olt...@nxp.com> To a DSA switch, port mirroring towards a foreign interface is the same as mirroring towards the CPU port, since all non-DSA interfaces are reachable through that. Tell the hardware to send the packets to the CPU port and let the mirred action deal with them in software.
Signed-off-by: Vladimir Oltean <vladimir.olt...@nxp.com> --- net/dsa/slave.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index b0571ab4e5a7..913a4a5e32a9 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -936,19 +936,19 @@ dsa_slave_add_cls_matchall_mirred(struct net_device *dev, if (!act->dev) return -EINVAL; - if (!dsa_slave_dev_check(act->dev)) - return -EOPNOTSUPP; - mall_tc_entry = kzalloc(sizeof(*mall_tc_entry), GFP_KERNEL); if (!mall_tc_entry) return -ENOMEM; + if (dsa_slave_dev_check(act->dev)) + to_dp = dsa_slave_to_port(act->dev); + else + to_dp = dp->cpu_dp; + mall_tc_entry->cookie = cls->cookie; mall_tc_entry->type = DSA_PORT_MALL_MIRROR; mirror = &mall_tc_entry->mirror; - to_dp = dsa_slave_to_port(act->dev); - mirror->to_local_port = to_dp->index; mirror->ingress = ingress; -- 2.25.1