Skip to content

Commit

Permalink
net/sched: cls_matchall: Reflect HW offloading status
Browse files Browse the repository at this point in the history
Matchall support for the "in hw" offloading flags.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Amir Vadai <amir@vadai.me>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Or Gerlitz authored and David S. Miller committed Feb 17, 2017
1 parent 5559396 commit c7d2b2f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions net/sched/cls_matchall.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,20 @@ static int mall_replace_hw_filter(struct tcf_proto *tp,
struct net_device *dev = tp->q->dev_queue->dev;
struct tc_to_netdev offload;
struct tc_cls_matchall_offload mall_offload = {0};
int err;

offload.type = TC_SETUP_MATCHALL;
offload.cls_mall = &mall_offload;
offload.cls_mall->command = TC_CLSMATCHALL_REPLACE;
offload.cls_mall->exts = &head->exts;
offload.cls_mall->cookie = cookie;

return dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle, tp->protocol,
&offload);
err = dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle, tp->protocol,
&offload);
if (!err)
head->flags |= TCA_CLS_FLAGS_IN_HW;

return err;
}

static void mall_destroy_hw_filter(struct tcf_proto *tp,
Expand Down Expand Up @@ -194,6 +199,9 @@ static int mall_change(struct net *net, struct sk_buff *in_skb,
}
}

if (!tc_in_hw(new->flags))
new->flags |= TCA_CLS_FLAGS_NOT_IN_HW;

*arg = (unsigned long) head;
rcu_assign_pointer(tp->root, new);
if (head)
Expand Down

0 comments on commit c7d2b2f

Please sign in to comment.