From patchwork Sat Jul 15 23:52:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Pettit X-Patchwork-Id: 788995 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3x95wJ3PKfz9s5L for ; Sun, 16 Jul 2017 09:53:04 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id ACC5FB4B; Sat, 15 Jul 2017 23:53:00 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 49F3FB49 for ; Sat, 15 Jul 2017 23:53:00 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 91D8FFC for ; Sat, 15 Jul 2017 23:52:59 +0000 (UTC) Received: from mfilter11-d.gandi.net (mfilter11-d.gandi.net [217.70.178.131]) by relay5-d.mail.gandi.net (Postfix) with ESMTP id 5AF5D41C088 for ; Sun, 16 Jul 2017 01:52:58 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter11-d.gandi.net Received: from relay5-d.mail.gandi.net ([IPv6:::ffff:217.70.183.197]) by mfilter11-d.gandi.net (mfilter11-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id Tw1gy5YECW29 for ; Sun, 16 Jul 2017 01:52:56 +0200 (CEST) X-Originating-IP: 98.234.50.139 Received: from localhost.localdomain (unknown [98.234.50.139]) (Authenticated sender: jpettit@ovn.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 4540441C07F for ; Sun, 16 Jul 2017 01:52:55 +0200 (CEST) From: Justin Pettit To: dev@openvswitch.org Date: Sat, 15 Jul 2017 16:52:54 -0700 Message-Id: <1500162774-57162-1-git-send-email-jpettit@ovn.org> X-Mailer: git-send-email 2.7.4 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH] OpenFlow: Add support for "group delete" flow removed reason to 1.3. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Signed-off-by: Justin Pettit Acked-by: Ben Pfaff --- 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(-) 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)