Skip to content

Commit cabcc44

Browse files
committed
SAI support for Credit Based Flow Control as defined in UEC 1.0.
Signed-off-by: rck-innovium <rck@marvell.com>
1 parent a189d93 commit cabcc44

16 files changed

Lines changed: 1521 additions & 3 deletions

doc/CBFC/SAI-Credit_Based_Flow_Control.md

Lines changed: 736 additions & 0 deletions
Large diffs are not rendered by default.
720 KB
Loading

doc/CBFC/images/CBFC_operation.png

488 KB
Loading
127 KB
Loading
407 KB
Loading
652 KB
Loading
Binary file not shown.

inc/sai.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
#include "saipoe.h"
8383
#include "saiicmpecho.h"
8484
#include "saisynce.h"
85+
#include "saivirtualchannel.h"
8586

8687
/**
8788
* @defgroup SAI SAI - Entry point specific API definitions.
@@ -153,6 +154,7 @@ typedef enum _sai_api_t
153154
SAI_API_ICMP_ECHO = 52, /**< sai_icmp_echo_api_t */
154155
SAI_API_PREFIX_COMPRESSION = 53, /**< sai_prefix_compression_api_t */
155156
SAI_API_SYNCE = 54, /**< sai_synce_api_t */
157+
SAI_API_VIRTUAL_CHANNEL = 55, /**< sai_virtual_channel_api_t */
156158
SAI_API_MAX, /**< total number of APIs */
157159

158160
/**

inc/saiport.h

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2965,6 +2965,203 @@ typedef enum _sai_port_attr_t
29652965
*/
29662966
SAI_PORT_ATTR_PTP_PEER_MEAN_PATH_DELAY,
29672967

