-
Notifications
You must be signed in to change notification settings - Fork 690
[vnetorch]: Set default VxLAN encap TTL value #980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -228,7 +228,8 @@ create_tunnel( | |
| sai_object_id_t tunnel_encap_id, | ||
| sai_object_id_t tunnel_decap_id, | ||
| sai_ip_address_t *src_ip, | ||
| sai_object_id_t underlay_rif) | ||
| sai_object_id_t underlay_rif, | ||
| sai_uint8_t encap_ttl=0) | ||
| { | ||
| sai_attribute_t attr; | ||
| std::vector<sai_attribute_t> tunnel_attrs; | ||
|
|
@@ -264,6 +265,17 @@ create_tunnel( | |
| tunnel_attrs.push_back(attr); | ||
| } | ||
|
|
||
| if (encap_ttl != 0) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since you're not exposing any places for user to change the
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @stcheng , the VxlanTunnel is created for different scenarios. For the VNET use-case, we would want the Tunnel to have default 128 TTL. So I think it is better to pass this as parameter. |
||
| { | ||
| attr.id = SAI_TUNNEL_ATTR_ENCAP_TTL_MODE; | ||
| attr.value.s32 = SAI_TUNNEL_TTL_MODE_PIPE_MODEL; | ||
| tunnel_attrs.push_back(attr); | ||
|
|
||
| attr.id = SAI_TUNNEL_ATTR_ENCAP_TTL_VAL; | ||
| attr.value.u8 = encap_ttl; | ||
| tunnel_attrs.push_back(attr); | ||
| } | ||
|
|
||
| sai_object_id_t tunnel_id; | ||
| sai_status_t status = sai_tunnel_api->create_tunnel( | ||
| &tunnel_id, | ||
|
|
@@ -358,7 +370,7 @@ remove_tunnel_termination(sai_object_id_t term_table_id) | |
| } | ||
| } | ||
|
|
||
| bool VxlanTunnel::createTunnel(MAP_T encap, MAP_T decap) | ||
| bool VxlanTunnel::createTunnel(MAP_T encap, MAP_T decap, uint8_t encap_ttl) | ||
| { | ||
| try | ||
| { | ||
|
|
@@ -378,7 +390,7 @@ bool VxlanTunnel::createTunnel(MAP_T encap, MAP_T decap) | |
| ip = &ips; | ||
| } | ||
|
|
||
| ids_.tunnel_id = create_tunnel(ids_.tunnel_encap_id, ids_.tunnel_decap_id, ip, gUnderlayIfId); | ||
| ids_.tunnel_id = create_tunnel(ids_.tunnel_encap_id, ids_.tunnel_decap_id, ip, gUnderlayIfId, encap_ttl); | ||
|
|
||
| ip = nullptr; | ||
| if (!dst_ip_.isZero()) | ||
|
|
@@ -562,7 +574,7 @@ VxlanTunnelOrch::removeNextHopTunnel(string tunnelName, IpAddress& ipAddr, MacAd | |
| } | ||
|
|
||
| bool VxlanTunnelOrch::createVxlanTunnelMap(string tunnelName, tunnel_map_type_t map, uint32_t vni, | ||
| sai_object_id_t encap, sai_object_id_t decap) | ||
| sai_object_id_t encap, sai_object_id_t decap, uint8_t encap_ttl) | ||
| { | ||
| SWSS_LOG_ENTER(); | ||
|
|
||
|
|
@@ -578,11 +590,11 @@ bool VxlanTunnelOrch::createVxlanTunnelMap(string tunnelName, tunnel_map_type_t | |
| { | ||
| if (map == TUNNEL_MAP_T_VIRTUAL_ROUTER) | ||
| { | ||
| tunnel_obj->createTunnel(MAP_T::VRID_TO_VNI, MAP_T::VNI_TO_VRID); | ||
| tunnel_obj->createTunnel(MAP_T::VRID_TO_VNI, MAP_T::VNI_TO_VRID, encap_ttl); | ||
| } | ||
| else if (map == TUNNEL_MAP_T_BRIDGE) | ||
| { | ||
| tunnel_obj->createTunnel(MAP_T::BRIDGE_TO_VNI, MAP_T::VNI_TO_BRIDGE); | ||
| tunnel_obj->createTunnel(MAP_T::BRIDGE_TO_VNI, MAP_T::VNI_TO_BRIDGE, encap_ttl); | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,7 +82,7 @@ class VxlanTunnel | |
| return active_; | ||
| } | ||
|
|
||
| bool createTunnel(MAP_T encap, MAP_T decap); | ||
| bool createTunnel(MAP_T encap, MAP_T decap, uint8_t encap_ttl=0); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do you set the default argument with value 0 instead of
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As Prince mentioned in another comment, VxLAN tunnel is created for different scenarios and for the VNET use-case we have default TTL set to 128 but for other use-cases all should work as before. |
||
| sai_object_id_t addEncapMapperEntry(sai_object_id_t obj, uint32_t vni); | ||
| sai_object_id_t addDecapMapperEntry(sai_object_id_t obj, uint32_t vni); | ||
|
|
||
|
|
@@ -172,7 +172,7 @@ class VxlanTunnelOrch : public Orch2 | |
| } | ||
|
|
||
| bool createVxlanTunnelMap(string tunnelName, tunnel_map_type_t mapType, uint32_t vni, | ||
| sai_object_id_t encap, sai_object_id_t decap); | ||
| sai_object_id_t encap, sai_object_id_t decap, uint8_t encap_ttl=0); | ||
|
|
||
| bool removeVxlanTunnelMap(string tunnelName, uint32_t vni); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to specify the default value here, as already specified in the header file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is
statichelper function to create tunnel in SAI, so we need default value here (in header file default value specified for "create tunnel" public APIs)