Skip to content
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

[orchagent]: VXLAN: Fix oper_status and tunnel encapsulation TTL #3383

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7291,7 +7291,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 @@ -7302,6 +7304,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 @@ -8251,9 +8254,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);
updateDbPortFlapCount(port, status);
updateGearboxPortOperStatus(port);

Expand Down
17 changes: 7 additions & 10 deletions orchagent/vxlanorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ create_tunnel(
sai_ip_address_t *dst_ip,
sai_object_id_t underlay_rif,
bool p2p,
sai_uint8_t encap_ttl=0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this removed? IIRC, it is done for a purpose to skip adding this attribute for those scenarios where the underlying implementation doesn't support this setting

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is a static function that only exists in that file and is never called without the encap_ttl argument. The public functions both set the default value and are optional. I can of course set to a proper default value there if you'd prefer, its just never used so I didn't see a point.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alternatively we can just go back to default of 0 everywhere to explicitly mean "choose something for me", then check for 0 in this and set it to 64. Some old revisions did that but @VladimirKuk suggested to change it. I personally don't care either way, both ways definitively fix the issue at hand.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prsunny how to move forward on this?

sai_uint8_t encap_ttl)
{
sai_attribute_t attr;
std::vector<sai_attribute_t> tunnel_attrs;
Expand Down Expand Up @@ -349,16 +349,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
5 changes: 3 additions & 2 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 Expand Up @@ -196,7 +197,7 @@ class VxlanTunnel

bool deleteMapperHw(uint8_t mapper_list, tunnel_map_use_t map_src);
bool createMapperHw(uint8_t mapper_list, tunnel_map_use_t map_src);
bool createTunnelHw(uint8_t mapper_list, tunnel_map_use_t map_src, bool with_term = true, sai_uint8_t encap_ttl=0);
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);
bool deleteTunnelHw(uint8_t mapper_list, tunnel_map_use_t map_src, bool with_term = true);
void deletePendingSIPTunnel();
void increment_spurious_imr_add(const std::string remote_vtep);
Expand Down Expand Up @@ -299,7 +300,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, uint8_t encap_ttl=0);
sai_object_id_t encap, sai_object_id_t decap, uint8_t encap_ttl=DEFAULT_TUNNEL_ENCAP_TTL);

bool removeVxlanTunnelMap(string tunnelName, uint32_t vni);

Expand Down
4 changes: 3 additions & 1 deletion tests/test_vxlan_tunnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ def check_vxlan_tunnel(dvs, src_ip, dst_ip, tunnel_map_ids, tunnel_map_entry_ids
'SAI_TUNNEL_ATTR_DECAP_MAPPERS': decapstr,
'SAI_TUNNEL_ATTR_ENCAP_MAPPERS': encapstr,
'SAI_TUNNEL_ATTR_PEER_MODE': 'SAI_TUNNEL_PEER_MODE_P2MP',
'SAI_TUNNEL_ATTR_ENCAP_SRC_IP': src_ip
'SAI_TUNNEL_ATTR_ENCAP_SRC_IP': src_ip,
'SAI_TUNNEL_ATTR_ENCAP_TTL_MODE': 'SAI_TUNNEL_TTL_MODE_PIPE_MODEL',
'SAI_TUNNEL_ATTR_ENCAP_TTL_VAL': '64'
}
)

Expand Down
Loading