diff mbox

[ovs-dev,1/5] ofp-actions: Add extension to support "group" action in OF1.0.

Message ID 1468454768-10085-2-git-send-email-blp@ovn.org
State Accepted
Headers show

Commit Message

Ben Pfaff July 14, 2016, 12:06 a.m. UTC
From time to time it confuses users that "group" actions disappear when
using OpenFlow 1.0.

Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 NEWS                     |  1 +
 lib/ofp-actions.c        | 12 ++++--------
 tests/ofp-actions.at     |  3 +++
 utilities/ovs-ofctl.8.in |  6 ++++--
 4 files changed, 12 insertions(+), 10 deletions(-)

Comments

Jarno Rajahalme July 14, 2016, 10:01 a.m. UTC | #1
That was surprisingly small change; speaks for all the infra you have built in here!

Acked-by: Jarno Rajahalme <jarno@ovn.org>

> On Jul 13, 2016, at 5:06 PM, Ben Pfaff <blp@ovn.org> wrote:
> 
> From time to time it confuses users that "group" actions disappear when
> using OpenFlow 1.0.
> 
> Signed-off-by: Ben Pfaff <blp@ovn.org>
> ---
> NEWS                     |  1 +
> lib/ofp-actions.c        | 12 ++++--------
> tests/ofp-actions.at     |  3 +++
> utilities/ovs-ofctl.8.in |  6 ++++--
> 4 files changed, 12 insertions(+), 10 deletions(-)
> 
> diff --git a/NEWS b/NEWS
> index 188e23f..b376420 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -19,6 +19,7 @@ Post-v2.5.0
>        packet to size M bytes when outputting to port N.
>      * New command OFPGC_ADD_OR_MOD for OFPT_GROUP_MOD message that adds a
>        new group or modifies an existing groups
> +     * New OpenFlow extension to support the "group" action in OpenFlow 1.0.
>    - ovs-ofctl:
>      * queue-get-config command now allows a queue ID to be specified.
>      * '--bundle' option can now be used with OpenFlow 1.3.
> diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c
> index 997cc15..0aafe0a 100644
> --- a/lib/ofp-actions.c
> +++ b/lib/ofp-actions.c
> @@ -196,8 +196,8 @@ enum ofp_raw_action_type {
>     /* NX1.0(4), OF1.1+(21): uint32_t. */
>     OFPAT_RAW_SET_QUEUE,
> 
> -    /* OF1.1+(22): uint32_t. */
> -    OFPAT_RAW11_GROUP,
> +    /* NX1.0(40), OF1.1+(22): uint32_t. */
> +    OFPAT_RAW_GROUP,
> 
>     /* OF1.1+(23): uint8_t. */
>     OFPAT_RAW11_SET_NW_TTL,
> @@ -619,7 +619,7 @@ format_OUTPUT(const struct ofpact_output *a, struct ds *s)
> /* Group actions. */
> 
> static enum ofperr
> -decode_OFPAT_RAW11_GROUP(uint32_t group_id,
> +decode_OFPAT_RAW_GROUP(uint32_t group_id,
>                          enum ofp_version ofp_version OVS_UNUSED,
>                          struct ofpbuf *out)
> {
> @@ -631,11 +631,7 @@ static void
> encode_GROUP(const struct ofpact_group *group,
>              enum ofp_version ofp_version, struct ofpbuf *out)
> {
> -    if (ofp_version == OFP10_VERSION) {
> -        /* XXX */
> -    } else {
> -        put_OFPAT11_GROUP(out, group->group_id);
> -    }
> +    put_OFPAT_GROUP(out, ofp_version, group->group_id);
> }
> 
> static char * OVS_WARN_UNUSED_RESULT
> diff --git a/tests/ofp-actions.at b/tests/ofp-actions.at
> index ca4d1ba..23d3202 100644
> --- a/tests/ofp-actions.at
> +++ b/tests/ofp-actions.at
> @@ -244,6 +244,9 @@ fe800000 00000000 020c 29ff fe88 a18b dnl
> # actions=output(port=1,max_len=100)
> ffff 0010 00002320 0027 0001 00000064
> 
> +# actions=group:5
> +ffff 0010 00002320 0028 0000 00000005
> +
> # bad OpenFlow10 actions: NXBRC_MUST_BE_ZERO
> ffff 0018 00002320 0025 0000 0005 0000 1122334455 000005
> 
> diff --git a/utilities/ovs-ofctl.8.in b/utilities/ovs-ofctl.8.in
> index 0d91e5f..8413f18 100644
> --- a/utilities/ovs-ofctl.8.in
> +++ b/utilities/ovs-ofctl.8.in
> @@ -1534,8 +1534,10 @@ Packets larger than \fInbytes\fR will be trimmed to \fInbytes\fR while
> packets smaller than \fInbytes\fR remains the original size.
> .
> .IP \fBgroup:\fIgroup_id\fR
> -Outputs the packet to the OpenFlow group \fIgroup_id\fR. Group tables
> -are only supported in OpenFlow 1.1+. See Group Syntax for more details.
> +Outputs the packet to the OpenFlow group \fIgroup_id\fR.  OpenFlow 1.1
> +introduced support for groups; Open vSwitch also supports output to
> +groups as an extension to OpenFlow 1.0.  See \fBGroup Syntax\fR for
> +more details.
> .
> .IP \fBnormal\fR
> Subjects the packet to the device's normal L2/L3 processing.  (This
> -- 
> 2.1.3
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
Ben Pfaff July 14, 2016, 3:33 p.m. UTC | #2
On Thu, Jul 14, 2016 at 03:01:30AM -0700, Jarno Rajahalme wrote:
> That was surprisingly small change; speaks for all the infra you have
> built in here!

I was pleased with that too.  Thanks!

> Acked-by: Jarno Rajahalme <jarno@ovn.org>

I applied this to master.
diff mbox

Patch

diff --git a/NEWS b/NEWS
index 188e23f..b376420 100644
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,7 @@  Post-v2.5.0
        packet to size M bytes when outputting to port N.
      * New command OFPGC_ADD_OR_MOD for OFPT_GROUP_MOD message that adds a
        new group or modifies an existing groups
+     * New OpenFlow extension to support the "group" action in OpenFlow 1.0.
    - ovs-ofctl:
      * queue-get-config command now allows a queue ID to be specified.
      * '--bundle' option can now be used with OpenFlow 1.3.
diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c
index 997cc15..0aafe0a 100644
--- a/lib/ofp-actions.c
+++ b/lib/ofp-actions.c
@@ -196,8 +196,8 @@  enum ofp_raw_action_type {
     /* NX1.0(4), OF1.1+(21): uint32_t. */
     OFPAT_RAW_SET_QUEUE,
 
-    /* OF1.1+(22): uint32_t. */
-    OFPAT_RAW11_GROUP,
+    /* NX1.0(40), OF1.1+(22): uint32_t. */
+    OFPAT_RAW_GROUP,
 
     /* OF1.1+(23): uint8_t. */
     OFPAT_RAW11_SET_NW_TTL,
@@ -619,7 +619,7 @@  format_OUTPUT(const struct ofpact_output *a, struct ds *s)
 /* Group actions. */
 
 static enum ofperr
-decode_OFPAT_RAW11_GROUP(uint32_t group_id,
+decode_OFPAT_RAW_GROUP(uint32_t group_id,
                          enum ofp_version ofp_version OVS_UNUSED,
                          struct ofpbuf *out)
 {
@@ -631,11 +631,7 @@  static void
 encode_GROUP(const struct ofpact_group *group,
              enum ofp_version ofp_version, struct ofpbuf *out)
 {
-    if (ofp_version == OFP10_VERSION) {
-        /* XXX */
-    } else {
-        put_OFPAT11_GROUP(out, group->group_id);
-    }
+    put_OFPAT_GROUP(out, ofp_version, group->group_id);
 }
 
 static char * OVS_WARN_UNUSED_RESULT
diff --git a/tests/ofp-actions.at b/tests/ofp-actions.at
index ca4d1ba..23d3202 100644
--- a/tests/ofp-actions.at
+++ b/tests/ofp-actions.at
@@ -244,6 +244,9 @@  fe800000 00000000 020c 29ff fe88 a18b dnl
 # actions=output(port=1,max_len=100)
 ffff 0010 00002320 0027 0001 00000064
 
+# actions=group:5
+ffff 0010 00002320 0028 0000 00000005
+
 # bad OpenFlow10 actions: NXBRC_MUST_BE_ZERO
 ffff 0018 00002320 0025 0000 0005 0000 1122334455 000005
 
diff --git a/utilities/ovs-ofctl.8.in b/utilities/ovs-ofctl.8.in
index 0d91e5f..8413f18 100644
--- a/utilities/ovs-ofctl.8.in
+++ b/utilities/ovs-ofctl.8.in
@@ -1534,8 +1534,10 @@  Packets larger than \fInbytes\fR will be trimmed to \fInbytes\fR while
 packets smaller than \fInbytes\fR remains the original size.
 .
 .IP \fBgroup:\fIgroup_id\fR
-Outputs the packet to the OpenFlow group \fIgroup_id\fR. Group tables
-are only supported in OpenFlow 1.1+. See Group Syntax for more details.
+Outputs the packet to the OpenFlow group \fIgroup_id\fR.  OpenFlow 1.1
+introduced support for groups; Open vSwitch also supports output to
+groups as an extension to OpenFlow 1.0.  See \fBGroup Syntax\fR for
+more details.
 .
 .IP \fBnormal\fR
 Subjects the packet to the device's normal L2/L3 processing.  (This