Skip to content

[BufferOrch] Use SAI bulk API to configure port, PG and queue#3452

Merged
prsunny merged 13 commits intosonic-net:masterfrom
stepanblyschak:buffer-bulk
Feb 18, 2025
Merged

[BufferOrch] Use SAI bulk API to configure port, PG and queue#3452
prsunny merged 13 commits intosonic-net:masterfrom
stepanblyschak:buffer-bulk

Conversation

@stepanblyschak
Copy link
Copy Markdown
Contributor

What I did

Make use of SAI set bulk API to improve switch boot up performance, especially in warm-boot and fast-boot scenarios.

The general concept:

  1. First, tasks are processed one by one by corresponding process* methods which add the SAI operation with a context to a bulk buffer. Bulk buffers are split by DB operation.
  2. Bulk buffer is flushed to syncd using SAI bulk API, first DELETE operations are pushed in bulk then SET operations are pushed. Status code for each operation is updated in the task context structure.
  3. Lastly, corresponding process*Post methods are invoked to handle SAI status code and perform post set operations like enabling FC counter for a PG/queue upon success.

This design allows re-use of all existing code that is written to handle one task at a time and a small change is needed to maintain task context persistence throughout steps 1-3.

Why I did it

To improve fast-boot/warm-boot convergence time.

How I verified it

Manual verification by booting up the T0 topology configuration and running basic tests with static and dynamic buffer models. Fast-boot tested and observed ~2 times improvement in buffer configuration time on 256 port system from 3 sec to 1.7 sec when syncd falls back to single SET API. A bigger improvement is expected with proper SAI driver bulk SET support.

Details if related

Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
DEL happens first, then SET. Otherwise the order in bulk SET could be
different.

Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@stepanblyschak
Copy link
Copy Markdown
Contributor Author

/azpw run

@mssonicbld
Copy link
Copy Markdown
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@developfast
Copy link
Copy Markdown
Contributor

Will review shortly

const auto tokens = tokenize(key, delimiter);
Port port;

for (const auto& portContext: task.ports)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Any capability check to query vendor SAI's bulk API implementation?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@stepanblyschak
Copy link
Copy Markdown
Contributor Author

/azpw run

@mssonicbld
Copy link
Copy Markdown
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@stepanblyschak
Copy link
Copy Markdown
Contributor Author

VS tests fail due to bulk set not supported for PGs in init view in syncd:

ERR #syncd: :- run: Runtime error: :- processBulkQuadEventInInitViewMode: SAI_OBJECT_TYPE_INGRESS_PRIORITY_GROUP is not supported in init view mode

Either need to add such support or disable bulk for systems that use init view

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@stepanblyschak
Copy link
Copy Markdown
Contributor Author

>           raise HTTPError(http_error_msg, response=self)
E           requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http+docker://localhost/v1.47/images/debian:jessie/json

@stepanblyschak
Copy link
Copy Markdown
Contributor Author

/azpw run

@mssonicbld
Copy link
Copy Markdown
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@stepanblyschak
Copy link
Copy Markdown
Contributor Author

/azpw run

@mssonicbld
Copy link
Copy Markdown
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@stepanblyschak
Copy link
Copy Markdown
Contributor Author

/azpw run

@mssonicbld
Copy link
Copy Markdown
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@bingwang-ms
Copy link
Copy Markdown
Contributor

@prsunny Could you help review & merge? Thanks

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@prsunny prsunny merged commit 1524054 into sonic-net:master Feb 18, 2025
15 checks passed
@mssonicbld
Copy link
Copy Markdown
Collaborator

Cherry-pick PR to 202411: #3523

Janetxxx pushed a commit to Janetxxx/sonic-swss that referenced this pull request Nov 10, 2025
…net#3452)

* [BufferOrch] Use SAI bulk API to configure port, PG and queue

What I did

Make use of SAI set bulk API to improve switch boot up performance, especially in warm-boot and fast-boot scenarios.

The general concept:

First, tasks are processed one by one by corresponding process* methods which add the SAI operation with a context to a bulk buffer. Bulk buffers are split by DB operation.
Bulk buffer is flushed to syncd using SAI bulk API, first DELETE operations are pushed in bulk then SET operations are pushed. Status code for each operation is updated in the task context structure.
Lastly, corresponding process*Post methods are invoked to handle SAI status code and perform post set operations like enabling FC counter for a PG/queue upon success.
This design allows re-use of all existing code that is written to handle one task at a time and a small change is needed to maintain task context persistence throughout steps 1-3.
baorliu pushed a commit to baorliu/sonic-swss that referenced this pull request Feb 23, 2026
…net#3452)

* [BufferOrch] Use SAI bulk API to configure port, PG and queue

What I did

Make use of SAI set bulk API to improve switch boot up performance, especially in warm-boot and fast-boot scenarios.

The general concept:

First, tasks are processed one by one by corresponding process* methods which add the SAI operation with a context to a bulk buffer. Bulk buffers are split by DB operation.
Bulk buffer is flushed to syncd using SAI bulk API, first DELETE operations are pushed in bulk then SET operations are pushed. Status code for each operation is updated in the task context structure.
Lastly, corresponding process*Post methods are invoked to handle SAI status code and perform post set operations like enabling FC counter for a PG/queue upon success.
This design allows re-use of all existing code that is written to handle one task at a time and a small change is needed to maintain task context persistence throughout steps 1-3.

Signed-off-by: Baorong Liu <96146196+baorliu@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants