@@ -228,7 +228,8 @@ create_tunnel(
228
228
sai_object_id_t tunnel_encap_id,
229
229
sai_object_id_t tunnel_decap_id,
230
230
sai_ip_address_t *src_ip,
231
- sai_object_id_t underlay_rif)
231
+ sai_object_id_t underlay_rif,
232
+ sai_uint8_t encap_ttl=0 )
232
233
{
233
234
sai_attribute_t attr;
234
235
std::vector<sai_attribute_t > tunnel_attrs;
@@ -264,6 +265,17 @@ create_tunnel(
264
265
tunnel_attrs.push_back (attr);
265
266
}
266
267
268
+ if (encap_ttl != 0 )
269
+ {
270
+ attr.id = SAI_TUNNEL_ATTR_ENCAP_TTL_MODE;
271
+ attr.value .s32 = SAI_TUNNEL_TTL_MODE_PIPE_MODEL;
272
+ tunnel_attrs.push_back (attr);
273
+
274
+ attr.id = SAI_TUNNEL_ATTR_ENCAP_TTL_VAL;
275
+ attr.value .u8 = encap_ttl;
276
+ tunnel_attrs.push_back (attr);
277
+ }
278
+
267
279
sai_object_id_t tunnel_id;
268
280
sai_status_t status = sai_tunnel_api->create_tunnel (
269
281
&tunnel_id,
@@ -358,7 +370,7 @@ remove_tunnel_termination(sai_object_id_t term_table_id)
358
370
}
359
371
}
360
372
361
- bool VxlanTunnel::createTunnel (MAP_T encap, MAP_T decap)
373
+ bool VxlanTunnel::createTunnel (MAP_T encap, MAP_T decap, uint8_t encap_ttl )
362
374
{
363
375
try
364
376
{
@@ -378,7 +390,7 @@ bool VxlanTunnel::createTunnel(MAP_T encap, MAP_T decap)
378
390
ip = &ips;
379
391
}
380
392
381
- ids_.tunnel_id = create_tunnel (ids_.tunnel_encap_id , ids_.tunnel_decap_id , ip, gUnderlayIfId );
393
+ ids_.tunnel_id = create_tunnel (ids_.tunnel_encap_id , ids_.tunnel_decap_id , ip, gUnderlayIfId , encap_ttl );
382
394
383
395
ip = nullptr ;
384
396
if (!dst_ip_.isZero ())
@@ -562,7 +574,7 @@ VxlanTunnelOrch::removeNextHopTunnel(string tunnelName, IpAddress& ipAddr, MacAd
562
574
}
563
575
564
576
bool VxlanTunnelOrch::createVxlanTunnelMap (string tunnelName, tunnel_map_type_t map, uint32_t vni,
565
- sai_object_id_t encap, sai_object_id_t decap)
577
+ sai_object_id_t encap, sai_object_id_t decap, uint8_t encap_ttl )
566
578
{
567
579
SWSS_LOG_ENTER ();
568
580
@@ -578,11 +590,11 @@ bool VxlanTunnelOrch::createVxlanTunnelMap(string tunnelName, tunnel_map_type_t
578
590
{
579
591
if (map == TUNNEL_MAP_T_VIRTUAL_ROUTER)
580
592
{
581
- tunnel_obj->createTunnel (MAP_T::VRID_TO_VNI, MAP_T::VNI_TO_VRID);
593
+ tunnel_obj->createTunnel (MAP_T::VRID_TO_VNI, MAP_T::VNI_TO_VRID, encap_ttl );
582
594
}
583
595
else if (map == TUNNEL_MAP_T_BRIDGE)
584
596
{
585
- tunnel_obj->createTunnel (MAP_T::BRIDGE_TO_VNI, MAP_T::VNI_TO_BRIDGE);
597
+ tunnel_obj->createTunnel (MAP_T::BRIDGE_TO_VNI, MAP_T::VNI_TO_BRIDGE, encap_ttl );
586
598
}
587
599
}
588
600
0 commit comments