Skip to content

Commit

Permalink
net: sched: don't take rtnl lock during flow_action setup
Browse files Browse the repository at this point in the history
Refactor tc_setup_flow_action() function not to use rtnl lock and remove
'rtnl_held' argument that is no longer needed.

Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Vlad Buslov authored and David S. Miller committed Feb 17, 2020
1 parent 107f2d5 commit b15e7a6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 14 deletions.
2 changes: 1 addition & 1 deletion include/net/pkt_cls.h
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ tcf_match_indev(struct sk_buff *skb, int ifindex)
}

int tc_setup_flow_action(struct flow_action *flow_action,
const struct tcf_exts *exts, bool rtnl_held);
const struct tcf_exts *exts);
void tc_cleanup_flow_action(struct flow_action *flow_action);

int tc_setup_cb_call(struct tcf_block *block, enum tc_setup_type type,
Expand Down
8 changes: 1 addition & 7 deletions net/sched/cls_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -3433,17 +3433,14 @@ static void tcf_sample_get_group(struct flow_action_entry *entry,
}

int tc_setup_flow_action(struct flow_action *flow_action,
const struct tcf_exts *exts, bool rtnl_held)
const struct tcf_exts *exts)
{
struct tc_action *act;
int i, j, k, err = 0;

if (!exts)
return 0;

if (!rtnl_held)
rtnl_lock();

j = 0;
tcf_exts_for_each_action(i, act, exts) {
struct flow_action_entry *entry;
Expand Down Expand Up @@ -3577,9 +3574,6 @@ int tc_setup_flow_action(struct flow_action *flow_action,
}

err_out:
if (!rtnl_held)
rtnl_unlock();

if (err)
tc_cleanup_flow_action(flow_action);

Expand Down
6 changes: 2 additions & 4 deletions net/sched/cls_flower.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,7 @@ static int fl_hw_replace_filter(struct tcf_proto *tp,
cls_flower.rule->match.key = &f->mkey;
cls_flower.classid = f->res.classid;

err = tc_setup_flow_action(&cls_flower.rule->action, &f->exts,
rtnl_held);
err = tc_setup_flow_action(&cls_flower.rule->action, &f->exts);
if (err) {
kfree(cls_flower.rule);
if (skip_sw) {
Expand Down Expand Up @@ -2000,8 +1999,7 @@ static int fl_reoffload(struct tcf_proto *tp, bool add, flow_setup_cb_t *cb,
cls_flower.rule->match.mask = &f->mask->key;
cls_flower.rule->match.key = &f->mkey;

err = tc_setup_flow_action(&cls_flower.rule->action, &f->exts,
true);
err = tc_setup_flow_action(&cls_flower.rule->action, &f->exts);
if (err) {
kfree(cls_flower.rule);
if (tc_skip_sw(f->flags)) {
Expand Down
4 changes: 2 additions & 2 deletions net/sched/cls_matchall.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static int mall_replace_hw_filter(struct tcf_proto *tp,
cls_mall.command = TC_CLSMATCHALL_REPLACE;
cls_mall.cookie = cookie;

err = tc_setup_flow_action(&cls_mall.rule->action, &head->exts, true);
err = tc_setup_flow_action(&cls_mall.rule->action, &head->exts);
if (err) {
kfree(cls_mall.rule);
mall_destroy_hw_filter(tp, head, cookie, NULL);
Expand Down Expand Up @@ -302,7 +302,7 @@ static int mall_reoffload(struct tcf_proto *tp, bool add, flow_setup_cb_t *cb,
TC_CLSMATCHALL_REPLACE : TC_CLSMATCHALL_DESTROY;
cls_mall.cookie = (unsigned long)head;

err = tc_setup_flow_action(&cls_mall.rule->action, &head->exts, true);
err = tc_setup_flow_action(&cls_mall.rule->action, &head->exts);
if (err) {
kfree(cls_mall.rule);
if (add && tc_skip_sw(head->flags)) {
Expand Down

0 comments on commit b15e7a6

Please sign in to comment.