diff --git a/orchagent/fdborch.cpp b/orchagent/fdborch.cpp index b33ea76a43..2ff89292d9 100644 --- a/orchagent/fdborch.cpp +++ b/orchagent/fdborch.cpp @@ -768,7 +768,7 @@ void FdbOrch::doTask(Consumer& consumer) { VxlanTunnelOrch* tunnel_orch = gDirectory.get(); - if (tunnel_orch->dipTunnelsUsed()) + if (tunnel_orch->isDipTunnelsSupported()) { if(!remote_ip.length()) { diff --git a/orchagent/vxlanorch.cpp b/orchagent/vxlanorch.cpp index 61d4c8229e..c2ae684d73 100644 --- a/orchagent/vxlanorch.cpp +++ b/orchagent/vxlanorch.cpp @@ -908,7 +908,7 @@ bool VxlanTunnel::createTunnelHw(uint8_t mapper_list, tunnel_map_use_t map_src, void VxlanTunnel::deletePendingSIPTunnel() { VxlanTunnelOrch* tunnel_orch = gDirectory.get(); - bool dip_tunnels_used = tunnel_orch->dipTunnelsUsed(); + bool dip_tunnels_used = tunnel_orch->isDipTunnelsSupported(); if ((!dip_tunnels_used || getDipTunnelCnt() == 0) && del_tnl_hw_pending) { @@ -1480,7 +1480,7 @@ bool VxlanTunnelOrch::addTunnelUser(const std::string remote_vtep, uint32_t vni return false; } - if (!dipTunnelsUsed() && usr == TUNNEL_USER_IP) + if (!isDipTunnelsSupported()) { vtep_ptr->updateRemoteEndPointIpRef(remote_vtep, true); return true; @@ -1512,9 +1512,7 @@ bool VxlanTunnelOrch::delTunnelUser(const std::string remote_vtep, uint32_t vni { if (TUNNEL_USER_MAC == usr) return true; - auto port_tunnel_name = getTunnelPortName(remote_vtep); EvpnNvoOrch* evpn_orch = gDirectory.get(); - auto vtep_ptr = evpn_orch->getEVPNVtep(); if (!vtep_ptr) @@ -1525,11 +1523,13 @@ bool VxlanTunnelOrch::delTunnelUser(const std::string remote_vtep, uint32_t vni } Port tunnelPort; - gPortsOrch->getPort(port_tunnel_name,tunnelPort); bool ret; + string port_tunnel_name; - if (!dipTunnelsUsed()) + if (!isDipTunnelsSupported()) { + port_tunnel_name = getTunnelPortName(vtep_ptr->getSrcIP().to_string(), true); + gPortsOrch->getPort(port_tunnel_name,tunnelPort); vtep_ptr->updateRemoteEndPointIpRef(remote_vtep, false); if (vtep_ptr->del_tnl_hw_pending && !vtep_ptr->isTunnelReferenced()) { @@ -1546,6 +1546,8 @@ bool VxlanTunnelOrch::delTunnelUser(const std::string remote_vtep, uint32_t vni return true; } + port_tunnel_name = getTunnelPortName(remote_vtep); + gPortsOrch->getPort(port_tunnel_name,tunnelPort); if ((vtep_ptr->getDipTunnelRefCnt(remote_vtep) == 1) && tunnelPort.m_fdb_count == 0) { @@ -1584,7 +1586,8 @@ void VxlanTunnelOrch::deleteTunnelPort(Port &tunnelPort) return; } - if (isSrcVtepTunnel(tunnelPort)) + /* P2MP scenario where P2MP tunnel port is used for FDB learning */ + if (!isDipTunnelsSupported()) { if (vtep_ptr->del_tnl_hw_pending && !vtep_ptr->isTunnelReferenced()) { @@ -1646,14 +1649,6 @@ std::string VxlanTunnelOrch::getTunnelPortName(const std::string& vtep, bool loc return tunnelPortName; } -bool VxlanTunnelOrch::isSrcVtepTunnel(Port& tunnelPort) -{ - string tunnel_port_name = tunnelPort.m_alias; - string prefix = LOCAL_TUNNEL_PORT_PREFIX; - return (tunnel_port_name.compare(0, prefix.length(), prefix) == 0); -} - - void VxlanTunnelOrch::getTunnelNameFromDIP(const string& dip, string& tunnel_name) { tunnel_name = EVPN_TUNNEL_NAME_PREFIX + dip; @@ -1760,7 +1755,7 @@ bool VxlanTunnel::isTunnelReferenced() auto port_tunnel_name = tunnel_orch->getTunnelPortName(src_vtep, true); bool ret; Port tunnelPort; - bool dip_tunnels_used = tunnel_orch->dipTunnelsUsed(); + bool dip_tunnels_used = tunnel_orch->isDipTunnelsSupported(); ret = gPortsOrch->getPort(port_tunnel_name, tunnelPort); if (!ret) @@ -1769,10 +1764,6 @@ bool VxlanTunnel::isTunnelReferenced() return false; } - if (tunnelPort.m_fdb_count != 0) - { - return true; - } if (dip_tunnels_used) { @@ -1780,6 +1771,10 @@ bool VxlanTunnel::isTunnelReferenced() } else { + if (tunnelPort.m_fdb_count != 0) + { + return true; + } /* Bridge port will have reference since on IMET routes reception L2MC group member would be created with end point IP and the P2MP tunnel bridge port */ @@ -1983,7 +1978,7 @@ bool VxlanTunnelMapOrch::delOperation(const Request& request) else { tunnel_obj->del_tnl_hw_pending = true; - if (tunnel_orch->dipTunnelsUsed()) + if (tunnel_orch->isDipTunnelsSupported()) { SWSS_LOG_WARN("Postponing the SIP Tunnel HW deletion DIP Tunnel count = %d", tunnel_obj->getDipTunnelCnt()); diff --git a/orchagent/vxlanorch.h b/orchagent/vxlanorch.h index 9d6b531eec..bd9b301c13 100644 --- a/orchagent/vxlanorch.h +++ b/orchagent/vxlanorch.h @@ -42,7 +42,7 @@ typedef enum #define MIN_VLAN_ID 1 #define MAX_VLAN_ID 4095 -#define MAX_VNI_ID (1<<24) +#define MAX_VNI_ID 16777215 typedef enum { @@ -256,9 +256,9 @@ typedef std::map VTEPTable; class VxlanTunnelOrch : public Orch2 { public: - VxlanTunnelOrch(DBConnector *statedb, DBConnector *db, const std::string& tableName, bool dipTunnelsSupported) : + VxlanTunnelOrch(DBConnector *statedb, DBConnector *db, const std::string& tableName, bool isP2pTunnelsSupported) : Orch2(db, tableName, request_), - m_stateVxlanTable(statedb, STATE_VXLAN_TUNNEL_TABLE_NAME), dip_tunnels_used(dipTunnelsSupported) + m_stateVxlanTable(statedb, STATE_VXLAN_TUNNEL_TABLE_NAME), is_dip_tunnel_supported(isP2pTunnelsSupported) {} @@ -326,7 +326,6 @@ class VxlanTunnelOrch : public Orch2 void addRemoveStateTableEntry(const string, IpAddress&, IpAddress&, tunnel_creation_src_t, bool); std::string getTunnelPortName(const std::string& vtep, bool local=false); - bool isSrcVtepTunnel(Port& tunnelPort); void getTunnelNameFromDIP(const string& dip, string& tunnel_name); void getTunnelNameFromPort(string& tunnel_portname, string& tunnel_name); void getTunnelDIPFromPort(Port& tunnelPort, string& remote_vtep); @@ -354,9 +353,9 @@ class VxlanTunnelOrch : public Orch2 vxlan_vni_vlan_map_table_.erase(vni); } - bool dipTunnelsUsed(void) + bool isDipTunnelsSupported(void) { - return dip_tunnels_used; + return is_dip_tunnel_supported; } @@ -369,7 +368,7 @@ class VxlanTunnelOrch : public Orch2 VxlanVniVlanMapTable vxlan_vni_vlan_map_table_; VTEPTable vtep_table_; Table m_stateVxlanTable; - bool dip_tunnels_used; + bool is_dip_tunnel_supported; }; const request_description_t vxlan_tunnel_map_request_description = {