-
Notifications
You must be signed in to change notification settings - Fork 656
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
[Dynamic buffer calc] Support dynamic buffer calculation #973
[Dynamic buffer calc] Support dynamic buffer calculation #973
Conversation
This pull request introduces 7 alerts and fixes 1 when merging 45eaa6d5abf4b0d7fa82981e2ffc82c4a459835e into fd52e93 - view on LGTM.com new alerts:
fixed alerts:
|
45eaa6d
to
4632e67
Compare
This pull request introduces 8 alerts when merging 4632e67e0f2df408160071e9af219c8366d56f9d into d5fdd74 - view on LGTM.com new alerts:
|
4632e67
to
8dad09b
Compare
This pull request introduces 8 alerts when merging 8dad09bd76832e4581dd7780d1ae46c97f89b437 into 37f131e - view on LGTM.com new alerts:
|
This pull request introduces 8 alerts when merging 7257fbf2f12d5d8db502b4613cad6b2edad4ed67 into ca8ffe7 - view on LGTM.com new alerts:
|
please add some tests for the new show and config commands |
3aa39aa
to
d17a143
Compare
This pull request introduces 1 alert when merging 1d822ac3fcc1a6de749385f97b12ec80d5b9b66f into 144bccb - view on LGTM.com new alerts:
|
1d822ac
to
dae7df5
Compare
e8522fb
to
1f81d20
Compare
This comment has been minimized.
This comment has been minimized.
retest this please |
fbe9462
to
2a2e96b
Compare
This pull request introduces 2 alerts when merging 2a2e96bf08e38c2403c8c656694e8142859019f0 into 1c45ca1 - view on LGTM.com new alerts:
|
Please add tests for show commands as well. You can refer to watermarkstat_test |
Very useful suggestions, thanks! |
This pull request introduces 1 alert when merging 82bf2a66ea416dff0c0e2b5aeeeb79de1bb3a59a into 9d55082 - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging 79440b85ab4fa4f6d7e203ab021c14206992c0e0 into 05c8e33 - view on LGTM.com new alerts:
|
doc/Command-Reference.md
Outdated
- Example: | ||
|
||
``` | ||
admin@sonic:~$ buffershow -l |
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 example command should be 'show buffer information' and not the script executed by it.
@stephenxs can you please resolve conflicts and double check the version for the db migration? |
1. commands added(see below) and testcases for new commands 2. db_migrator: - migrate CONFIG_DB from old approach to the new approach - when system warm starts from old image to the new one, copies related tables from CONFIG_DB to APPL_DB for the purpose that buffermgrd can start smoothly 3. warm-reboot script: don't clear BUFFER_MAX_PARAM table across warm reboot CLI list - config interface buffer priority-group lossless <add|set|remove> - config interface buffer priority-group lossless add <port> <PG> [headroom-override-profile] for adding the PG for the first time providing option headroom-override-profile means to configure the PG as headroom override otherwise as dynamically calculated headroom - config interface buffer priority-group lossless set <port> <PG> [headroom-override-profile] for modifying an existing PG, the option headroom-override-profile has the same meaning as "add" - config interface buffer priority-group lossless remove <port> [PG] for removing the PG specified by option PG. if the option isn't provided, all lossless PGs on the port will be removed - config buffer-profile <add|set|remove> To add, modify or remove buffer profiles - show buffer <configuration|information> Testcase covered for global config commands. show command unconvered due to subprocess call isn't supported by test infra Signed-off-by: Stephen Sun <stephens@nvidia.com>
1. If all the buffer configuration aligns the default, use dynamic buffer calculation mode. Otherwise, use the traditional mode 2. Dynamic mode is adopted in switches newly installed from scratch and traditional mode in switches installed from minigraph This is done by: - introducing the option --no-dynamic-buffer in "config qos reload" to designate whether the dynamic or traditional mode is used - introducing a new filed "buffer_model" in DEVICE_METADATA|localhost to store which buffer model currently is used - updating db_migrator accordingly Signed-off-by: Stephen Sun <stephens@nvidia.com>
Review comments: - Add testcases for show and config command - Address review comments in db_migrator - Use "size" to represent the size of the PG and "headroom" for xoff - Fix typo Signed-off-by: Stephen Sun <stephens@nvidia.com>
79440b8
to
c237619
Compare
Signed-off-by: Stephen Sun <stephens@nvidia.com>
This pull request introduces 1 alert when merging c237619 into 9a17108 - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging a63b850 into 9a17108 - view on LGTM.com new alerts:
|
retest this please |
# | ||
# 'buffer' subgroup ('config interface buffer ...') | ||
# | ||
@interface.group(cls=clicommon.AbbreviationGroup) |
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.
unit testing missing for interface group. Please add
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.
Hi @neethajohn ,
this needs an infrastructure level update.
For unit testing to work for a command, the fixture @clicommon.pass_db
is required. However, the db objects are generated in interface subcommand instead of passed by @clicommon.pass_db
.
So we are unable to add unit testing here until it is updated. There isn't any unit test for any of config interface
commands now for the same cause.
If we would like to enable unit testing for all config interface
commands, I suggest updating the interface command first and the updating unit test cases. It's better to do it in another PR.
How do you think?
All other comments have been fixed.
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.
@lguohan, how do we want to proceed on this? I don't see any unit tests for any of the 'config interface' commands currently
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.
Hi @neethajohn @lguohan ,
Can we merge it and add unit test cases for config interface buffer
when the infrastructure is ready?
Thanks.
Stephen
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.
issue #1301 opened for tracking this.
- Fix alignment error - Update DEVICE_METADATA|localhost.buffer_model only if it is changed Signed-off-by: Stephen Sun <stephens@nvidia.com>
This pull request introduces 1 alert when merging aee20c1 into 326e534 - view on LGTM.com new alerts:
|
I don't quite understand why LGTM reports the following import is unused. Probably because it is only imported in the test code which is skipped by LGTM?
|
retest this please. |
retest this, please |
**- Why I did it** To support dynamic buffer calculation. This PR also depends on the following PRs for sub modules - [sonic-swss: [buffermgr/bufferorch] Support dynamic buffer calculation #1338](sonic-net/sonic-swss#1338) - [sonic-swss-common: Dynamic buffer calculation #361](sonic-net/sonic-swss-common#361) - [sonic-utilities: Support dynamic buffer calculation #973](sonic-net/sonic-utilities#973) **- How I did it** 1. Introduce field `buffer_model` in `DEVICE_METADATA|localhost` to represent which buffer model is running in the system currently: - `dynamic` for the dynamic buffer calculation model - `traditional` for the traditional model in which the `pg_profile_lookup.ini` is used 2. Add the tables required for the feature: - ASIC_TABLE in platform/\<vendor\>/asic_table.j2 - PERIPHERAL_TABLE in platform/\<vendor\>/peripheral_table.j2 - PORT_PERIPHERAL_TABLE on a per-platform basis in device/\<vendor\>/\<platform\>/port_peripheral_config.j2 for each platform with gearbox installed. - DEFAULT_LOSSLESS_BUFFER_PARAMETER and LOSSLESS_TRAFFIC_PATTERN in files/build_templates/buffers_config.j2 - Add lossless PGs (3-4) for each port in files/build_templates/buffers_config.j2 3. Copy the newly introduced j2 files into the image and rendering them when the system starts 4. Update the CLI options for buffermgrd so that it can start with dynamic mode 5. Fetches the ASIC vendor name in orchagent: - fetch the vendor name when creates the docker and pass it as a docker environment variable - `buffermgrd` can use this passed-in variable 6. Clear buffer related tables from STATE_DB when swss docker starts 7. Update the src/sonic-config-engine/tests/sample_output/buffers-dell6100.json according to the buffer_config.j2 8. Remove buffer pool sizes for ingress pools and egress_lossy_pool Update the buffer settings for dynamic buffer calculation
**What I did** ***Support dynamic buffer calculation*** 1. Extend the CLI options for buffermgrd: - -a: asic_table provided, - -p: peripheral_table provided The `buffermgrd` will start the dynamic headroom calculation mode with -a provided. Otherwise, it will start the legacy mode (pg_headroom_profile looking up) 2. A new class is provided for dynamic buffer calculation while the old one remains. The daemon will instantiate the corresponding class according to the CLI option when it starts. 3. In both modes, the `buffermgrd` will copy BUFFER_XXX tables from CONFIG_DB to APPL_DB and the `bufferorch` will consume BUFFER_XXX tables from APPL_DB ***Backward compatibility*** For legacy mode, the backward compatibility is provided. As mentioned above, `buffermgrd` will check whether the json file representing the `ASIC_TABLE` exists when it starts. - If yes it will start the dynamic buffer calculating mode - Otherwise, it will start the compatible mode which is the old looking up mode in the new code committed in this PR. This logic is in `cfgmgr/buffermgrd.cpp`. The logic of buffer handling in `buffermgrd` isn't changed in the legacy mode. The differences are: - in legacy mode which is the old code, there isn't any buffer related table in `APPL_DB`. All tables are in `CONFIG_DB`. - `buffermgrd` listens to `PORT` and `CABLE_LENGTH` tables in `CONFIG_DB` and inserts the buffer profiles into `BUFFER_PROFILE` table. - `bufferorch` listens to buffer related tables in `CONFIG_DB` and call SAI API correspondingly. - In the compatible mode, `buffermgrd` listens to tables in `CONFIG_DB` and copies them into `APPL_DB` - `buffermgrd` - listens to `PORT` and `CABLE_LENGTH` tables in `CONFIG_DB` and inserts the buffer profiles into `BUFFER_PROFILE` table in `CONFIG_DB` (not changed) - listens to buffer related tables in `CONFIG_DB` and copies them into `APPL_DB` - `bufferorch` listens to `APPL_DB` and call SAI API correspondingly. (the difference is the db it listens to). - `db_migrator` is responsible to copy the buffer related tables from `CONFIG_DB` to `APPL_DB` when system is warmbooted from the old image to the new image for the first time. The compatible code is in `cfgmgr/buffermgr.cpp`, `orchagent/bufferorch.cpp` and `db_migrator` (in the [sonic-utilities PR](sonic-net/sonic-utilities#973)). **Why I did it** **How I verified it** 1. vs test 2. regression test [PR: [Dynamic buffer calc] Test cases for dynamic buffer calculation](sonic-net/sonic-mgmt#1971) **Dynamic buffer details** 1. In the dynamic buffer calculation mode, there are 3 lua plugins are provided for vendor-specific operations: - buffer_headroom_<vendor>.lua, for calculating headroom size. - buffer_pool_<vendor>.lua, for calculating buffer pool size. - buffer_check_headroom_<vendor>.lua, for checking whether headroom exceeds the limit 2. During initialization, The daemon will: - load asic_table and peripheral_table from the given json file, parse them and push them into STATE_DB.ASIC_TABLE and STATE_DB.PERIPHERAL_TABLE respectively - load all plugins - try to load the STATE_DB.BUFFER_MAX_PARAM.mmu_size which is used for updating buffer pool size - a timer will be started for periodic buffer pool size audit 3. The daemon will listen to and handle the following tables from CONFIG_DB The tables will be cached internally in the daemon for the purpose of saving access time - BUFFER_POOL: - if the size is provided: insert the entry to APPL_DB - otherwise: cache them and push to APPL_DB after the size is calculated by lua plugin - BUFFER_PROFILE and BUFFER_PG: - items for ingress lossless headroom need to be cached and handled (according to the design) - other items will be inserted to the APPL_DB directly - PORT_TABLE, for ports' speed and MTU update - CABLE_LENGTH, for ports' cable length 4. Other tables will be copied to APPL_DB directly: - BUFFER_QUEUE - BUFFER_PORT_INGRESS_PROFILE_LIST - BUFFER_PORT_EGRESS_PROFILE_LIST 5. BufferOrch modified accordingly: - Consume buffer relevant tables from APPL_DB instead of CONFIG_DB - For BUFFER_POOL, don't set ingress/egress and static/dynamic to sai if the pool has already existed because they are create-only - For BUFFER_PROFILE, don't set pool for the same reason 6. Warm reboot: - db_migrator is responsible for copying the data from CONFIG_DB to APPL_DB if the switch is warm-rebooted from an old image to the new image for the first time - no specific handling in the daemon side 7. Provide vstest script
**- What I did** Support dynamic buffer calculation **- How I did it** 1. Commands added: • config interface buffer priority-group lossless <add|set|remove> • config interface buffer priority-group lossless add <port> <PG> [headroom-override-profile] for adding the PG for the first time providing option headroom-override-profile means to configure the PG as headroom override otherwise as dynamically calculated headroom • config interface buffer priority-group lossless set <port> <PG> [headroom-override-profile] for modifying an existing PG, the option headroom-override-profile has the same meaning as "add" • config interface buffer priority-group lossless remove <port> [PG] for removing the PG specified by option PG. If the option isn't provided, all lossless PGs on the port will be removed • config buffer-profile <add|set|remove> to add, modify or remove buffer profiles • show buffer <configuration|information> 2. db_migrator: • migrate CONFIG_DB from old approach to the new approach • when system warm starts from old image to the new one, copies related tables from CONFIG_DB to APPL_DB for the purpose that buffermgrd can start smoothly 3. Warm-reboot script: don't clear BUFFER_MAX_PARAM table across warm reboot 4. CLI reference is also provided **- How to verify it** **- Previous command output (if the output of a command-line utility has changed)** **- New command output (if the output of a command-line utility has changed)**
- What I did
Support dynamic buffer calculation
- How I did it
• config interface buffer priority-group lossless <add|set|remove>
• config interface buffer priority-group lossless add [headroom-override-profile] for adding the PG for
the first time providing option headroom-override-profile means to configure the PG as headroom override
otherwise as dynamically calculated headroom
• config interface buffer priority-group lossless set [headroom-override-profile] for modifying an existing
PG, the option headroom-override-profile has the same meaning as "add"
• config interface buffer priority-group lossless remove [PG] for removing the PG specified by option PG. If the
option isn't provided, all lossless PGs on the port will be removed
• config buffer-profile <add|set|remove> to add, modify or remove buffer profiles
• show buffer <configuration|information>
• migrate CONFIG_DB from old approach to the new approach
• when system warm starts from old image to the new one, copies related tables from CONFIG_DB to APPL_DB for the
purpose that buffermgrd can start smoothly
- How to verify it
- Previous command output (if the output of a command-line utility has changed)
- New command output (if the output of a command-line utility has changed)