mirror of
https://github.com/openvswitch/ovs
synced 2025-10-19 14:37:21 +00:00
dpctl: Properly reflect a rule's offloaded to HW state
Previously, any rule that is offloaded via a netdev, not necessarily to the HW, would be reported as "offloaded". This patch fixes this misalignment, and introduces the 'dp' state, as follows: rule is in HW via TC offload -> offloaded=yes dp:tc rule is in not HW over TC DP -> offloaded=no dp:tc rule is in not HW over OVS DP -> offloaded=no dp:ovs To achieve this, the flows's 'offloaded' flag was encapsulated in a new attrs struct, which contains the offloaded state of the flow and the DP layer the flow is handled in, and instead of setting the flow's 'offloaded' state based solely on the type of dump it was acquired via, for netdev flows it now sends the new attrs struct to be collected along with the rest of the flow via the netdev, allowing it to be set per flow. For TC offloads, the offloaded state is set based on the 'in_hw' and 'not_in_hw' flags received from the TC as part of the flower. If no such flag was received, due to lack of kernel support, it defaults to true. Signed-off-by: Gavi Teitz <gavi@mellanox.com> Acked-by: Roi Dayan <roid@mellanox.com> [simon: resolved conflict in lib/dpctl.man] Signed-off-by: Simon Horman <simon.horman@netronome.com>
This commit is contained in:
23
lib/tc.c
23
lib/tc.c
@@ -458,6 +458,28 @@ nl_parse_flower_ip(struct nlattr **attrs, struct tc_flower *flower) {
|
||||
}
|
||||
}
|
||||
|
||||
static enum tc_offloaded_state
|
||||
nl_get_flower_offloaded_state(struct nlattr **attrs)
|
||||
{
|
||||
uint32_t flower_flags = 0;
|
||||
|
||||
if (attrs[TCA_FLOWER_FLAGS]) {
|
||||
flower_flags = nl_attr_get_u32(attrs[TCA_FLOWER_FLAGS]);
|
||||
if (flower_flags & TCA_CLS_FLAGS_NOT_IN_HW) {
|
||||
return TC_OFFLOADED_STATE_NOT_IN_HW;
|
||||
} else if (flower_flags & TCA_CLS_FLAGS_IN_HW) {
|
||||
return TC_OFFLOADED_STATE_IN_HW;
|
||||
}
|
||||
}
|
||||
return TC_OFFLOADED_STATE_UNDEFINED;
|
||||
}
|
||||
|
||||
static void
|
||||
nl_parse_flower_flags(struct nlattr **attrs, struct tc_flower *flower)
|
||||
{
|
||||
flower->offloaded_state = nl_get_flower_offloaded_state(attrs);
|
||||
}
|
||||
|
||||
static const struct nl_policy pedit_policy[] = {
|
||||
[TCA_PEDIT_PARMS_EX] = { .type = NL_A_UNSPEC,
|
||||
.min_len = sizeof(struct tc_pedit),
|
||||
@@ -942,6 +964,7 @@ nl_parse_flower_options(struct nlattr *nl_options, struct tc_flower *flower)
|
||||
nl_parse_flower_vlan(attrs, flower);
|
||||
nl_parse_flower_ip(attrs, flower);
|
||||
nl_parse_flower_tunnel(attrs, flower);
|
||||
nl_parse_flower_flags(attrs, flower);
|
||||
return nl_parse_flower_actions(attrs, flower);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user