summaryrefslogtreecommitdiff
path: root/lib/tc.c
diff options
context:
space:
mode:
authorBaowen Zheng <baowen.zheng@corigine.com>2022-09-30 14:07:56 +0800
committerSimon Horman <simon.horman@corigine.com>2022-11-01 10:18:16 +0100
commitffcb6f115fe5e00be3ca8fb9a940a3224e687e23 (patch)
tree2aeb478eabd799933e30218adfee15698d8bca70 /lib/tc.c
parent743499607bdd0dcb3541a179ba2bb41ea10c4b3b (diff)
downloadopenvswitch-ffcb6f115fe5e00be3ca8fb9a940a3224e687e23.tar.gz
netdev-linux: Allow meter to work in tc software datapath when tc-policy is specified
Add tc action flags when adding police action to offload meter table. There is a restriction that the flag of skip_sw/skip_hw should be same for filter rule and the independent created tc actions the rule uses. In this case, if we configure the tc-policy as skip_hw, filter rule will be created with skip_hw flag and the police action according to meter table will have no action flag, then flower rule will fail to add to tc kernel system. To fix this issue, we will add tc action flag when adding police action to offload a meter table, so it will allow meter table to work in tc software datapath. Fixes: 5c039ddc64ff ("netdev-linux: Add functions to manipulate tc police action") Signed-off-by: Baowen Zheng <baowen.zheng@corigine.com> Acked-by: Ilya Maximets <i.maximets@ovn.org> Signed-off-by: Simon Horman <simon.horman@corigine.com>
Diffstat (limited to 'lib/tc.c')
-rw-r--r--lib/tc.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/tc.c b/lib/tc.c
index 3b591975b..4d7de8add 100644
--- a/lib/tc.c
+++ b/lib/tc.c
@@ -3810,3 +3810,24 @@ tc_set_policy(const char *policy)
VLOG_INFO("tc: Using policy '%s'", policy);
}
+
+void
+nl_msg_put_act_tc_policy_flag(struct ofpbuf *request)
+{
+ int flag = 0;
+
+ if (!request) {
+ return;
+ }
+
+ if (tc_policy == TC_POLICY_SKIP_HW) {
+ flag = TCA_ACT_FLAGS_SKIP_HW;
+ } else if (tc_policy == TC_POLICY_SKIP_SW) {
+ flag = TCA_ACT_FLAGS_SKIP_SW;
+ }
+
+ if (flag) {
+ struct nla_bitfield32 flags = { flag, flag };
+ nl_msg_put_unspec(request, TCA_ACT_FLAGS, &flags, sizeof flags);
+ }
+}