From patchwork Mon Mar 21 18:58:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ben@skyportsystems.com X-Patchwork-Id: 600272 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (archives.nicira.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 3qTQB75zSxz9s3s for ; Tue, 22 Mar 2016 05:59:59 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=skyportsystems.com header.i=@skyportsystems.com header.b=fWXgmxQe; dkim-atps=neutral Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 25FB71052D; Mon, 21 Mar 2016 11:58:57 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v3.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id 1D0B210319 for ; Mon, 21 Mar 2016 11:58:51 -0700 (PDT) Received: from bar6.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id 90B69162432 for ; Mon, 21 Mar 2016 12:58:50 -0600 (MDT) X-ASG-Debug-ID: 1458586729-0b323727626b4bd0001-byXFYA Received: from mx1-pf1.cudamail.com ([192.168.24.1]) by bar6.cudamail.com with ESMTP id hHkECQErRFMPGuFc (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 21 Mar 2016 12:58:49 -0600 (MDT) X-Barracuda-Envelope-From: ben@skyportsystems.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.1 Received: from unknown (HELO mail-pf0-f178.google.com) (209.85.192.178) by mx1-pf1.cudamail.com with ESMTPS (RC4-SHA encrypted); 21 Mar 2016 18:58:49 -0000 Received-SPF: pass (mx1-pf1.cudamail.com: SPF record at _netblocks.google.com designates 209.85.192.178 as permitted sender) X-Barracuda-RBL-Trusted-Forwarder: 209.85.192.178 Received: by mail-pf0-f178.google.com with SMTP id 4so144246066pfd.0 for ; Mon, 21 Mar 2016 11:58:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skyportsystems.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=23+ZGmij8KvhGK35U03/7fRCAQCtUojk8Tb+b5u96wI=; b=fWXgmxQegRwZUZFpbVXgHkFBYjMAi2Qskcxvf2k22348PqEKAHPokZPlJ3QKWwkG79 iUowL8UCnC23xbskygA7+cIunrKNsDRBHOmaSZgJN6j4/OnIiSqZsvOJba0/qDybN3zz jO0Tc4+6g6CDNVtPzv3Vo22G94PnnkNz37/TQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=23+ZGmij8KvhGK35U03/7fRCAQCtUojk8Tb+b5u96wI=; b=eblMAyBRz16Y2SSQJs3js7wkQ+5c+NBKq9oSDKmGGxXPAaGdrDnTi74wBpzYXuwfQq Oipcdby5QDGsxO8WtnyHr76sWeAHXyHAVioJgWlu/U2i9264DsqP0B+6HUAnxrXNitbQ ucAM9tgtui2LnCRuqz03Z62P3k2J6icidSh3l80l7fA2aOsosHfyt2RSaFcNAImvmTC5 3n9Iida4UsZ5K01Yq12Yzm8fCvYleO77P32cUMngIik6ScIJO50NI7yHO2rsCbcER9Hu VsBVaCcRQ8L7oKHZVQmrRYZV+nplj7Ujfl281j0va87IeVx4WUAU0KUiH3NRPOn0K79G +LzQ== X-Gm-Message-State: AD7BkJLxBIl8Tk7sPzFwl32WJa7b4c/FqDeXklL0nS1gz2p4EHV79Kbt+QrClphmn8vfIaVB X-Received: by 10.66.124.167 with SMTP id mj7mr47709727pab.153.1458586728361; Mon, 21 Mar 2016 11:58:48 -0700 (PDT) Received: from Arrow.corp.skyportsystems.com (67-207-112-138.static.wiline.com. [67.207.112.138]) by smtp.gmail.com with ESMTPSA id a22sm42472831pfj.2.2016.03.21.11.58.47 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 21 Mar 2016 11:58:47 -0700 (PDT) X-CudaMail-Envelope-Sender: ben@skyportsystems.com X-Barracuda-Apparent-Source-IP: 67.207.112.138 From: ben@skyportsystems.com To: dev@openvswitch.org X-CudaMail-MID: CM-E1-320058825 X-CudaMail-DTE: 032116 X-CudaMail-Originating-IP: 209.85.192.178 Date: Mon, 21 Mar 2016 11:58:17 -0700 X-ASG-Orig-Subj: [##CM-E1-320058825##][PATCH v3 09/21] Break packets.h into private and public parts Message-Id: <3501400d2bf3a3847e7771e83eec0bb9c84ce918.1458586229.git.ben@skyportsystems.com> X-Mailer: git-send-email 2.5.4 (Apple Git-61) In-Reply-To: References: In-Reply-To: References: X-GBUdb-Analysis: 0, 209.85.192.178, Ugly c=0.486243 p=-0.375 Source Normal X-MessageSniffer-Rules: 0-0-0-11123-c X-Barracuda-Connect: UNKNOWN[192.168.24.1] X-Barracuda-Start-Time: 1458586729 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.60 X-Barracuda-Spam-Status: No, SCORE=0.60 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=4.0 tests=BSF_SC5_MJ1963, DKIM_SIGNED, NO_REAL_NAME, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.28028 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.00 NO_REAL_NAME From: does not include a real name 0.00 DKIM_SIGNED Domain Keys Identified Mail: message has a signature 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS 0.50 BSF_SC5_MJ1963 Custom Rule MJ1963 Cc: Ben Warren Subject: [ovs-dev] [PATCH v3 09/21] Break packets.h into private and public parts X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" From: Ben Warren Public (struct definitions and some prototypes) go in include/openvswitch Signed-off-by: Ben Warren --- include/openvswitch/automake.mk | 1 + include/openvswitch/packets.h | 64 +++++++++++++++++++++++++++++++++++++++++ lib/packets.h | 43 +-------------------------- 3 files changed, 66 insertions(+), 42 deletions(-) create mode 100644 include/openvswitch/packets.h diff --git a/include/openvswitch/automake.mk b/include/openvswitch/automake.mk index 8d253f3..fc183ff 100644 --- a/include/openvswitch/automake.mk +++ b/include/openvswitch/automake.mk @@ -7,6 +7,7 @@ openvswitchinclude_HEADERS = \ include/openvswitch/ofpbuf.h \ include/openvswitch/ofp-errors.h \ include/openvswitch/ofp-parse.h \ + include/openvswitch/packets.h \ include/openvswitch/thread.h \ include/openvswitch/token-bucket.h \ include/openvswitch/tun-metadata.h \ diff --git a/include/openvswitch/packets.h b/include/openvswitch/packets.h new file mode 100644 index 0000000..5d97309 --- /dev/null +++ b/include/openvswitch/packets.h @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENVSWITCH_PACKETS_H +#define OPENVSWITCH_PACKETS_H 1 + +#include +#include "openvswitch/tun-metadata.h" + +/* Tunnel information used in flow key and metadata. */ +struct flow_tnl { + ovs_be32 ip_dst; + struct in6_addr ipv6_dst; + ovs_be32 ip_src; + struct in6_addr ipv6_src; + ovs_be64 tun_id; + uint16_t flags; + uint8_t ip_tos; + uint8_t ip_ttl; + ovs_be16 tp_src; + ovs_be16 tp_dst; + ovs_be16 gbp_id; + uint8_t gbp_flags; + uint8_t pad1[5]; /* Pad to 64 bits. */ + struct tun_metadata metadata; +}; + +/* Some flags are exposed through OpenFlow while others are used only + * internally. */ + +/* Public flags */ +#define FLOW_TNL_F_OAM (1 << 0) + +#define FLOW_TNL_PUB_F_MASK ((1 << 1) - 1) + +/* Private flags */ +#define FLOW_TNL_F_DONT_FRAGMENT (1 << 1) +#define FLOW_TNL_F_CSUM (1 << 2) +#define FLOW_TNL_F_KEY (1 << 3) + +#define FLOW_TNL_F_MASK ((1 << 4) - 1) + +/* Unfortunately, a "struct flow" sometimes has to handle OpenFlow port + * numbers and other times datapath (dpif) port numbers. This union allows + * access to both. */ +union flow_in_port { + odp_port_t odp_port; + ofp_port_t ofp_port; +}; + +#endif /* packets.h */ diff --git a/lib/packets.h b/lib/packets.h index a8ea24b..8139a6b 100644 --- a/lib/packets.h +++ b/lib/packets.h @@ -19,11 +19,11 @@ #include #include -#include #include #include #include "compiler.h" #include "openvswitch/geneve.h" +#include "openvswitch/packets.h" #include "openvswitch/types.h" #include "odp-netlink.h" #include "random.h" @@ -35,39 +35,6 @@ struct dp_packet; struct ds; -/* Tunnel information used in flow key and metadata. */ -struct flow_tnl { - ovs_be32 ip_dst; - struct in6_addr ipv6_dst; - ovs_be32 ip_src; - struct in6_addr ipv6_src; - ovs_be64 tun_id; - uint16_t flags; - uint8_t ip_tos; - uint8_t ip_ttl; - ovs_be16 tp_src; - ovs_be16 tp_dst; - ovs_be16 gbp_id; - uint8_t gbp_flags; - uint8_t pad1[5]; /* Pad to 64 bits. */ - struct tun_metadata metadata; -}; - -/* Some flags are exposed through OpenFlow while others are used only - * internally. */ - -/* Public flags */ -#define FLOW_TNL_F_OAM (1 << 0) - -#define FLOW_TNL_PUB_F_MASK ((1 << 1) - 1) - -/* Private flags */ -#define FLOW_TNL_F_DONT_FRAGMENT (1 << 1) -#define FLOW_TNL_F_CSUM (1 << 2) -#define FLOW_TNL_F_KEY (1 << 3) - -#define FLOW_TNL_F_MASK ((1 << 4) - 1) - /* Purely internal to OVS userspace. These flags should never be exposed to * the outside world and so aren't included in the flags mask. */ @@ -123,14 +90,6 @@ flow_tnl_equal(const struct flow_tnl *a, const struct flow_tnl *b) return a_size == flow_tnl_size(b) && !memcmp(a, b, a_size); } -/* Unfortunately, a "struct flow" sometimes has to handle OpenFlow port - * numbers and other times datapath (dpif) port numbers. This union allows - * access to both. */ -union flow_in_port { - odp_port_t odp_port; - ofp_port_t ofp_port; -}; - /* Datapath packet metadata */ struct pkt_metadata { uint32_t recirc_id; /* Recirculation id carried with the