Skip to content

Commit 81f4ea9

Browse files
authored
orchagent/portsorch: Missing scheduler group after SWSS restart (sonic-net#2174)
What I did Added function to query scheduler group objects during SWSS restart. Why I did it Scheduler group objects were removed as they were missing in temp view during SWSS restart. The triggers to reproduce this issue: sudo config warm_restart enable swss sudo service swss restart How I verified it Verified scheduler group objects are not removed after the fix and are part of ASIC_DB. Details if related Mar 1 22:46:39.015724 sonic NOTICE swss#orchagent: :- setWarmStartState: orchagent warm start state changed to restored Mar 1 22:46:39.015724 sonic NOTICE swss#orchagent: :- warmRestoreAndSyncUp: Orchagent state restore done Mar 1 22:46:39.015724 sonic NOTICE swss#orchagent: :- syncd_apply_view: Notify syncd APPLY_VIEW Mar 1 22:46:39.015724 sonic NOTICE swss#orchagent: :- notifySyncd: sending syncd: APPLY_VIEW Mar 1 22:46:39.016078 sonic WARNING syncd[24]: :- processNotifySyncd: syncd received APPLY VIEW, will translate Mar 1 22:46:39.155799 sonic NOTICE syncd[24]: :- dump: getting took 0.139421 sec Mar 1 22:46:39.172973 sonic NOTICE syncd[24]: :- getAsicView: ASIC_STATE switch count: 1: Mar 1 22:46:39.172973 sonic NOTICE syncd[24]: :- getAsicView: oid:0x21000000000000: objects count: 7529 Mar 1 22:46:39.175515 sonic NOTICE syncd[24]: :- getAsicView: get asic view from ASIC_STATE took 0.159394 sec Mar 1 22:46:39.304183 sonic NOTICE syncd[24]: :- dump: getting took 0.128388 sec Mar 1 22:46:39.318381 sonic NOTICE syncd[24]: :- getAsicView: TEMP_ASIC_STATE switch count: 1: Mar 1 22:46:39.318381 sonic NOTICE syncd[24]: :- getAsicView: oid:0x21000000000000: objects count: 7174 Mar 1 22:46:39.320676 sonic NOTICE syncd[24]: :- getAsicView: get asic view from TEMP_ASIC_STATE took 0.145098 sec Mar 1 22:46:39.412827 sonic NOTICE syncd[24]: :- ComparisonLogic: srand seed for switch oid:0x21000000000000: 1646174799 Mar 1 22:46:39.413412 sonic NOTICE syncd[24]: :- matchOids: matched oids Mar 1 22:46:39.413412 sonic NOTICE syncd[24]: :- populateExistingObjects: populate existing objects Mar 1 22:46:39.414330 sonic NOTICE syncd[24]: :- checkInternalObjects: check internal objects Mar 1 22:46:39.414519 sonic WARNING syncd[24]: :- checkInternalObjects: different number of objects SAI_OBJECT_TYPE_SCHEDULER_GROUP, curr: 321, tmp 33 (not expected if warm boot) Mar 1 22:46:39.414519 sonic ERR syncd[24]: :- checkInternalObjects: object status is not MATCHED on curr: SAI_OBJECT_TYPE_SCHEDULER_GROUP:oid:0x1700000000005e Mar 1 22:46:39.414519 sonic ERR syncd[24]: :- checkInternalObjects: object status is not MATCHED on curr: SAI_OBJECT_TYPE_SCHEDULER_GROUP:oid:0x1700000000005f Mar 1 22:46:39.414519 sonic ERR syncd[24]: :- checkInternalObjects: object status is not MATCHED on curr: SAI_OBJECT_TYPE_SCHEDULER_GROUP:oid:0x17000000000060 .. .. Mar 1 22:46:39.421248 sonic ERR syncd[24]: :- checkInternalObjects: object status is not MATCHED on curr: SAI_OBJECT_TYPE_SCHEDULER_GROUP:oid:0x1700000000034e Mar 1 22:46:39.439937 sonic NOTICE syncd[24]: :- createPreMatchMap: preMatch map size: 102, tmp oid obj: 186 Mar 1 22:46:39.439937 sonic NOTICE syncd[24]: :- createPreMatchMap: create preMatch map took 0.023570 sec Mar 1 22:46:39.441150 sonic WARNING syncd[24]: :- logViewObjectCount: object count for SAI_OBJECT_TYPE_SCHEDULER_GROUP on current view 321 is different than on temporary view: 33 Mar 1 22:46:39.443028 sonic WARNING syncd[24]: :- logViewObjectCount: object count is different on both view, there will be ASIC OPERATIONS! Mar 1 22:46:39.443028 sonic NOTICE syncd[24]: :- checkMatchedPorts: all ports are matched Mar 1 22:46:39.443082 sonic WARNING syncd[24]: :- performObjectSetTransition: current attr is CREATE_ONLY and object is MATCHED: oid:0x1000000000050 transferring SAI_PORT_ATTR_HW_LANE_LIST:4:0,1,2,3 to temp object Mar 1 22:46:39.443150 sonic WARNING syncd[24]: :- performObjectSetTransition: current attr is CREATE_ONLY and object is MATCHED: oid:0x1000000000068 transferring SAI_PORT_ATTR_HW_LANE_LIST:4:4,5,6,7 to temp object .. .. Mar 1 22:46:39.444210 sonic WARNING syncd[24]: :- performObjectSetTransition: current attr is CREATE_ONLY and object is MATCHED: oid:0x1000000000338 transferring SAI_PORT_ATTR_HW_LANE_LIST:4:124,125,126,127 to temp object Mar 1 22:46:39.516195 sonic NOTICE syncd[24]: :- applyViewTransition: loop removed 288 objects Mar 1 22:46:39.516680 sonic NOTICE syncd[24]: :- applyViewTransition: comparison logic took 0.073610 sec Mar 1 22:46:39.516680 sonic NOTICE syncd[24]: :- transferNotProcessed: calling transferNotProcessed Mar 1 22:46:39.517046 sonic NOTICE syncd[24]: :- compareViews: ASIC operations to execute: 288 Mar 1 22:46:39.517992 sonic NOTICE syncd[24]: :- compareViews: all temporary view objects were processed to FINAL state Mar 1 22:46:39.518395 sonic NOTICE syncd[24]: :- compareViews: all current view objects were processed to FINAL state Mar 1 22:46:39.518395 sonic NOTICE syncd[24]: :- executeOperationsOnAsic: operations to execute on ASIC: 288 Mar 1 22:46:39.518416 sonic NOTICE syncd[24]: :- executeOperationsOnAsic: NOT optimized operations Mar 1 22:46:39.518451 sonic NOTICE syncd[24]: :- executeOperationsOnAsic: remove: SAI_OBJECT_TYPE_SCHEDULER_GROUP:oid:0x1700000000005e Mar 1 22:46:39.518451 sonic NOTICE syncd[24]: :- executeOperationsOnAsic: remove: SAI_OBJECT_TYPE_SCHEDULER_GROUP:oid:0x1700000000005f .. .. Mar 1 22:46:39.527085 sonic NOTICE syncd[24]: :- executeOperationsOnAsic: operations on SAI_OBJECT_TYPE_SCHEDULER_GROUP: 288 Mar 1 22:46:39.527085 sonic NOTICE syncd[24]: :- asicGetWithOptimizedRemoveOperations: moved 288 REMOVE operations upper in stack from total 288 operations Mar 1 22:46:39.527118 sonic NOTICE syncd[24]: :- asicGetWithOptimizedRemoveOperations: optimizing asic remove operations took 0.000160 sec Mar 1 22:46:39.530969 sonic NOTICE syncd[24]: :- executeOperationsOnAsic: asic apply took 0.012517 sec Mar 1 22:46:39.530969 sonic NOTICE syncd[24]: :- executeOperationsOnAsic: performed all operations on asic successfully Mar 1 22:46:39.589620 sonic NOTICE syncd[24]: :- threadFunction: time span 573 ms for 'notify:APPLY_VIEW'
1 parent e557855 commit 81f4ea9

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

orchagent/portsorch.cpp

+45
Original file line numberDiff line numberDiff line change
@@ -4587,6 +4587,50 @@ void PortsOrch::initializeQueues(Port &port)
45874587
SWSS_LOG_INFO("Get queues for port %s", port.m_alias.c_str());
45884588
}
45894589

