summaryrefslogtreecommitdiffstats
path: root/src/vnet/geneve/geneve.c
diff options
context:
space:
mode:
authorMarco Varlese <marco.varlese@suse.com>2017-11-20 09:20:38 +0100
committerNeale Ranns <nranns@cisco.com>2017-11-24 15:51:30 +0000
commit60d48bbd13649133e51cf56e072c11305c661797 (patch)
tree5caa4f8bfc04c39d681d700de4801df42a1cbf98 /src/vnet/geneve/geneve.c
parent952181e0bcbc838c646bd4c710033dd3bc20cec6 (diff)
GENEVE: shift/mask for header
This patch addresses the bit-shifting/masking required to set/get specific fields/bits in the GENEVE header. Change-Id: I06ea6d3487c827ec2bc3edfc67c7cb97640d4fc3 Signed-off-by: Marco Varlese <marco.varlese@suse.com>
Diffstat (limited to 'src/vnet/geneve/geneve.c')
-rw-r--r--src/vnet/geneve/geneve.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/vnet/geneve/geneve.c b/src/vnet/geneve/geneve.c
index 86250e9430b..25bf4a49741 100644
--- a/src/vnet/geneve/geneve.c
+++ b/src/vnet/geneve/geneve.c
@@ -32,9 +32,6 @@
* This makes it possible for servers to be co-located in the same data
* center or be separated geographically as long as they are reachable
* through the underlay L3 network.
- *
- * You can refer to this kind of L2 overlay bridge domain as a GENEVE
- * (Virtual eXtensible VLAN) segment.
*/
@@ -272,6 +269,9 @@ geneve_rewrite (geneve_tunnel_t * t, bool is_ip6)
vnet_set_geneve_oamframe_bit (geneve, 0);
vnet_set_geneve_critical_bit (geneve, 0);
vnet_set_geneve_protocol (geneve, GENEVE_ETH_PROTOCOL);
+
+ vnet_geneve_hdr_1word_hton (geneve);
+
vnet_set_geneve_vni (geneve, t->vni);
t->rewrite = r.rw;
@@ -404,13 +404,15 @@ int vnet_geneve_add_del_tunnel
if (!is_ip6)
{
key4.remote = a->remote.ip4.as_u32;
- key4.vni = clib_host_to_net_u32 (a->vni << 8);
+ key4.vni =
+ clib_host_to_net_u32 ((a->vni << GENEVE_VNI_SHIFT) & GENEVE_VNI_MASK);
p = hash_get (vxm->geneve4_tunnel_by_key, key4.as_u64);
}
else
{
key6.remote = a->remote.ip6;
- key6.vni = clib_host_to_net_u32 (a->vni << 8);
+ key6.vni =
+ clib_host_to_net_u32 ((a->vni << GENEVE_VNI_SHIFT) & GENEVE_VNI_MASK);
p = hash_get_mem (vxm->geneve6_tunnel_by_key, &key6);
}