- if (listen_mask == dpif->listen_mask) {
- return 0;
- } else if (!listen_mask) {
- nl_sock_destroy(dpif->mc_sock);
- dpif->mc_sock = NULL;
- dpif->listen_mask = 0;
- return 0;
- } else if (!dpif->mc_sock) {
- error = nl_sock_create(NETLINK_GENERIC, &dpif->mc_sock);
- if (error) {
- return error;
+ return dpif_linux_execute__(dpif->dp_ifindex, key, key_len,
+ actions, actions_len, packet);
+}
+
+static void
+dpif_linux_operate(struct dpif *dpif_, union dpif_op **ops, size_t n_ops)
+{
+ struct dpif_linux *dpif = dpif_linux_cast(dpif_);
+ struct nl_transaction **txnsp;
+ struct nl_transaction *txns;
+ size_t i;
+
+ txns = xmalloc(n_ops * sizeof *txns);
+ for (i = 0; i < n_ops; i++) {
+ struct nl_transaction *txn = &txns[i];
+ union dpif_op *op = ops[i];
+
+ if (op->type == DPIF_OP_FLOW_PUT) {
+ struct dpif_flow_put *put = &op->flow_put;
+ struct dpif_linux_flow request;
+
+ dpif_linux_init_flow_put(dpif_, put->flags, put->key, put->key_len,
+ put->actions, put->actions_len,
+ &request);
+ if (put->stats) {
+ request.nlmsg_flags |= NLM_F_ECHO;
+ }
+ txn->request = ofpbuf_new(1024);
+ dpif_linux_flow_to_ofpbuf(&request, txn->request);
+ } else if (op->type == DPIF_OP_EXECUTE) {
+ struct dpif_execute *execute = &op->execute;
+
+ txn->request = dpif_linux_encode_execute(
+ dpif->dp_ifindex, execute->key, execute->key_len,
+ execute->actions, execute->actions_len, execute->packet);
+ } else {
+ NOT_REACHED();