[ovs-dev] [PATCH] dpif-netdev: Allow enqueue actions.

Ethan Jackson ethan at nicira.com
Mon Nov 21 21:39:26 UTC 2011


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     |   10 +++++++++-
 tests/ofproto-dpif.at |    4 ++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index bc93a10..6de4bfc 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -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,
diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
index 13c6fd7..545b7c0 100644
--- a/tests/ofproto-dpif.at
+++ b/tests/ofproto-dpif.at
@@ -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
-- 
1.7.7.1




More information about the dev mailing list