new makefile target for error reporting
[sliver-openvswitch.git] / ofproto / ofproto-dpif-upcall.c
index 54d3c21..2420865 100644 (file)
@@ -123,6 +123,9 @@ udpif_create(struct dpif_backer *backer, struct dpif *dpif)
     list_init(&udpif->upcalls);
     list_init(&udpif->fmbs);
     atomic_init(&udpif->reval_seq, 0);
+    ovs_mutex_init(&udpif->drop_key_mutex, PTHREAD_MUTEX_NORMAL);
+    ovs_mutex_init(&udpif->upcall_mutex, PTHREAD_MUTEX_NORMAL);
+    ovs_mutex_init(&udpif->fmb_mutex, PTHREAD_MUTEX_NORMAL);
 
     return udpif;
 }
@@ -544,7 +547,7 @@ recv_upcalls(struct udpif *udpif)
                     || type == OVS_KEY_ATTR_UDP) {
                     if (nl_attr_get_size(nla) == 4) {
                         ovs_be32 attr = nl_attr_get_be32(nla);
-                        hash = mhash_add(hash, (uint32_t) attr);
+                        hash = mhash_add(hash, (OVS_FORCE uint32_t) attr);
                         n_bytes += 4;
                     } else {
                         VLOG_WARN("Netlink attribute with incorrect size.");
@@ -636,25 +639,28 @@ execute_flow_miss(struct flow_miss *miss, struct dpif_op *ops, size_t *n_ops)
     flow_wildcards_or(&miss->xout.wc, &miss->xout.wc, &wc);
 
     if (rule->up.cr.priority == FAIL_OPEN_PRIORITY) {
-        struct ofputil_packet_in pin;
-
-        /* Extra-special case for fail-open mode.
-         *
-         * We are in fail-open mode and the packet matched the fail-open
-         * rule, but we are connected to a controller too.  We should send
-         * the packet up to the controller in the hope that it will try to
-         * set up a flow and thereby allow us to exit fail-open.
-         *
-         * See the top-level comment in fail-open.c for more information. */
-        pin.packet = packet->data;
-        pin.packet_len = packet->size;
-        pin.reason = OFPR_NO_MATCH;
-        pin.controller_id = 0;
-        pin.table_id = 0;
-        pin.cookie = 0;
-        pin.send_len = 0; /* Not used for flow table misses. */
-        flow_get_metadata(&miss->flow, &pin.fmd);
-        ofproto_dpif_send_packet_in(ofproto, &pin);
+        LIST_FOR_EACH (packet, list_node, &miss->packets) {
+            struct ofputil_packet_in *pin;
+
+            /* Extra-special case for fail-open mode.
+             *
+             * We are in fail-open mode and the packet matched the fail-open
+             * rule, but we are connected to a controller too.  We should send
+             * the packet up to the controller in the hope that it will try to
+             * set up a flow and thereby allow us to exit fail-open.
+             *
+             * See the top-level comment in fail-open.c for more information. */
+            pin = xmalloc(sizeof(*pin));
+            pin->packet = xmemdup(packet->data, packet->size);
+            pin->packet_len = packet->size;
+            pin->reason = OFPR_NO_MATCH;
+            pin->controller_id = 0;
+            pin->table_id = 0;
+            pin->cookie = 0;
+            pin->send_len = 0; /* Not used for flow table misses. */
+            flow_get_metadata(&miss->flow, &pin->fmd);
+            ofproto_dpif_send_packet_in(ofproto, pin);
+        }
     }
 
     if (miss->xout.slow) {
@@ -764,7 +770,7 @@ handle_miss_upcalls(struct udpif *udpif, struct list *upcalls)
             continue;
         }
 
-        flow_extract(dupcall->packet, flow.skb_priority, flow.skb_mark,
+        flow_extract(dupcall->packet, flow.skb_priority, flow.pkt_mark,
                      &flow.tunnel, &flow.in_port, &miss->flow);
 
         /* Add other packets to a to-do list. */