Commit 3fbae382 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

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: default avatarJiri Pirko <jiri@mellanox.com>
Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9cbf14ed
......@@ -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 (type) {
case TC_SETUP_CLSMATCHALL:
switch (tc->cls_mall->command) {
switch (cls->command) {
case TC_CLSMATCHALL_REPLACE:
return dsa_slave_add_cls_matchall(dev, protocol,
tc->cls_mall,
ingress);
return dsa_slave_add_cls_matchall(dev, protocol, cls, ingress);
case TC_CLSMATCHALL_DESTROY:
dsa_slave_del_cls_matchall(dev, tc->cls_mall);
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:
return dsa_slave_setup_tc_cls_matchall(dev, handle, chain_index,
protocol, tc->cls_mall);
default:
return -EOPNOTSUPP;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment