From 5682f723319241223baa7250ed215e1359dd6d8c Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 30 Jul 2010 15:39:56 -0700 Subject: [PATCH] ovs-ofctl: Add support for OpenFlow enqueue action. --- lib/ofp-parse.c | 16 ++++++++++++++++ utilities/ovs-ofctl.8.in | 5 +++++ 2 files changed, 21 insertions(+) diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c index 9068772f..cc1419a0 100644 --- a/lib/ofp-parse.c +++ b/lib/ofp-parse.c @@ -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. */ diff --git a/utilities/ovs-ofctl.8.in b/utilities/ovs-ofctl.8.in index 54d222a4..f51f87a1 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 \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.) -- 2.30.2