diff options
author | Vladimir Oltean <olteanv@gmail.com> | 2019-09-14 21:59:59 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-09-16 15:32:57 -0400 |
commit | 47d23af29220bf38c312cf434487500d93789c7c (patch) | |
tree | 4a00fc770b2a930258d60e4168627ff9272c26a7 | |
parent | 9c66d15646760eb8982242b4531c4d4fd36118fd (diff) |
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 <olteanv@gmail.com>
Acked-by: Kurt Kanzenbach <kurt@linutronix.de>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/dsa.h | 2 | ||||
-rw-r--r-- | net/dsa/slave.c | 12 |
2 files changed, 10 insertions, 4 deletions
diff --git a/include/net/dsa.h b/include/net/dsa.h index 96acb14ec1a8..541fb514e31d 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h | |||
@@ -515,6 +515,8 @@ struct dsa_switch_ops { | |||
515 | bool ingress); | 515 | bool ingress); |
516 | void (*port_mirror_del)(struct dsa_switch *ds, int port, | 516 | void (*port_mirror_del)(struct dsa_switch *ds, int port, |
517 | struct dsa_mall_mirror_tc_entry *mirror); | 517 | 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); | ||
518 | 520 | ||
519 | /* | 521 | /* |
520 | * Cross-chip operations | 522 | * Cross-chip operations |
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 9a88035517a6..75d58229a4bd 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c | |||
@@ -1035,12 +1035,16 @@ static int dsa_slave_setup_tc_block(struct net_device *dev, | |||
1035 | static int dsa_slave_setup_tc(struct net_device *dev, enum tc_setup_type type, | 1035 | static int dsa_slave_setup_tc(struct net_device *dev, enum tc_setup_type type, |
1036 | void *type_data) | 1036 | void *type_data) |
1037 | { | 1037 | { |
1038 | switch (type) { | 1038 | struct dsa_port *dp = dsa_slave_to_port(dev); |
1039 | case TC_SETUP_BLOCK: | 1039 | struct dsa_switch *ds = dp->ds; |
1040 | |||
1041 | if (type == TC_SETUP_BLOCK) | ||
1040 | return dsa_slave_setup_tc_block(dev, type_data); | 1042 | return dsa_slave_setup_tc_block(dev, type_data); |
1041 | default: | 1043 | |
1044 | if (!ds->ops->port_setup_tc) | ||
1042 | return -EOPNOTSUPP; | 1045 | return -EOPNOTSUPP; |
1043 | } | 1046 | |
1047 | return ds->ops->port_setup_tc(ds, dp->index, type, type_data); | ||
1044 | } | 1048 | } |
1045 | 1049 | ||
1046 | static void dsa_slave_get_stats64(struct net_device *dev, | 1050 | static void dsa_slave_get_stats64(struct net_device *dev, |