Skip to content
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

Closed

Conversation

vganesan-nokia
Copy link
Contributor

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.

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.
Copy link
Collaborator

@kcudnik kcudnik left a 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

Comment on lines +61 to +65

std::map<std::vector<uint32_t>, std::string> m_coreportindex_to_ifname;

std::map<std::string, std::vector<uint32_t>> m_ifname_to_coreportindex;

Copy link
Collaborator

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in PR #698

Comment on lines +87 to +99
/**
* @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"

Copy link
Collaborator

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in PR #703

Comment on lines +33 to +37
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;
}
Copy link
Collaborator

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 ?

Copy link
Contributor Author

@vganesan-nokia vganesan-nokia Nov 10, 2020

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);
Copy link
Collaborator

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

Copy link
Contributor Author

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space after //

Copy link
Contributor Author

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)
Copy link
Collaborator

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

Copy link
Contributor Author

@vganesan-nokia vganesan-nokia Nov 10, 2020

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!");
Copy link
Collaborator

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in PR #702

@vganesan-nokia
Copy link
Contributor Author

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

I'll raise following multiple PRs

(1) PR for CorePortIndexMap.h and CorePortIndexMap.cpp
(2) PR for CorePortIndexMapContainer.h and CorePortIndexMapContainer.cpp
(3) PR for CorePortIndexMapFileParser.h and CorePortIndexMapFileParser.cpp
(4) PR for SwitchStateBase (.h and .cpp) changes without reference to coreportindxmap
(5) PR for VirtualSwitchSaiInterface.cpp changes to create VOQ switch objects
(6) PR for Makefile and Sai (.h and .cpp), SwitchConfig.h, saivs.h changes

I"ll also address other review comments in these PRs.

Thanks for the comments.

@vganesan-nokia
Copy link
Contributor Author

Request re-review of this on the 6 small PRs (#698, #699, #700, #701, #702 and #703). I'll close this PR once these 6 PRs are merged.
Thanks

@kcudnik kcudnik marked this pull request as draft November 13, 2020 11:51
@kcudnik
Copy link
Collaborator

kcudnik commented Nov 13, 2020

closing this since it was split to multiple PR

@kcudnik kcudnik closed this Nov 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants