Skip to content

Commit 3fb24a4

Browse files
ummakynesdavem330
authored andcommitted
dsa: slave: add support for TC_SETUP_FT
The dsa infrastructure provides a well-defined hierarchy of devices, pass up the call to set up the flow block to the master device. From the software dataplane, the netfilter infrastructure uses the dsa slave devices to refer to the input and output device for the given skbuff. Similarly, the flowtable definition in the ruleset refers to the dsa slave port devices. This patch adds the glue code to call ndo_setup_tc with TC_SETUP_FT with the master device via the dsa slave devices. Signed-off-by: Pablo Neira Ayuso <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 17e52c0 commit 3fb24a4

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

net/dsa/slave.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1278,14 +1278,32 @@ static int dsa_slave_setup_tc_block(struct net_device *dev,
12781278
}
12791279
}
12801280

1281+
static int dsa_slave_setup_ft_block(struct dsa_switch *ds, int port,
1282+
void *type_data)
1283+
{
1284+
struct dsa_port *cpu_dp = dsa_to_port(ds, port)->cpu_dp;
1285+
struct net_device *master = cpu_dp->master;
1286+
1287+
if (!master->netdev_ops->ndo_setup_tc)
1288+
return -EOPNOTSUPP;
1289+
1290+
return master->netdev_ops->ndo_setup_tc(master, TC_SETUP_FT, type_data);
1291+
}
1292+
12811293
static int dsa_slave_setup_tc(struct net_device *dev, enum tc_setup_type type,
12821294
void *type_data)
12831295
{
12841296
struct dsa_port *dp = dsa_slave_to_port(dev);
12851297
struct dsa_switch *ds = dp->ds;
12861298

1287-
if (type == TC_SETUP_BLOCK)
1299+
switch (type) {
1300+
case TC_SETUP_BLOCK:
12881301
return dsa_slave_setup_tc_block(dev, type_data);
1302+
case TC_SETUP_FT:
1303+
return dsa_slave_setup_ft_block(ds, dp->index, type_data);
1304+
default:
1305+
break;
1306+
}
12891307

12901308
if (!ds->ops->port_setup_tc)
12911309
return -EOPNOTSUPP;

0 commit comments

Comments
 (0)