Skip to content

Commit 69ee097

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 69ee097

16 files changed

+1521
-3
lines changed

doc/CBFC/SAI-Credit_Based_Flow_Control.md

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

doc/CBFC/images/CBFC_operation.png

486 KB
Loading
127 KB
Loading
46.3 KB
Loading
70.3 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
@@ -2809,6 +2809,203 @@ typedef enum _sai_port_attr_t
28092809
*/
28102810
SAI_PORT_ATTR_SERDES_FW_REVISION,
28112811

2812+
/**
2813+
* @brief Get CBFC Native Credit Size in bytes.
2814+
*
2815+
* Receiver's input buffer is typically divided into cells, and the native credit size is this cell size (in bytes).
2816+
*
2817+
* @type sai_uint16_t
2818+
* @flags READ_ONLY
2819+
* @isvlan false
2820+
*/
2821+
SAI_PORT_ATTR_CBFC_RECEIVER_NATIVE_CREDIT_SIZE,
2822+
2823+
/**
2824+
* @brief Get CBFC Receiver Native Packet Overhead in bytes.
2825+
*
2826+
* @type sai_int16_t
2827+
* @flags READ_ONLY
2828+
*/
2829+
SAI_PORT_ATTR_CBFC_RECEIVER_NATIVE_PACKET_OVERHEAD,
2830+
2831+
/**
2832+
* @brief Get CBFC Receiver Total Port Credits in Credits.
2833+
*
2834+
* If value is 0, receiver sets per-VC credit limits.
2835+
*
2836+
* @type sai_uint16_t
2837+
* @flags READ_ONLY
2838+
* @isvlan false
2839+
*/
2840+
SAI_PORT_ATTR_CBFC_RECEIVER_NATIVE_TOTAL_CREDITS,
2841+
2842+
/**
2843+
* @brief Configure CBFC Receiver Credit Size in bytes.
2844+
*
2845+
* If value is 0, CBFC_RECEIVER_NATIVE_CREDIT_SIZE will be used.
2846+
*
2847+
* @type sai_uint16_t
2848+
* @flags CREATE_AND_SET
2849+
* @isvlan false
2850+
* @default 0
2851+
*/
2852+
SAI_PORT_ATTR_CBFC_RECEIVER_CREDIT_SIZE,
2853+
2854+
/**
2855+
* @brief Configure CBFC Receiver Packet Overhead in bytes.
2856+
*
2857+
* Range: -16 to 127
2858+
* If value is 128, SAI_PORT_ATTR_CBFC_RECEIVER_NATIVE_PACKET_OVERHEAD will be used
2859+
*
2860+
* @type sai_int16_t
2861+
* @flags CREATE_AND_SET
2862+
* @default 128
2863+
*/
2864+
SAI_PORT_ATTR_CBFC_RECEIVER_PACKET_OVERHEAD,
2865+
2866+
/**
2867+
* @brief Get CBFC supported Credit Size in bytes.
2868+
*
2869+
* @type sai_u16_list_t
2870+
* @flags READ_ONLY
2871+
*/
2872+
SAI_PORT_ATTR_CBFC_SENDER_SUPPORTED_CREDIT_SIZE,
2873+
2874+
/**
2875+
* @brief Configure CBFC Sender Credit Size in bytes.
2876+
*
2877+
* 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.
2878+
*
2879+
* @type sai_uint16_t
2880+
* @flags CREATE_AND_SET
2881+
* @isvlan false
2882+
* @default 128
2883+
*/
2884+
SAI_PORT_ATTR_CBFC_SENDER_CREDIT_SIZE,
2885+
2886+
/**
2887+
* @brief Configure CBFC Sender Packet Overhead in bytes.
2888+
*
2889+
* Range: -16 to 127.
2890+
*
2891+
* @type sai_int16_t
2892+
* @flags CREATE_AND_SET
2893+
* @default 0
2894+
*/
2895+
SAI_PORT_ATTR_CBFC_SENDER_PACKET_OVERHEAD,
2896+
2897+
/**
2898+
* @brief Configure CBFC Sender Port Credit Limit.
2899+
*
2900+
* Range; 0 to (2^20 - 1).
2901+
*
2902+
* @type sai_uint32_t
2903+
* @flags CREATE_AND_SET
2904+
* @default 0
2905+
*/
2906+
SAI_PORT_ATTR_CBFC_SENDER_CREDIT_LIMIT,
2907+
2908+
/**
2909+
* @brief Configure CBFC CC_Update message timer in microseconds.
2910+
*
2911+
* Range: 1us to 250000us.
2912+
*
2913+
* @type sai_uint32_t
2914+
* @flags CREATE_AND_SET
2915+
* @default 256
2916+
*/
2917+
SAI_PORT_ATTR_CBFC_CC_MESSAGE_TIMER,
2918+
2919+
/**
2920+
* @brief Configure minimum space between CBFC CF_Update messages in bytes.
2921+
*
2922+
* Must be >=800B.
2923+
*
2924+
* @type sai_uint32_t
2925+
* @flags CREATE_AND_SET
2926+
* @default 6400
2927+
*/
2928+
SAI_PORT_ATTR_CBFC_CF_MIN_SPACING,
2929+
2930+
/**
2931+
* @brief Configure minimum space in bytes between CtlOS messages
2932+
* like CBFC CF_Update, LLR ACK etc.
2933+
* Must be >=800B.
2934+
*
2935+
* @type sai_uint32_t
2936+
* @flags CREATE_AND_SET
2937+
* @default 6400
2938+
*/
2939+
SAI_PORT_ATTR_CTLOS_MIN_SPACING,
2940+
2941+
/**
2942+
* @brief Configure maximum space between CBFC CF_Update messages in bytes.
2943+
*
2944+
* Range: 16 KB to 1 MB with minimum granularity of 16 KB.
2945+
*
2946+
* @type sai_uint32_t
2947+
* @flags CREATE_AND_SET
2948+
* @default 262144
2949+
*/
2950+
SAI_PORT_ATTR_CBFC_CF_MAX_SPACING,
2951+
2952+
/**
2953+
* @brief Enable Queue to VC MAP on port
2954+
*
2955+
* QOS_MAP of type SAI_QOS_MAP_TYPE_QUEUE_TO_VC
2956+
*
2957+
* @type sai_object_id_t
2958+
* @flags CREATE_AND_SET
2959+
* @objects SAI_OBJECT_TYPE_QOS_MAP
2960+
* @allownull true
2961+
* @default SAI_NULL_OBJECT_ID
2962+
*/
2963+
SAI_PORT_ATTR_QOS_QUEUE_TO_VC_MAP,
2964+
2965+
/**
2966+
* @brief Enable TC to VC MAP on port.
2967+
*
2968+
* QOS_MAP of type SAI_QOS_MAP_TYPE_TC_TO_VC
2969+
*
2970+
* @type sai_object_id_t
2971+
* @flags CREATE_AND_SET
2972+
* @objects SAI_OBJECT_TYPE_QOS_MAP
2973+
* @allownull true
2974+
* @default SAI_NULL_OBJECT_ID
2975+
*/
2976+
SAI_PORT_ATTR_QOS_TC_TO_VC_MAP,
2977+
2978+
/**
2979+
* @brief Enable {DOT1P,DEI} -> TC MAP on port.
2980+
*
2981+
* Cannot co-exist with SAI_PORT_ATTR_QOS_DOT1P_TO_TC_MAP.
2982+
*
2983+
* @type sai_object_id_t
2984+
* @flags CREATE_AND_SET
2985+
* @objects SAI_OBJECT_TYPE_QOS_MAP
2986+
* @allownull true
2987+
* @default SAI_NULL_OBJECT_ID
2988+
*/
2989+
SAI_PORT_ATTR_QOS_DOT1P_DEI_TO_TC_MAP,
2990+
2991+
/**
2992+
* @brief List of virtual channels for the port.
2993+
*
2994+
* @type sai_object_list_t
2995+
* @flags READ_ONLY
2996+
* @objects SAI_OBJECT_TYPE_VIRTUAL_CHANNEL
2997+
*/
2998+
SAI_PORT_ATTR_QOS_VIRTUAL_CHANNEL_LIST,
2999+
3000+
/**
3001+
* @brief List of CBFC credit pools for the port.
3002+
*
3003+
* @type sai_object_list_t
3004+
* @flags READ_ONLY
3005+
* @objects SAI_OBJECT_TYPE_CBFC_CREDIT_POOL
3006+
*/
3007+
SAI_PORT_ATTR_CBFC_CREDIT_POOL_LIST,
3008+
28123009
/**
28133010
* @brief Per Lane PRBS Lock Status
28143011
*
@@ -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)