summaryrefslogtreecommitdiff
path: root/datapath-windows/ovsext/Geneve.h
diff options
context:
space:
mode:
authorYin Lin <linyi@vmware.com>2016-06-24 14:44:30 -0700
committerGurucharan Shetty <guru@ovn.org>2016-06-24 14:47:15 -0700
commit47c3123da2d0140299e4f1d9fe4a2922a072ec1b (patch)
tree2eabe610529dc85263142387dc1dc89e25e5084a /datapath-windows/ovsext/Geneve.h
parent1f5b157ece72c6ed346a48309b29ea0a2e1c0c63 (diff)
downloadopenvswitch-47c3123da2d0140299e4f1d9fe4a2922a072ec1b.tar.gz
datapath-windows: Add Geneve support
Signed-off-by: Yin Lin <linyi@vmware.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
Diffstat (limited to 'datapath-windows/ovsext/Geneve.h')
-rw-r--r--datapath-windows/ovsext/Geneve.h121
1 files changed, 121 insertions, 0 deletions
diff --git a/datapath-windows/ovsext/Geneve.h b/datapath-windows/ovsext/Geneve.h
new file mode 100644
index 000000000..057f80a05
--- /dev/null
+++ b/datapath-windows/ovsext/Geneve.h
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2016 VMware, 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 __GENEVE_H_
+#define __GENEVE_H_ 1
+
+#include "NetProto.h"
+typedef struct _OVS_GENEVE_VPORT {
+ UINT16 dstPort;
+ UINT64 filterID;
+ UINT64 ipId;
+ /*
+ * To be filled
+ */
+} OVS_GENEVE_VPORT, *POVS_GENEVE_VPORT;
+
+/* Geneve Header:
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |Ver| Opt Len |O|C| Rsvd. | Protocol Type |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Virtual Network Identifier (VNI) | Reserved |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Variable Length Options |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *
+ * Option Header:
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Option Class | Type |R|R|R| Length |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Variable Option Data |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+typedef struct GeneveHdr {
+ /* Length of options fields in int32 excluding the common header */
+ UINT32 optLen : 6;
+ /* Version. */
+ UINT32 version:2;
+ /* Reserved. */
+ UINT32 reserved1 : 6;
+ /* Critical options present */
+ UINT32 critical : 1;
+ /* This packet contains a control message instead of a data payload */
+ UINT32 oam:1;
+ /* Protocol Type. */
+ UINT32 protocol:16;
+ /* VNI */
+ UINT32 vni:24;
+ /* Reserved. */
+ UINT32 reserved2:8;
+} GeneveHdr;
+
+typedef struct GeneveOptionHdr {
+ /* Namespace for the 'type' field. */
+ UINT32 optionClass:16;
+ /* Format of data contained in the option. */
+ UINT32 type:8;
+ /* Reserved. */
+ UINT32 reserved:3;
+ /* Length of option in int32 excluding the option header. */
+ UINT32 length:5;
+} GeneveOptionHdr;
+
+#define GENEVE_CRIT_OPT_TYPE (1 << 7)
+
+NTSTATUS OvsInitGeneveTunnel(POVS_VPORT_ENTRY vport,
+ UINT16 udpDestPort);
+
+VOID OvsCleanupGeneveTunnel(POVS_VPORT_ENTRY vport);
+
+
+NDIS_STATUS OvsEncapGeneve(POVS_VPORT_ENTRY vport,
+ PNET_BUFFER_LIST curNbl,
+ OvsIPv4TunnelKey *tunKey,
+ POVS_SWITCH_CONTEXT switchContext,
+ POVS_PACKET_HDR_INFO layers,
+ PNET_BUFFER_LIST *newNbl);
+
+NDIS_STATUS OvsDecapGeneve(POVS_SWITCH_CONTEXT switchContext,
+ PNET_BUFFER_LIST curNbl,
+ OvsIPv4TunnelKey *tunKey,
+ PNET_BUFFER_LIST *newNbl);
+
+static __inline UINT32
+OvsGetGeneveTunHdrMinSize(VOID)
+{
+ /* XXX: Can L2 include VLAN at all? */
+ return sizeof (EthHdr) + sizeof (IPHdr) + sizeof (UDPHdr) +
+ sizeof (GeneveHdr);
+}
+
+static __inline UINT32
+OvsGetGeneveTunHdrMaxSize(VOID)
+{
+ /* XXX: Can L2 include VLAN at all? */
+ return OvsGetGeneveTunHdrMinSize() + TUN_OPT_MAX_LEN;
+}
+
+#define GENEVE_UDP_PORT 6081
+#define GENEVE_UDP_PORT_NBO 0xC117
+#define GENEVE_VER 0
+#define GENEVE_DEFAULT_TTL 64
+#define GENEVE_ID_IS_VALID(geneveID) (0 < (geneveID) && (vxlanID) <= 0xffffff)
+#define GENEVE_TUNNELID_TO_VNI(_tID) (UINT32)(((UINT64)(_tID)) >> 40)
+#define GENEVE_VNI_TO_TUNNELID(_vni) (((UINT64)(_vni)) << 40)
+#define ETH_P_TEB_NBO 0x5865 /* Trans Ether Bridging */
+
+#endif /* __GENEVE_H_ */