ovs-ofctl: Add support for OpenFlow enqueue action.
authorBen Pfaff <blp@nicira.com>
Fri, 30 Jul 2010 22:39:56 +0000 (15:39 -0700)
committerBen Pfaff <blp@nicira.com>
Fri, 30 Jul 2010 23:04:17 +0000 (16:04 -0700)
lib/ofp-parse.c
utilities/ovs-ofctl.8.in

index 9068772..cc1419a 100644 (file)
@@ -144,6 +144,14 @@ put_output_action(struct ofpbuf *b, uint16_t port)
     return oao;
 }
 
+static void
+put_enqueue_action(struct ofpbuf *b, uint16_t port, uint32_t queue)
+{
+    struct ofp_action_enqueue *oae = put_action(b, sizeof *oae, OFPAT_ENQUEUE);
+    oae->port = htons(port);
+    oae->queue_id = htonl(queue);
+}
+
 static void
 put_dl_addr_action(struct ofpbuf *b, uint16_t type, const char *addr)
 {
@@ -257,6 +265,14 @@ str_to_action(char *str, struct ofpbuf *b)
             nast->tun_id = htonl(str_to_u32(arg));
         } else if (!strcasecmp(act, "output")) {
             put_output_action(b, str_to_u32(arg));
+        } else if (!strcasecmp(act, "enqueue")) {
+            char *sp = NULL;
+            char *port = strtok_r(arg, ":q", &sp);
+            char *queue = strtok_r(NULL, "", &sp);
+            if (port == NULL || queue == NULL) {
+                ovs_fatal(0, "\"enqueue\" syntax is \"enqueue:PORT:QUEUE\"");
+            }
+            put_enqueue_action(b, str_to_u32(port), str_to_u32(queue));
         } else if (!strcasecmp(act, "drop")) {
             /* A drop action in OpenFlow occurs by just not setting
              * an action. */
index 54d222a..f51f87a 100644 (file)
@@ -362,6 +362,11 @@ of the following keywords:
 .IP \fBoutput\fR:\fIport\fR
 Outputs the packet on the port specified by \fIport\fR.
 .
+.IP \fBenqueue\fR:\fIport\fB:\fIqueue\fR
+Enqueues the packet on the specified \fIqueue\fR within port
+\fIport\fR.  The number of supported queues depends on the switch;
+some OpenFlow implementations do not support queuing at all.
+.
 .IP \fBnormal\fR
 Subjects the packet to the device's normal L2/L3 processing.  (This
 action is not implemented by all OpenFlow switches.)