199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause 299a2dd95SBruce Richardson * Copyright 2020 Mellanox Technologies, Ltd 399a2dd95SBruce Richardson */ 499a2dd95SBruce Richardson 599a2dd95SBruce Richardson #ifndef _RTE_GENEVE_H_ 699a2dd95SBruce Richardson #define _RTE_GENEVE_H_ 799a2dd95SBruce Richardson 899a2dd95SBruce Richardson /** 999a2dd95SBruce Richardson * @file 1099a2dd95SBruce Richardson * 1199a2dd95SBruce Richardson * GENEVE-related definitions 1299a2dd95SBruce Richardson */ 1399a2dd95SBruce Richardson #include <stdint.h> 1499a2dd95SBruce Richardson 1599a2dd95SBruce Richardson #include <rte_byteorder.h> 1699a2dd95SBruce Richardson 1799a2dd95SBruce Richardson /** GENEVE default port. */ 1899a2dd95SBruce Richardson #define RTE_GENEVE_DEFAULT_PORT 6081 1999a2dd95SBruce Richardson 2099a2dd95SBruce Richardson /** 2199a2dd95SBruce Richardson * GENEVE protocol header. (draft-ietf-nvo3-geneve-09) 2299a2dd95SBruce Richardson * Contains: 2399a2dd95SBruce Richardson * 2-bits version (must be 0). 2499a2dd95SBruce Richardson * 6-bits option length in four byte multiples, not including the eight 2599a2dd95SBruce Richardson * bytes of the fixed tunnel header. 2699a2dd95SBruce Richardson * 1-bit control packet. 2799a2dd95SBruce Richardson * 1-bit critical options in packet. 2899a2dd95SBruce Richardson * 6-bits reserved 2999a2dd95SBruce Richardson * 16-bits Protocol Type. The protocol data unit after the Geneve header 3099a2dd95SBruce Richardson * following the EtherType convention. Ethernet itself is represented by 3199a2dd95SBruce Richardson * the value 0x6558. 3299a2dd95SBruce Richardson * 24-bits Virtual Network Identifier (VNI). Virtual network unique identified. 3399a2dd95SBruce Richardson * 8-bits reserved bits (must be 0 on transmission and ignored on receipt). 3499a2dd95SBruce Richardson * More-bits (optional) variable length options. 3599a2dd95SBruce Richardson */ 3699a2dd95SBruce Richardson __extension__ 37*fba98755SAndre Muezerie struct __rte_packed_begin rte_geneve_hdr { 3899a2dd95SBruce Richardson #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN 3999a2dd95SBruce Richardson uint8_t ver:2; /**< Version. */ 4099a2dd95SBruce Richardson uint8_t opt_len:6; /**< Options length. */ 4199a2dd95SBruce Richardson uint8_t oam:1; /**< Control packet. */ 4299a2dd95SBruce Richardson uint8_t critical:1; /**< Critical packet. */ 4399a2dd95SBruce Richardson uint8_t reserved1:6; /**< Reserved. */ 4499a2dd95SBruce Richardson #else 4599a2dd95SBruce Richardson uint8_t opt_len:6; /**< Options length. */ 4699a2dd95SBruce Richardson uint8_t ver:2; /**< Version. */ 4799a2dd95SBruce Richardson uint8_t reserved1:6; /**< Reserved. */ 4899a2dd95SBruce Richardson uint8_t critical:1; /**< Critical packet. */ 4999a2dd95SBruce Richardson uint8_t oam:1; /**< Control packet. */ 5099a2dd95SBruce Richardson #endif 5199a2dd95SBruce Richardson rte_be16_t proto; /**< Protocol type. */ 5299a2dd95SBruce Richardson uint8_t vni[3]; /**< Virtual network identifier. */ 5399a2dd95SBruce Richardson uint8_t reserved2; /**< Reserved. */ 5499a2dd95SBruce Richardson uint32_t opts[]; /**< Variable length options. */ 55*fba98755SAndre Muezerie } __rte_packed_end; 5699a2dd95SBruce Richardson 5799a2dd95SBruce Richardson /* GENEVE ETH next protocol types */ 5899a2dd95SBruce Richardson #define RTE_GENEVE_TYPE_ETH 0x6558 /**< Ethernet Protocol. */ 5999a2dd95SBruce Richardson 6099a2dd95SBruce Richardson #endif /* RTE_GENEVE_H_ */ 61