diff options
author | Joe Stringer <joestringer@nicira.com> | 2014-02-27 14:13:08 -0800 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2014-02-27 14:30:25 -0800 |
commit | d2ad7ef178c39427f2e93ea5c70b3ffc51b7ad1f (patch) | |
tree | 0dce5eb1c33bb88872062b7f024e356e83f9fee4 /utilities/ovs-dpctl.c | |
parent | e723fd32d5d5d8d06c3235d2bc8e9142edcca524 (diff) | |
download | openvswitch-d2ad7ef178c39427f2e93ea5c70b3ffc51b7ad1f.tar.gz |
dpif: Make dpif_flow_dump_next() thread-safe.
This patch makes it the caller's responsibility to initialize a
per-thread 'state' object and pass it down to the dpif_flow_dump_next()
implementation. The implementation can expect to be called from multiple
threads with the same 'iter' and different 'state' objects.
When flow_dump_next() returns non-zero, the implementation must ensure
that subsequent calls with the same arguments also return non-zero.
Subsequent calls with the same 'iter' and different 'state' may return
zero, but should make progress towards returning non-zero.
Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'utilities/ovs-dpctl.c')
-rw-r--r-- | utilities/ovs-dpctl.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/utilities/ovs-dpctl.c b/utilities/ovs-dpctl.c index 66f87fe55..8f1716d05 100644 --- a/utilities/ovs-dpctl.c +++ b/utilities/ovs-dpctl.c @@ -764,6 +764,7 @@ dpctl_dump_flows(int argc, char *argv[]) char *name, *error, *filter = NULL; struct flow flow_filter; struct flow_wildcards wc_filter; + void *state = NULL; if (argc > 1 && !strncmp(argv[argc - 1], "filter=", 7)) { filter = xstrdup(argv[--argc] + 7); @@ -791,9 +792,10 @@ dpctl_dump_flows(int argc, char *argv[]) ds_init(&ds); dpif_flow_dump_start(&flow_dump, dpif); - while (dpif_flow_dump_next(&flow_dump, &key, &key_len, - &mask, &mask_len, - &actions, &actions_len, &stats)) { + dpif_flow_dump_state_init(dpif, &state); + while (dpif_flow_dump_next(&flow_dump, state, &key, &key_len, + &mask, &mask_len, &actions, &actions_len, + &stats)) { if (filter) { struct flow flow; struct flow_wildcards wc; @@ -824,6 +826,7 @@ dpctl_dump_flows(int argc, char *argv[]) format_odp_actions(&ds, actions, actions_len); printf("%s\n", ds_cstr(&ds)); } + dpif_flow_dump_state_uninit(dpif, state); dpif_flow_dump_done(&flow_dump); free(filter); |