[ovs-dev] [PATCH V7 09/18] dpctl: Support dump-flows filters "dpdk" and "partially-offloaded"

Eli Britstein elibr at mellanox.com
Thu Jan 9 07:46:46 UTC 2020


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 <elibr at mellanox.com>
---
 NEWS          |  3 +++
 lib/dpctl.c   | 28 +++++++++++++++++++++++++---
 lib/dpctl.man |  2 ++
 3 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index 965facaf8..8e89f77f6 100644
--- a/NEWS
+++ b/NEWS
@@ -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
 ---------------------
diff --git a/lib/dpctl.c b/lib/dpctl.c
index a1ea25b47..23c2682d0 100644
--- a/lib/dpctl.c
+++ b/lib/dpctl.c
@@ -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);
@@ -830,8 +834,10 @@ 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
@@ -839,8 +845,10 @@ 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
@@ -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 {
@@ -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
@@ -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)) {
diff --git a/lib/dpctl.man b/lib/dpctl.man
index 090c3b960..727d1f7be 100644
--- a/lib/dpctl.man
+++ b/lib/dpctl.man
@@ -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.
-- 
2.14.5



More information about the dev mailing list