Skip to content

Commit c5780a9

Browse files
committed
parent a40cfa9
author JaiOCP <jai.kumar@broadcom.com> 1780351110 -0700 committer JaiOCP <jai.kumar@broadcom.com> 1781547347 -0700 Optimized Forwarding Header Signed-off-by: JaiOCP <jai.kumar@broadcom.com> Optimized Forwarding Header Signed-off-by: JaiOCP <jai.kumar@broadcom.com> Fix gensairpc.pl crash on Doxygen 1.9.8+ by reusing NeedsTwoPassProcessing (#2282) Why: To fix below build error Uncaught exception from user code: at gensairpc.pl line 480. main::assign_attr_types(HASH(0x55e190dc20c8), ARRAY(0x55e190d2d080)) called at gensairpc.pl line 434 main::get_definitions() called at gensairpc.pl line 156 main::assign_attr_types(HASH(0x55e190dc20c8), ARRAY(0x55e190d2d080)) called at gensairpc.pl line 434 main::get_definitions() called at gensairpc.pl line 156 How: gensairpc.pl crashed during SAI thrift build with an uncaught exception at line 480 (assign_attr_types) because its inline Doxygen layout detection was too weak - it only checked sai_8h.xml for any enumvalue presence, missing cases where the new Doxygen 1.9.8+ XML structure requires group__*.xml files to be processed for complete definitions. This caused incomplete parsing, leading to missing types and a croak in assign_attr_types when sai_attribute_value_t could not be found. Changes: - xmlutils.pm: Add NeedsTwoPassProcessing and export it. - parse.pl: Remove local NeedsTwoPassProcessing; use imported version. - gensairpc.pl: Replace inline detection with NeedsTwoPassProcessing() call, fixing the build failure and eliminating code duplication. Signed-off-by: Pavan Naregundi <pnaregundi@marvell.com> Count BFD session state changes from UP to DOWN (#2268) Signed-off-by: Chikkegowda Chikkaiah <cchikkai@cisco.com> SAI API Performance Monitoring (#2287) Signed-off-by: JaiOCP <jai.kumar@broadcom.com> Support OTN attenuator and amplifier (#2217) 1. Add a new precision attribute flag for optical analog values (e.g., gain, tilt, power), instead of using double/float point type which would introduce NaN issue. 2. Add support for optical attenuator in experimental extensions, derived from openconfig-optical-attenuator.yang. 3. Add support for optical amplifier in experimental extensions, derived from openconfig-optical-amplifier.yang. 4. Add SAI extension for OTN proposal document. Signed-off-by: Jimmy Jin <jjin62@yahoo.com> Co-authored-by: Lu.Mao <lu.mao@molex.com> OFH Admin State Signed-off-by: JaiOCP <jai.kumar@broadcom.com>
1 parent a40cfa9 commit c5780a9

24 files changed

Lines changed: 1648 additions & 14 deletions
690 KB
Loading
548 KB
Loading
660 KB
Loading
837 KB
Loading

doc/OTN/sai_otn_proposal.md

Lines changed: 392 additions & 0 deletions
Large diffs are not rendered by default.

doc/perfmon/SAI-perfmon-Spec.md

Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
# Performance Monitoring SAI Specification
2+
-------------------------------------------------------------------------------
3+
Title | SAI support for Performance Monitoring
4+
:-------------|:-----------------------------------------------------------------
5+
Authors | Jai Kumar, Broadcom Inc
6+
Status | In review
7+
Type | Standards track
8+
Created | 03/18/2026: Initial Draft
9+
SAI-Version | 1.19
10+
-------------------------------------------------------------------------------
11+
12+
13+
## 1.0 Introduction
14+
As network fabric scale increases and data centers require regional spine connectivity, the number of downlinks for cluster connectivity is growing. This leads to more LAGs, more prefixes, and larger ECMP. This is also true for large scale up and scale across fabrics for AI/ML.
15+
16+
This increasing scale mandates that SAI be scalable, reliable, and high-performance. This specification addresses the performance component of SAI by introducing a new set of metrics to accurately measure the performance of various components within the SAI layer and below, such as SDK and hardware updates.
17+
18+
Using these metrics, deployments can isolate components impacting performance and focus on their optimization.
19+
20+
21+
22+
## 2.0 Terms and Acronyms
23+
24+
| Term| Description |
25+
|:---|:---|
26+
| perfmon | Performance Metrics |
27+
28+
## 3.0 Overview
29+
The SAI infrastructure exposes a set of APIs as a standard interface to the upper layer.
30+
31+
These APIs are synchronous and blocking, making the completion time of any given API a critical performance measure. Note that application-specific callbacks are not addressed by this specification.
32+
33+
```
34+
/**
35+
* @brief SAI common API type
36+
*/
37+
typedef enum _sai_common_api_t
38+
{
39+
SAI_COMMON_API_CREATE = 0,
40+
SAI_COMMON_API_REMOVE = 1,
41+
SAI_COMMON_API_SET = 2,
42+
SAI_COMMON_API_GET = 3,
43+
SAI_COMMON_API_BULK_CREATE = 4,
44+
SAI_COMMON_API_BULK_REMOVE = 5,
45+
SAI_COMMON_API_BULK_SET = 6,
46+
SAI_COMMON_API_BULK_GET = 7,
47+
SAI_COMMON_API_MAX = 8,
48+
} sai_common_api_t;
49+
50+
```
51+
52+
This specification proposes API performance measures for the following metrics
53+
1. Average Latency
54+
2. Instantaneous Latency
55+
3. Maximum Latency
56+
57+
### 3.1 Average, Instantaneous, and Maximum Latency
58+
API completion time consists of the time spent in the SAI adapter and the SDK, including hardware update or query time. Time measured is irrespetcive of the status of the API call i.e. if the API call completes with error status, adapter will still account the measured latency during the time interval of the metrics computation. NOS tracks the return status of API calls and can account for errors as needed. Discounting latency for specific error statuses would result in inconsistent measurements, requiring metric subscribers to implement manual workarounds for those cases.
59+
60+
These metrics can be used to:
61+
- Improve SAI adapter and SDK implementations
62+
- Provide a baseline for comparing different hardware
63+
- Instantaneous value: last observed latency for the API call
64+
- Maximum: The highest value observed across the last n invocations
65+
- Average: The average value over the last n invocations.
66+
67+
68+
## 4.0 SAI Specification
69+
New perfmon object is introduced. Each perfmon object specifies the object of interest, set of APIs and metrics to be measured for each API.
70+
71+
72+
Each perfmon object created has a binding to the switch object.
73+
74+
### 4.2 Perfmon Object
75+
New perfmon object is introduced specifying API and metrics of interest.
76+
77+
#### 4.3.1 Metrics
78+
Each API can be measure for a specific performance metrics as specified in sai_perfmon_metrics_t
79+
80+
```
81+
/**
82+
* @brief Performance Monitoring Metrics
83+
*/
84+
typedef enum _sai_perfmon_metrics_t
85+
{
86+
/**
87+
* @brief None
88+
*/
89+
SAI_PERFMON_METRICS_NONE,
90+
91+
/**
92+
* @brief Maximum latency observed
93+
*/
94+
SAI_PERFMON_METRICS_MAX_LATENCY,
95+
96+
/**
97+
* @brief Average latency observed
98+
*/
99+
SAI_PERFMON_METRICS_AVERAGE_LATENCY,
100+
101+
/**
102+
* @brief Instantaneous latency observed
103+
*/
104+
SAI_PERFMON_METRICS_INST_LATENCY,
105+
106+
} sai_perfmon_metrics_t;
107+
108+
```
109+
110+
#### 4.3.2 Perfmon Object Attributes
111+
Type of API to be monitored for performance and its associated attributes are specified in the perfmon object attributes
112+
113+
```
114+
/**
115+
* @brief Performance Monitoring Attributes
116+
*/
117+
typedef enum _sai_perfmon_attr_t
118+
{
119+
/**
120+
* @brief Start of Attributes
121+
*/
122+
SAI_PERFMON_ATTR_START,
123+
124+
/**
125+
* @brief Object to be monitored
126+
*
127+
* @type sai_object_type_t
128+
* @flags MANDATORY_ON_CREATE | CREATE_ONLY
129+
*/
130+
SAI_PERFMON_ATTR_OBJECT_TYPE = SAI_PERFMON_ATTR_START,
131+
132+
/**
133+
* @brief API to be monitored
134+
*
135+
* @type sai_common_api_t
136+
* @flags CREATE_AND_SET
137+
*/
138+
SAI_PERFMON_ATTR_COMMON_API,
139+
140+
/**
141+
* @brief Performance metrics to be collected
142+
*
143+
* @type sai_perfmon_metrics_t
144+
* @flags CREATE_AND_SET
145+
* @default SAI_PERFMON_METRICS_NONE
146+
*/
147+
SAI_PERFMON_ATTR_PERFMON_METRICS,
148+
149+
/**
150+
* @brief Performance data as collected. This is clear on read.
151+
* Performance data is computed once enabled and is cleared once read.
152+
*
153+
* @type sai_uint64_t
154+
* @flags READ_ONLY
155+
*/
156+
SAI_PERFMON_ATTR_PERFDATA,
157+
158+
/**
159+
* @brief End of Performance Monitoring attributes
160+
*/
161+
SAI_PERFMON_ATTR_END,
162+
163+
/** Custom range base value */
164+
SAI_PERFMON_ATTR_CUSTOM_RANGE_START = 0x10000000,
165+
166+
/** End of custom range base */
167+
SAI_PERFMON_ATTR_CUSTOM_RANGE_END
168+
169+
} sai_perfmon_attr_t;
170+
171+
```
172+
173+
#### 4.3.3 Perfmon Object Switch Binding
174+
List of perfmon objects configured can be read using the following switch atribute.
175+
176+
```
177+
/**
178+
* @brief Performance Monitoring enabled on the switch
179+
*
180+
* @type sai_object_list_t
181+
* @flags READ_ONLY
182+
* @objects SAI_OBJECT_TYPE_PERFMON
183+
*/
184+
SAI_SWITCH_ATTR_PERFMON_LIST,
185+
```
186+
187+
188+
## 5.0 Sample Workflow
189+
190+
This section talks about enabling performance monitoring for a given API and a metrics.
191+
192+
### 5.1 Create perfmon object
193+
- Each perfmon object supports a single API and a single set of metrics. To monitor additional metrics for the same API or to monitor a different API, a new perfmon object must be created.
194+
- Monitoring in the SAI adapter will only begin once the perfmon object is bound to the switch object.
195+
196+
```
197+
/*
198+
* Configure Perfmon object for Bulk Set API performance monitoring
199+
*/
200+
201+
// Specify the Object of intererst
202+
sai_attr_list[0].id = SAI_PERFMON_ATTR_OBJECT_TYPE;
203+
sai_attr_list[0].value.s32 = SAI_OBJECT_TYPE_ROUTE_ENTRY;
204+
205+
// Specify the API of interest
206+
sai_attr_list[1].id = SAI_PERFMON_ATTR_COMMON_API;
207+
sai_attr_list[1].value.s32 = SAI_COMMON_API_BULK_SET;
208+
209+
// Configure metrics to be measured
210+
sai_attr_list[2].id = SAI_PERFMON_ATTR_PERFMON_METRICS;
211+
sai_attr_list[2].value.s32 = SAI_PERFMON_METRICS_AVERAGE_LATENCY;
212+
213+
// Create perfmon object
214+
attr_count = 3;
215+
create_perfmon(
216+
&sai_perfmon_object,
217+
switch_id,
218+
attr_count,
219+
sai_attr_list);
220+
```
221+
222+
### 5.2 Read perfmon Metrics
223+
224+
Read the perfmon attribute for getting the API related metrics.
225+
226+
```
227+
// Specify the read attribute
228+
sai_attr_list[1].id = SAI_PERFMON_ATTR_PERFDATA;
229+
230+
// Read perfmon metrics
231+
attr_count = 1;
232+
get_perfmon_attribute(
233+
sai_perfmon_object,
234+
attr_count,
235+
sai_attr_list);
236+
...
237+

0 commit comments

Comments
 (0)