SAI Metadata
Loading...
Searching...
No Matches
SAI - Entry point specific API definitions.

Classes

struct  _sai_service_method_table_t
 Method table that contains function pointers for services exposed by adapter host for adapter. More...
 

Typedefs

typedef enum _sai_api_t sai_api_t
 Defined API sets have assigned IDs.
 
typedef enum _sai_log_level_t sai_log_level_t
 Defines log level.
 
typedef const char *(* sai_profile_get_value_fn) (_In_ sai_switch_profile_id_t profile_id, _In_ const char *variable)
 
typedef int(* sai_profile_get_next_value_fn) (_In_ sai_switch_profile_id_t profile_id, _Out_ const char **variable, _Out_ const char **value)
 
typedef struct _sai_service_method_table_t sai_service_method_table_t
 Method table that contains function pointers for services exposed by adapter host for adapter.
 

Enumerations

enum  _sai_api_t {
  SAI_API_UNSPECIFIED = 0 , SAI_API_SWITCH = 1 , SAI_API_PORT = 2 , SAI_API_FDB = 3 ,
  SAI_API_VLAN = 4 , SAI_API_VIRTUAL_ROUTER = 5 , SAI_API_ROUTE = 6 , SAI_API_NEXT_HOP = 7 ,
  SAI_API_NEXT_HOP_GROUP = 8 , SAI_API_ROUTER_INTERFACE = 9 , SAI_API_NEIGHBOR = 10 , SAI_API_ACL = 11 ,
  SAI_API_HOSTIF = 12 , SAI_API_MIRROR = 13 , SAI_API_SAMPLEPACKET = 14 , SAI_API_STP = 15 ,
  SAI_API_LAG = 16 , SAI_API_POLICER = 17 , SAI_API_WRED = 18 , SAI_API_QOS_MAP = 19 ,
  SAI_API_QUEUE = 20 , SAI_API_SCHEDULER = 21 , SAI_API_SCHEDULER_GROUP = 22 , SAI_API_BUFFER = 23 ,
  SAI_API_HASH = 24 , SAI_API_UDF = 25 , SAI_API_TUNNEL = 26 , SAI_API_L2MC = 27 ,
  SAI_API_IPMC = 28 , SAI_API_RPF_GROUP = 29 , SAI_API_L2MC_GROUP = 30 , SAI_API_IPMC_GROUP = 31 ,
  SAI_API_MCAST_FDB = 32 , SAI_API_BRIDGE = 33 , SAI_API_TAM = 34 , SAI_API_SRV6 = 35 ,
  SAI_API_MPLS = 36 , SAI_API_DTEL = 37 , SAI_API_BFD = 38 , SAI_API_ISOLATION_GROUP = 39 ,
  SAI_API_NAT = 40 , SAI_API_COUNTER = 41 , SAI_API_DEBUG_COUNTER = 42 , SAI_API_MACSEC = 43 ,
  SAI_API_SYSTEM_PORT = 44 , SAI_API_MY_MAC = 45 , SAI_API_IPSEC = 46 , SAI_API_GENERIC_PROGRAMMABLE = 47 ,
  SAI_API_ARS = 48 , SAI_API_ARS_PROFILE = 49 , SAI_API_TWAMP = 50 , SAI_API_MAX ,
  SAI_API_CUSTOM_RANGE_START = 256 , SAI_API_CUSTOM_RANGE_END
}
 Defined API sets have assigned IDs. More...
 
enum  _sai_log_level_t {
  SAI_LOG_LEVEL_DEBUG = 0 , SAI_LOG_LEVEL_INFO = 1 , SAI_LOG_LEVEL_NOTICE = 2 , SAI_LOG_LEVEL_WARN = 3 ,
  SAI_LOG_LEVEL_ERROR = 4 , SAI_LOG_LEVEL_CRITICAL = 5
}
 Defines log level. More...
 

Functions

sai_status_t sai_api_initialize (_In_ uint64_t flags, _In_ const sai_service_method_table_t *services)
 Adapter module initialization call.
 
sai_status_t sai_api_query (_In_ sai_api_t api, _Out_ void **api_method_table)
 Retrieve a pointer to the C-style method table for desired SAI functionality as specified by the given sai_api_id.
 
sai_status_t sai_api_uninitialize (void)
 Uninitialize adapter module. SAI functionalities, retrieved via sai_api_query() cannot be used after this call.
 
sai_status_t sai_log_set (_In_ sai_api_t api, _In_ sai_log_level_t log_level)
 Set log level for SAI API module.
 
