Skip to content

Commit ed8bc68

Browse files
Manually override HW switchover for planned operation (#2219)
Signed-off-by: Chikkegowda Chikkaiah <[email protected]>
1 parent 19f3224 commit ed8bc68

File tree

2 files changed

+119
-1
lines changed

2 files changed

+119
-1
lines changed

doc/SAI-Proposal-FRR.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,22 @@ typedef enum _sai_next_hop_group_type_t
230230
231231
} sai_next_hop_group_type_t;
232232
233+
+/**
234+
+ * @brief Next hop group admin role to manually control switching between primary and backup, overriding hardware switchover
235+
+ */
236+
+typedef enum _sai_next_hop_group_admin_role_t
237+
+{
238+
+ /** Auto mode - hardware controlled switching (default) */
239+
+ SAI_NEXT_HOP_GROUP_ADMIN_ROLE_AUTO,
240+
+
241+
+ /** Force primary role - manual override to primary */
242+
+ SAI_NEXT_HOP_GROUP_ADMIN_ROLE_PRIMARY,
243+
+
244+
+ /** Force backup role - manual override to standby */
245+
+ SAI_NEXT_HOP_GROUP_ADMIN_ROLE_STANDBY,
246+
+
247+
+} sai_next_hop_group_admin_role_t;
248+
233249
/**
234250
* @brief Attribute id for next hop
235251
*/
@@ -273,6 +289,20 @@ typedef enum _sai_next_hop_group_attr_t
273289
+ * @validonly SAI_NEXT_HOP_GROUP_ATTR_TYPE == SAI_NEXT_HOP_GROUP_TYPE_PROTECTION
274290
+ */
275291
+ SAI_NEXT_HOP_GROUP_ATTR_SET_SWITCHOVER,
292+
+
293+
+ /**
294+
+ * @brief Admin role to manually control switching between primary and backup
295+
+ *
296+
+ * This attribute allows manual switching between primary and standby roles,
297+
+ * overriding hardware-controlled switching when not set to auto mode.
298+
+ * Enables planned operations without any traffic loss.
299+
+ *
300+
+ * @type sai_next_hop_group_admin_role_t
301+
+ * @flags CREATE_AND_SET
302+
+ * @default SAI_NEXT_HOP_GROUP_ADMIN_ROLE_AUTO
303+
+ * @validonly SAI_NEXT_HOP_GROUP_ATTR_TYPE == SAI_NEXT_HOP_GROUP_TYPE_HW_PROTECTION
304+
+ */
305+
+ SAI_NEXT_HOP_GROUP_ATTR_ADMIN_ROLE,
276306
277307
/**
278308
* @brief End of attributes
@@ -560,6 +590,64 @@ for (attr_id = 0; attr_id < attr_count; attr_id++) {
560590
561591
```
562592

593+
## Manual Admin Role Control
594+
595+
### Force primary role
596+
```
597+
// Force the next hop group to use primary path regardless of hardware state
598+
nhg_entry_attrs[1].id = SAI_NEXT_HOP_GROUP_ATTR_ADMIN_ROLE;
599+
nhg_entry_attrs[1].value.u32 = SAI_NEXT_HOP_GROUP_ADMIN_ROLE_PRIMARY;
600+
saistatus = sai_set_next_hop_group_attribute_fn(nhg_id, nhg_entry_attrs);
601+
if (saistatus != SAI_STATUS_SUCCESS) {
602+
return saistatus;
603+
}
604+
605+
```
606+
607+
### Force standby role
608+
```
609+
// Force the next hop group to use backup path regardless of hardware state
610+
nhg_entry_attrs[1].id = SAI_NEXT_HOP_GROUP_ATTR_ADMIN_ROLE;
611+
nhg_entry_attrs[1].value.u32 = SAI_NEXT_HOP_GROUP_ADMIN_ROLE_STANDBY;
612+
saistatus = sai_set_next_hop_group_attribute_fn(nhg_id, nhg_entry_attrs);
613+
if (saistatus != SAI_STATUS_SUCCESS) {
614+
return saistatus;
615+
}
616+
617+
```
618+
619+
### Reset to auto mode
620+
```
621+
// Return control back to hardware-based switching
622+
nhg_entry_attrs[1].id = SAI_NEXT_HOP_GROUP_ATTR_ADMIN_ROLE;
623+
nhg_entry_attrs[1].value.u32 = SAI_NEXT_HOP_GROUP_ADMIN_ROLE_AUTO;
624+
saistatus = sai_set_next_hop_group_attribute_fn(nhg_id, nhg_entry_attrs);
625+
if (saistatus != SAI_STATUS_SUCCESS) {
626+
return saistatus;
627+
}
628+
629+
```
630+
631+
### Query current admin role
632+
```
633+
// Get the current admin role setting
634+
nhg_entry_attrs[0].id = SAI_NEXT_HOP_GROUP_ATTR_ADMIN_ROLE;
635+
saistatus = sai_get_next_hop_group_attribute_fn(nhg_id, 1, nhg_entry_attrs);
636+
if (saistatus != SAI_STATUS_SUCCESS) {
637+
return saistatus;
638+
}
639+
640+
// Check the current admin role
641+
if (nhg_entry_attrs[0].value.u32 == SAI_NEXT_HOP_GROUP_ADMIN_ROLE_AUTO) {
642+
// Hardware-controlled switching is active
643+
} else if (nhg_entry_attrs[0].value.u32 == SAI_NEXT_HOP_GROUP_ADMIN_ROLE_PRIMARY) {
644+
// Forced to use primary path
645+
} else if (nhg_entry_attrs[0].value.u32 == SAI_NEXT_HOP_GROUP_ADMIN_ROLE_STANDBY) {
646+
// Forced to use backup path
647+
}
648+
649+
```
650+
563651
# Pipeline
564652

565653
TBD

inc/sainexthopgroup.h

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,22 @@ typedef enum _sai_next_hop_group_member_observed_role_t
9595

9696
} sai_next_hop_group_member_observed_role_t;
9797

98+
/**
99+
* @brief Next hop group admin role to manually switch between primary and standby, overriding hardware switchover
100+
*/
101+
typedef enum _sai_next_hop_group_admin_role_t
102+
{
103+
/** Auto mode - hardware controlled switching (default) */
104+
SAI_NEXT_HOP_GROUP_ADMIN_ROLE_AUTO,
105+
106+
/** Force primary role - manual override to primary */
107+
SAI_NEXT_HOP_GROUP_ADMIN_ROLE_PRIMARY,
108+
109+
/** Force standby role - manual override to standby */
110+
SAI_NEXT_HOP_GROUP_ADMIN_ROLE_STANDBY,
111+
112+
} sai_next_hop_group_admin_role_t;
113+
98114
/**
99115
* @brief Attribute id for next hop
100116
*/
@@ -299,6 +315,20 @@ typedef enum _sai_next_hop_group_attr_t
299315
*/
300316
SAI_NEXT_HOP_GROUP_ATTR_LABEL,
301317

