2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

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: 5c039ddc64 ("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>
This commit is contained in:
Baowen Zheng
2022-09-30 14:07:56 +08:00
committed by Simon Horman
parent 743499607b
commit ffcb6f115f
5 changed files with 47 additions and 13 deletions

View File

@@ -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);
}
}