+static void
+subfacet_destroy_batch(struct ofproto_dpif *ofproto,
+ struct subfacet **subfacets, int n)
+{
+ struct odputil_keybuf keybufs[SUBFACET_DESTROY_MAX_BATCH];
+ struct dpif_op ops[SUBFACET_DESTROY_MAX_BATCH];
+ struct dpif_op *opsp[SUBFACET_DESTROY_MAX_BATCH];
+ struct ofpbuf keys[SUBFACET_DESTROY_MAX_BATCH];
+ struct dpif_flow_stats stats[SUBFACET_DESTROY_MAX_BATCH];
+ int i;
+
+ for (i = 0; i < n; i++) {
+ ops[i].type = DPIF_OP_FLOW_DEL;
+ subfacet_get_key(subfacets[i], &keybufs[i], &keys[i]);
+ ops[i].u.flow_del.key = keys[i].data;
+ ops[i].u.flow_del.key_len = keys[i].size;
+ ops[i].u.flow_del.stats = &stats[i];
+ opsp[i] = &ops[i];
+ }
+
+ dpif_operate(ofproto->dpif, opsp, n);
+ for (i = 0; i < n; i++) {
+ subfacet_reset_dp_stats(subfacets[i], &stats[i]);
+ subfacets[i]->path = SF_NOT_INSTALLED;
+ subfacet_destroy(subfacets[i]);
+ }
+}
+