1 From: Pablo Neira Ayuso <pablo@netfilter.org>
2 Date: Wed, 24 Mar 2021 02:30:51 +0100
3 Subject: [PATCH] dsa: slave: add support for TC_SETUP_FT
5 The dsa infrastructure provides a well-defined hierarchy of devices,
6 pass up the call to set up the flow block to the master device. From the
7 software dataplane, the netfilter infrastructure uses the dsa slave
8 devices to refer to the input and output device for the given skbuff.
9 Similarly, the flowtable definition in the ruleset refers to the dsa
12 This patch adds the glue code to call ndo_setup_tc with TC_SETUP_FT
13 with the master device via the dsa slave devices.
15 Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
20 @@ -1239,14 +1239,32 @@ static int dsa_slave_setup_tc_block(stru
24 +static int dsa_slave_setup_ft_block(struct dsa_switch *ds, int port,
27 + struct dsa_port *cpu_dp = dsa_to_port(ds, port)->cpu_dp;
28 + struct net_device *master = cpu_dp->master;
30 + if (!master->netdev_ops->ndo_setup_tc)
33 + return master->netdev_ops->ndo_setup_tc(master, TC_SETUP_FT, type_data);
36 static int dsa_slave_setup_tc(struct net_device *dev, enum tc_setup_type type,
39 struct dsa_port *dp = dsa_slave_to_port(dev);
40 struct dsa_switch *ds = dp->ds;
42 - if (type == TC_SETUP_BLOCK)
44 + case TC_SETUP_BLOCK:
45 return dsa_slave_setup_tc_block(dev, type_data);
47 + return dsa_slave_setup_ft_block(ds, dp->index, type_data);
52 if (!ds->ops->port_setup_tc)