-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[vstest]VS test support for VOQ system ports #696
Conversation
Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com> SAI emulation support added for VOQ system ports. The changes include: (1) Switch create initialization for VOQ switch objects (2) Associating local port id to sytems ports that correspond ot the local ports. In real SAI, mapping between system port and local port is done by matching the system ports's <switch_id, core index, core port index> tuple. In VOQ switches, each port blongs to a switch core and is assigned an index. This mapping is done in hardware configurations. For VS, the mapping is emulated via a new file coreportindexmap.ini. This file is made available in /usr/share/sonic/hwsku in the same way how lanemap.ini is made avaialble. The loading and and parsing of coreportindexmap.ini is done in similar way as it is done for lanemap.ini. While emulating configuration system ports, if a system port is found to be a local port (determined using its switch_id), the local port oid corresponding system port is retrieved from m_port_list and local port atribute is set in the system port object. This is used by orchagent (portsorch) for system port initialization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't ever create such huge PR's, create small prs preferred single class per PR, no need to add this new class to Makefile, you can make this on separate pr after all files will be in place
Address comments
|
||
std::map<std::vector<uint32_t>, std::string> m_coreportindex_to_ifname; | ||
|
||
std::map<std::string, std::vector<uint32_t>> m_ifname_to_coreportindex; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep naming convention as other names like m_corePortIndexToIfName
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in PR #698
/** | ||
* @def SAI_KEY_VS_CORE_PORT_INDEX_MAP_FILE | ||
* | ||
* For VOQ systems if specified in profile.ini it should point to eth interface to | ||
* core and core port index map as port name:core_index,core_port_index | ||
* | ||
* Example: | ||
* eth1:0,1 | ||
* eth17:1,1 | ||
* | ||
*/ | ||
#define SAI_KEY_VS_CORE_PORT_INDEX_MAP_FILE "SAI_VS_CORE_PORT_INDEX_MAP_FILE" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this UP, where SAI_KEY_* are declared
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in PR #703
if (n != 2) | ||
{ | ||
SWSS_LOG_ERROR("Invalid corePortIndex. Core port index must have core and core port index %d, %s", n, ifname.c_str()); | ||
return false; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this is is alwasy 2, should it be better to have 2 input parameters in add method instead of vector ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now it is going to be only 2 fields. But not sure if this will change in the future. We may have switch_id (not switch index) as part of the mapping later.
|
||
for (uint32_t idx = 0; idx < defaultPortCount; idx++) | ||
{ | ||
auto ifname = "eth" + std::to_string(idx); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move "eth" to some define in top of file or constexpr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in PR #698
@@ -659,6 +659,12 @@ sai_status_t VirtualSwitchSaiInterface::create( | |||
return SAI_STATUS_FAILURE; | |||
} | |||
|
|||
//Initialize switch for VOQ attributes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space after //
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in PR #702
@@ -659,6 +659,12 @@ sai_status_t VirtualSwitchSaiInterface::create( | |||
return SAI_STATUS_FAILURE; | |||
} | |||
|
|||
//Initialize switch for VOQ attributes | |||
if ((ss->initialize_voq_switch_objects(attr_count, attr_list)) != SAI_STATUS_SUCCESS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems wrong to me, this should not be here, since there can be warm boot executed, and voq objects may be different than cold boot, remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The system ports are one time static configuration done at the start of the system. Unlike m_port_list, no configuration will change system ports and other voq switch objects during lifetime of the system. As of now, irrespective of whether the cold boot or warm boot, the system ports config is required to be always freshly configured. And since attr_count and attr_list are needed to initialize voq switch objects, voq swith object initialization is done from here. In the future, in case, dynamic configuration of system ports are implemented, we can always check for the warmboot state here and take action appropriately.
//Initialize switch for VOQ attributes | ||
if ((ss->initialize_voq_switch_objects(attr_count, attr_list)) != SAI_STATUS_SUCCESS) | ||
{ | ||
SWSS_LOG_ERROR("VOQ switch initialization failed!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
init failed but you continue, throw here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in PR #702
I'll raise following multiple PRs (1) PR for CorePortIndexMap.h and CorePortIndexMap.cpp I"ll also address other review comments in these PRs. Thanks for the comments. |
closing this since it was split to multiple PR |
Signed-off-by: vedganes vedavinayagam.ganesan@nokia.com
SAI emulation support added for VOQ system ports. The changes include:
(1) Switch create initialization for VOQ switch objects
(2) Associating local port id to sytems ports that correspond to the
local ports. In real SAI, mapping between system port and local port
is done by matching the system ports's <switch_id, core index, core port
index> tuple. In VOQ switches, each port blongs to a switch core and is
assigned an index. This mapping is done in hardware configurations. For
VS, the mapping is emulated via a new file coreportindexmap.ini. This
file is made available in /usr/share/sonic/hwsku in the same way how
lanemap.ini is made avaialble. The loading and parsing of
coreportindexmap.ini is done in similar way as it is done for
lanemap.ini. While emulating configuration system ports, if a system
port is found to be a local port (determined using its switch_id), the
local port oid corresponding system port is retrieved from m_port_list
and local port atribute is set in the system port object. This is used
by orchagent (portsorch) for system port initialization.