+ struct dpif_linux *dpif = dpif_linux_cast(dpif_);
+
+ struct op_auxdata {
+ struct nl_transaction txn;
+
+ struct ofpbuf request;
+ uint64_t request_stub[1024 / 8];
+
+ struct ofpbuf reply;
+ uint64_t reply_stub[1024 / 8];
+ } auxes[MAX_OPS];
+
+ struct nl_transaction *txnsp[MAX_OPS];
+ size_t i;
+
+ assert(n_ops <= MAX_OPS);
+ for (i = 0; i < n_ops; i++) {
+ struct op_auxdata *aux = &auxes[i];
+ struct dpif_op *op = ops[i];
+ struct dpif_flow_put *put;
+ struct dpif_flow_del *del;
+ struct dpif_execute *execute;
+ struct dpif_linux_flow flow;
+
+ ofpbuf_use_stub(&aux->request,
+ aux->request_stub, sizeof aux->request_stub);
+ aux->txn.request = &aux->request;
+
+ ofpbuf_use_stub(&aux->reply, aux->reply_stub, sizeof aux->reply_stub);
+ aux->txn.reply = NULL;
+
+ switch (op->type) {
+ case DPIF_OP_FLOW_PUT:
+ put = &op->u.flow_put;
+ dpif_linux_init_flow_put(dpif_, put, &flow);
+ if (put->stats) {
+ flow.nlmsg_flags |= NLM_F_ECHO;
+ aux->txn.reply = &aux->reply;
+ }
+ dpif_linux_flow_to_ofpbuf(&flow, &aux->request);
+ break;
+
+ case DPIF_OP_FLOW_DEL:
+ del = &op->u.flow_del;
+ dpif_linux_init_flow_del(dpif_, del, &flow);
+ if (del->stats) {
+ flow.nlmsg_flags |= NLM_F_ECHO;
+ aux->txn.reply = &aux->reply;
+ }
+ dpif_linux_flow_to_ofpbuf(&flow, &aux->request);
+ break;
+
+ case DPIF_OP_EXECUTE:
+ execute = &op->u.execute;
+ dpif_linux_encode_execute(dpif->dp_ifindex, execute,
+ &aux->request);
+ break;
+
+ default:
+ NOT_REACHED();
+ }
+ }
+
+ for (i = 0; i < n_ops; i++) {
+ txnsp[i] = &auxes[i].txn;
+ }
+ nl_sock_transact_multiple(genl_sock, txnsp, n_ops);
+
+ for (i = 0; i < n_ops; i++) {
+ struct op_auxdata *aux = &auxes[i];
+ struct nl_transaction *txn = &auxes[i].txn;
+ struct dpif_op *op = ops[i];
+ struct dpif_flow_put *put;
+ struct dpif_flow_del *del;
+
+ op->error = txn->error;
+
+ switch (op->type) {
+ case DPIF_OP_FLOW_PUT:
+ put = &op->u.flow_put;
+ if (put->stats) {
+ if (!op->error) {
+ struct dpif_linux_flow reply;
+
+ op->error = dpif_linux_flow_from_ofpbuf(&reply,
+ txn->reply);
+ if (!op->error) {
+ dpif_linux_flow_get_stats(&reply, put->stats);
+ }
+ }
+
+ if (op->error) {
+ memset(put->stats, 0, sizeof *put->stats);
+ }
+ }
+ break;
+
+ case DPIF_OP_FLOW_DEL:
+ del = &op->u.flow_del;
+ if (del->stats) {
+ if (!op->error) {
+ struct dpif_linux_flow reply;
+
+ op->error = dpif_linux_flow_from_ofpbuf(&reply,
+ txn->reply);
+ if (!op->error) {
+ dpif_linux_flow_get_stats(&reply, del->stats);
+ }
+ }
+
+ if (op->error) {
+ memset(del->stats, 0, sizeof *del->stats);
+ }
+ }
+ break;
+
+ case DPIF_OP_EXECUTE:
+ break;
+
+ default:
+ NOT_REACHED();
+ }
+
+ ofpbuf_uninit(&aux->request);
+ ofpbuf_uninit(&aux->reply);
+ }
+}
+
+static void
+dpif_linux_operate(struct dpif *dpif, struct dpif_op **ops, size_t n_ops)
+{
+ while (n_ops > 0) {
+ size_t chunk = MIN(n_ops, MAX_OPS);
+ dpif_linux_operate__(dpif, ops, chunk);
+ ops += chunk;
+ n_ops -= chunk;
+ }
+}
+
+static void
+set_upcall_pids(struct dpif *dpif_)
+{
+ struct dpif_linux *dpif = dpif_linux_cast(dpif_);
+ struct dpif_port_dump port_dump;
+ struct dpif_port port;