[ovs-dev] [PATCH] ovs-ofctl: Add support for OpenFlow enqueue action.
Ben Pfaff
blp at nicira.com
Fri Jul 30 17:40:30 UTC 2010
---
lib/ofp-parse.c | 16 ++++++++++++++++
utilities/ovs-ofctl.8.in | 5 +++++
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c
index 9068772..cc1419a 100644
--- a/lib/ofp-parse.c
+++ b/lib/ofp-parse.c
@@ -145,6 +145,14 @@ put_output_action(struct ofpbuf *b, uint16_t port)
}
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)
{
struct ofp_action_dl_addr *oada = put_action(b, sizeof *oada, type);
@@ -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. */
diff --git a/utilities/ovs-ofctl.8.in b/utilities/ovs-ofctl.8.in
index 54d222a..2138d74 100644
--- a/utilities/ovs-ofctl.8.in
+++ b/utilities/ovs-ofctl.8.in
@@ -362,6 +362,11 @@ of the following keywords:
.IP \fBoutput\fR:\fIport\fR
Outputs the packet on the port specified by \fIport\fR.
.
+.IP \fBoutput\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.)
--
1.7.1
More information about the dev
mailing list