Skip to content

Commit bfaaa0e

Browse files
bingwang-msJaiOCP
andauthored
Tunnel Scoped TC MAP and Remarking (opencomputeproject#1452)
Signed-off-by: bingwang <[email protected]> Co-authored-by: Jai Kumar <[email protected]>
1 parent 1265969 commit bfaaa0e

File tree

3 files changed

+286
-0
lines changed

3 files changed

+286
-0
lines changed

inc/saiswitch.h

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,177 @@ typedef enum _sai_switch_failover_config_mode_t
325325

326326
} sai_switch_failover_config_mode_t;
327327

328+
/**
329+
* @brief Defines tunnel attributes at switch level.
330+
* SAI_OBJECT_TYPE_SWITCH_TUNNEL object provides
331+
* per tunnel type global configuration.
332+
* SAI_OBJECT_TYPE_TUNNEL object configuration
333+
* overrides the switch scoped global configuration.
334+
*/
335+
typedef enum _sai_switch_tunnel_attr_t
336+
{
337+
/**
338+
* @brief Start of attributes
339+
*/
340+
SAI_SWITCH_TUNNEL_ATTR_START,
341+
342+
/**
343+
* @brief Tunnel type key
344+
*
345+
* @type sai_tunnel_type_t
346+
* @flags MANDATORY_ON_CREATE | CREATE_ONLY | KEY
347+
* @isresourcetype true
348+
*/
349+
SAI_SWITCH_TUNNEL_ATTR_TUNNEL_TYPE = SAI_SWITCH_TUNNEL_ATTR_START,
350+
351+
/**
352+
* @brief Packet action when a packet ingress and gets routed back to same tunnel
353+
*
354+
* @type sai_packet_action_t
355+
* @flags CREATE_AND_SET
356+
* @default SAI_PACKET_ACTION_FORWARD
357+
*/
358+
SAI_SWITCH_TUNNEL_ATTR_LOOPBACK_PACKET_ACTION,
359+
360+
/* Tunnel encap attributes */
361+
362+
/**
363+
* @brief Tunnel encap ECN mode
364+
*
365+
* @type sai_tunnel_encap_ecn_mode_t
366+
* @flags CREATE_ONLY
367+
* @default SAI_TUNNEL_ENCAP_ECN_MODE_STANDARD
368+
*/
369+
SAI_SWITCH_TUNNEL_ATTR_TUNNEL_ENCAP_ECN_MODE,
370+
371+
/**
372+
* @brief Tunnel encap ECN mappers only
373+
*
374+
* @type sai_object_list_t
375+
* @flags CREATE_ONLY
376+
* @objects SAI_OBJECT_TYPE_TUNNEL_MAP
377+
* @default empty
378+
*/
379+
SAI_SWITCH_TUNNEL_ATTR_ENCAP_MAPPERS,
380+
381+
/* Tunnel decap attributes */
382+
383+
/**
384+
* @brief Tunnel decap ECN mode
385+
*
386+
* @type sai_tunnel_decap_ecn_mode_t
387+
* @flags CREATE_ONLY
388+
* @default SAI_TUNNEL_DECAP_ECN_MODE_STANDARD
389+
*/
390+
SAI_SWITCH_TUNNEL_ATTR_TUNNEL_DECAP_ECN_MODE,
391+
392+
/**
393+
* @brief Tunnel decap ECN mappers only
394+
*
395+
* @type sai_object_list_t
396+
* @flags CREATE_ONLY
397+
* @objects SAI_OBJECT_TYPE_TUNNEL_MAP
398+
* @default empty
399+
*/
400+
SAI_SWITCH_TUNNEL_ATTR_DECAP_MAPPERS,
401+
402+
/**
403+
* @brief Tunnel VXLAN UDP source port mode
404+
*
405+
* @type sai_tunnel_vxlan_udp_sport_mode_t
406+
* @flags CREATE_AND_SET
407+
* @default SAI_TUNNEL_VXLAN_UDP_SPORT_MODE_EPHEMERAL
408+
*/
409+
SAI_SWITCH_TUNNEL_ATTR_TUNNEL_VXLAN_UDP_SPORT_MODE,
410+
411+
/**
412+
* @brief Tunnel UDP source port
413+
*
414+
* @type sai_uint16_t
415+
* @flags CREATE_AND_SET
416+
* @isvlan false
417+
* @default 0
418+
* @validonly SAI_SWITCH_TUNNEL_ATTR_TUNNEL_TYPE == SAI_TUNNEL_TYPE_VXLAN and SAI_SWITCH_TUNNEL_ATTR_TUNNEL_VXLAN_UDP_SPORT_MODE == SAI_TUNNEL_VXLAN_UDP_SPORT_MODE_USER_DEFINED
419+
*/
420+
SAI_SWITCH_TUNNEL_ATTR_VXLAN_UDP_SPORT,
421+
422+
/**
423+
* @brief Tunnel UDP source port mask
424+
*
425+
* Sport mask defining the number of least significant bits
426+
* reserved for the calculated hash value. 0 means a fixed value.
427+
*
428+
* @type sai_uint8_t
429+
* @flags CREATE_AND_SET
430+
* @isvlan false
431+
* @default 0
432+
* @validonly SAI_SWITCH_TUNNEL_ATTR_TUNNEL_TYPE == SAI_TUNNEL_TYPE_VXLAN and SAI_SWITCH_TUNNEL_ATTR_TUNNEL_VXLAN_UDP_SPORT_MODE == SAI_TUNNEL_VXLAN_UDP_SPORT_MODE_USER_DEFINED
433+
*/
434+
SAI_SWITCH_TUNNEL_ATTR_VXLAN_UDP_SPORT_MASK,
435+
436+
/**
437+
* @brief Enable TC AND COLOR -> DSCP MAP on tunnel at encapsulation (access-to-network) node to remark the DSCP in tunnel header
438+
*
439+
* @type sai_object_id_t
440+
* @flags CREATE_AND_SET
441+
* @objects SAI_OBJECT_TYPE_QOS_MAP
442+
* @allownull true
443+
* @default SAI_NULL_OBJECT_ID
444+
*/
445+
SAI_SWITCH_TUNNEL_ATTR_ENCAP_QOS_TC_AND_COLOR_TO_DSCP_MAP,
446+
447+
/**
448+
* @brief Enable TC -> Queue MAP on tunnel encap
449+
*
450+
* Map id = #SAI_NULL_OBJECT_ID to disable map on tunnel.
451+
* Default no map, i.e. packets are queued with static mapping.
452+
*
453+
* @type sai_object_id_t
454+
* @flags CREATE_AND_SET
455+
* @objects SAI_OBJECT_TYPE_QOS_MAP
456+
* @allownull true
457+
* @default SAI_NULL_OBJECT_ID
458+
*/
459+
SAI_SWITCH_TUNNEL_ATTR_ENCAP_QOS_TC_TO_QUEUE_MAP,
460+
461+
/**
462+
* @brief Enable DSCP -> TC MAP on tunnel at termination (Network-to-access) node.
463+
*
464+
* @type sai_object_id_t
465+
* @flags CREATE_AND_SET
466+
* @objects SAI_OBJECT_TYPE_QOS_MAP
467+
* @allownull true
468+
* @default SAI_NULL_OBJECT_ID
469+
*/
470+
SAI_SWITCH_TUNNEL_ATTR_DECAP_QOS_DSCP_TO_TC_MAP,
471+
472+
/**
473+
* @brief Enable TC -> Priority Group MAP
474+
*
475+
* Map id = #SAI_NULL_OBJECT_ID to disable map on port.
476+
* Default no map
477+
*
478+
* @type sai_object_id_t
479+
* @flags CREATE_AND_SET
480+
* @objects SAI_OBJECT_TYPE_QOS_MAP
481+
* @allownull true
482+
* @default SAI_NULL_OBJECT_ID
483+
*/
484+
SAI_SWITCH_TUNNEL_ATTR_DECAP_QOS_TC_TO_PRIORITY_GROUP_MAP,
485+
486+
/**
487+
* @brief End of attributes
488+
*/
489+
SAI_SWITCH_TUNNEL_ATTR_END,
490+
491+
/** Custom range base value */
492+
SAI_SWITCH_TUNNEL_ATTR_CUSTOM_RANGE_START = 0x10000000,
493+
494+
/** End of custom range base */
495+
SAI_SWITCH_TUNNEL_ATTR_CUSTOM_RANGE_END
496+
497+
} sai_switch_tunnel_attr_t;
498+
328499
/**
329500
* @brief Attribute Id in sai_set_switch_attribute() and
330501
* sai_get_switch_attribute() calls

inc/saitunnel.h

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,118 @@ typedef enum _sai_tunnel_attr_t
652652
*/
653653
SAI_TUNNEL_ATTR_LOOPBACK_PACKET_ACTION,
654654

