@@ -679,10 +679,19 @@ void PortsOrch::doPortTask(Consumer &consumer)
679
679
{
680
680
if (m_lanesAliasSpeedMap.find (it->first ) == m_lanesAliasSpeedMap.end ())
681
681
{
682
- if (!removePort (it->second ))
682
+ char *platform = getenv (" platform" );
683
+ if (platform && strstr (platform, MLNX_PLATFORM_SUBSTRING))
683
684
{
684
- throw runtime_error (" PortsOrch initialization failure." );
685
+ if (!removePort (it->second ))
686
+ {
687
+ throw runtime_error (" PortsOrch initialization failure." );
688
+ }
685
689
}
690
+ else
691
+ {
692
+ SWSS_LOG_NOTICE (" Failed to remove Port %lx due to missing SAI remove_port API." , it->second );
693
+ }
694
+
686
695
it = m_portListLaneMap.erase (it);
687
696
}
688
697
else
@@ -693,23 +702,50 @@ void PortsOrch::doPortTask(Consumer &consumer)
693
702
694
703
for (auto it = m_lanesAliasSpeedMap.begin (); it != m_lanesAliasSpeedMap.end ();)
695
704
{
705
+ bool port_created = false ;
706
+
696
707
if (m_portListLaneMap.find (it->first ) == m_portListLaneMap.end ())
697
708
{
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))
699
713
{
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 ());
701
724
}
702
725
}
726
+ else
727
+ {
728
+ port_created = true ;
729
+ }
703
730
704
- if (! initPort (get< 0 >(it-> second ), it-> first ) )
731
+ if (port_created )
705
732
{
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
+ }
707
737
}
708
738
709
739
it = m_lanesAliasSpeedMap.erase (it);
710
740
}
711
741
}
712
742
743
+ if (!m_portConfigDone)
744
+ {
745
+ it = consumer.m_toSync .erase (it);
746
+ continue ;
747
+ }
748
+
713
749
Port p;
714
750
if (!getPort (alias, p))
715
751
{
0 commit comments