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

netdev-offload-tc: Offloading rules with police actions

When offloading rule, tc should be filled with police index, instead
of meter id. As meter is mapped to police action, and the mapping is
inserted into meter_id_to_police_idx hmap, this hmap is used to find
the police index. Besides, the reverse mapping between meter id and
police index is also added, so meter id can be retrieved from this
hashmap and pass to dpif while dumping rules.

Signed-off-by: Jianbo Liu <jianbol@nvidia.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
This commit is contained in:
Jianbo Liu
2022-07-08 03:06:28 +00:00
committed by Simon Horman
parent f6ed09ef55
commit 218304df18
2 changed files with 65 additions and 2 deletions

View File

@@ -2444,6 +2444,22 @@ nl_msg_put_act_gact(struct ofpbuf *request, uint32_t chain)
nl_msg_end_nested(request, offset);
}
static void
nl_msg_put_act_police_index(struct ofpbuf *request, uint32_t police_idx)
{
struct tc_police police;
size_t offset;
memset(&police, 0, sizeof police);
police.index = police_idx;
nl_msg_put_string(request, TCA_ACT_KIND, "police");
offset = nl_msg_start_nested(request, TCA_ACT_OPTIONS);
nl_msg_put_unspec(request, TCA_POLICE_TBF, &police, sizeof police);
nl_msg_put_u32(request, TCA_POLICE_RESULT, TC_ACT_PIPE);
nl_msg_end_nested(request, offset);
}
static void
nl_msg_put_act_ct(struct ofpbuf *request, struct tc_action *action)
{
@@ -2934,7 +2950,9 @@ nl_msg_put_flower_acts(struct ofpbuf *request, struct tc_flower *flower)
}
break;
case TC_ACT_POLICE: {
/* Not supported yet */
act_offset = nl_msg_start_nested(request, act_index++);
nl_msg_put_act_police_index(request, action->police.index);
nl_msg_end_nested(request, act_offset);
}
break;
}