sai_object_type_t sai_object_type_query (_In_ sai_object_id_t object_id)
 Query SAI object type.
 
sai_object_id_t sai_switch_id_query (_In_ sai_object_id_t object_id)
 Query SAI switch id.
 
sai_status_t sai_dbg_generate_dump (_In_ const char *dump_file_name)
 Generate dump file. The dump file may include SAI state information and vendor SDK information.
 
sai_status_t sai_object_type_get_availability (_In_ sai_object_id_t switch_id, _In_ sai_object_type_t object_type, _In_ uint32_t attr_count, _In_ const sai_attribute_t *attr_list, _Out_ uint64_t *count)
 Get SAI object type resource availability.
 

Detailed Description

Typedef Documentation

◆ sai_api_t

typedef enum _sai_api_t sai_api_t

Defined API sets have assigned IDs.

If specific API method table changes in any way (method signature, number of methods), a new ID needs to be created (e.g. VLAN2) and old API still may need to be supported for compatibility with older adapter hosts.

◆ sai_profile_get_next_value_fn

typedef int(* sai_profile_get_next_value_fn) (_In_ sai_switch_profile_id_t profile_id, _Out_ const char **variable, _Out_ const char **value)

Definition at line 187 of file sai.h.

◆ sai_profile_get_value_fn

typedef const char *(* sai_profile_get_value_fn) (_In_ sai_switch_profile_id_t profile_id, _In_ const char *variable)

Definition at line 183 of file sai.h.

Enumeration Type Documentation

◆ _sai_api_t

enum _sai_api_t

Defined API sets have assigned IDs.

If specific API method table changes in any way (method signature, number of methods), a new ID needs to be created (e.g. VLAN2) and old API still may need to be supported for compatibility with older adapter hosts.

Enumerator
SAI_API_UNSPECIFIED 

unspecified API

SAI_API_SWITCH 

sai_switch_api_t

SAI_API_PORT 

sai_port_api_t

SAI_API_FDB 

sai_fdb_api_t

SAI_API_VLAN 

sai_vlan_api_t

SAI_API_VIRTUAL_ROUTER 

sai_virtual_router_api_t

SAI_API_ROUTE 

sai_route_api_t

SAI_API_NEXT_HOP 

sai_next_hop_api_t

SAI_API_NEXT_HOP_GROUP 

sai_next_hop_group_api_t

SAI_API_ROUTER_INTERFACE 

sai_router_interface_api_t

SAI_API_NEIGHBOR 

sai_neighbor_api_t

SAI_API_ACL 

sai_acl_api_t

SAI_API_HOSTIF 

sai_hostif_api_t

SAI_API_MIRROR 

sai_mirror_api_t

SAI_API_SAMPLEPACKET 

sai_samplepacket_api_t

SAI_API_STP 

sai_stp_api_t

SAI_API_LAG 

sai_lag_api_t

SAI_API_POLICER 

sai_policer_api_t

SAI_API_WRED 

sai_wred_api_t

SAI_API_QOS_MAP 

sai_qos_map_api_t

SAI_API_QUEUE 

sai_queue_api_t

SAI_API_SCHEDULER 

sai_scheduler_api_t

SAI_API_SCHEDULER_GROUP 

sai_scheduler_group_api_t

SAI_API_BUFFER 

sai_buffer_api_t

SAI_API_HASH 

sai_hash_api_t

SAI_API_UDF 

sai_udf_api_t

SAI_API_TUNNEL 

sai_tunnel_api_t

SAI_API_L2MC 

sai_l2mc_api_t

SAI_API_IPMC 

sai_ipmc_api_t

SAI_API_RPF_GROUP 

sai_rpf_group_api_t

SAI_API_L2MC_GROUP 

sai_l2mc_group_api_t

SAI_API_IPMC_GROUP 

sai_ipmc_group_api_t

SAI_API_MCAST_FDB 

sai_mcast_fdb_api_t

SAI_API_BRIDGE 

sai_bridge_api_t

SAI_API_TAM 

sai_tam_api_t

SAI_API_SRV6 

sai_srv6_api_t

SAI_API_MPLS 

sai_mpls_api_t

SAI_API_DTEL 

sai_dtel_api_t (experimental)

SAI_API_BFD 

sai_bfd_api_t

SAI_API_ISOLATION_GROUP 

sai_isolation_group_api_t

SAI_API_NAT 

sai_nat_api_t

SAI_API_COUNTER 

sai_counter_api_t

SAI_API_DEBUG_COUNTER 

sai_debug_counter_api_t

SAI_API_MACSEC 

sai_macsec_api_t

