[ovs-dev] [PATCHv2 1/2] ofp-actions: Switch away from odd use of "q" in "enqueue" action format.

Ben Pfaff blp at nicira.com
Sun Nov 3 04:51:00 UTC 2013


The formatting of the "enqueue" action uses a "q" to separate the port
number from the queue number, as in "enqueue:123q456".  This is different
from every other action.  This commit improves the situation by:

    * Switching the formatting to use a colon (e.g. "enqueue:123:456"),
      which is a little less odd-looking but still accepted by older
      versions of Open vSwitch.

    * Improving the parser to accept "enqueue(123,456)" also.

Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 lib/ofp-actions.c        |    2 +-
 lib/ofp-parse.c          |    5 +++--
 tests/ofp-actions.at     |    2 +-
 utilities/ovs-ofctl.8.in |    4 ++--
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c
index bae479e..91ff206 100644
--- a/lib/ofp-actions.c
+++ b/lib/ofp-actions.c
@@ -3280,7 +3280,7 @@ ofpact_format(const struct ofpact *a, struct ds *s)
         enqueue = ofpact_get_ENQUEUE(a);
         ds_put_format(s, "enqueue:");
         ofputil_format_port(enqueue->port, s);
-        ds_put_format(s, "q%"PRIu32, enqueue->queue);
+        ds_put_format(s, ":%"PRIu32, enqueue->queue);
         break;
 
     case OFPACT_OUTPUT_REG:
diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c
index 915dc90..0fbe9f0 100644
--- a/lib/ofp-parse.c
+++ b/lib/ofp-parse.c
@@ -179,12 +179,13 @@ static char * WARN_UNUSED_RESULT
 parse_enqueue(char *arg, struct ofpbuf *ofpacts)
 {
     char *sp = NULL;
-    char *port = strtok_r(arg, ":q", &sp);
+    char *port = strtok_r(arg, ":q,", &sp);
     char *queue = strtok_r(NULL, "", &sp);
     struct ofpact_enqueue *enqueue;
 
     if (port == NULL || queue == NULL) {
-        return xstrdup("\"enqueue\" syntax is \"enqueue:PORT:QUEUE\"");
+        return xstrdup("\"enqueue\" syntax is \"enqueue:PORT:QUEUE\" or "
+                       "\"enqueue(PORT,QUEUE)\"");
     }
 
     enqueue = ofpact_put_ENQUEUE(ofpacts);
diff --git a/tests/ofp-actions.at b/tests/ofp-actions.at
index 244c9ee..cdca8ca 100644
--- a/tests/ofp-actions.at
+++ b/tests/ofp-actions.at
@@ -39,7 +39,7 @@ AT_DATA([test-data], [dnl
 # actions=mod_tp_dst:443
 000a 0008 01bb 0000
 
-# actions=enqueue:10q55
+# actions=enqueue:10:55
 000b 0010 000a 000000000000 00000037
 
 # actions=resubmit:5
diff --git a/utilities/ovs-ofctl.8.in b/utilities/ovs-ofctl.8.in
index dc86619..86e013c 100644
--- a/utilities/ovs-ofctl.8.in
+++ b/utilities/ovs-ofctl.8.in
@@ -1055,10 +1055,10 @@ written in the upper half of register 0.  This form of \fBoutput\fR
 uses an OpenFlow extension that is not supported by standard OpenFlow
 switches.
 .
-.IP \fBenqueue:\fIport\fB:\fIqueue\fR
+.IP \fBenqueue(\fIport\fB,\fIqueue\fB)\fR
 Enqueues the packet on the specified \fIqueue\fR within port
 \fIport\fR, which must be an OpenFlow port number or keyword
-(e.g. \fBLOCAL\fR)..  The number of supported queues depends on the
+(e.g. \fBLOCAL\fR).  The number of supported queues depends on the
 switch; some OpenFlow implementations do not support queuing at all.
 .
 .IP \fBnormal\fR
-- 
1.7.10.4




More information about the dev mailing list