diff options
author | Neale Ranns <nranns@cisco.com> | 2020-04-03 07:46:28 +0000 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2020-04-10 12:21:30 +0000 |
commit | 91fd910d7d7611a28d1f85482ed5d5c3ee6a8853 (patch) | |
tree | f2594418e3e7e80a69f16491da15a7af152feb1a /src/vnet/geneve/geneve_packet.h | |
parent | ae9c45938bdf6e180f83f02aed31113e60db20a9 (diff) |
geneve: Fix the byte swapping for the VNI
Type: fix
- swipe away the vomit indent left last time.
- add tests for VNIs > 16bit
Change-Id: I2d1f591bfb9d7a18996c38969365a509168d4193
Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/geneve/geneve_packet.h')
-rw-r--r-- | src/vnet/geneve/geneve_packet.h | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/vnet/geneve/geneve_packet.h b/src/vnet/geneve/geneve_packet.h index ab37f5378df..a0d0687434c 100644 --- a/src/vnet/geneve/geneve_packet.h +++ b/src/vnet/geneve/geneve_packet.h @@ -137,21 +137,14 @@ typedef struct static inline u32 vnet_get_geneve_vni (geneve_header_t * h) { - return (clib_net_to_host_u32 (h->vni_rsvd & GENEVE_VNI_MASK) >> + return ((clib_net_to_host_u32 (h->vni_rsvd) & GENEVE_VNI_MASK) >> GENEVE_VNI_SHIFT); } -/* - * Return the VNI in network-byte order - * - * To be used in the DECAP phase to create the lookup key (IP + VNI) - */ static inline u32 -vnet_get_geneve_vni_bigendian (geneve_header_t * h) +vnet_get_geneve_vni_network_order (geneve_header_t * h) { - u32 vni_host = vnet_get_geneve_vni (h); - return clib_host_to_net_u32 ((vni_host << GENEVE_VNI_SHIFT) & - GENEVE_VNI_MASK); + return (h->vni_rsvd & clib_net_to_host_u32 (GENEVE_VNI_MASK)); } static inline void |