655+
/**
656+
* @brief Tunnel VXLAN UDP source port mode
657+
*
658+
* @type sai_tunnel_vxlan_udp_sport_mode_t
659+
* @flags CREATE_AND_SET
660+
* @default SAI_TUNNEL_VXLAN_UDP_SPORT_MODE_EPHEMERAL
661+
*/
662+
SAI_TUNNEL_ATTR_VXLAN_UDP_SPORT_MODE,
663+
664+
/**
665+
* @brief Tunnel UDP source port
666+
*
667+
* @type sai_uint16_t
668+
* @flags CREATE_AND_SET
669+
* @isvlan false
670+
* @default 0
671+
* @validonly SAI_TUNNEL_ATTR_TYPE == SAI_TUNNEL_TYPE_VXLAN and SAI_TUNNEL_ATTR_VXLAN_UDP_SPORT_MODE == SAI_TUNNEL_VXLAN_UDP_SPORT_MODE_USER_DEFINED
672+
*/
673+
SAI_TUNNEL_ATTR_VXLAN_UDP_SPORT,
674+
675+
/**
676+
* @brief Tunnel UDP source port mask
677+
*
678+
* Sport mask defining the number of least significant bits
679+
* reserved for the calculated hash value. 0 means a fixed value.
680+
*
681+
* @type sai_uint8_t
682+
* @flags CREATE_AND_SET
683+
* @isvlan false
684+
* @default 0
685+
* @validonly SAI_TUNNEL_ATTR_TYPE == SAI_TUNNEL_TYPE_VXLAN and SAI_TUNNEL_ATTR_VXLAN_UDP_SPORT_MODE == SAI_TUNNEL_VXLAN_UDP_SPORT_MODE_USER_DEFINED
686+
*/
687+
SAI_TUNNEL_ATTR_VXLAN_UDP_SPORT_MASK,
688+
689+
/**
690+
* @brief IPsec encryption SA index
691+
*
692+
* Index to bind an egress IPsec SA to a tunnel.
693+
*
694+
* @type sai_uint32_t
695+
* @flags CREATE_AND_SET
696+
* @default 0
697+
* @validonly SAI_TUNNEL_ATTR_TYPE == SAI_TUNNEL_TYPE_IPINIP_ESP or SAI_TUNNEL_ATTR_TYPE == SAI_TUNNEL_TYPE_IPINIP_UDP_ESP or SAI_TUNNEL_ATTR_TYPE == SAI_TUNNEL_TYPE_VXLAN_UDP_ESP
698+
*/
699+
SAI_TUNNEL_ATTR_SA_INDEX,
700+
701+
/**
702+
* @brief List of ports that are programmed with SAs for this IPsec tunnel.
703+
* Useful only when IPsec is implemented in a PHY Chip (different sai_switch
704+
* object).
705+
*
706+
* For IPsec hardware in the Switch ASIC, the per-tunnel port list can be
707+
* derived from the union of SAI_IPSEC_SA_ATTR_IPSEC_PORT_LIST for all
708+
* sai_ipsec_sa objects for that tunnel.
709+
*
710+
* @type sai_object_list_t
711+
* @flags CREATE_AND_SET
712+
* @objects SAI_OBJECT_TYPE_PORT
713+
* @default empty
714+
*/
715+
SAI_TUNNEL_ATTR_IPSEC_SA_PORT_LIST,
716+
717+
/**
718+
* @brief Enable TC AND COLOR -> DSCP MAP on tunnel at encapsulation (access-to-network) node to remark the DSCP in tunnel header
719+
*
720+
* @type sai_object_id_t
721+
* @flags CREATE_AND_SET
722+
* @objects SAI_OBJECT_TYPE_QOS_MAP
723+
* @allownull true
724+
* @default SAI_NULL_OBJECT_ID
725+
*/
726+
SAI_TUNNEL_ATTR_ENCAP_QOS_TC_AND_COLOR_TO_DSCP_MAP,
727+
728+
/**
729+
* @brief Enable TC -> Queue MAP on tunnel encap
730+
*
731+
* Map id = #SAI_NULL_OBJECT_ID to disable map on tunnel.
732+
* Default no map, i.e. packets are queued with static mapping.
733+
*
734+
* @type sai_object_id_t
735+
* @flags CREATE_AND_SET
736+
* @objects SAI_OBJECT_TYPE_QOS_MAP
737+
* @allownull true
738+
* @default SAI_NULL_OBJECT_ID
739+
*/
740+
SAI_TUNNEL_ATTR_ENCAP_QOS_TC_TO_QUEUE_MAP,
741+
742+
/**
743+
* @brief Enable DSCP -> TC MAP on tunnel at termination (Network-to-access) node. This map if configured overrides the port MAP
744+
*
745+
* @type sai_object_id_t
746+
* @flags CREATE_AND_SET
747+
* @objects SAI_OBJECT_TYPE_QOS_MAP
748+
* @allownull true
749+
* @default SAI_NULL_OBJECT_ID
750+
*/
751+
SAI_TUNNEL_ATTR_DECAP_QOS_DSCP_TO_TC_MAP,
752+
753+
/**
754+
* @brief Enable TC -> Priority Group MAP. TC is derived from the tunnel MAP
755+
*
756+
* Map id = #SAI_NULL_OBJECT_ID to disable map on port.
757+
* Default no map
758+
*
759+
* @type sai_object_id_t
760+
* @flags CREATE_AND_SET
761+
* @objects SAI_OBJECT_TYPE_QOS_MAP
762+
* @allownull true
763+
* @default SAI_NULL_OBJECT_ID
764+
*/
765+
SAI_TUNNEL_ATTR_DECAP_QOS_TC_TO_PRIORITY_GROUP_MAP,
766+
655767
/**
656768
* @brief End of attributes
657769
*/
@@ -1037,6 +1149,8 @@ typedef struct _sai_tunnel_api_t
10371149
sai_remove_tunnel_map_entry_fn remove_tunnel_map_entry;
10381150
sai_set_tunnel_map_entry_attribute_fn set_tunnel_map_entry_attribute;
10391151
sai_get_tunnel_map_entry_attribute_fn get_tunnel_map_entry_attribute;
1152+
sai_bulk_object_get_attribute_fn get_tunnels_attribute;
1153+
sai_bulk_object_set_attribute_fn set_tunnels_attribute;
10401154

10411155
} sai_tunnel_api_t;
10421156

inc/saitypes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,7 @@ typedef struct _sai_acl_capability_t
723723
* @passparam &sai_metadata_enum_sai_acl_action_type_t
724724
*/
725725
sai_s32_list_t action_list;
726+
726727
} sai_acl_capability_t;
727728

728729
/**

0 commit comments

Comments
 (0)