Skip to content

Commit 8fb25c7

Browse files
bradh352bluecmd
authored andcommitted
VXLAN: Fix oper_status and tunnel encapsulation TTL
This fixes 2 issues across a range of open tickets building upon patches created by others with modifications as requested by @VladimirKuk. The first issue this resolves is the status shown for remote vteps which in the fact that it is wrong makes debugging nearly impossible: ``` +------------+------------+-------------------+--------------+ | SIP | DIP | Creation Source | OperStatus | +============+============+===================+==============+ | 172.16.0.1 | 172.16.0.2 | EVPN | oper_down | +------------+------------+-------------------+--------------+ Total count : 1 ``` The VTEP is really up. Original PR for that is sonic-net#2080. Also fixes sonic-net/sonic-buildimage#10004 or at least the error message which hurts debugging. The next issue is in reachabiity across VXLANs. This fixes IP/MAC learning via ARP. The original PR for that is sonic-net#3216, however it appears it has its origins in sonic-net/sonic-buildimage#10050 which goes into greater detail about the issue itself. Also there is talk about it here kamelnetworks/sonic#9 as well as another similar patch here: 02ee3e3 Fixes sonic-net#3216 Fixes sonic-net#2080 Fixes sonic-net/sonic-buildimage#10050 Fixes sonic-net/sonic-buildimage#10004 Signed-off-by: Brad House (@bradh352)
1 parent 79f04e3 commit 8fb25c7

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

orchagent/portsorch.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7284,7 +7284,9 @@ bool PortsOrch::addTunnel(string tunnel_alias, sai_object_id_t tunnel_id, bool h
72847284
{
72857285
tunnel.m_learn_mode = SAI_BRIDGE_PORT_FDB_LEARNING_MODE_DISABLE;
72867286
}
7287+
tunnel.m_oper_status = SAI_PORT_OPER_STATUS_DOWN;
72877288
m_portList[tunnel_alias] = tunnel;
7289+
saiOidToAlias[tunnel_id] = tunnel_alias;
72887290

72897291
SWSS_LOG_INFO("addTunnel:: %" PRIx64, tunnel_id);
72907292

@@ -7295,6 +7297,7 @@ bool PortsOrch::removeTunnel(Port tunnel)
72957297
{
72967298
SWSS_LOG_ENTER();
72977299

7300+
saiOidToAlias.erase(tunnel.m_tunnel_id);
72987301
m_portList.erase(tunnel.m_alias);
72997302

73007303
return true;
@@ -8252,9 +8255,10 @@ void PortsOrch::updatePortOperStatus(Port &port, sai_port_oper_status_t status)
82528255
return;
82538256
}
82548257

8258+
updateDbPortOperStatus(port, status);
8259+
82558260
if (port.m_type == Port::PHY)
82568261
{
8257-
updateDbPortOperStatus(port, status);
82588262
updateDbPortFlapCount(port, status);
82598263
updateGearboxPortOperStatus(port);
82608264

orchagent/vxlanorch.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ create_tunnel(
275275
sai_ip_address_t *dst_ip,
276276
sai_object_id_t underlay_rif,
277277
bool p2p,
278-
sai_uint8_t encap_ttl=0)
278+
sai_uint8_t encap_ttl)
279279
{
280280
sai_attribute_t attr;
281281
std::vector<sai_attribute_t> tunnel_attrs;
@@ -349,16 +349,13 @@ create_tunnel(
349349
tunnel_attrs.push_back(attr);
350350
}
351351

352-
if (encap_ttl != 0)
353-
{
354-
attr.id = SAI_TUNNEL_ATTR_ENCAP_TTL_MODE;
355-
attr.value.s32 = SAI_TUNNEL_TTL_MODE_PIPE_MODEL;
356-
tunnel_attrs.push_back(attr);
352+
attr.id = SAI_TUNNEL_ATTR_ENCAP_TTL_MODE;
353+
attr.value.s32 = SAI_TUNNEL_TTL_MODE_PIPE_MODEL;
354+
tunnel_attrs.push_back(attr);
357355

358-
attr.id = SAI_TUNNEL_ATTR_ENCAP_TTL_VAL;
359-
attr.value.u8 = encap_ttl;
360-
tunnel_attrs.push_back(attr);
361-
}
356+
attr.id = SAI_TUNNEL_ATTR_ENCAP_TTL_VAL;
357+
attr.value.u8 = encap_ttl;
358+
tunnel_attrs.push_back(attr);
362359

363360
sai_object_id_t tunnel_id;
364361
sai_status_t status = sai_tunnel_api->create_tunnel(

orchagent/vxlanorch.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ typedef enum
4646
#define MAX_VLAN_ID 4095
4747

4848
#define MAX_VNI_ID 16777215
49+
#define DEFAULT_TUNNEL_ENCAP_TTL 64
4950

5051
typedef enum
5152
{
@@ -196,7 +197,7 @@ class VxlanTunnel
196197

197198
bool deleteMapperHw(uint8_t mapper_list, tunnel_map_use_t map_src);
198199
bool createMapperHw(uint8_t mapper_list, tunnel_map_use_t map_src);
199-
bool createTunnelHw(uint8_t mapper_list, tunnel_map_use_t map_src, bool with_term = true, sai_uint8_t encap_ttl=0);
200+
bool createTunnelHw(uint8_t mapper_list, tunnel_map_use_t map_src, bool with_term = true, sai_uint8_t encap_ttl=DEFAULT_TUNNEL_ENCAP_TTL);
200201
bool deleteTunnelHw(uint8_t mapper_list, tunnel_map_use_t map_src, bool with_term = true);
201202
void deletePendingSIPTunnel();
202203
void increment_spurious_imr_add(const std::string remote_vtep);
@@ -299,7 +300,7 @@ class VxlanTunnelOrch : public Orch2
299300

300301

301302
bool createVxlanTunnelMap(string tunnelName, tunnel_map_type_t mapType, uint32_t vni,
302-
sai_object_id_t encap, sai_object_id_t decap, uint8_t encap_ttl=0);
303+
sai_object_id_t encap, sai_object_id_t decap, uint8_t encap_ttl=DEFAULT_TUNNEL_ENCAP_TTL);
303304

304305
bool removeVxlanTunnelMap(string tunnelName, uint32_t vni);
305306

0 commit comments

Comments
 (0)