Skip to content

Commit 8b22bb4

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 8b22bb4

8 files changed

Lines changed: 257 additions & 1 deletion

File tree

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

3910+
/** SAI port stat sender credits used */
3911+
SAI_PORT_STAT_CBFC_SENDER_CREDITS_USED,
3912+
3913+
/** SAI port stat sender credits used watermark */
3914+
SAI_PORT_STAT_CBFC_SENDER_CREDITS_USED_WATERMARK,
3915+
3916+
/** SAI port stat credits consumed update messages tx */
3917+
SAI_PORT_STAT_CBFC_NUM_CC_UPDATE_MESSAGES_TX,
3918+
3919+
/** SAI port stat credits freed update messages tx */
3920+
SAI_PORT_STAT_CBFC_NUM_CF_UPDATE_MESSAGES_TX,
3921+
3922+
/** SAI port stat credits consumed update messages rx */
3923+
SAI_PORT_STAT_CBFC_NUM_CC_UPDATE_MESSAGES_RX,
3924+
3925+
/** SAI port stat credits freed update messages rx */
3926+
SAI_PORT_STAT_CBFC_NUM_CF_UPDATE_MESSAGES_RX,
3927+
37253928
/** Port stat in drop reasons range start */
37263929
SAI_PORT_STAT_IN_DROP_REASON_RANGE_BASE = 0x00001000,
37273930

inc/saiqosmap.h

Lines changed: 9 additions & 0 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

inc/saiqueue.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,30 @@ typedef enum _sai_queue_attr_t
280280
*/
281281
SAI_QUEUE_ATTR_SELECTIVE_COUNTER_LIST,
282282

283+
/**
284+
* @brief Queue packet dequeue enable
285+
*
286+
* Enable/Disable packet transmission of a queue. When packet transmission
287+
* is disabled on a queue, packets are still subject to regular ingress and egress
288+
* admission control to determine the actions on a packet
289+
*
290+
* @type bool
291+
* @flags CREATE_AND_SET
292+
* @default true
293+
*/
294+
SAI_QUEUE_ATTR_PKT_DEQUEUE_ENABLE,
295+
296+
/**
297+
* @brief Queue packet enqueue enable
298+
*
299+
* Enable/Disable packet enqueue to a queue
300+
*
301+
* @type bool
302+
* @flags CREATE_AND_SET
303+
* @default true
304+
*/
305+
SAI_QUEUE_ATTR_PKT_ENQUEUE_ENABLE,
306+
283307
/**
284308
* @brief End of attributes
285309
*/

inc/saitypes.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,9 @@ typedef enum _sai_object_type_t
303303
SAI_OBJECT_TYPE_PREFIX_COMPRESSION_ENTRY = 113,
304304
SAI_OBJECT_TYPE_SYNCE_CLOCK = 114,
305305
SAI_OBJECT_TYPE_PORT_LLR_PROFILE = 115,
306+
SAI_OBJECT_TYPE_VIRTUAL_CHANNEL = 116,
307+
SAI_OBJECT_TYPE_CBFC_CREDIT_POOL = 117,
308+
SAI_OBJECT_TYPE_CBFC_CREDIT_PROFILE = 118,
306309

307310
/** Must remain in last position */
308311
SAI_OBJECT_TYPE_MAX,
@@ -836,6 +839,12 @@ typedef struct _sai_qos_map_params_t
836839
/** Forwarding class */
837840
sai_uint8_t fc;
838841

842+
/** Dot1p + DEI used in SAI_QOS_MAP_TYPE_DOT1P_DEI_TO_TC */
843+
sai_uint8_t dot1p_dei;
844+
845+
/** Virtual Channel */
846+
sai_uint8_t vc;
847+
839848
} sai_qos_map_params_t;
840849

841850
typedef struct _sai_qos_map_t