2968+
/**
2969+
* @brief Get CBFC Native Credit Size in bytes.
2970+
*
2971+
* Receiver's input buffer is typically divided into cells, and the native credit size is this cell size (in bytes).
2972+
*
2973+
* @type sai_uint16_t
2974+
* @flags READ_ONLY
2975+
* @isvlan false
2976+
*/
2977+
SAI_PORT_ATTR_CBFC_RECEIVER_NATIVE_CREDIT_SIZE,
2978+
2979+
/**
2980+
* @brief Get CBFC Receiver Native Packet Overhead in bytes.
2981+
*
2982+
* @type sai_int16_t
2983+
* @flags READ_ONLY
2984+
*/
2985+
SAI_PORT_ATTR_CBFC_RECEIVER_NATIVE_PACKET_OVERHEAD,
2986+
2987+
/**
2988+
* @brief Get CBFC Receiver Total Port Credits in Credits.
2989+
*
2990+
* If value is 0, receiver sets per-VC credit limits.
2991+
*
2992+
* @type sai_uint16_t
2993+
* @flags READ_ONLY
2994+
* @isvlan false
2995+
*/
2996+
SAI_PORT_ATTR_CBFC_RECEIVER_NATIVE_TOTAL_CREDITS,
2997+
2998+
/**
2999+
* @brief Configure CBFC Receiver Credit Size in bytes.
3000+
*
3001+
* If value is 0, CBFC_RECEIVER_NATIVE_CREDIT_SIZE will be used.
3002+
*
3003+
* @type sai_uint16_t
3004+
* @flags CREATE_AND_SET
3005+
* @isvlan false
3006+
* @default 0
3007+
*/
3008+
SAI_PORT_ATTR_CBFC_RECEIVER_CREDIT_SIZE,
3009+
3010+
/**
3011+
* @brief Configure CBFC Receiver Packet Overhead in bytes.
3012+
*
3013+
* Range: -16 to 127
3014+
* If value is 128, SAI_PORT_ATTR_CBFC_RECEIVER_NATIVE_PACKET_OVERHEAD will be used
3015+
*
3016+
* @type sai_int16_t
3017+
* @flags CREATE_AND_SET
3018+
* @default 128
3019+
*/
3020+
SAI_PORT_ATTR_CBFC_RECEIVER_PACKET_OVERHEAD,
3021+
3022+
/**
3023+
* @brief Get CBFC supported Credit Size in bytes.
3024+
*
3025+
* @type sai_u16_list_t
3026+
* @flags READ_ONLY
3027+
*/
3028+
SAI_PORT_ATTR_CBFC_SENDER_SUPPORTED_CREDIT_SIZE,
3029+
3030+
/**
3031+
* @brief Configure CBFC Sender Credit Size in bytes.
3032+
*
3033+
* To maximize utilization of the receiver's input buffer, set to largest value in CBFC_SENDER_SUPPORTED_CREDIT_SIZE that does not exceed CBFC_RECEIVER_NATIVE_CREDIT_SIZE.
3034+
*
3035+
* @type sai_uint16_t
3036+
* @flags CREATE_AND_SET
3037+
* @isvlan false
3038+
* @default 128
3039+
*/
3040+
SAI_PORT_ATTR_CBFC_SENDER_CREDIT_SIZE,
3041+
3042+
/**
3043+
* @brief Configure CBFC Sender Packet Overhead in bytes.
3044+
*
3045+
* Range: -16 to 127.
3046+
*
3047+
* @type sai_int16_t
3048+
* @flags CREATE_AND_SET
3049+
* @default 0
3050+
*/
3051+
SAI_PORT_ATTR_CBFC_SENDER_PACKET_OVERHEAD,
3052+
3053+
/**
3054+
* @brief Configure CBFC Sender Port Credit Limit.
3055+
*
3056+
* Range; 0 to (2^20 - 1).
3057+
*
3058+
* @type sai_uint32_t
3059+
* @flags CREATE_AND_SET
3060+
* @default 0
3061+
*/
3062+
SAI_PORT_ATTR_CBFC_SENDER_CREDIT_LIMIT,
3063+
3064+
/**
3065+
* @brief Configure CBFC CC_Update message timer in microseconds.
3066+
*
3067+
* Range: 1us to 250000us.
3068+
*
3069+
* @type sai_uint32_t
3070+
* @flags CREATE_AND_SET
3071+
* @default 256
3072+
*/
3073+
SAI_PORT_ATTR_CBFC_CC_MESSAGE_TIMER,
3074+
3075+
/**
3076+
* @brief Configure minimum space between CBFC CF_Update messages in bytes.
3077+
*
3078+
* Must be >=800B.
3079+
*
3080+
* @type sai_uint32_t
3081+
* @flags CREATE_AND_SET
3082+
* @default 6400
3083+
*/
3084+
SAI_PORT_ATTR_CBFC_CF_MIN_SPACING,
3085+
3086+
/**
3087+
* @brief Configure minimum space in bytes between CtlOS messages
3088+
* like CBFC CF_Update, LLR ACK etc.
3089+
* Must be >=800B.
3090+
*
3091+
* @type sai_uint32_t
3092+
* @flags CREATE_AND_SET
3093+
* @default 6400
3094+
*/
3095+
SAI_PORT_ATTR_CTLOS_MIN_SPACING,
3096+
3097+
/**
3098+
* @brief Configure maximum space between CBFC CF_Update messages in bytes.
3099+
*
3100+
* Range: 16 KB to 1 MB with minimum granularity of 16 KB.
3101+
*
3102+
* @type sai_uint32_t
3103+
* @flags CREATE_AND_SET
3104+
* @default 262144
3105+
*/
3106+
SAI_PORT_ATTR_CBFC_CF_MAX_SPACING,
3107+
3108+
/**
3109+
* @brief Enable Queue to VC MAP on port
3110+
*
3111+
* QOS_MAP of type SAI_QOS_MAP_TYPE_QUEUE_TO_VC
3112+
*
3113+
* @type sai_object_id_t
3114+
* @flags CREATE_AND_SET
3115+
* @objects SAI_OBJECT_TYPE_QOS_MAP
3116+
* @allownull true
3117+
* @default SAI_NULL_OBJECT_ID
3118+
*/
3119+
SAI_PORT_ATTR_QOS_QUEUE_TO_VC_MAP,
3120+
3121+
/**
3122+
* @brief Enable TC to VC MAP on port.
3123+
*
3124+
* QOS_MAP of type SAI_QOS_MAP_TYPE_TC_TO_VC
3125+
*
3126+
* @type sai_object_id_t
3127+
* @flags CREATE_AND_SET
3128+
* @objects SAI_OBJECT_TYPE_QOS_MAP
3129+
* @allownull true
3130+
* @default SAI_NULL_OBJECT_ID
3131+
*/
3132+
SAI_PORT_ATTR_QOS_TC_TO_VC_MAP,
3133+
3134+
/**
3135+
* @brief Enable {DOT1P,DEI} -> TC MAP on port.
3136+
*
3137+
* Cannot co-exist with SAI_PORT_ATTR_QOS_DOT1P_TO_TC_MAP.
3138+
*
3139+
* @type sai_object_id_t
3140+
* @flags CREATE_AND_SET
3141+
* @objects SAI_OBJECT_TYPE_QOS_MAP
3142+
* @allownull true
3143+
* @default SAI_NULL_OBJECT_ID
3144+
*/
3145+
SAI_PORT_ATTR_QOS_DOT1P_DEI_TO_TC_MAP,
3146+
3147+
/**
3148+
* @brief List of virtual channels for the port.
3149+
*
3150+
* @type sai_object_list_t
3151+
* @flags READ_ONLY
3152+
* @objects SAI_OBJECT_TYPE_VIRTUAL_CHANNEL
3153+
*/
3154+
SAI_PORT_ATTR_QOS_VIRTUAL_CHANNEL_LIST,
3155+
3156+
/**
3157+
* @brief List of CBFC credit pools for the port.
3158+
*
3159+
* @type sai_object_list_t
3160+
* @flags READ_ONLY
3161+
* @objects SAI_OBJECT_TYPE_CBFC_CREDIT_POOL
3162+
*/
3163+
SAI_PORT_ATTR_CBFC_CREDIT_POOL_LIST,
3164+
29683165
/**
29693166
* @brief End of attributes
29703167
*/
@@ -3722,6 +3919,24 @@ typedef enum _sai_port_stat_t
37223919
/** Number of times that LLR Rx detected the start of a replay */
37233920
SAI_PORT_STAT_LLR_RX_REPLAY,
37243921

