Skip to content

Commit 47d23af

Browse files
vladimirolteandavem330
authored andcommitted
net: dsa: Pass ndo_setup_tc slave callback to drivers
DSA currently handles shared block filters (for the classifier-action qdisc) in the core due to what I believe are simply pragmatic reasons - hiding the complexity from drivers and offerring a simple API for port mirroring. Extend the dsa_slave_setup_tc function by passing all other qdisc offloads to the driver layer, where the driver may choose what it implements and how. DSA is simply a pass-through in this case. Signed-off-by: Vladimir Oltean <[email protected]> Acked-by: Kurt Kanzenbach <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Acked-by: Ilias Apalodimas <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9c66d15 commit 47d23af

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

include/net/dsa.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,8 @@ struct dsa_switch_ops {
515515
bool ingress);
516516
void (*port_mirror_del)(struct dsa_switch *ds, int port,
517517
struct dsa_mall_mirror_tc_entry *mirror);
518+
int (*port_setup_tc)(struct dsa_switch *ds, int port,
519+
enum tc_setup_type type, void *type_data);
518520

519521
/*
520522
* Cross-chip operations

net/dsa/slave.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,12 +1035,16 @@ static int dsa_slave_setup_tc_block(struct net_device *dev,
10351035
static int dsa_slave_setup_tc(struct net_device *dev, enum tc_setup_type type,
10361036
void *type_data)
10371037
{
1038-
switch (type) {
1039-
case TC_SETUP_BLOCK:
1038+
struct dsa_port *dp = dsa_slave_to_port(dev);
1039+
struct dsa_switch *ds = dp->ds;
1040+
1041+
if (type == TC_SETUP_BLOCK)
10401042
return dsa_slave_setup_tc_block(dev, type_data);
1041-
default:
1043+
1044+
if (!ds->ops->port_setup_tc)
10421045
return -EOPNOTSUPP;
1043-
}
1046+
1047+
return ds->ops->port_setup_tc(ds, dp->index, type, type_data);
10441048
}
10451049

10461050
static void dsa_slave_get_stats64(struct net_device *dev,

0 commit comments

Comments
 (0)