@@ -4393,15 +4393,36 @@ sai_status_t Syncd::setUninitDataPlaneOnRemovalOnAllSwitches()
4393
4393
4394
4394
auto strRid = sai_serialize_object_id (rid);
4395
4395
4396
- auto status = m_vendorSai-> set (SAI_OBJECT_TYPE_SWITCH, rid, &attr) ;
4396
+ sai_attr_capability_t attr_capability = {} ;
4397
4397
4398
- if (status != SAI_STATUS_SUCCESS)
4398
+ sai_status_t queryStatus;
4399
+
4400
+ queryStatus = sai_query_attribute_capability (rid,
4401
+ SAI_OBJECT_TYPE_SWITCH,
4402
+ SAI_SWITCH_ATTR_UNINIT_DATA_PLANE_ON_REMOVAL,
4403
+ &attr_capability);
4404
+ if (queryStatus != SAI_STATUS_SUCCESS)
4399
4405
{
4400
- SWSS_LOG_ERROR (" Failed to set SAI_SWITCH_ATTR_UNINIT_DATA_PLANE_ON_REMOVAL=false : %s:%s" ,
4401
- strRid.c_str (),
4402
- sai_serialize_status (status ).c_str ());
4406
+ SWSS_LOG_ERROR (" Failed to get SAI_SWITCH_ATTR_UNINIT_DATA_PLANE_ON_REMOVAL capabilities : %s:%s" ,
4407
+ strRid.c_str (),
4408
+ sai_serialize_status (queryStatus ).c_str ());
4403
4409
4404
- result = status;
4410
+ result = queryStatus;
4411
+ continue ;
4412
+ }
4413
+
4414
+ if (attr_capability.set_implemented )
4415
+ {
4416
+ auto status = m_vendorSai->set (SAI_OBJECT_TYPE_SWITCH, rid, &attr);
4417
+
4418
+ if (status != SAI_STATUS_SUCCESS)
4419
+ {
4420
+ SWSS_LOG_ERROR (" Failed to set SAI_SWITCH_ATTR_UNINIT_DATA_PLANE_ON_REMOVAL=false: %s:%s" ,
4421
+ strRid.c_str (),
4422
+ sai_serialize_status (status).c_str ());
4423
+
4424
+ result = status;
4425
+ }
4405
4426
}
4406
4427
}
4407
4428
@@ -4650,15 +4671,11 @@ void Syncd::run()
4650
4671
}
4651
4672
}
4652
4673
4653
- #ifdef SAI_SUPPORT_UNINIT_DATA_PLANE_ON_REMOVAL
4654
-
4655
4674
if (shutdownType == SYNCD_RESTART_TYPE_FAST || shutdownType == SYNCD_RESTART_TYPE_WARM)
4656
4675
{
4657
4676
setUninitDataPlaneOnRemovalOnAllSwitches ();
4658
4677
}
4659
4678
4660
- #endif
4661
-
4662
4679
m_manager->removeAllCounters ();
4663
4680
4664
4681
sai_status_t status = removeAllSwitches ();
0 commit comments