-
Notifications
You must be signed in to change notification settings - Fork 690
swss: Fix sFlow sampling-rate and admin-state #1224
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
In configuring
admin_statefield of CONFIG_DBSFLOW|globaltable, bothsflowHandleSessionAllandsflowHandleSessionLocalwill be called ifm_intfAllConfis true (default value). Before your change,it.second.local_conf, to my understanding, controls the mutual exclusion that an individual port is set in eithersflowHandleSessionAllorsflowHandleSessionLocal, depending on whether it has its own configuration or not. Now you remove this variable, a port having its own config can be set twice to APPL_DB by bothsflowHandleSessionAllandsflowHandleSessionLocal, callingm_appSflowSessionTable.set(it.first, fvs).Uh oh!
There was an error while loading. Please reload this page.
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.
@wangxin - Are you asking a question or suggesting a change?
I replaced
port_info.local_confwith two variablesport_info.local_rate_cfgandport_info.local_admin_cfgto differeniate between a local change to the port's admin-state and a local change to the port's sampling-rate. This change is needed to address the issue at hand. Without it we will hit a case where the user configured a port's sampling-rate, but the port will not obey the global admin-status (because there is a local config), as the unfixed UT demonstrates.Not sure what you mean here. If a port has a local config (either sample-rate, admin-status, or both), APPL_DB will be set when either
sflowHandleSessionAllorsFlowHandleSessionLocalis called. This behavior is exactly the same as when there was only one variableport_info.local_config, because we are doing a OR (||) check:https://github.com/Azure/sonic-swss/pull/1224/files#diff-e3e7c0a4d48317ec70d5339d6fd3c6d1R136
https://github.com/Azure/sonic-swss/pull/1224/files#diff-e3e7c0a4d48317ec70d5339d6fd3c6d1R162
Each of those function can configure ApplDB once as needed.
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.
As you said in reply "APPL_DB will be set when either sflowHandleSessionAll or sFlowHandleSessionLocal is called", APPL_DB will be set twice here https://github.com/Azure/sonic-swss/blob/master/cfgmgr/sflowmgr.cpp#L289
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.
Yes, once per function call and only if
m_intfallConfevaluates totrue. This is needed. I'm still not sure if you're trying to make a suggestion or asking a question...