From 47c3123da2d0140299e4f1d9fe4a2922a072ec1b Mon Sep 17 00:00:00 2001 From: Yin Lin Date: Fri, 24 Jun 2016 14:44:30 -0700 Subject: datapath-windows: Add Geneve support Signed-off-by: Yin Lin Acked-by: Nithin Raju Signed-off-by: Gurucharan Shetty --- datapath-windows/ovsext/DpInternal.h | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'datapath-windows/ovsext/DpInternal.h') diff --git a/datapath-windows/ovsext/DpInternal.h b/datapath-windows/ovsext/DpInternal.h index 07bc1804b..42b5ec942 100644 --- a/datapath-windows/ovsext/DpInternal.h +++ b/datapath-windows/ovsext/DpInternal.h @@ -128,10 +128,18 @@ typedef struct L2Key { } L2Key; /* Size of 24 byte. */ /* Number of packet attributes required to store OVS tunnel key. */ -#define NUM_PKT_ATTR_REQUIRED 3 +#define NUM_PKT_ATTR_REQUIRED 35 +#define TUN_OPT_MAX_LEN 255 typedef union OvsIPv4TunnelKey { + /* Options should always be the first member of tunnel key. + * They are stored at the end of the array if they are less than the + * maximum size. This allows us to get the benefits of variable length + * matching for small options. + */ struct { + UINT8 tunOpts[TUN_OPT_MAX_LEN]; /* Tunnel options. */ + UINT8 tunOptLen; /* Tunnel option length in byte. */ ovs_be32 dst; ovs_be32 src; ovs_be64 tunnelId; @@ -147,7 +155,22 @@ typedef union OvsIPv4TunnelKey { }; }; uint64_t attr[NUM_PKT_ATTR_REQUIRED]; -} OvsIPv4TunnelKey; /* Size of 24 byte. */ +} OvsIPv4TunnelKey; /* Size of 280 byte. */ + +__inline uint8_t TunnelKeyGetOptionsOffset(const OvsIPv4TunnelKey *key) +{ + return TUN_OPT_MAX_LEN - key->tunOptLen; +} + +__inline uint8_t* TunnelKeyGetOptions(OvsIPv4TunnelKey *key) +{ + return key->tunOpts + TunnelKeyGetOptionsOffset(key); +} + +__inline uint16_t TunnelKeyGetRealSize(OvsIPv4TunnelKey *key) +{ + return sizeof(OvsIPv4TunnelKey) - TunnelKeyGetOptionsOffset(key); +} typedef struct MplsKey { ovs_be32 lse; /* MPLS topmost label stack entry. */ @@ -155,7 +178,7 @@ typedef struct MplsKey { } MplsKey; /* Size of 8 bytes. */ typedef __declspec(align(8)) struct OvsFlowKey { - OvsIPv4TunnelKey tunKey; /* 24 bytes */ + OvsIPv4TunnelKey tunKey; /* 280 bytes */ L2Key l2; /* 24 bytes */ union { /* These headers are mutually exclusive. */ -- cgit v1.2.1