meta/acronyms.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ BW - Bandwidth
1919
CAM - Content Addressable Memory
2020
CAUI - 100 Gigabit Attachment Unit Interface
2121
CB - Callback
22+
CBFC - Credit Based Flow Control
2223
CBS - Committed Burst Size
2324
CCITT - Comite Consultatif International de Telegraphique et Telephonique
2425
CFI - Canonical Format Indicator
@@ -29,6 +30,7 @@ CPLD - Complex programmable logic device
2930
CPU - Central Processing Unit
3031
CRC - Cyclic Redundancy Code
3132
CSIG - Congestion Signaling
33+
DEI - Drop Elgibility Indicator
3234
DFE - Decision Feedback Equalizer
3335
DHCP - Dynamic Host Configuration Protocol
3436
DHCPV6 - Dynamic Host Configuration Protocol for IPv6
@@ -180,6 +182,7 @@ UDP - User Datagram Protocol
180182
USD - Ultimate Segment Decapsulation
181183
USP - Ultimate Segment Pop
182184
USXGMII - Universal Serial 10 Gigabit Media Independent Interface
185+
VC - Virtual Channel
183186
VGA - Variable Gain Amplifier
184187
VNET - Virtual Network
185188
VNI - Virtual Network Interface

meta/aspell.en.pws

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Decrement
3737
defaultvalue
3838
defaultvaluetype
3939
defgroup
40+
dequeue
4041
deserialize
4142
deserialized
4243
didn
@@ -50,6 +51,7 @@ Encaps
5051
eni
5152
Eni
5253
ENI
54+
enqueue
5355
enum
5456
Enum
5557
enums
@@ -210,10 +212,12 @@ Uninitialize
210212
unordered
211213
untagged
212214
Untagged
215+
Upto
213216
uSID
214217
Utils
215218
validonly
216219
validonlys
220+
VCs
217221
versa
218222
vlan
219223
Vlan

meta/saisanitycheck.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1071,6 +1071,7 @@ void check_attr_default_required(
10711071
case SAI_ATTR_VALUE_TYPE_INT32:
10721072
case SAI_ATTR_VALUE_TYPE_UINT8:
10731073
case SAI_ATTR_VALUE_TYPE_UINT16:
1074+
case SAI_ATTR_VALUE_TYPE_INT16:
10741075
case SAI_ATTR_VALUE_TYPE_UINT32:
10751076
case SAI_ATTR_VALUE_TYPE_UINT64:
10761077
case SAI_ATTR_VALUE_TYPE_MAC:
@@ -2177,7 +2178,8 @@ void check_attr_key(
21772178
if ((md->objecttype == SAI_OBJECT_TYPE_QUEUE && md->attrid == SAI_QUEUE_ATTR_PORT) ||
21782179
(md->objecttype == SAI_OBJECT_TYPE_INGRESS_PRIORITY_GROUP && md->attrid == SAI_INGRESS_PRIORITY_GROUP_ATTR_PORT) ||
21792180
(md->objecttype == SAI_OBJECT_TYPE_PORT_CONNECTOR && md->attrid == SAI_PORT_CONNECTOR_ATTR_SYSTEM_SIDE_PORT_ID) ||
2180-
(md->objecttype == SAI_OBJECT_TYPE_PORT_CONNECTOR && md->attrid == SAI_PORT_CONNECTOR_ATTR_LINE_SIDE_PORT_ID))
2181+
(md->objecttype == SAI_OBJECT_TYPE_PORT_CONNECTOR && md->attrid == SAI_PORT_CONNECTOR_ATTR_LINE_SIDE_PORT_ID) ||
2182+
(md->objecttype == SAI_OBJECT_TYPE_VIRTUAL_CHANNEL && md->attrid == SAI_VIRTUAL_CHANNEL_ATTR_PORT))
21812183
{
21822184
/*
21832185
* This is also special case, OBJECT_ID at should not be a

0 commit comments

Comments
 (0)