summaryrefslogtreecommitdiff
path: root/utilities/ovs-dpctl.c
diff options
context:
space:
mode:
authorJoe Stringer <joestringer@nicira.com>2014-02-27 14:13:09 -0800
committerBen Pfaff <blp@nicira.com>2014-02-27 14:38:58 -0800
commit938eaa50a637df3817ef5f356c10f3965f8226fe (patch)
tree9f8c1e6829cf8a221b1a0a4ed1739bfe055e1780 /utilities/ovs-dpctl.c
parentd2ad7ef178c39427f2e93ea5c70b3ffc51b7ad1f (diff)
downloadopenvswitch-938eaa50a637df3817ef5f356c10f3965f8226fe.tar.gz
dpif: Don't synchronize flow_dump_next() status.
Recent changes to the flow_dump_next() interface have made it the responsibility of the dpif implementation to track error status over a flow dump operation. This patch removes status tracking from 'struct dpif_flow_dump', allowing multiple threads to call dpif_flow_dump_next() and track their status independently. Even if one thread finishes processing flows for a given iterator and state, it will not prevent other callers from processing the remaining flows in their buffers. After this patch, the error code that dpif_flow_dump_next() returns is only significant for the current state and buffer. As before, the status of the entire flow dump operation can be obtained by calling dpif_flow_dump_done(). 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.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/utilities/ovs-dpctl.c b/utilities/ovs-dpctl.c
index 8f1716d05..4b00118ab 100644
--- a/utilities/ovs-dpctl.c
+++ b/utilities/ovs-dpctl.c
@@ -761,10 +761,11 @@ dpctl_dump_flows(int argc, char *argv[])
size_t key_len;
size_t mask_len;
struct ds ds;
- char *name, *error, *filter = NULL;
+ char *name, *filter = NULL;
struct flow flow_filter;
struct flow_wildcards wc_filter;
void *state = NULL;
+ int error;
if (argc > 1 && !strncmp(argv[argc - 1], "filter=", 7)) {
filter = xstrdup(argv[--argc] + 7);
@@ -783,15 +784,18 @@ dpctl_dump_flows(int argc, char *argv[])
}
if (filter) {
- error = parse_ofp_exact_flow(&flow_filter, &wc_filter.masks, filter,
- &names_portno);
- if (error) {
- ovs_fatal(0, "Failed to parse filter (%s)", error);
+ char *err = parse_ofp_exact_flow(&flow_filter, &wc_filter.masks,
+ filter, &names_portno);
+ if (err) {
+ ovs_fatal(0, "Failed to parse filter (%s)", err);
}
}
ds_init(&ds);
- dpif_flow_dump_start(&flow_dump, dpif);
+ error = dpif_flow_dump_start(&flow_dump, dpif);
+ if (error) {
+ goto exit;
+ }
dpif_flow_dump_state_init(dpif, &state);
while (dpif_flow_dump_next(&flow_dump, state, &key, &key_len,
&mask, &mask_len, &actions, &actions_len,
@@ -827,8 +831,12 @@ dpctl_dump_flows(int argc, char *argv[])
printf("%s\n", ds_cstr(&ds));
}
dpif_flow_dump_state_uninit(dpif, state);
- dpif_flow_dump_done(&flow_dump);
+ error = dpif_flow_dump_done(&flow_dump);
+exit:
+ if (error) {
+ ovs_fatal(error, "Failed to dump flows from datapath");
+ }
free(filter);
odp_portno_names_destroy(&portno_names);
hmap_destroy(&portno_names);