3922+
/** SAI port stat sender credits used */
3923+
SAI_PORT_STAT_CBFC_SENDER_CREDITS_USED,
3924+
3925+
/** SAI port stat sender credits used watermark */
3926+
SAI_PORT_STAT_CBFC_SENDER_CREDITS_USED_WATERMARK,
3927+
3928+
/** SAI port stat credits consumed update messages tx */
3929+
SAI_PORT_STAT_CBFC_NUM_CC_UPDATE_MESSAGES_TX,
3930+
3931+
/** SAI port stat credits freed update messages tx */
3932+
SAI_PORT_STAT_CBFC_NUM_CF_UPDATE_MESSAGES_TX,
3933+
3934+
/** SAI port stat credits consumed update messages rx */
3935+
SAI_PORT_STAT_CBFC_NUM_CC_UPDATE_MESSAGES_RX,
3936+
3937+
/** SAI port stat credits freed update messages rx */
3938+
SAI_PORT_STAT_CBFC_NUM_CF_UPDATE_MESSAGES_RX,
3939+
37253940
/** Port stat in drop reasons range start */
37263941
SAI_PORT_STAT_IN_DROP_REASON_RANGE_BASE = 0x00001000,
37273942

inc/saiqosmap.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@ typedef enum _sai_qos_map_type_t
8383
/** QOS Map to set EXP to Forwarding class */
8484
SAI_QOS_MAP_TYPE_MPLS_EXP_TO_FORWARDING_CLASS = 0x0000000e,
8585

86+
/** QOS Map to map packet {dot1p+DEI} to TC */
87+
SAI_QOS_MAP_TYPE_DOT1P_DEI_TO_TC = 0x0000000f,
88+
89+
/** QOS Map to map Traffic class to VC */
90+
SAI_QOS_MAP_TYPE_TC_TO_VC = 0x00000010,
91+
92+
/** QOS Map to set queue to VC */
93+
SAI_QOS_MAP_TYPE_QUEUE_TO_VC = 0x00000011,
94+
8695
/** Custom range base value */
8796
SAI_QOS_MAP_TYPE_CUSTOM_RANGE_BASE = 0x10000000
8897

@@ -110,8 +119,8 @@ typedef enum _sai_qos_map_attr_t
110119
* @brief Dot1p to TC Mapping
111120
*
112121
* Defaults:
113-
* - All Dot1p/DSCP maps to traffic class 0
114-
* - All Dot1p/DSCP maps to color #SAI_PACKET_COLOR_GREEN
122+
* - All Dot1p/Dot1p+DEI/DSCP maps to traffic class 0
123+
* - All Dot1p/Dot1p+DEI/DSCP maps to color #SAI_PACKET_COLOR_GREEN
115124
* - All traffic class maps to queue 0
116125
*
117126
* @type sai_qos_map_list_t

0 commit comments

Comments
 (0)