Skip to content

Commit eaccf67

Browse files
andriymoroz-mlnxlguohan
authored andcommitted
Fix port speed validation (sonic-net#288)
1 parent 8c922a5 commit eaccf67

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

orchagent/portsorch.cpp

+11-2
Original file line numberDiff line numberDiff line change
@@ -268,13 +268,22 @@ bool PortsOrch::validatePortSpeed(sai_object_id_t port_id, sai_uint32_t speed)
268268
}
269269
else
270270
{
271-
SWSS_LOG_ERROR("Failed to get supported speed list for port %lx\n", port_id);
271+
SWSS_LOG_ERROR("Failed to get supported speed list for port %lx", port_id);
272272
return false;
273273
}
274274
}
275+
// TODO: change to macro SAI_STATUS_IS_ATTR_NOT_SUPPORTED once it is fixed in SAI
276+
// https://github.com/opencomputeproject/SAI/pull/710
277+
else if (((status) & (~0xFFFF)) == SAI_STATUS_ATTR_NOT_SUPPORTED_0)
278+
{
279+
// unable to validate speed if attribute is not supported on platform
280+
// assuming input value is correct
281+
SWSS_LOG_WARN("Unable to validate speed for port %lx. Not supported by platform", port_id);
282+
return true;
283+
}
275284
else
276285
{
277-
SWSS_LOG_ERROR("Failed to get number of supported speeds for port %lx\n", port_id);
286+
SWSS_LOG_ERROR("Failed to get number of supported speeds for port %lx", port_id);
278287
return false;
279288
}
280289
}

0 commit comments

Comments
 (0)