4590+
void PortsOrch::initializeSchedulerGroups(Port &port)
4591+
{
4592+
std::vector<sai_object_id_t> scheduler_group_ids;
4593+
SWSS_LOG_ENTER();
4594+
4595+
sai_attribute_t attr;
4596+
attr.id = SAI_PORT_ATTR_QOS_NUMBER_OF_SCHEDULER_GROUPS;
4597+
sai_status_t status = sai_port_api->get_port_attribute(port.m_port_id, 1, &attr);
4598+
if (status != SAI_STATUS_SUCCESS)
4599+
{
4600+
SWSS_LOG_ERROR("Failed to get number of scheduler groups for port:%s", port.m_alias.c_str());
4601+
task_process_status handle_status = handleSaiGetStatus(SAI_API_PORT, status);
4602+
if (handle_status != task_process_status::task_success)
4603+
{
4604+
throw runtime_error("PortsOrch initialization failure.");
4605+
}
4606+
}
4607+
SWSS_LOG_INFO("Got %d number of scheduler groups for port %s", attr.value.u32, port.m_alias.c_str());
4608+
4609+
scheduler_group_ids.resize(attr.value.u32);
4610+
4611+
if (attr.value.u32 == 0)
4612+
{
4613+
return;
4614+
}
4615+
4616+
attr.id = SAI_PORT_ATTR_QOS_SCHEDULER_GROUP_LIST;
4617+
attr.value.objlist.count = (uint32_t)scheduler_group_ids.size();
4618+
attr.value.objlist.list = scheduler_group_ids.data();
4619+
4620+
status = sai_port_api->get_port_attribute(port.m_port_id, 1, &attr);
4621+
if (status != SAI_STATUS_SUCCESS)
4622+
{
4623+
SWSS_LOG_ERROR("Failed to get scheduler group list for port %s rv:%d", port.m_alias.c_str(), status);
4624+
task_process_status handle_status = handleSaiGetStatus(SAI_API_PORT, status);
4625+
if (handle_status != task_process_status::task_success)
4626+
{
4627+
throw runtime_error("PortsOrch initialization failure.");
4628+
}
4629+
}
4630+
4631+
SWSS_LOG_INFO("Got scheduler groups for port %s", port.m_alias.c_str());
4632+
}
4633+
45904634
void PortsOrch::initializePriorityGroups(Port &port)
45914635
{
45924636
SWSS_LOG_ENTER();
@@ -4661,6 +4705,7 @@ bool PortsOrch::initializePort(Port &port)
46614705

46624706
initializePriorityGroups(port);
46634707
initializeQueues(port);
4708+
initializeSchedulerGroups(port);
46644709
initializePortBufferMaximumParameters(port);
46654710

46664711
/* Create host interface */

orchagent/portsorch.h

100755100644
+1-1
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,9 @@ class PortsOrch : public Orch, public Subject
299299
void initializePriorityGroups(Port &port);
300300
void initializePortBufferMaximumParameters(Port &port);
301301
void initializeQueues(Port &port);
302+
void initializeSchedulerGroups(Port &port);
302303
void initializeVoqs(Port &port);
303304

304-
305305
bool addHostIntfs(Port &port, string alias, sai_object_id_t &host_intfs_id);
306306
bool setHostIntfsStripTag(Port &port, sai_hostif_vlan_tag_t strip);
307307

0 commit comments

Comments
 (0)