From: Paul Blakey <[email protected]> When verbosity is requested on dump-flows (-m) indicate which flows are offloaded.
Signed-off-by: Paul Blakey <[email protected]> Reviewed-by: Roi Dayan <[email protected]> --- lib/dpctl.c | 11 ++++++++--- lib/dpif-netlink.c | 4 ++++ lib/dpif.h | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/dpctl.c b/lib/dpctl.c index a2ee8a2..7f44d02 100644 --- a/lib/dpctl.c +++ b/lib/dpctl.c @@ -739,7 +739,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, - struct dpctl_params *dpctl_p) + char *type, struct dpctl_params *dpctl_p) { if (dpctl_p->verbosity && f->ufid_present) { odp_format_ufid(&f->ufid, ds); @@ -750,6 +750,9 @@ 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) { + ds_put_cstr(ds, ", offloaded:yes"); + } ds_put_cstr(ds, ", actions:"); format_odp_actions(ds, f->actions, f->actions_len); } @@ -850,6 +853,7 @@ dpctl_dump_flows(int argc, const char *argv[], struct dpctl_params *dpctl_p) BUILD_ASSERT(PMD_ID_NULL != NON_PMD_CORE_ID); ds_init(&ds); + memset(&f, 0, sizeof f); flow_dump = dpif_flow_dump_create(dpif, false, (type ? type : "dpctl")); flow_dump_thread = dpif_flow_dump_thread_create(flow_dump); while (dpif_flow_dump_next(flow_dump_thread, &f, 1)) { @@ -886,7 +890,8 @@ 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, dpctl_p); + format_dpif_flow(&ds, &f, &portno_names, type, dpctl_p); + dpctl_print(dpctl_p, "%s\n", ds_cstr(&ds)); } dpif_flow_dump_thread_destroy(flow_dump_thread); @@ -1069,7 +1074,7 @@ dpctl_get_flow(int argc, const char *argv[], struct dpctl_params *dpctl_p) } ds_init(&ds); - format_dpif_flow(&ds, &flow, &portno_names, dpctl_p); + format_dpif_flow(&ds, &flow, &portno_names, NULL, dpctl_p); dpctl_print(dpctl_p, "%s\n", ds_cstr(&ds)); ds_destroy(&ds); diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c index f10c638..75cd228 100644 --- a/lib/dpif-netlink.c +++ b/lib/dpif-netlink.c @@ -1639,6 +1639,7 @@ dpif_netlink_flow_to_dpif_flow(struct dpif *dpif, struct dpif_flow *dpif_flow, &dpif_flow->ufid); } dpif_netlink_flow_get_stats(datapath_flow, &dpif_flow->stats); + dpif_flow->offloaded = false; } /* The design is such that all threads are working together on the first dump @@ -1718,6 +1719,9 @@ dpif_netlink_netdev_match_to_dpif_flow(struct match *match, flow->ufid = *ufid; flow->pmd_id = PMD_ID_NULL; + + flow->offloaded = true; + return 0; } diff --git a/lib/dpif.h b/lib/dpif.h index b1f516e..38efd29 100644 --- a/lib/dpif.h +++ b/lib/dpif.h @@ -591,6 +591,7 @@ struct dpif_flow { bool ufid_present; /* True if 'ufid' was provided by datapath.*/ unsigned pmd_id; /* Datapath poll mode driver id. */ struct dpif_flow_stats stats; /* Flow statistics. */ + bool offloaded; /* True if flow is offloaded */ }; int dpif_flow_dump_next(struct dpif_flow_dump_thread *, struct dpif_flow *flows, int max_flows); -- 2.7.4 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
