@@ -679,10 +679,19 @@ void PortsOrch::doPortTask(Consumer &consumer)
679679 {
680680 if (m_lanesAliasSpeedMap.find (it->first ) == m_lanesAliasSpeedMap.end ())
681681 {
682- if (!removePort (it->second ))
682+ char *platform = getenv (" platform" );
683+ if (platform && strstr (platform, MLNX_PLATFORM_SUBSTRING))
683684 {
684- throw runtime_error (" PortsOrch initialization failure." );
685+ if (!removePort (it->second ))
686+ {
687+ throw runtime_error (" PortsOrch initialization failure." );
688+ }
685689 }
690+ else
691+ {
692+ SWSS_LOG_NOTICE (" Failed to remove Port %lx due to missing SAI remove_port API." , it->second );
693+ }
694+
686695 it = m_portListLaneMap.erase (it);
687696 }
688697 else
@@ -693,23 +702,50 @@ void PortsOrch::doPortTask(Consumer &consumer)
693702
694703 for (auto it = m_lanesAliasSpeedMap.begin (); it != m_lanesAliasSpeedMap.end ();)
695704 {
705+ bool port_created = false ;
706+
696707 if (m_portListLaneMap.find (it->first ) == m_portListLaneMap.end ())
697708 {
698- if (!addPort (it->first , get<1 >(it->second )))
709+ // work around to avoid syncd termination on SAI error due missing create_port SAI API
710+ // can be removed when SAI redis return NotImplemented error
711+ char *platform = getenv (" platform" );
712+ if (platform && strstr (platform, MLNX_PLATFORM_SUBSTRING))
699713 {
700- throw runtime_error (" PortsOrch initialization failure." );
714+ if (!addPort (it->first , get<1 >(it->second )))
715+ {
716+ throw runtime_error (" PortsOrch initialization failure." );
717+ }
718+
719+ port_created = true ;
720+ }
721+ else
722+ {
723+ SWSS_LOG_NOTICE (" Failed to create Port %s due to missing SAI create_port API." , get<0 >(it->second ).c_str ());
701724 }
702725 }
726+ else
727+ {
728+ port_created = true ;
729+ }
703730
704- if (! initPort (get< 0 >(it-> second ), it-> first ) )
731+ if (port_created )
705732 {
706- throw runtime_error (" PortsOrch initialization failure." );
733+ if (!initPort (get<0 >(it->second ), it->first ))
734+ {
735+ throw runtime_error (" PortsOrch initialization failure." );
736+ }
707737 }
708738
709739 it = m_lanesAliasSpeedMap.erase (it);
710740 }
711741 }
712742
743+ if (!m_portConfigDone)
744+ {
745+ it = consumer.m_toSync .erase (it);
746+ continue ;
747+ }
748+
713749 Port p;
714750 if (!getPort (alias, p))
715751 {
0 commit comments