Commit 1f15bb4f399ceccd85522b24af31198f53516f9b

Authored by Vlad Buslov
Committed by David S. Miller
1 parent cba2bf7a22

net: sched: flower: only return error from hw offload if skip_sw

Recently introduced tc_setup_flow_action() can fail when parsing tcf_exts
on some unsupported action commands. However, this should not affect the
case when user did not explicitly request hw offload by setting skip_sw
flag. Modify tc_setup_flow_action() callers to only propagate the error if
skip_sw flag is set for filter that is being offloaded, and set extack
error message in that case.

Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Fixes: 3a7b68617de7 ("cls_api: add translator to flow_action representation")
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 10 additions and 2 deletions Side-by-side Diff

net/sched/cls_flower.c
... ... @@ -396,7 +396,11 @@
396 396 err = tc_setup_flow_action(&cls_flower.rule->action, &f->exts);
397 397 if (err) {
398 398 kfree(cls_flower.rule);
399   - return err;
  399 + if (skip_sw) {
  400 + NL_SET_ERR_MSG_MOD(extack, "Failed to setup flow action");
  401 + return err;
  402 + }
  403 + return 0;
400 404 }
401 405  
402 406 err = tc_setup_cb_call(block, TC_SETUP_CLSFLOWER, &cls_flower, skip_sw);
... ... @@ -1503,7 +1507,11 @@
1503 1507 &f->exts);
1504 1508 if (err) {
1505 1509 kfree(cls_flower.rule);
1506   - return err;
  1510 + if (tc_skip_sw(f->flags)) {
  1511 + NL_SET_ERR_MSG_MOD(extack, "Failed to setup flow action");
  1512 + return err;
  1513 + }
  1514 + continue;
1507 1515 }
1508 1516  
1509 1517 cls_flower.classid = f->res.classid;