@@ -328,7 +328,7 @@ PortsOrch::PortsOrch(DBConnector *db, DBConnector *stateDb, vector<table_name_wi
328
328
port_stat_manager(PORT_STAT_COUNTER_FLEX_COUNTER_GROUP, StatsMode::READ, PORT_STAT_FLEX_COUNTER_POLLING_INTERVAL_MS, false ),
329
329
port_buffer_drop_stat_manager(PORT_BUFFER_DROP_STAT_FLEX_COUNTER_GROUP, StatsMode::READ, PORT_BUFFER_DROP_STAT_POLLING_INTERVAL_MS, false ),
330
330
queue_stat_manager(QUEUE_STAT_COUNTER_FLEX_COUNTER_GROUP, StatsMode::READ, QUEUE_STAT_FLEX_COUNTER_POLLING_INTERVAL_MS, false ),
331
- m_timer (new SelectableTimer(timespec { .tv_sec = PORT_STATE_POLLING_SEC, .tv_nsec = 0 }))
331
+ m_port_state_poller (new SelectableTimer(timespec { .tv_sec = PORT_STATE_POLLING_SEC, .tv_nsec = 0 }))
332
332
{
333
333
SWSS_LOG_ENTER ();
334
334
@@ -594,7 +594,7 @@ PortsOrch::PortsOrch(DBConnector *db, DBConnector *stateDb, vector<table_name_wi
594
594
m_lagIdAllocator = unique_ptr<LagIdAllocator> (new LagIdAllocator (chassisAppDb));
595
595
}
596
596
597
- auto executor = new ExecutableTimer (m_timer , this , " PORT_STATE_POLL " );
597
+ auto executor = new ExecutableTimer (m_port_state_poller , this , " PORT_STATE_POLLER " );
598
598
Orch::addExecutor (executor);
599
599
}
600
600
@@ -1945,7 +1945,7 @@ void PortsOrch::initPortCapLinkTraining(Port &port)
1945
1945
*/
1946
1946
attr.id = SAI_PORT_ATTR_SUPPORTED_AUTO_NEG_MODE;
1947
1947
#endif
1948
- status = sai_port_api->set_port_attribute (port.m_port_id , &attr);
1948
+ status = sai_port_api->get_port_attribute (port.m_port_id , 1 , &attr);
1949
1949
if (status == SAI_STATUS_SUCCESS)
1950
1950
{
1951
1951
port.m_cap_lt = attr.value .booldata ? 1 : 0 ;
@@ -2242,12 +2242,11 @@ task_process_status PortsOrch::setPortLinkTraining(const Port &port, bool state)
2242
2242
sai_status_t status = sai_port_api->set_port_attribute (port.m_port_id , &attr);
2243
2243
if (status != SAI_STATUS_SUCCESS)
2244
2244
{
2245
- SWSS_LOG_ERROR (" Failed to set LT %s to port pid:%" PRIx64,
2246
- op.c_str (), port.m_port_id );
2245
+ SWSS_LOG_ERROR (" Failed to set LT %s to port %s" , op.c_str (), port.m_alias .c_str ());
2247
2246
return handleSaiSetStatus (SAI_API_PORT, status);
2248
2247
}
2249
2248
2250
- SWSS_LOG_INFO (" Set LT %s to port pid:% " PRIx64 , op.c_str (), port.m_port_id );
2249
+ SWSS_LOG_INFO (" Set LT %s to port %s " , op.c_str (), port.m_alias . c_str () );
2251
2250
2252
2251
return task_success;
2253
2252
}
@@ -6153,8 +6152,6 @@ bool PortsOrch::getPortLinkTrainingFailure(const Port &port, sai_port_link_train
6153
6152
6154
6153
sai_attribute_t attr;
6155
6154
attr.id = SAI_PORT_ATTR_LINK_TRAINING_FAILURE_STATUS;
6156
- attr.value .u32 = 0 ;
6157
-
6158
6155
sai_status_t ret = sai_port_api->get_port_attribute (port.m_port_id , 1 , &attr);
6159
6156
if (ret != SAI_STATUS_SUCCESS)
6160
6157
{
@@ -7202,7 +7199,7 @@ void PortsOrch::updatePortStatePoll(const Port &port, port_state_poll_t type, bo
7202
7199
if (active)
7203
7200
{
7204
7201
m_port_state_poll[port.m_alias ] |= type;
7205
- m_timer ->start ();
7202
+ m_port_state_poller ->start ();
7206
7203
}
7207
7204
else
7208
7205
{
@@ -7214,24 +7211,26 @@ void PortsOrch::doTask(swss::SelectableTimer &timer)
7214
7211
{
7215
7212
Port port;
7216
7213
7217
- for (auto it = m_port_state_poll.begin (); it != m_port_state_poll.end (); ++it )
7214
+ for (auto it = m_port_state_poll.begin (); it != m_port_state_poll.end (); )
7218
7215
{
7219
7216
if ((it->second == 0 ) || !getPort (it->first , port))
7220
7217
{
7221
- m_port_state_poll.erase (it);
7218
+ it = m_port_state_poll.erase (it);
7222
7219
continue ;
7223
7220
}
7224
7221
if (!port.m_admin_state_up )
7225
7222
{
7223
+ ++it;
7226
7224
continue ;
7227
7225
}
7228
7226
if (it->second & PORT_STATE_POLL_LT)
7229
7227
{
7230
7228
updatePortStateLinkTraining (port);
7231
7229
}
7230
+ ++it;
7232
7231
}
7233
7232
if (m_port_state_poll.size () == 0 )
7234
7233
{
7235
- m_timer ->stop ();
7234
+ m_port_state_poller ->stop ();
7236
7235
}
7237
7236
}
0 commit comments