Skip to content

Commit

Permalink
dpctl: Support dump-flows filters "dpdk" and "partially-offloaded".
Browse files Browse the repository at this point in the history
Flows that are offloaded via DPDK can be partially offloaded (matches
only) or fully offloaded (matches and actions). Set partially offloaded
display to (offloaded=partial, dp:ovs), and fully offloaded to
(offloaded=yes, dp:dpdk). Also support filter types "dpdk" and
"partially-offloaded".

Signed-off-by: Eli Britstein <[email protected]>
Signed-off-by: Ilya Maximets <[email protected]>
  • Loading branch information
Eli Britstein authored and igsilya committed Jan 16, 2020
1 parent 2aca29d commit 80944cb
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ Post-v2.12.0
interval is increased to 60 seconds for the connection to the
replication server. This value is configurable with the unixctl
command - ovsdb-server/set-active-ovsdb-server-probe-interval.
- 'ovs-appctl dpctl/dump-flows' can now show offloaded=partial for
partially offloaded flows, dp:dpdk for fully offloaded by dpdk, and
type filter supports new filters: "dpdk" and "partially-offloaded".

v2.12.0 - 03 Sep 2019
---------------------
Expand Down
28 changes: 25 additions & 3 deletions lib/dpctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,11 @@ format_dpif_flow(struct ds *ds, const struct dpif_flow *f, struct hmap *ports,

dpif_flow_stats_format(&f->stats, ds);
if (dpctl_p->verbosity && f->attrs.offloaded) {
ds_put_cstr(ds, ", offloaded:yes");
if (f->attrs.dp_layer && !strcmp(f->attrs.dp_layer, "ovs")) {
ds_put_cstr(ds, ", offloaded:partial");
} else {
ds_put_cstr(ds, ", offloaded:yes");
}
}
if (dpctl_p->verbosity && f->attrs.dp_layer) {
ds_put_format(ds, ", dp:%s", f->attrs.dp_layer);
Expand All @@ -830,17 +834,21 @@ format_dpif_flow(struct ds *ds, const struct dpif_flow *f, struct hmap *ports,
struct dump_types {
bool ovs;
bool tc;
bool dpdk;
bool offloaded;
bool non_offloaded;
bool partially_offloaded;
};

static void
enable_all_dump_types(struct dump_types *dump_types)
{
dump_types->ovs = true;
dump_types->tc = true;
dump_types->dpdk = true;
dump_types->offloaded = true;
dump_types->non_offloaded = true;
dump_types->partially_offloaded = true;
}

static int
Expand All @@ -865,10 +873,14 @@ populate_dump_types(char *types_list, struct dump_types *dump_types,
dump_types->ovs = true;
} else if (!strcmp(current_type, "tc")) {
dump_types->tc = true;
} else if (!strcmp(current_type, "dpdk")) {
dump_types->dpdk = true;
} else if (!strcmp(current_type, "offloaded")) {
dump_types->offloaded = true;
} else if (!strcmp(current_type, "non-offloaded")) {
dump_types->non_offloaded = true;
} else if (!strcmp(current_type, "partially-offloaded")) {
dump_types->partially_offloaded = true;
} else if (!strcmp(current_type, "all")) {
enable_all_dump_types(dump_types);
} else {
Expand All @@ -886,7 +898,9 @@ determine_dpif_flow_dump_types(struct dump_types *dump_types,
{
dpif_dump_types->ovs_flows = dump_types->ovs || dump_types->non_offloaded;
dpif_dump_types->netdev_flows = dump_types->tc || dump_types->offloaded
|| dump_types->non_offloaded;
|| dump_types->non_offloaded
|| dump_types->dpdk
|| dump_types->partially_offloaded;
}

static bool
Expand All @@ -899,7 +913,15 @@ flow_passes_type_filter(const struct dpif_flow *f,
if (dump_types->tc && !strcmp(f->attrs.dp_layer, "tc")) {
return true;
}
if (dump_types->offloaded && f->attrs.offloaded) {
if (dump_types->dpdk && !strcmp(f->attrs.dp_layer, "dpdk")) {
return true;
}
if (dump_types->offloaded && f->attrs.offloaded &&
strcmp(f->attrs.dp_layer, "ovs")) {
return true;
}
if (dump_types->partially_offloaded && f->attrs.offloaded &&
!strcmp(f->attrs.dp_layer, "ovs")) {
return true;
}
if (dump_types->non_offloaded && !(f->attrs.offloaded)) {
Expand Down
2 changes: 2 additions & 0 deletions lib/dpctl.man
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,10 @@ This option supported only for \fBovs\-appctl dpctl/dump\-flows\fR.
.
\fBovs\fR - displays flows handled in the ovs dp
\fBtc\fR - displays flows handled in the tc dp
\fBdpdk\fR - displays flows fully offloaded by dpdk
\fBoffloaded\fR - displays flows offloaded to the HW
\fBnon-offloaded\fR - displays flows not offloaded to the HW
\fBpartially-offloaded\fR - displays flows where only part of their proccessing is done in HW
\fBall\fR - displays all the types of flows
.IP
By default all the types of flows are displayed.
Expand Down

0 comments on commit 80944cb

Please sign in to comment.