Skip to content

Commit

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

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Amir Vadai <amir@vadai.me>
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 c7d2b2f commit 24d3dc6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions net/sched/cls_u32.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,10 @@ static int u32_replace_hw_knode(struct tcf_proto *tp, struct tc_u_knode *n,

err = dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle,
tp->protocol, &offload);

if (!err)
n->flags |= TCA_CLS_FLAGS_IN_HW;

if (tc_skip_sw(flags))
return err;

Expand Down Expand Up @@ -895,6 +899,9 @@ static int u32_change(struct net *net, struct sk_buff *in_skb,
return err;
}

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

u32_replace_knode(tp, tp_c, new);
tcf_unbind_filter(tp, &n->res);
call_rcu(&n->rcu, u32_delete_key_rcu);
Expand Down Expand Up @@ -1014,6 +1021,9 @@ static int u32_change(struct net *net, struct sk_buff *in_skb,
if (err)
goto errhw;

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

ins = &ht->ht[TC_U32_HASH(handle)];
for (pins = rtnl_dereference(*ins); pins;
ins = &pins->next, pins = rtnl_dereference(*ins))
Expand Down

0 comments on commit 24d3dc6

Please sign in to comment.