summaryrefslogtreecommitdiffstats
path: root/net/dsa/slave.c
diff options
context:
space:
mode:
authorJiri Pirko <jiri@mellanox.com>2017-08-07 10:15:26 +0200
committerDavid S. Miller <davem@davemloft.net>2017-08-07 18:42:36 +0200
commit3fbae382f7dd81c4e43b76169e08cc0d440e760b (patch)
treec09d5883a5ddcc8143ef68977e490e2a04037969 /net/dsa/slave.c
parentmlxsw: spectrum: rename cls arg in matchall processing (diff)
downloadlinux-3fbae382f7dd81c4e43b76169e08cc0d440e760b.tar.xz
linux-3fbae382f7dd81c4e43b76169e08cc0d440e760b.zip
dsa: push cls_matchall setup_tc processing into a separate function
Let dsa_slave_setup_tc be a splitter for specific setup_tc types and push out cls_matchall specific code into a separate function. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa/slave.c')
-rw-r--r--net/dsa/slave.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 453f6ddcd023..e76d576b941d 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -863,26 +863,35 @@ static void dsa_slave_del_cls_matchall(struct net_device *dev,
kfree(mall_tc_entry);
}
-static int dsa_slave_setup_tc(struct net_device *dev, enum tc_setup_type type,
- u32 handle, u32 chain_index, __be16 protocol,
- struct tc_to_netdev *tc)
+static int dsa_slave_setup_tc_cls_matchall(struct net_device *dev,
+ u32 handle, u32 chain_index,
+ __be16 protocol,
+ struct tc_cls_matchall_offload *cls)
{
bool ingress = TC_H_MAJ(handle) == TC_H_MAJ(TC_H_INGRESS);
if (chain_index)
return -EOPNOTSUPP;
+ switch (cls->command) {
+ case TC_CLSMATCHALL_REPLACE:
+ return dsa_slave_add_cls_matchall(dev, protocol, cls, ingress);
+ case TC_CLSMATCHALL_DESTROY:
+ dsa_slave_del_cls_matchall(dev, cls);
+ return 0;
+ default:
+ return -EOPNOTSUPP;
+ }
+}
+
+static int dsa_slave_setup_tc(struct net_device *dev, enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 protocol,
+ struct tc_to_netdev *tc)
+{
switch (type) {
case TC_SETUP_CLSMATCHALL:
- switch (tc->cls_mall->command) {
- case TC_CLSMATCHALL_REPLACE:
- return dsa_slave_add_cls_matchall(dev, protocol,
- tc->cls_mall,
- ingress);
- case TC_CLSMATCHALL_DESTROY:
- dsa_slave_del_cls_matchall(dev, tc->cls_mall);
- return 0;
- }
+ return dsa_slave_setup_tc_cls_matchall(dev, handle, chain_index,
+ protocol, tc->cls_mall);
default:
return -EOPNOTSUPP;
}