318+
/**
319+
* @brief Admin role to manually control switching between primary and standby
320+
*
321+
* This attribute allows manual switching between primary and standby roles,
322+
* overriding hardware-controlled switching.
323+
* Enables planned operations without any traffic loss.
324+
*
325+
* @type sai_next_hop_group_admin_role_t
326+
* @flags CREATE_AND_SET
327+
* @default SAI_NEXT_HOP_GROUP_ADMIN_ROLE_AUTO
328+
* @validonly SAI_NEXT_HOP_GROUP_ATTR_TYPE == SAI_NEXT_HOP_GROUP_TYPE_HW_PROTECTION
329+
*/
330+
SAI_NEXT_HOP_GROUP_ATTR_ADMIN_ROLE,
331+
302332
/**
303333
* @brief End of attributes
304334
*/
@@ -363,7 +393,7 @@ typedef enum _sai_next_hop_group_member_attr_t
363393
/**
364394
* @brief The actual role in protection group
365395
*
366-
* Should only be used if the type of owning group is SAI_NEXT_HOP_GROUP_TYPE_PROTECTION
396+
* Should only be used if the type of owning group is SAI_NEXT_HOP_GROUP_TYPE_PROTECTION or SAI_NEXT_HOP_GROUP_TYPE_HW_PROTECTION
367397
*
368398
* @type sai_next_hop_group_member_observed_role_t
369399
* @flags READ_ONLY

0 commit comments

Comments
 (0)