Skip to content

Commit

Permalink
VXLAN: Fix oper_status and tunnel encapsulation TTL
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
bradh352 committed Dec 3, 2024
1 parent c3a3a70 commit 29f29ed
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
6 changes: 5 additions & 1 deletion orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6222,7 +6222,9 @@ bool PortsOrch::addTunnel(string tunnel_alias, sai_object_id_t tunnel_id, bool h
{
tunnel.m_learn_mode = SAI_BRIDGE_PORT_FDB_LEARNING_MODE_DISABLE;
}
tunnel.m_oper_status = SAI_PORT_OPER_STATUS_DOWN;
m_portList[tunnel_alias] = tunnel;
saiOidToAlias[tunnel_id] = tunnel_alias;

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

Expand All @@ -6233,6 +6235,7 @@ bool PortsOrch::removeTunnel(Port tunnel)
{
SWSS_LOG_ENTER();

saiOidToAlias.erase(tunnel.m_tunnel_id);
m_portList.erase(tunnel.m_alias);

return true;
Expand Down Expand Up @@ -6972,9 +6975,10 @@ void PortsOrch::updatePortOperStatus(Port &port, sai_port_oper_status_t status)
return;
}

updateDbPortOperStatus(port, status);

if (port.m_type == Port::PHY)
{
updateDbPortOperStatus(port, status);
updateGearboxPortOperStatus(port);

/* Refresh the port states and reschedule the poller tasks */
Expand Down
17 changes: 7 additions & 10 deletions orchagent/vxlanorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ create_tunnel(
sai_ip_address_t *dst_ip,
sai_object_id_t underlay_rif,
bool p2p,
sai_uint8_t encap_ttl=0)
sai_uint8_t encap_ttl=DEFAULT_TUNNEL_ENCAP_TTL)
{
sai_attribute_t attr;
std::vector<sai_attribute_t> tunnel_attrs;
Expand Down Expand Up @@ -348,16 +348,13 @@ create_tunnel(
tunnel_attrs.push_back(attr);
}

if (encap_ttl != 0)
{
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_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);
}
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(
Expand Down
1 change: 1 addition & 0 deletions orchagent/vxlanorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ typedef enum
#define MAX_VLAN_ID 4095

#define MAX_VNI_ID 16777215
#define DEFAULT_TUNNEL_ENCAP_TTL 64

typedef enum
{
Expand Down

0 comments on commit 29f29ed

Please sign in to comment.