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,
struct dpif dpif;
run(dpif_open(argv[1], &dpif), "opening datapath");
- run(dpif_flow_del_all(&dpif), "deleting all flows");
+ run(dpif_flow_flush(&dpif), "deleting all flows");
dpif_close(&dpif);
}