When trying to offload u32 cmd by adding skip_sw attributes it gets
ignored and it cannot be correctly processed by HW and tc_cls_u32_offload
struct which is then passed to driver lacks skip_sw var enabled.
Encountered the issue while developing ixgbe.
u32_replace_hw_knode is fed with the TCA_ACT_* flags (bits 16+)
instead of TCA_CLS_* flags (bits 0-4) which actually stores the flags
parsed by tc, so tc_skip_sw() always returns false. This leads to
ignoring some of the attributes which meant to be configured on filter
setup.
None of the TCA_ACT_FLAGS_* is actually used within
u32_replace_hw_knode(), so there's no point in passing them.
Other classifiers do not put TCA_ACT_FLAGS_* during filter setup.
Looks like commit 695176bfe5de ("net_sched: refactor TC action init API")
shadowed the local flags variable which used to be set with
nla_get_u32(tb[TCA_U32_FLAGS]) with the flags as the new function param
while not replacing for none of the u32_replace_hw_knode() calls.
Because skip_sw is now honored, "tc ... u32 ... skip_sw" add/replace
commands that previously succeeded (and were silently skipped by the
software path) will now return -EOPNOTSUPP/-EINVAL when the block or
driver cannot offload the filter.
Fixes: 695176bfe5de ("net_sched: refactor TC action init API")
Cc: stab…@vger.kernel.org
Reviewed-by: Marcin Szycik <marc…@linux.intel.com>
Reviewed-by: Przemek Kitszel <prze…@intel.com>
Signed-off-by: Jedrzej Jagielski <jedr…@intel.com>
---
net/sched/cls_u32.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
index bf4dc4244b84..48c581d6830c 100644
--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -956,7 +956,7 @@ static int u32_change(struct net *net, struct sk_buff *in_skb,
u32_bind_filter(tp, new, base, tb);
- err = u32_replace_hw_knode(tp, new, flags, false, extack);
+ err = u32_replace_hw_knode(tp, new, userflags, false, extack);
if (err) {
u32_unbind_filter(tp, new, tb);
__u32_destroy_key(new);
@@ -1194,7 +1194,7 @@ static int u32_change(struct net *net, struct sk_buff *in_skb,
struct tc_u_knode __rcu **ins;
struct tc_u_knode *pins;
- err = u32_replace_hw_knode(tp, n, flags, true, extack);
+ err = u32_replace_hw_knode(tp, n, userflags, true, extack);
if (err)
goto errunbind;
--
2.31.1