Skip to content

Commit ac54821

Browse files
committed
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: kamelnetworks@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 d6dd7af commit ac54821

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

orchagent/portsorch.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7277,7 +7277,9 @@ bool PortsOrch::addTunnel(string tunnel_alias, sai_object_id_t tunnel_id, bool h
72777277
{
72787278
tunnel.m_learn_mode = SAI_BRIDGE_PORT_FDB_LEARNING_MODE_DISABLE;
72797279
}
7280+
tunnel.m_oper_status = SAI_PORT_OPER_STATUS_DOWN;
72807281
m_portList[tunnel_alias] = tunnel;
7282+
saiOidToAlias[tunnel_id] = tunnel_alias;
72817283

72827284
SWSS_LOG_INFO("addTunnel:: %" PRIx64, tunnel_id);
72837285

@@ -7288,6 +7290,7 @@ bool PortsOrch::removeTunnel(Port tunnel)
72887290
{
72897291
SWSS_LOG_ENTER();
72907292

7293+
saiOidToAlias.erase(tunnel.m_tunnel_id);
72917294
m_portList.erase(tunnel.m_alias);
72927295

72937296
return true;
@@ -8215,9 +8218,10 @@ void PortsOrch::updatePortOperStatus(Port &port, sai_port_oper_status_t status)
82158218
return;
82168219
}
82178220

8221+
updateDbPortOperStatus(port, status);
8222+
82188223
if (port.m_type == Port::PHY)
82198224
{
8220-
updateDbPortOperStatus(port, status);
82218225
updateDbPortFlapCount(port, status);
82228226
updateGearboxPortOperStatus(port);
82238227

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=DEFAULT_TUNNEL_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: 1 addition & 0 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
{

0 commit comments

Comments
 (0)