Skip to content

Commit

Permalink
Merge branch 'master' into packetIoHldUpdate
Browse files Browse the repository at this point in the history
  • Loading branch information
donNewtonAlpha authored Aug 9, 2022
2 parents d9d70d0 + 3f0ba59 commit d5e0cc3
Show file tree
Hide file tree
Showing 34 changed files with 1,143 additions and 237 deletions.
26 changes: 9 additions & 17 deletions Supported-Devices-and-Platforms.html
Original file line number Diff line number Diff line change
Expand Up @@ -471,15 +471,15 @@ <h2><p style="text-align: left; font-family: Verdana, sans-serif; color: #2E86C1
<tr>
<td>Arista</td>
<td>7170-32CD</td>
<td class="asic_vendor">Barefoot</td>
<td class="asic_vendor">Intel</td>
<td>Tofino</td>
<td>32x100G + 2x10G</td>
<td></td>
</tr>
<tr>
<td>Arista</td>
<td>7170-64C</td>
<td class="asic_vendor">Barefoot</td>
<td class="asic_vendor">Intel</td>
<td>Tofino</td>
<td>64x100G</td>
<td></td>
Expand Down Expand Up @@ -509,25 +509,17 @@ <h2><p style="text-align: left; font-family: Verdana, sans-serif; color: #2E86C1
<td></td>
</tr>
<tr>
<td>Barefoot</td>
<td>SONiC-P4</td>
<td class="asic_vendor">Barefoot</td>
<td>P4 Emulated</td>
<td>Configurable</td>
<td></td>
</tr>
<tr>
<td>Barefoot</td>
<td>Accton</td>
<td>Wedge 100BF-32</td>
<td class="asic_vendor">Barefoot</td>
<td class="asic_vendor">Intel</td>
<td>Tofino</td>
<td>32x100G</td>
<td></td>
</tr>
<tr>
<td>Barefoot</td>
<td>Accton</td>
<td>Wedge 100BF-65X</td>
<td class="asic_vendor">Barefoot</td>
<td class="asic_vendor">Intel</td>
<td>Tofino</td>
<td>32x100G</td>
<td></td>
Expand Down Expand Up @@ -837,7 +829,7 @@ <h2><p style="text-align: left; font-family: Verdana, sans-serif; color: #2E86C1
<tr>
<td>Ingrasys</td>
<td>S9180-32X</td>
<td class="asic_vendor">Barefoot</td>
<td class="asic_vendor">Intel</td>
<td>Tofino</td>
<td>32x100G</td>
<td></td>
Expand All @@ -861,7 +853,7 @@ <h2><p style="text-align: left; font-family: Verdana, sans-serif; color: #2E86C1
<tr>
<td>Ingrasys</td>
<td>S9280-64X</td>
<td class="asic_vendor">Barefoot</td>
<td class="asic_vendor">Intel</td>
<td>Tofino</td>
<td>64x100G</td>
<td></td>
Expand Down Expand Up @@ -1093,7 +1085,7 @@ <h2><p style="text-align: left; font-family: Verdana, sans-serif; color: #2E86C1
<tr>
<td>Wnc</td>
<td>OSW1800</td>
<td class="asic_vendor">Barefoot</td>
<td class="asic_vendor">Intel</td>
<td>Tofino</td>
<td>48x25G + 6x100G</td>
<td></td>
Expand Down
Binary file modified assets/img/all_partners2_1920x1320.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion doc/SONiC_202111_Release_Notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ Refer [HLD document](https://github.com/Azure/SONiC/blob/dc4a7ae5be75e8e376f9e95
The SONiC Generic Update and Rollback feature is to standardize the way to do partial updates, to take checkpoints and finally to rollback the configurations for SONiC.

Refer [HLD document](https://github.com/ghooo/SONiC/blob/c1f3f3b5427d0cafb3defd93df8b906a26fcee8a/doc/config-generic-update-rollback/SONiC_Generic_Config_Update_and_Rollback_Design.md) and below mentioned PR's for more details.
<br> **Pull Requests** : [736](https://github.com/Azure/SONiC/pull/736)
<br> **Pull Requests** : [736](https://github.com/Azure/SONiC/pull/736), [1536](https://github.com/Azure/sonic-utilities/pull/1536), [1599](https://github.com/Azure/sonic-utilities/pull/1599), [1762](https://github.com/Azure/sonic-utilities/pull/1762), [1794](https://github.com/Azure/sonic-utilities/pull/1794), [1831](https://github.com/Azure/sonic-utilities/pull/1831), [1856](https://github.com/Azure/sonic-utilities/pull/1856), [1864](https://github.com/Azure/sonic-utilities/pull/1864), [1885](https://github.com/Azure/sonic-utilities/pull/1885), [1901](https://github.com/Azure/sonic-utilities/pull/1901), [1919](https://github.com/Azure/sonic-utilities/pull/1919), [1923](https://github.com/Azure/sonic-utilities/pull/1923), [1929](https://github.com/Azure/sonic-utilities/pull/1929), [1934](https://github.com/Azure/sonic-utilities/pull/1934), [1969](https://github.com/Azure/sonic-utilities/pull/1969), [1973](https://github.com/Azure/sonic-utilities/pull/1973), [1977](https://github.com/Azure/sonic-utilities/pull/1977), [1981](https://github.com/Azure/sonic-utilities/pll/1981), [1983](https://github.com/Azure/sonic-utilities/pull/1983), [1987](https://github.com/Azure/sonic-utilities/pull/1987), [1988](https://github.com/Azure/sonic-utilities/pull/1988), [2003](https://github.com/Azure/sonic-utilities/pull/2003), [2006](https://github.com/Azure/sonic-utilities/pull/2006), [2008](https://github.com/Azure/sonic-utilities/pull/2008), [2015](https://github.com/Azure/sonic-utilities/pull/2015), [2020](https://github.com/Azure/sonic-utilities/pull/2020) & [2028](https://github.com/Azure/sonic-utilities/pull/2028)

#### SRv6 support (Cntd)
SRv6 has been widely adopted as an IPv6 based SDN solution, which provides programming ability, TE capabilities, and deployment simplicity to network administrators. With current support from a rich ecosystem, including major ASIC manufactures, networking vendors and open source communities, the deployment of SRv6 is accelerating. This implentation adds SRv6 into SONIC to benefit users in DC as well as beyond DC.
Expand Down
152 changes: 152 additions & 0 deletions doc/bulk_counter/bulk_counter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
# SONiC Bulk Counter Design #

## Table of Content

### Revision

| Rev | Date | Author | Change Description |
|:---:|:-----------:|:------------------:|-----------------------------------|
| 0.1 | | Junchao Chen | Initial version |

### Scope

This document is the design document for bulk counter feature on SONiC.

### Definitions/Abbreviations

N/A

### Overview

PR https://github.com/opencomputeproject/SAI/pull/1352/files introduced new SAI APIs that supports bulk stats:

- sai_bulk_object_get_stats
- sai_bulk_object_clear_stats

SONiC flex counter infrastructure shall utilize bulk stats API to gain better performance. This document discusses how to integrate these two new APIs to SONiC.

### Requirements

- Syncd shall use bulk stats APIs based on object type. E.g. for a counter group that queries queue and pg stats, queue stats support bulk while pg stats does not, in that case queue stats shall use bulk API, pg stats shall use non bulk API
- For a certain object in a counter group, it shall use bulk stats only if all counter IDs support bulk API
- Syncd shall automatically fall back to old way if bulk stats APIs are not supported
- Syncd shall utilize sai_bulk_object_get_stats/sai_bulk_object_clear_stats to query bulk capability. Syncd shall treat counter as no bulk capability if API return error
- Syncd shall call bulk stats API in flex counter thread and avoid calling it in main thread to make sure main thread only handles short and high priority tasks. (This is the default behavior in current flex counter infrastructure)
- In phase 1, the change is limited to syncd only, no CLI/swss change. Syncd shall deduce the bulk stats mode according to the stats mode defined in FLEX DB:
- SAI_STATS_MODE_READ -> SAI_STATS_MODE_BULK_READ
- SAI_STATS_MODE_READ_AND_CLEAR -> SAI_STATS_MODE_BULK_READ_AND_CLEAR

### Architecture Design

For each counter group, different statistic type is allowed to choose bulk or non-bulk API based on vendor SAI implementation.

![architecture](/doc/bulk_counter/bulk_counter.svg).

> Note: In the picture, pg/queue watermark statistic use bulk API and buffer watermark statistic uses non-bulk API. This is just an example to show the design idea.
### High-Level Design

Changes shall be made to sonic-sairedis to support this feature. No CLI change. No DB schema change.

> Note: Code present in this design document is only for demonstrating the design idea, it is not production code.
#### sonic-sairedis

##### Bulk Statistic Context

A new structure shall be added to FlexCounter class.

This structure is created because:

- Meet the signature of sai_bulk_object_get_stats and sai_bulk_object_clear_stats
- Avoid constructing these information each time collecting statistic. The bulk context shall only be updated under below cases:
- New object join counter group. E.g. adding a new port object.
- Existing object leave counter group. E.g removing an existing port object.
- Other case such as counter IDs is updated by upper layer.

```cpp
struct BulkStatsContext
{
sai_object_type_t object_type;
std::vector<sai_object_id_t> object_vids;
std::vector<sai_object_key_t> object_keys;
std::vector<sai_stat_id_t> counter_ids;
std::vector<sai_status_t> object_statuses;
std::vector<uint64_t> counters;
};
```
- object_type: object type.
- object_vids: virtual IDs.
- object_keys: real IDs.
- counter_ids: SAI statistic IDs that will be queried/cleared by the bulk call.
- object_statuses: SAI bulk API return value for each object.
- counters: counter values that will be fill by vendor SAI.

The flow of how to updating bulk context will be discussed in following section.

For a given object type, different object instance may support different stats capability, so, a map of BulkStatsContext shall be added to FlexCounter class for each object type.

```cpp
std::map<std::vector<sai_port_stat_t>, BulkStatsContext> m_portBulkContexts;
...

```

##### Update Bulk Context

1. New object join counter group.

![Add Object Flow](/doc/bulk_counter/object_join_counter_group.svg).

2. Existing object leave counter group, related data shall be removed from bulk context.

##### Statistic Collect

![Collect Counter Flow](/doc/bulk_counter/counter_collect.svg).

### SAI API

SAI APIs shall be used in this feature:

- sai_bulk_object_get_stats
- sai_bulk_object_clear_stats

### Configuration and management

N/A

### Warmboot and Fastboot Design Impact

No extra logic on SONiC side is needed to handle warmboot/fastboot.

- As fastboot delays all counters querying, this feature does not affect fastboot.
- For warmboot, it is vendor SAI implementation's responsible to make sure that there must be no error if warmboot starts while bulk API is called.

### Restrictions/Limitations

- Bulk collect attribute value is not supported
- Buffer pool stats is not support for bulk because different buffer pool may have different stats mode. E.g. pool1 has mode SAI_STATS_MODE_READ, pool2 has mode SAI_STATS_MODE_READ_AND_CLEAR. The new SAI bulk API only allows specify one stats mode.
- Maximum object number at one bulk call is a limitation based on vendor implementation.

### Performance Improvement

A rough test has been done on Nvidia platform for queue.

- Non bulk API: get stats for one queue takes X seconds; get stats for 32 port * 8 queue is 256X seconds;
- Bulk API: get stats for one queue takes Y seconds; get stats for 32 port * 8 queue is almost Y seconds;

X is almost equal to Y. So, more object instances, more performance improvement.

### Testing Requirements/Design

As this feature does not introduce any new function, unit test shall be good enough to cover the code changes and new sonic-mgmt/VS test cases will be added.

#### Unit Test cases

- addRemoveBulkCounter
- counterIdChange
- not support bulk -> support bulk
- support bulk but counter IDs change
- support bulk with different counter IDs
- support bulk -> not support bulk
- not support bulk but counter IDs change
1 change: 1 addition & 0 deletions doc/bulk_counter/bulk_counter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d5e0cc3

Please sign in to comment.