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

[vs] Initialization of VOQ switch objects #702

Merged
merged 5 commits into from
Nov 13, 2020

Conversation

vganesan-nokia
Copy link
Contributor

VOQ switch objects are initialized during swich create. This VOQ objects
are initialized after regular switch objects are initialized. This PR depends on #701
for switch state initialization

Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>

VOQ switch objects are initialized during swich create. This VOQ objects
are initialized after regular switch objects are initialized.
@@ -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 is in the wrong place, it should be inside SwitchStateBase.cpp class in initialize objects

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.

As discussed in PR #701, this is unchanged and going to be called from here as it is now.

Copy link
Collaborator

Choose a reason for hiding this comment

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

agree, but there are places init_default_objects inside _init_switch and warm_boot_initialize_objects,
current implementation you want to execute only for default objects, and this place here is actually executing it for both, which will cause to duplicate system port existence in virtual switch for warm boot,
so i would propose to add attr_count/list to init_switch and move this initialization in line 604

Copy link
Collaborator

Choose a reason for hiding this comment

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

also when you will want to support warm boot scenario for this, then you will need to add warm boot case in init_switch also

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 comment 1: o.k. I'll fix proposed.
For comment 2: o.k. when we support warm boot (only when system ports become dynamic config. Not sure when), this place will be used.

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. Moved initialize_voq_switch_objects() to init_switch() as proposed.

@kcudnik kcudnik changed the title [vstest] Initialization of VOQ switch objects [vs] Initialization of VOQ switch objects Nov 10, 2020
Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>

Code review comments fix 1
@@ -602,6 +604,15 @@ std::shared_ptr<SwitchStateBase> VirtualSwitchSaiInterface::init_switch(
SWSS_LOG_THROW("unable to init switch %s", sai_serialize_status(status).c_str());
}

// Initialize switch for VOQ attributes

status = ss->initialize_voq_switch_objects(attr_count, attr_list);
Copy link
Collaborator

Choose a reason for hiding this comment

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

ok, this looks better, but i would like you to make 1 more change, so i think it would be actually better to propagate those count/list to parameters initialize_default_objects() function, and call voq initialize inside initialize_devault_objects, this way we will have initialization part in 1 single function, what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No issue in doing what you are proposing. However, here the voq objects are not defaults. They are configured attributes. Not sure if it will be clearer to have non default object initialization in function whose name indicates default object initialization

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also see a comment "TODO" to move the calling "initialize_default_objects()" to constructor. If we modify to propagate attr_count/attr_list to this function, we may not be able move this to constructor. Is it still o.k, if I do the modification as proposed?

Copy link
Collaborator

Choose a reason for hiding this comment

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

that move to constructor cant be moved to constructor since that is virtual function, it could be moved, but it would need to be called explicitly in each constructor, and not in SwitchStateBase

Copy link
Contributor Author

Choose a reason for hiding this comment

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

o.k. I'll modify as proposed, then.

Copy link
Collaborator

Choose a reason for hiding this comment

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

thanks, this is actually interesting that some of the internal objects depends on the input attributes to create_switch function, and not actual hardware profile, this is wired to me

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Modified as proposed.

@kcudnik
Copy link
Collaborator

kcudnik commented Nov 13, 2020

retest vs please

@kcudnik
Copy link
Collaborator

kcudnik commented Nov 13, 2020

lgtm is stuck, so you will need to do force push or add another commit to trigger lgtm rerun

vedganes added 2 commits November 13, 2020 09:55
Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>

Code review comments 2
Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>

Code review comments fix 3
@kcudnik kcudnik merged commit fc50cf5 into sonic-net:master Nov 13, 2020
pettershao-ragilenetworks pushed a commit to pettershao-ragilenetworks/sonic-sairedis that referenced this pull request Nov 18, 2022
VOQ switch objects are initialized during switch create. This VOQ objects are initialized after regular switch objects are initialized. This PR depends on sonic-net#701 for switch state initialization
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