diff mbox

[ovs-dev] OpenFlow: Add support for "group delete" flow removed reason to 1.3.

Message ID 1500162774-57162-1-git-send-email-jpettit@ovn.org
State Accepted
Headers show

Commit Message

Justin Pettit July 15, 2017, 11:52 p.m. UTC
Signed-off-by: Justin Pettit <jpettit@ovn.org>
---
 Documentation/topics/design.rst    |  2 +-
 include/openflow/openflow-common.h |  6 ++++--
 lib/ofp-util.c                     | 18 ++++++++++++------
 tests/ofproto.at                   | 14 +++++++-------
 4 files changed, 24 insertions(+), 16 deletions(-)

Comments

Ben Pfaff July 16, 2017, 5:59 p.m. UTC | #1
On Sat, Jul 15, 2017 at 04:52:54PM -0700, Justin Pettit wrote:
> Signed-off-by: Justin Pettit <jpettit@ovn.org>

I'll assume the tests pass.  Thank you!

Acked-by: Ben Pfaff <blp@ovn.org>
Justin Pettit July 16, 2017, 6:45 p.m. UTC | #2
> On Jul 16, 2017, at 10:59 AM, Ben Pfaff <blp@ovn.org> wrote:
> 
> On Sat, Jul 15, 2017 at 04:52:54PM -0700, Justin Pettit wrote:
>> Signed-off-by: Justin Pettit <jpettit@ovn.org>
> 
> I'll assume the tests pass.  Thank you!

Best way to find out: pushed to master!

> Acked-by: Ben Pfaff <blp@ovn.org>

Thanks for the review!

--Justin
diff mbox

Patch

diff --git a/Documentation/topics/design.rst b/Documentation/topics/design.rst
index eb290ab68692..22e966687bd9 100644
--- a/Documentation/topics/design.rst
+++ b/Documentation/topics/design.rst
@@ -91,7 +91,7 @@  that the message is suppressed.
   ``OFPRR_IDLE_TIMEOUT``                        yes    ---
   ``OFPRR_HARD_TIMEOUT``                        yes    ---
   ``OFPRR_DELETE``                              yes    ---
-  ``OFPRR_GROUP_DELETE`` (OF1.4+)               yes    ---
+  ``OFPRR_GROUP_DELETE`` (OF1.3+)               yes    ---
   ``OFPRR_METER_DELETE`` (OF1.4+)               yes    ---
   ``OFPRR_EVICTION`` (OF1.4+)                   yes    ---
   =========================================== ======= =====
diff --git a/include/openflow/openflow-common.h b/include/openflow/openflow-common.h
index 3a0a575508e4..410f392d20cd 100644
--- a/include/openflow/openflow-common.h
+++ b/include/openflow/openflow-common.h
@@ -334,9 +334,11 @@  enum ofp_flow_removed_reason {
     ((1u << OFPRR_IDLE_TIMEOUT) |               \
      (1u << OFPRR_HARD_TIMEOUT) |               \
      (1u << OFPRR_DELETE))
-#define OFPRR14_BITS                            \
+#define OFPRR13_BITS                            \
     (OFPRR10_BITS |                             \
-     (1u << OFPRR_GROUP_DELETE) |               \
+     (1u << OFPRR_GROUP_DELETE))
+#define OFPRR14_BITS                            \
+    (OFPRR13_BITS |                             \
      (1u << OFPRR_METER_DELETE) |               \
      (1u << OFPRR_EVICTION))
 
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 6052d3cc5f56..dabd1f220683 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -11047,15 +11047,21 @@  ofputil_async_cfg_default(enum ofp_version version)
         pin |= 1u << OFPR_IMPLICIT_MISS;
     }
 
-    return (struct ofputil_async_cfg) {
+    struct ofputil_async_cfg oac = {
         .master[OAM_PACKET_IN] = pin,
-
-        .master[OAM_FLOW_REMOVED]
-            = (version >= OFP14_VERSION ? OFPRR14_BITS : OFPRR10_BITS),
-
         .master[OAM_PORT_STATUS] = OFPPR_BITS,
-        .slave[OAM_PORT_STATUS] = OFPPR_BITS,
+        .slave[OAM_PORT_STATUS] = OFPPR_BITS
     };
+
+    if (version >= OFP14_VERSION) {
+        oac.master[OAM_FLOW_REMOVED] = OFPRR14_BITS;
+    } else if (version == OFP13_VERSION) {
+        oac.master[OAM_FLOW_REMOVED] = OFPRR13_BITS;
+    } else {
+        oac.master[OAM_FLOW_REMOVED] = OFPRR10_BITS;
+    }
+
+    return oac;
 }
 
 static void
diff --git a/tests/ofproto.at b/tests/ofproto.at
index 9e6acfad653d..9c10253bb4de 100644
--- a/tests/ofproto.at
+++ b/tests/ofproto.at
@@ -3429,8 +3429,8 @@  udp,vlan_tci=0x0000,dl_src=00:26:b9:8c:b0:f9,dl_dst=00:25:83:df:b4:00,nw_src=172
     ovs-ofctl -O OpenFlow13 add-group br0 group_id=1234,type=all,bucket=output:10
     ovs-ofctl -O OpenFlow13 add-flow br0 send_flow_rem,actions=group:1234
     ovs-ofctl -O OpenFlow13 --strict del-groups br0 group_id=1234
-    if test X"$1" = X"OFPRR_DELETE"; then shift;
-        echo >>expout "OFPT_FLOW_REMOVED (OF1.3):  reason=gropu_delete table_id=0"
+    if test X"$1" = X"OFPRR_GROUP_DELETE"; then shift;
+        echo >>expout "OFPT_FLOW_REMOVED (OF1.3):  reason=group_delete table_id=0"
     fi
 
     AT_FAIL_IF([test X"$1" != X])
@@ -3450,19 +3450,19 @@  check_async 1
 
 # Set miss_send_len to 128, turning on packet-ins for our service connection.
 ovs-appctl -t ovs-ofctl ofctl/send 0409000c0123456700000080
-check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE
+check_async 2 OFPR_ACTION OFPPR_ADD OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
 
 # Become slave (OF 1.3), which should disable everything except port status.
 ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
 check_async 3 OFPPR_ADD OFPPR_DELETE
 
 # Use OF 1.3 OFPT_SET_ASYNC to enable a patchwork of asynchronous messages.
-ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000020000000500000005000000020000000200000005
-check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE
+ovs-appctl -t ovs-ofctl ofctl/send 041c00200000000200000002000000050000000500000002000000020000000d
+check_async 4 OFPR_INVALID_TTL OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
 
 # Set controller ID 123.
 ovs-appctl -t ovs-ofctl ofctl/send 04040018000000030000232000000014000000000000007b
-check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE
+check_async 5 OFPR_NO_MATCH OFPPR_DELETE OFPRR_DELETE OFPRR_GROUP_DELETE
 
 # Restore controller ID 0.
 ovs-appctl -t ovs-ofctl ofctl/send 040400180000000300002320000000140000000000000000
@@ -4708,7 +4708,7 @@  OFPT_GET_ASYNC_REPLY (OF1.3):
  master:
        PACKET_IN: no_match action
      PORT_STATUS: add delete modify
-    FLOW_REMOVED: idle hard delete
+    FLOW_REMOVED: idle hard delete group_delete
      ROLE_STATUS: (off)
     TABLE_STATUS: (off)
   REQUESTFORWARD: (off)