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

[Dynamic buffer calc] Support dynamic buffer calculation #1338

Merged
merged 8 commits into from
Dec 15, 2020

Commits on Dec 3, 2020

  1. [buffermgr/bufferorch] Support dynamic buffer calculation

    1. Extend the CLI options for buffermgrd:
       -a: asic_table provided,
       -p: peripheral_table provided
       The buffermgrd will start with 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 mode, the buffermgrd will copy BUFFER_XXX tables from CONFIG_DB to APPL_DB
       and the bufferorch will consume BUFFER_XXX tables from APPL_DB
    The following points are for dynamic buffer calculation mode
    4. In the dynamic buffer calculation mode, there are 3 lua plugins are provided for vendor-specific operations:
       - buffer_headroom_<vendor>.lua, for calculationg headroom size.
       - buffer_pool_<vendor>.lua, for calculating buffer pool size.
       - buffer_check_headroom_<vendor>.lua, for checking whether headroom exceeds the limit
    5. 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
    6. The daemon will listen to and handle the following tables from CONFIG_DB
       The tables will be cached internally in the damon for the purpose of saving access time
       - BUFFER_POOL:
         - if 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
    7. Other tables will be copied to APPL_DB directly:
       - BUFFER_QUEUE
       - BUFFER_PORT_INGRESS_PROFILE_LIST
       - BUFFER_PORT_EGRESS_PROFILE_LIST
       As the names of tables in APPL_DB differ from that in CONFIG_DB, all references should be adjusted accordingly
    8. BufferOrch modified accordingly: Consume buffer relavent tables from APPL_DB instead of CONFIG_DB
    9. Warm reboot:
       - db_migrator is responsible for copying the data from CONFIG_DB to APPL_DB if switch is warm-rebooted
       from an old image to the new image for the first time
       - no specific handling in the daemon side
    10.Provide vstest script
    
    Signed-off-by: Stephen Sun <stephens@nvidia.com>
    stephenxs committed Dec 3, 2020
    Configuration menu
    Copy the full SHA
    60746cc View commit details
    Browse the repository at this point in the history
  2. Improve the vstest according to review comments

    - Very the profile in ASIC_DB when possible:
      in case of a new profile is created, we can get the OID of the profile
      by comparing SAI OID set before and after the creation
    - Add function which can switch buffer model dynamically
    - Add testcases for mtu update and non-default alpha
    
    Signed-off-by: Stephen Sun <stephens@nvidia.com>
    stephenxs committed Dec 3, 2020
    Configuration menu
    Copy the full SHA
    cb78de3 View commit details
    Browse the repository at this point in the history
  3. Support the DVS CLI option by which dynamic buffer model can be enabled

    Signed-off-by: Stephen Sun <stephens@nvidia.com>
    stephenxs committed Dec 3, 2020
    Configuration menu
    Copy the full SHA
    5b89593 View commit details
    Browse the repository at this point in the history

Commits on Dec 6, 2020

  1. BufferOrch/BufferMgrDyn: do not block the m_toSync if the head needs …

    …retry
    
    In case the head element in m_toSync needs to retry, the doTask will move to the
    following items and call process<TableName> for each of the items in the m_toSync.
    However, as the process<TableName> always handle the first element in m_toSync,
    it results in the m_toSync being blocked if the head needs retry.
    
    Solution: pass the element to which doTask move to process<TableName> so that
    it's able to handle the following element in m_toSync
    
    Signed-off-by: Stephen Sun <stephens@nvidia.com>
    stephenxs authored and stephens committed Dec 6, 2020
    Configuration menu
    Copy the full SHA
    190fde1 View commit details
    Browse the repository at this point in the history

Commits on Dec 8, 2020

  1. Address review comments

    buffermgrdyn: t => tupple
    vstest:
    1. use try-finally infrastructure to make sure buffermgr will
       always starts even if there is an error
    2. remove duplicated sentence
    3. add assert if the SAI OID for newly created profile isn't fetched
       from ASIC DB but it should be
    
    Signed-off-by: Stephen Sun <stephens@nvidia.com>
    stephenxs committed Dec 8, 2020
    Configuration menu
    Copy the full SHA
    9a8424b View commit details
    Browse the repository at this point in the history

Commits on Dec 14, 2020

  1. Adjust testcases according to recent change in sonic-buildimage

    1. Initialize DEFAULT_LOSSLESS_BUFFER_PARAMETER and LOSSLESS_TRAFFIC_PATTERN when enable the dynamic buffer
       and remove them when disable it.
       Originally they were enabled by default regardless whether dynamic buffer model is enabled, which has been
       removed according to the latest review comments from Qi. So move the initialization here.
    2. Remove all the dependency to buffer commands in order to make the vstest pass without sonic-utilities merged
    3. Some enhancement: make the test more stable:
       - before test starting, waiting all dynamic generated buffer profiles removed
       - adjust the order in which related tables removed, to make sure no leftover after buffer model switched
       - as no dynamic profile existing before test starting, it's possible to check asic db for speed change testcase
    
    Signed-off-by: Stephen Sun <stephens@nvidia.com>
    stephenxs authored and root committed Dec 14, 2020
    Configuration menu
    Copy the full SHA
    c36930f View commit details
    Browse the repository at this point in the history
  2. Add delay

    Signed-off-by: Stephen Sun <stephens@nvidia.com>
    stephenxs committed Dec 14, 2020
    Configuration menu
    Copy the full SHA
    38a136c View commit details
    Browse the repository at this point in the history

Commits on Dec 15, 2020

  1. Replace cable-length speed command with related CONFIG_DB operation

    Signed-off-by: Stephen Sun <stephens@nvidia.com>
    stephenxs committed Dec 15, 2020
    Configuration menu
    Copy the full SHA
    baa2eb3 View commit details
    Browse the repository at this point in the history