Skip to content

Commit f6fc7f1

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 715c159 commit f6fc7f1

17 files changed

+1526
-4
lines changed

doc/CBFC/SAI-Credit_Based_Flow_Control.md

Lines changed: 739 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
@@ -3070,6 +3070,203 @@ typedef enum _sai_port_attr_t
30703070
*/
30713071
SAI_PORT_ATTR_SUPPORTED_PRBS_PATTERN,
30723072

3073+
/**
3074+
* @brief Get CBFC Native Credit Size in bytes.
3075+
*
3076+
* Receiver's input buffer is typically divided into cells, and the native credit size is this cell size (in bytes).
3077+
*
3078+
* @type sai_uint16_t
3079+
* @flags READ_ONLY
3080+
* @isvlan false
3081+
*/
3082+
SAI_PORT_ATTR_CBFC_RECEIVER_NATIVE_CREDIT_SIZE,
3083+
3084+
/**
3085+
* @brief Get CBFC Receiver Native Packet Overhead in bytes.
3086+
*
3087+
* @type sai_int16_t
3088+
* @flags READ_ONLY
3089+
*/
3090+
SAI_PORT_ATTR_CBFC_RECEIVER_NATIVE_PACKET_OVERHEAD,
3091+
3092+
/**
3093+
* @brief Get CBFC Receiver Total Port Credits in Credits.
3094+
*
3095+
* If value is 0, receiver sets per-VC credit limits.
3096+
*
3097+
* @type sai_uint16_t
3098+
* @flags READ_ONLY
3099+
* @isvlan false
3100+
*/
3101+
SAI_PORT_ATTR_CBFC_RECEIVER_NATIVE_TOTAL_CREDITS,
3102+
3103+
/**
3104+
* @brief Configure CBFC Receiver Credit Size in bytes.
3105+
*
3106+
* If value is 0, CBFC_RECEIVER_NATIVE_CREDIT_SIZE will be used.
3107+
*
3108+
* @type sai_uint16_t
3109+
* @flags CREATE_AND_SET
3110+
* @isvlan false
3111+
* @default 0
3112+
*/
3113+
SAI_PORT_ATTR_CBFC_RECEIVER_CREDIT_SIZE,
3114+
3115+
/**
3116+
* @brief Configure CBFC Receiver Packet Overhead in bytes.
3117+
*
3118+
* Range: -16 to 127
3119+
* If value is 128, SAI_PORT_ATTR_CBFC_RECEIVER_NATIVE_PACKET_OVERHEAD will be used
3120+
*
3121+
* @type sai_int16_t
3122+
* @flags CREATE_AND_SET
3123+
* @default 128
3124+
*/
3125+
SAI_PORT_ATTR_CBFC_RECEIVER_PACKET_OVERHEAD,
3126+
3127+
/**
3128+
* @brief Get CBFC supported Credit Size in bytes.
3129+
*
3130+
* @type sai_u16_list_t
3131+
* @flags READ_ONLY
3132+
*/
3133+
SAI_PORT_ATTR_CBFC_SENDER_SUPPORTED_CREDIT_SIZE,
3134+
3135+
/**
3136+
* @brief Configure CBFC Sender Credit Size in bytes.
3137+
*
3138+
* 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.
3139+
*
3140+
* @type sai_uint16_t
3141+
* @flags CREATE_AND_SET
3142+
* @isvlan false
3143+
* @default 128
3144+
*/
3145+
SAI_PORT_ATTR_CBFC_SENDER_CREDIT_SIZE,
3146+
3147+
/**
3148+
* @brief Configure CBFC Sender Packet Overhead in bytes.
3149+
*
3150+
* Range: -16 to 127.
3151+
*
3152+
* @type sai_int16_t
3153+
* @flags CREATE_AND_SET
3154+
* @default 0
3155+
*/
3156+
SAI_PORT_ATTR_CBFC_SENDER_PACKET_OVERHEAD,
3157+
3158+
/**
3159+
* @brief Configure CBFC Sender Port Credit Limit.
3160+
*
3161+
* Range; 0 to (2^20 - 1).
3162+
*
3163+
* @type sai_uint32_t
3164+
* @flags CREATE_AND_SET
3165+
* @default 0
3166+
*/
3167+
SAI_PORT_ATTR_CBFC_SENDER_CREDIT_LIMIT,
3168+
3169+
/**
3170+
* @brief Configure CBFC CC_Update message timer in microseconds.
3171+
*
3172+
* Range: 1us to 250000us.
3173+
*
3174+
* @type sai_uint32_t
3175+
* @flags CREATE_AND_SET
3176+
* @default 256
3177+
*/
3178+
SAI_PORT_ATTR_CBFC_CC_MESSAGE_TIMER,
3179+
3180+
/**
3181+
* @brief Configure minimum space between CBFC CF_Update messages in bytes.
3182+
*
3183+
* Must be >=800B.
3184+
*
3185+
* @type sai_uint32_t
3186+
* @flags CREATE_AND_SET
3187+
* @default 6400
3188+
*/
3189+
SAI_PORT_ATTR_CBFC_CF_MIN_SPACING,
3190+
3191+
/**
3192+
* @brief Configure minimum space in bytes between CtlOS messages
3193+
* like CBFC CF_Update, LLR ACK etc.
3194+
* Must be >=800B.
3195+
*
3196+
* @type sai_uint32_t
3197+
* @flags CREATE_AND_SET
3198+
* @default 6400
3199+
*/
3200+
SAI_PORT_ATTR_CTLOS_MIN_SPACING,
3201+
3202+
/**
3203+
* @brief Configure maximum space between CBFC CF_Update messages in bytes.
3204+
*
3205+
* Range: 16 KB to 1 MB with minimum granularity of 16 KB.
3206+
*
3207+
* @type sai_uint32_t
3208+
* @flags CREATE_AND_SET
3209+
* @default 262144
3210+
*/
3211+
SAI_PORT_ATTR_CBFC_CF_MAX_SPACING,
3212+
3213+
/**
3214+
* @brief Enable Queue to VC MAP on port
3215+
*
3216+
* QOS_MAP of type SAI_QOS_MAP_TYPE_QUEUE_TO_VC
3217+
*
3218+
* @type sai_object_id_t
3219+
* @flags CREATE_AND_SET
3220+
* @objects SAI_OBJECT_TYPE_QOS_MAP
3221+
* @allownull true
3222+
* @default SAI_NULL_OBJECT_ID
3223+
*/
3224+
SAI_PORT_ATTR_QOS_QUEUE_TO_VC_MAP,
3225+
3226+
/**
3227+
* @brief Enable TC to VC MAP on port.
3228+
*
3229+
* QOS_MAP of type SAI_QOS_MAP_TYPE_TC_TO_VC
3230+
*
3231+
* @type sai_object_id_t
3232+
* @flags CREATE_AND_SET
3233+
* @objects SAI_OBJECT_TYPE_QOS_MAP
3234+
* @allownull true
3235+
* @default SAI_NULL_OBJECT_ID
3236+
*/
3237+
SAI_PORT_ATTR_QOS_TC_TO_VC_MAP,
3238+
3239+
/**
3240+
* @brief Enable {DOT1P,DEI} -> TC MAP on port.
3241+
*
3242+
* Cannot co-exist with SAI_PORT_ATTR_QOS_DOT1P_TO_TC_MAP.
3243+
*
3244+
* @type sai_object_id_t
3245+
* @flags CREATE_AND_SET
3246+
* @objects SAI_OBJECT_TYPE_QOS_MAP
3247+
* @allownull true
3248+
* @default SAI_NULL_OBJECT_ID
3249+
*/
3250+
SAI_PORT_ATTR_QOS_DOT1P_DEI_TO_TC_MAP,
3251+
3252+
/**
3253+
* @brief List of virtual channels for the port.
3254+
*
3255+
* @type sai_object_list_t
3256+
* @flags READ_ONLY
3257+
* @objects SAI_OBJECT_TYPE_VIRTUAL_CHANNEL
3258+
*/
3259+
SAI_PORT_ATTR_QOS_VIRTUAL_CHANNEL_LIST,
3260+
3261+
/**
3262+
* @brief List of CBFC credit pools for the port.
3263+
*
3264+
* @type sai_object_list_t
3265+
* @flags READ_ONLY
3266+
* @objects SAI_OBJECT_TYPE_CBFC_CREDIT_POOL
3267+
*/
3268+
SAI_PORT_ATTR_CBFC_CREDIT_POOL_LIST,
3269+
30733270
/**
30743271
* @brief End of attributes
30753272
*/
@@ -3827,6 +4024,24 @@ typedef enum _sai_port_stat_t
38274024
/** Number of times that LLR Rx detected the start of a replay */
38284025
SAI_PORT_STAT_LLR_RX_REPLAY,
38294026

4027+
/** SAI port stat sender credits used */
4028+
SAI_PORT_STAT_CBFC_SENDER_CREDITS_USED,
4029+
4030+
/** SAI port stat sender credits used watermark */
4031+
SAI_PORT_STAT_CBFC_SENDER_CREDITS_USED_WATERMARK,
4032+
4033+
/** SAI port stat credits consumed update messages tx */
4034+
SAI_PORT_STAT_CBFC_NUM_CC_UPDATE_MESSAGES_TX,
4035+
4036+
/** SAI port stat credits freed update messages tx */
4037+
SAI_PORT_STAT_CBFC_NUM_CF_UPDATE_MESSAGES_TX,
4038+
4039+
/** SAI port stat credits consumed update messages rx */
4040+
SAI_PORT_STAT_CBFC_NUM_CC_UPDATE_MESSAGES_RX,
4041+
4042+
/** SAI port stat credits freed update messages rx */
4043+
SAI_PORT_STAT_CBFC_NUM_CF_UPDATE_MESSAGES_RX,
4044+
38304045
/** Port stat in drop reasons range start */
38314046
SAI_PORT_STAT_IN_DROP_REASON_RANGE_BASE = 0x00001000,
38324047

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)