dpif-netdev: Allow enqueue actions.
authorEthan Jackson <ethan@nicira.com>
Mon, 21 Nov 2011 21:36:17 +0000 (13:36 -0800)
committerEthan Jackson <ethan@nicira.com>
Mon, 21 Nov 2011 21:36:17 +0000 (13:36 -0800)
The dpif-netdev implementation disallowed enqueue actions because
it did not support conversion from OVS 'queue_id' to dpif
'priority'.  For testing purposes, this patch allows queues which
translate into NOOPs.

lib/dpif-netdev.c
tests/ofproto-dpif.at

index bc93a10244ef6216c1b497f0cbd318ddd2a5398e..6de4bfc15898df291053de2b285d7a4f1c2b1c7b 100644 (file)
@@ -908,6 +908,14 @@ dpif_netdev_recv_set_mask(struct dpif *dpif, int listen_mask)
     return 0;
 }
 
+static int
+dpif_netdev_queue_to_priority(const struct dpif *dpif OVS_UNUSED,
+                              uint32_t queue_id, uint32_t *priority)
+{
+    *priority = queue_id;
+    return 0;
+}
+
 static struct dp_netdev_queue *
 find_nonempty_queue(struct dpif *dpif)
 {
@@ -1366,7 +1374,7 @@ const struct dpif_class dpif_netdev_class = {
     NULL,                       /* operate */
     dpif_netdev_recv_get_mask,
     dpif_netdev_recv_set_mask,
-    NULL,                       /* queue_to_priority */
+    dpif_netdev_queue_to_priority,
     dpif_netdev_recv,
     dpif_netdev_recv_wait,
     dpif_netdev_recv_purge,
index 13c6fd778b7c732f2aefa66fceecf250332e41de..545b7c0aed3253c5c2b66559f0dba871e013fe5a 100644 (file)
@@ -81,7 +81,7 @@ AT_DATA([flows.txt], [dnl
 in_port=1 actions=flood
 in_port=2 actions=all
 in_port=3 actions=output:65534,output:1,output:2,output:3,output:4,output:5,output:6,output:7
-in_port=4 actions=enqueue:65534:1,enqueue:1:1,enqueue:2:1,enqueue:3:1,enqueue:4:1,enqueue:5:1,enqueue:6:1,enqueue:7:1
+in_port=4 actions=enqueue:65534:1,enqueue:1:1,enqueue:2:1,enqueue:3:2,enqueue:4:1,enqueue:5:1,enqueue:6:1,enqueue:7:1
 ])
 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
 AT_CHECK([ovs-ofctl mod-port br0 5 noforward])
@@ -115,7 +115,7 @@ AT_CHECK([tail -1 stdout], [0],
 
 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port(4),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout])
 AT_CHECK([tail -1 stdout], [0],
-  [Datapath actions: 0,1,2,3,6,7
+  [Datapath actions: set(priority(1)),0,1,2,set(priority(2)),3,set(priority(1)),6,7
 ])
 OVS_VSWITCHD_STOP
 AT_CLEANUP