mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 14:25:26 +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:
25
lib/dpctl.c
25
lib/dpctl.c
@@ -771,7 +771,7 @@ dpctl_dump_dps(int argc OVS_UNUSED, const char *argv[] OVS_UNUSED,
|
||||
|
||||
static void
|
||||
format_dpif_flow(struct ds *ds, const struct dpif_flow *f, struct hmap *ports,
|
||||
char *type, struct dpctl_params *dpctl_p)
|
||||
struct dpctl_params *dpctl_p)
|
||||
{
|
||||
if (dpctl_p->verbosity && f->ufid_present) {
|
||||
odp_format_ufid(&f->ufid, ds);
|
||||
@@ -782,9 +782,12 @@ format_dpif_flow(struct ds *ds, const struct dpif_flow *f, struct hmap *ports,
|
||||
ds_put_cstr(ds, ", ");
|
||||
|
||||
dpif_flow_stats_format(&f->stats, ds);
|
||||
if (dpctl_p->verbosity && !type && f->offloaded) {
|
||||
if (dpctl_p->verbosity && f->attrs.offloaded) {
|
||||
ds_put_cstr(ds, ", offloaded:yes");
|
||||
}
|
||||
if (dpctl_p->verbosity && f->attrs.dp_layer) {
|
||||
ds_put_format(ds, ", dp:%s", f->attrs.dp_layer);
|
||||
}
|
||||
ds_put_cstr(ds, ", actions:");
|
||||
format_odp_actions(ds, f->actions, f->actions_len, ports);
|
||||
}
|
||||
@@ -794,6 +797,15 @@ static char *supported_dump_types[] = {
|
||||
"ovs",
|
||||
};
|
||||
|
||||
static bool
|
||||
flow_passes_type_filter(const struct dpif_flow *f, char *type)
|
||||
{
|
||||
if (!strcmp(type, "offloaded")) {
|
||||
return f->attrs.offloaded;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static struct hmap *
|
||||
dpctl_get_portno_names(struct dpif *dpif, const struct dpctl_params *dpctl_p)
|
||||
{
|
||||
@@ -938,9 +950,10 @@ dpctl_dump_flows(int argc, const char *argv[], struct dpctl_params *dpctl_p)
|
||||
}
|
||||
pmd_id = f.pmd_id;
|
||||
}
|
||||
format_dpif_flow(&ds, &f, portno_names, type, dpctl_p);
|
||||
|
||||
dpctl_print(dpctl_p, "%s\n", ds_cstr(&ds));
|
||||
if (!type || flow_passes_type_filter(&f, type)) {
|
||||
format_dpif_flow(&ds, &f, portno_names, dpctl_p);
|
||||
dpctl_print(dpctl_p, "%s\n", ds_cstr(&ds));
|
||||
}
|
||||
}
|
||||
dpif_flow_dump_thread_destroy(flow_dump_thread);
|
||||
error = dpif_flow_dump_destroy(flow_dump);
|
||||
@@ -1102,7 +1115,7 @@ dpctl_get_flow(int argc, const char *argv[], struct dpctl_params *dpctl_p)
|
||||
}
|
||||
|
||||
ds_init(&ds);
|
||||
format_dpif_flow(&ds, &flow, portno_names, NULL, dpctl_p);
|
||||
format_dpif_flow(&ds, &flow, portno_names, dpctl_p);
|
||||
dpctl_print(dpctl_p, "%s\n", ds_cstr(&ds));
|
||||
ds_destroy(&ds);
|
||||
|
||||
|
Reference in New Issue
Block a user