Skip to content

Commit

Permalink
dpif-netdev: Modified ovs-appctl dpctl/dump-flows command
Browse files Browse the repository at this point in the history
Modified ovs-appctl dpctl/dump-flows command to output
the miniflow bits for a given flow when -m option is passed.

$ ovs-appctl dpctl/dump-flows -m

Signed-off-by: Emma Finn <[email protected]>
Signed-off-by: Ian Stokes <[email protected]>
  • Loading branch information
emmaLfinn00 authored and istokes committed Jan 17, 2020
1 parent 8ae6a5f commit 0e8f5c6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Post-v2.12.0
* Add option to enable, disable and query TCP sequence checking in
conntrack.
* Add support for conntrack zone limits.
* Command "ovs-appctl dpctl/dump-flows" refactored to show subtable
miniflow bits for userspace datapath.
- AF_XDP:
* New option 'use-need-wakeup' for netdev-afxdp to control enabling
of corresponding 'need_wakeup' flag in AF_XDP rings. Enabled by default
Expand Down
4 changes: 4 additions & 0 deletions lib/dpctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,10 @@ format_dpif_flow(struct ds *ds, const struct dpif_flow *f, struct hmap *ports,
}
ds_put_cstr(ds, ", actions:");
format_odp_actions(ds, f->actions, f->actions_len, ports);
if (dpctl_p->verbosity && f->attrs.dp_extra_info) {
ds_put_format(ds, ", dp-extra-info:%s", f->attrs.dp_extra_info);
}
free(f->attrs.dp_extra_info);
}

struct dump_types {
Expand Down
15 changes: 15 additions & 0 deletions lib/dpif-netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -3158,6 +3158,21 @@ dp_netdev_flow_to_dpif_flow(const struct dp_netdev *dp,
flow->pmd_id = netdev_flow->pmd_id;

get_dpif_flow_status(dp, netdev_flow, &flow->stats, &flow->attrs);

struct ds extra_info = DS_EMPTY_INITIALIZER;
size_t unit;

ds_put_cstr(&extra_info, "miniflow_bits(");
FLOWMAP_FOR_EACH_UNIT (unit) {
if (unit) {
ds_put_char(&extra_info, ',');
}
ds_put_format(&extra_info, "%d",
count_1bits(netdev_flow->cr.mask->mf.map.bits[unit]));
}
ds_put_char(&extra_info, ')');
flow->attrs.dp_extra_info = ds_steal_cstr(&extra_info);
ds_destroy(&extra_info);
}

static int
Expand Down
1 change: 1 addition & 0 deletions lib/dpif.h
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ struct dpif_flow_detailed_stats {
struct dpif_flow_attrs {
bool offloaded; /* True if flow is offloaded to HW. */
const char *dp_layer; /* DP layer the flow is handled in. */
char *dp_extra_info; /* Extra information provided by DP. */
};

struct dpif_flow_dump_types {
Expand Down

0 comments on commit 0e8f5c6

Please sign in to comment.