Skip to content

Commit e647ad0

Browse files
SAI proposal for Per-Traffic-Class Enhancements: Flood Control and TAM Bind Point Support
-New TC object introduced. -Flood control for broadcast, unknown unicast, multicast packets per traffic class. -TAM bind point support per traffic class. Signed-off-by: praneeth-marvell <pchippada@marvell.com>
1 parent 4b4347b commit e647ad0

File tree

7 files changed

+616
-0
lines changed

7 files changed

+616
-0
lines changed
Lines changed: 281 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,281 @@
1+
# [SAI] Per-Traffic-Class Enhancements
2+
-------------------------------------------------------------------------------
3+
Title | Per-Traffic-Class Enhancements: BUM Flood Control and TAM Bind Point Support.
4+
-------------|-----------------------------------------------------------------
5+
Authors | Praneeth Chippada, Ravindranath C K (Marvell)
6+
Status | In review
7+
Type | Standards track
8+
Created | 2025-11-22
9+
SAI-Version | 1.18
10+
-------------------------------------------------------------------------------
11+
12+
## 1.0 Introduction
13+
14+
15+
The HLD describes the design and implementation of Broadcast, Unknown Unicast, and Multicast (BUM) flood control per traffic class (TC) in SAI. The goal is to provide the ability to control flooding behavior for BUM traffic based on individual traffic classes. This feature helps optimize network resource usage and improve QoS for critical traffic.
16+
17+
Similarly, the new TC object allows binding TAM objects on a per TC granularity across the switch. TAM object bind point per TC object provides flexibitlity to user to attach telemetry to a traffic class.
18+
19+
## 2.0 Abbreviations and Information
20+
21+
| **Term** | **Definition** |
22+
| ------------ | -------------------------------------------- |
23+
| TC | Traffic Class |
24+
| BUM | Broadcast, Unknown Unicast, Multicast |
25+
26+
27+
## 3.0 Behavior
28+
29+
### 3.1 BUM Flood Control per TC
30+
#### Existing Behavior
31+
1) BUM traffic is either allowed or dropped per-VLAN basis. BUM traffic can also be rate-limited on a per-port basis
32+
2) No granularity exists for controlling BUM traffic based on TC and all TCs are treated the same for BUM flooding control.
33+
34+
#### New Behavior
35+
1) Flood control settings are introduced per TC level for BUM traffic.
36+
2) The hostif trap is used to derive the packet action for BUM flooded packets on TCs with flood control enabled. Hostif trap counter can also be used to count the packets hitting the hostif trap.
37+
38+
### 3.2 TAM Object Bind per TC
39+
#### Existing Behavior
40+
1) TAM already supports multiple bind points (Ports, queues, buffers etc.).
41+
2) No provision exists to bind TAM object on a per-TC granularity.
42+
43+
#### New Behavior
44+
1) TAM object bind on a per-TC granularity across switch is added.
45+
46+
47+
## 4.0 SAI Enhancement
48+
49+
### Hostif trap type for BUM flood control per TC
50+
A new hostif trap type is defined to apply the trap action to the flooded packets on the TCs which have flood control enabled.
51+
```c
52+
/**
53+
* @brief Host interface trap type
54+
*
55+
* @flags ranges
56+
*/
57+
typedef enum _sai_hostif_trap_type_t
58+
{
59+
...
60+
/**
61+
* @brief Hostif trap to define flood control on broadcast,
62+
* unknown unicast and multicast packets per traffic class
63+
*
64+
* This applies to packets whose TC object has
65+
* SAI_TC_ATTR_FLOOD_CONTROL_ENABLE as true.
66+
*
67+
* (default packet action is drop)
68+
*/
69+
SAI_HOSTIF_TRAP_TYPE_TC_FLOOD_CONTROL,
70+
...
71+
} sai_hostif_trap_type_t;
72+
```
73+
### TC object attributes
74+
New attributes are added in TC object for enabling flood control feature per traffic class and adding TAM object bind per traffic class.
75+
```c
76+
/**
77+
* @brief Enum defining TC attributes
78+
*/
79+
typedef enum _sai_tc_attr_t
80+
{
81+
...
82+
83+
/**
84+
* @brief Flood Control Enable
85+
* Enable flood control on traffic class for broadcast,
86+
* unknown unicast and multicast traffic
87+
*
88+
* Use SAI_HOSTIF_TRAP_TYPE_TC_FLOOD_CONTROL trap type
89+
* to apply flood control on the TC
90+
*
91+
* @type bool
92+
* @flags CREATE_AND_SET
93+
* @default false
94+
*/
95+
SAI_TC_ATTR_FLOOD_CONTROL_ENABLE,
96+
/**
97+
* @brief TC Bind point for TAM object
98+
*
99+
* @type sai_object_list_t
100+
* @flags CREATE_AND_SET
101+
* @objects SAI_OBJECT_TYPE_TAM
102+
* @default empty
103+
*/
104+
SAI_TC_ATTR_TAM_OBJECT,
105+
106+
...
107+
} sai_tc_attr_t;
108+
```
109+
110+
## 5.0 API Example
111+
1. Create a HostIf Trap with drop action.
112+
2. Enable flood control on TC id 4.
113+
3. Get Flood dropped packet count
114+
4. Disable flood control on TC id 4.
115+
5. Bind TAM objects to the TC object.
116+
117+
### 5.1 Create a HostIf Trap with drop action.
118+
```c
119+
/* Create HostIf Trap with drop action for BUM packets */
120+
attr_count = 0;
121+
sai_attr_list[attr_count].id = SAI_HOSTIF_TRAP_ATTR_TRAP_GROUP;
122+
sai_attr_list[attr_count++].value.oid = test_trap_group;
123+
sai_attr_list[attr_count].id = SAI_HOSTIF_TRAP_ATTR_PACKET_ACTION;
124+
sai_attr_list[attr_count++].value.s32 = SAI_PACKET_ACTION_DROP;
125+
sai_attr_list[attr_count].id = SAI_HOSTIF_TRAP_ATTR_COUNTER_ID;
126+
sai_attr_list[attr_count++].value.u32 = counter_id;
127+
sai_attr_list[attr_count].id = SAI_HOSTIF_TRAP_ATTR_TRAP_TYPE;
128+
sai_attr_list[attr_count++].value.s32 = SAI_HOSTIF_TRAP_TYPE_TC_FLOOD_CONTROL;
129+
sai_create_hostif_trap_fn(
130+
&trap_oid,
131+
switch_id,
132+
attr_count,
133+
sai_attr_list);
134+
```
135+
136+
### 5.2 Enable flood control on TC id 4
137+
138+
139+
```c
140+
/* Create TC object with index 4 and enable flood control */
141+
attr_count = 0;
142+
sai_attr_list[attr_count].id = SAI_TC_ATTR_INDEX;
143+
sai_attr_list[attr_count++].value.u32 = 4;
144+
sai_attr_list[attr_count].id = SAI_TC_ATTR_FLOOD_CONTROL_ENABLE;
145+
sai_attr_list[attr_count++].value.booldata = true;
146+
147+
sai_create_tc_fn(
148+
&tc_oid,
149+
switch_id,
150+
attr_count,
151+
sai_attr_list);
152+
```
153+
### 5.3 Get Flood-Dropped Packet Count
154+
```c
155+
/* Read the HostIf Trap counter for flood-dropped packets */
156+
counter_attr.id = SAI_COUNTER_ATTR_PACKETS;
157+
sai_get_counter_attribute_fn(
158+
counter_id,
159+
1,
160+
&counter_attr);
161+
printf("Flood dropped packets = %" PRIu64 "\n",
162+
counter_attr.value.u64);
163+
```
164+
165+
### 5.4 Disable Flood Control on TC ID 4
166+
167+
```c
168+
/* Disable flood control on TC ID 4 */
169+
attr_count = 0;
170+
sai_attr_list[attr_count].id = SAI_TC_ATTR_FLOOD_CONTROL_ENABLE;
171+
sai_attr_list[attr_count++].value.booldata = false;
172+
173+
sai_set_tc_attribute_fn(
174+
tc_oid,
175+
sai_attr_list);
176+
177+
```
178+
### 5.5 Bind TAM Objects to the TC Object
179+
Below API example shows the creation of TAM objects and their binding it on TC object to capture Queue Tail dropped packets to remote collector.
180+
```c
181+
/* Create a Transport Object */
182+
count = 0;
183+
sai_attr_list[count].id = SAI_TAM_TRANSPORT_ATTR_TRANSPORT_TYPE;
184+
sai_attr_list[count].value.s32 = SAI_TAM_TRANSPORT_TYPE_GRE;
185+
count++;
186+
sai_create_tam_transport_fn(
187+
&tam_transport_id,
188+
switch_id,
189+
count,
190+
sai_attr_list);
191+
/* Create a TAM Collector Object */
192+
count = 0;
193+
memset(attr_list, 0, sizeof(attr_list));
194+
sai_attr_list[count].id = SAI_TAM_COLLECTOR_ATTR_TRANSPORT;
195+
sai_attr_list[count].value.oid = tam_transport_id;
196+
count++;
197+
sai_attr_list[count].id = SAI_TAM_COLLECTOR_ATTR_SRC_IP;
198+
sai_attr_list[count].value.ipaddr.addr_family = SAI_IP_ADDR_FAMILY_IPV4;
199+
sai_attr_list[count].value.ipaddr.addr.ip4 = 0x0101010a;
200+
count++;
201+
sai_attr_list[count].id = SAI_TAM_COLLECTOR_ATTR_DST_IP;
202+
sai_attr_list[count].value.ipaddr.addr_family = SAI_IP_ADDR_FAMILY_IPV4;
203+
sai_attr_list[count].value.ipaddr.addr.ip4 = 0x0101010b;
204+
count++;
205+
sai_attr_list[count].id = SAI_TAM_COLLECTOR_ATTR_DESTINATION;
206+
sai_attr_list[count].value.oid = port2_oid;
207+
count++;
208+
sai_attr_list[count].id = SAI_TAM_COLLECTOR_ATTR_DSCP_VALUE;
209+
sai_attr_list[count].value.u8 = 8;
210+
count++;
211+
sai_create_tam_collector(
212+
&tam_collector_id,
213+
switch_id,
214+
count,
215+
sai_attr_list);
216+
/* Create a TAM Report Object */
217+
count = 0;
218+
sai_attr_list[count].id = SAI_TAM_REPORT_ATTR_TYPE;
219+
sai_attr_list[count].value.s32 = SAI_TAM_REPORT_TYPE_VENDOR_EXTN;
220+
count++;
221+
sai_attr_list[count].id = SAI_TAM_REPORT_ATTR_REPORT_MODE;
222+
sai_attr_list[count].value.s32 = SAI_TAM_REPORT_MODE_ALL;
223+
count++;
224+
sai_create_tam_report_fn(
225+
&tam_report_id,
226+
switch_id,
227+
count,
228+
sai_attr_list);
229+
/* Create a TAM Event Action Object */
230+
count = 0;
231+
sai_attr_list[count].id = SAI_TAM_EVENT_ACTION_ATTR_REPORT_TYPE;
232+
sai_attr_list[count].value.oid = tam_report_id;
233+
count++;
234+
sai_create_tam_event_action_fn(
235+
&tam_event_action_id,
236+
switch_id,
237+
count,
238+
sai_attr_list);
239+
/* Create a TAM Event Object */
240+
count = 0;
241+
sai_attr_list[count].id = SAI_TAM_EVENT_ATTR_TYPE;
242+
sai_attr_list[count].value.s32 = SAI_TAM_EVENT_TYPE_QUEUE_TAIL_DROP;
243+
count++;
244+
sai_attr_list[count].id = SAI_TAM_EVENT_ATTR_ACTION_LIST;
245+
sai_attr_list[count].value.objlist.count = 1;
246+
sai_attr_list[count].value.objlist.list[0] = tam_event_action_id;
247+
count++;
248+
sai_attr_list[count].id = SAI_TAM_EVENT_ATTR_COLLECTOR_LIST;
249+
sai_attr_list[count].value.objlist.count = 1;
250+
sai_attr_list[count].value.objlist.list[0] = tam_collector_id;
251+
count++;
252+
sai_create_tam_event_fn(
253+
&tam_event_id,
254+
switch_id,
255+
count,
256+
sai_attr_list);
257+
/* Create a TAM Object */
258+
count = 0;
259+
attr_list[count].id = SAI_TAM_ATTR_EVENT_OBJECTS_LIST;
260+
attr_list[count].value.objlist.count = 1;
261+
attr_list[count].value.objlist.list[0] = tam_event_id;
262+
count++;
263+
attr_list[count].id = SAI_TAM_ATTR_TAM_BIND_POINT_TYPE_LIST;
264+
attr_list[count].value.objlist.count = 1;
265+
attr_list[count].value.objlist.list[0] = SAI_TAM_BIND_POINT_TYPE_TC;
266+
count++;
267+
sai_create_tam_fn(
268+
&tam_oid,
269+
switch_id,
270+
count,
271+
attr_list);
272+
/* Bind TAM object to the TC object */
273+
attr_count = 0;
274+
sai_attr_list[attr_count].id = SAI_TC_ATTR_TAM_OBJECT;
275+
sai_attr_list[attr_count].value.objlist.count = 1;
276+
sai_attr_list[attr_count].value.objlist.list[0] = tam_oid;
277+
attr_count++;
278+
sai_set_tc_attribute_fn(
279+
tc_oid,
280+
sai_attr_list);
281+
```

0 commit comments

Comments
 (0)