From patchwork Fri Jun 2 00:02:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Stringer X-Patchwork-Id: 770024 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 3wf4CT5TS6z9sN8 for ; Fri, 2 Jun 2017 10:02:29 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id A385AC12; Fri, 2 Jun 2017 00:02:27 +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 7A4D3BB3 for ; Fri, 2 Jun 2017 00:02:26 +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 D39E1209 for ; Fri, 2 Jun 2017 00:02:25 +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 9F6C541C074; Fri, 2 Jun 2017 02:02:24 +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 avt3wfEuoMpQ; Fri, 2 Jun 2017 02:02:23 +0200 (CEST) X-Originating-IP: 208.91.1.34 Received: from carno.eng.vmware.com (unknown [208.91.1.34]) (Authenticated sender: joe@ovn.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 59B7A41C088; Fri, 2 Jun 2017 02:02:22 +0200 (CEST) From: Joe Stringer To: dev@openvswitch.org Date: Thu, 1 Jun 2017 17:02:10 -0700 Message-Id: <20170602000210.13750-1-joe@ovn.org> X-Mailer: git-send-email 2.11.1 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] [PATCHv2] ofproto-dpif: Detect support for ct_tuple6. 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 Support for extracting original direction 5 tuple fields from the connection tracking module may differ on some platforms between the IPv4 original tuple fields vs. IPv6. Detect IPv6 original tuple support separately and reflect this support up to the OpenFlow layer. Signed-off-by: Joe Stringer --- CC: Sairam Venugopal v2: Fix setting of support.ct_orig_tuple6 field prior to probe. --- lib/odp-util.h | 3 ++- ofproto/ofproto-dpif.c | 28 +++++++++++++++++++--------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/lib/odp-util.h b/lib/odp-util.h index fafbb10ee7d2..aa7fb825b710 100644 --- a/lib/odp-util.h +++ b/lib/odp-util.h @@ -193,7 +193,8 @@ int odp_flow_from_string(const char *s, ODP_SUPPORT_FIELD(bool, ct_state_nat, "CT state NAT") \ \ /* Conntrack original direction tuple matching * supported. */ \ - ODP_SUPPORT_FIELD(bool, ct_orig_tuple, "CT orig tuple") + ODP_SUPPORT_FIELD(bool, ct_orig_tuple, "CT orig tuple") \ + ODP_SUPPORT_FIELD(bool, ct_orig_tuple6, "CT orig tuple for IPv6") /* Indicates support for various fields. This defines how flows will be * serialised. */ diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 5d247e3e675b..7a17f2141c67 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -1358,6 +1358,7 @@ CHECK_FEATURE__(ct_label, ct_label, ct_label.u64.lo, 1, ETH_TYPE_IP) CHECK_FEATURE__(ct_state_nat, ct_state, ct_state, \ CS_TRACKED|CS_SRC_NAT, ETH_TYPE_IP) CHECK_FEATURE__(ct_orig_tuple, ct_orig_tuple, ct_nw_proto, 1, ETH_TYPE_IP) +CHECK_FEATURE__(ct_orig_tuple6, ct_orig_tuple6, ct_nw_proto, 1, ETH_TYPE_IPV6) #undef CHECK_FEATURE #undef CHECK_FEATURE__ @@ -1388,6 +1389,7 @@ check_support(struct dpif_backer *backer) backer->support.odp.ct_state_nat = check_ct_state_nat(backer); backer->support.odp.ct_orig_tuple = check_ct_orig_tuple(backer); + backer->support.odp.ct_orig_tuple6 = check_ct_orig_tuple6(backer); } static int @@ -4266,7 +4268,7 @@ check_mask(struct ofproto_dpif *ofproto, const struct miniflow *flow) * the features we know of. */ if (support->ct_state && support->ct_zone && support->ct_mark && support->ct_label && support->ct_state_nat - && support->ct_orig_tuple) { + && support->ct_orig_tuple && support->ct_orig_tuple6) { return ct_state & CS_UNSUPPORTED_MASK ? OFPERR_OFPBMC_BAD_MASK : 0; } @@ -4283,14 +4285,22 @@ check_mask(struct ofproto_dpif *ofproto, const struct miniflow *flow) return OFPERR_OFPBMC_BAD_MASK; } - if (!support->ct_orig_tuple && - (MINIFLOW_GET_U8(flow, ct_nw_proto) || - MINIFLOW_GET_U16(flow, ct_tp_src) || - MINIFLOW_GET_U16(flow, ct_tp_dst) || - MINIFLOW_GET_U32(flow, ct_nw_src) || - MINIFLOW_GET_U32(flow, ct_nw_dst) || - !ovs_u128_is_zero(MINIFLOW_GET_U128(flow, ct_ipv6_src)) || - !ovs_u128_is_zero(MINIFLOW_GET_U128(flow, ct_ipv6_dst)))) { + if (!support->ct_orig_tuple && !support->ct_orig_tuple6 + && (MINIFLOW_GET_U8(flow, ct_nw_proto) + || MINIFLOW_GET_U16(flow, ct_tp_src) + || MINIFLOW_GET_U16(flow, ct_tp_dst))) { + return OFPERR_OFPBMC_BAD_MASK; + } + + if (!support->ct_orig_tuple + && (MINIFLOW_GET_U32(flow, ct_nw_src) + || MINIFLOW_GET_U32(flow, ct_nw_dst))) { + return OFPERR_OFPBMC_BAD_MASK; + } + + if (!support->ct_orig_tuple6 + && (!ovs_u128_is_zero(MINIFLOW_GET_U128(flow, ct_ipv6_src)) + || !ovs_u128_is_zero(MINIFLOW_GET_U128(flow, ct_ipv6_dst)))) { return OFPERR_OFPBMC_BAD_MASK; }