SAI_API_SYSTEM_PORT 

sai_system_port_api_t

SAI_API_MY_MAC 

sai_my_mac_api_t

SAI_API_IPSEC 

sai_ipsec_api_t

SAI_API_GENERIC_PROGRAMMABLE 

sai_generic_programmable_t

SAI_API_ARS 

sai_ars_api_t

SAI_API_ARS_PROFILE 

sai_ars_api_profile_t

SAI_API_TWAMP 

sai_twamp_api_t

SAI_API_MAX 

total number of APIs

SAI_API_CUSTOM_RANGE_START 

Custom range base value

SAI_API_CUSTOM_RANGE_END 

End of custom range base

Definition at line 96 of file sai.h.

◆ _sai_log_level_t

Defines log level.

Enumerator
SAI_LOG_LEVEL_DEBUG 

Log Level Debug

SAI_LOG_LEVEL_INFO 

Log Level Info

SAI_LOG_LEVEL_NOTICE 

Log Level Notice

SAI_LOG_LEVEL_WARN 

Log level Warning

SAI_LOG_LEVEL_ERROR 

Log Level Error

SAI_LOG_LEVEL_CRITICAL 

Log Level Critical

Definition at line 161 of file sai.h.

Function Documentation

◆ sai_api_initialize()

sai_status_t sai_api_initialize ( _In_ uint64_t  flags,
_In_ const sai_service_method_table_t services 
)

Adapter module initialization call.

This is NOT for SDK initialization.

Parameters
[in]flagsReserved for future use, must be zero
[in]servicesMethods table with services provided by adapter host
Returns
SAI_STATUS_SUCCESS on success, failure status code on error

◆ sai_api_query()

sai_status_t sai_api_query ( _In_ sai_api_t  api,
_Out_ void **  api_method_table 
)

Retrieve a pointer to the C-style method table for desired SAI functionality as specified by the given sai_api_id.

Parameters
[in]apiSAI API ID
[out]api_method_tableCaller allocated method table. The table must remain valid until the sai_api_uninitialize() is called.
Returns
SAI_STATUS_SUCCESS on success, failure status code on error

◆ sai_api_uninitialize()

sai_status_t sai_api_uninitialize ( void  )

Uninitialize adapter module. SAI functionalities, retrieved via sai_api_query() cannot be used after this call.

Returns
SAI_STATUS_SUCCESS on success, failure status code on error

◆ sai_dbg_generate_dump()

sai_status_t sai_dbg_generate_dump ( _In_ const char *  dump_file_name)

Generate dump file. The dump file may include SAI state information and vendor SDK information.

Parameters
[in]dump_file_nameFull path for dump file
Returns
SAI_STATUS_SUCCESS on success, failure status code on error

◆ sai_log_set()

sai_status_t sai_log_set ( _In_ sai_api_t  api,
_In_ sai_log_level_t  log_level 
)

Set log level for SAI API module.

The default log level is SAI_LOG_LEVEL_WARN.

Parameters
[in]apiSAI API ID
[in]log_levelLog level
Returns
SAI_STATUS_SUCCESS on success, failure status code on error

◆ sai_object_type_get_availability()

sai_status_t sai_object_type_get_availability ( _In_ sai_object_id_t  switch_id,
_In_ sai_object_type_t  object_type,
_In_ uint32_t  attr_count,
_In_ const sai_attribute_t attr_list,
_Out_ uint64_t *  count 
)

Get SAI object type resource availability.

Parameters
[in]switch_idSAI Switch object id
[in]object_typeSAI object type
[in]attr_countNumber of attributes
[in]attr_listList of attributes that to distinguish resource
[out]countAvailable objects left
Returns
SAI_STATUS_NOT_SUPPORTED if the given object type does not support resource accounting. Otherwise, return SAI_STATUS_SUCCESS.

◆ sai_object_type_query()

sai_object_type_t sai_object_type_query ( _In_ sai_object_id_t  object_id)

Query SAI object type.

Parameters
[in]object_idObject id
Returns
SAI_OBJECT_TYPE_NULL when sai_object_id is not valid. Otherwise, return a valid SAI object type SAI_OBJECT_TYPE_XXX.

◆ sai_switch_id_query()

sai_object_id_t sai_switch_id_query ( _In_ sai_object_id_t  object_id)

Query SAI switch id.

Parameters
[in]object_idObject id
Returns
SAI_NULL_OBJECT_ID when sai_object_id is not valid. Otherwise, return a valid SAI_OBJECT_TYPE_SWITCH object on which provided object id belongs. If valid switch id object is provided as input parameter it should return itself.