return 0;
}
+int
+dpif_flow_del_all(struct dpif *dpif)
+{
+ struct odp_stats stats;
+ struct odp_flow *flows;
+ size_t n_flows;
+ size_t i;
+ int error;
+
+ error = dpif_get_dp_stats(dpif, &stats);
+ if (error) {
+ return error;
+ }
+
+ flows = xmalloc(sizeof *flows * stats.n_flows);
+ error = dpif_flow_list(dpif, flows, stats.n_flows, &n_flows);
+ if (error) {
+ free(flows);
+ return error;
+ }
+
+ if (stats.n_flows != n_flows) {
+ VLOG_WARN_RL(&error_rl, "dp%u: datapath stats reported %"PRIu32" "
+ "flows but flow listing reported %zu",
+ dpif->minor, stats.n_flows, n_flows);
+ }
+
+ for (i=0; i<n_flows; i++) {
+ error = dpif_flow_del(dpif, &flows[i]);
+ if (error) {
+ VLOG_WARN_RL(&error_rl, "dp%u: problem deleting flow",
+ dpif->minor);
+ return error;
+ }
+ }
+ return 0;
+}
+
int
dpif_execute(struct dpif *dpif, uint16_t in_port,
const union odp_action actions[], size_t n_actions,
simpler flows maintained by the datapaths used by the OpenFlow
reference implementation.
+.IP "\fBdp-del-flows \fIdp\fR"
+Deletes all flow entries from datapath \fIdp\fR's flow table.
+
+This command is primarily useful for debugging the OpenFlow reference
+implementation. As discussed in \fBdp-dump-flows\fR, these entries are
+not OpenFlow flow entries. By deleting them, the process that set them
+up may be confused about their disappearance.
+
.IP "\fBdp-dump-groups \fIdp\fR"
Prints to the console the sets of port groups maintained by datapath
\fIdp\fR. Ordinarily there are at least 2 port groups in a datapath
" dp-show show basic info on all datapaths\n"
" dp-show DP... show basic info on each DP\n"
" dp-dump-flows DP display flows in DP\n"
+ " dp-del-flows DP delete all flows from DP\n"
" dp-dump-groups DP display port groups in DP\n"
"\nFor OpenFlow switches:\n"
" show SWITCH show OpenFlow information\n"
dpif_close(&dpif);
}
+static void
+do_dp_del_flows(const struct settings *s UNUSED,
+ int argc UNUSED, char *argv[])
+{
+ struct dpif dpif;
+
+ run(dpif_open(argv[1], &dpif), "opening datapath");
+ run(dpif_flow_del_all(&dpif), "deleting all flows");
+ dpif_close(&dpif);
+}
+
static void
do_dp_dump_groups(const struct settings *s UNUSED,
int argc UNUSED, char *argv[])
{ "get-name", 1, 1, do_get_name },
{ "dp-show", 0, INT_MAX, do_dp_show },
{ "dp-dump-flows", 1, 1, do_dp_dump_flows },
+ { "dp-del-flows", 1, 1, do_dp_del_flows },
{ "dp-dump-groups", 1, 1, do_dp_dump_groups },
#endif