Mellanox SwitchX SDK API Guide  4.3.2104
Functions
sx_api_mstp.h File Reference

Go to the source code of this file.

Functions

sx_status_t sx_api_mstp_log_verbosity_level_set (const sx_api_handle_t handle, const sx_log_verbosity_target_t verbosity_target, const sx_verbosity_level_t module_verbosity_level, const sx_verbosity_level_t api_verbosity_level)
 
sx_status_t sx_api_mstp_log_verbosity_level_get (const sx_api_handle_t handle, const sx_log_verbosity_target_t verbosity_target, sx_verbosity_level_t *module_verbosity_level_p, sx_verbosity_level_t *api_verbosity_level_p)
 
sx_status_t sx_api_mstp_mode_set (const sx_api_handle_t handle, const sx_swid_t swid, const sx_mstp_mode_t mode)
 
sx_status_t sx_api_mstp_mode_get (const sx_api_handle_t handle, const sx_swid_t swid, sx_mstp_mode_t *mode_p)
 
sx_status_t sx_api_mstp_inst_set (const sx_api_handle_t handle, const sx_access_cmd_t cmd, const sx_swid_t swid, const sx_mstp_inst_id_t inst_id)
 
sx_status_t sx_api_mstp_inst_iter_get (const sx_api_handle_t handle, const sx_access_cmd_t cmd, const sx_swid_t swid, const sx_mstp_inst_id_t inst_key, const sx_mstp_inst_filter_t *inst_filter_p, sx_mstp_inst_id_t *inst_list_p, uint32_t *inst_cnt_p)
 
sx_status_t sx_api_mstp_inst_vlan_list_set (const sx_api_handle_t handle, const sx_access_cmd_t cmd, const sx_swid_t swid, const sx_mstp_inst_id_t inst_id, const sx_vlan_id_t *vlan_list_p, const uint32_t vlan_cnt)
 
sx_status_t sx_api_mstp_inst_vlan_list_get (const sx_api_handle_t handle, const sx_swid_t swid, const sx_mstp_inst_id_t inst_id, sx_vlan_id_t *vlan_list_p, uint32_t *vlan_cnt_p)
 
sx_status_t sx_api_mstp_inst_port_state_set (const sx_api_handle_t handle, const sx_swid_t swid, const sx_mstp_inst_id_t inst_id, const sx_port_log_id_t log_port, const sx_mstp_inst_port_state_t port_state)
 
sx_status_t sx_api_mstp_inst_port_state_get (const sx_api_handle_t handle, const sx_swid_t swid, const sx_mstp_inst_id_t inst_id, const sx_port_log_id_t log_port, sx_mstp_inst_port_state_t *port_state_p)
 
sx_status_t sx_api_rstp_port_state_set (const sx_api_handle_t handle, const sx_port_log_id_t log_port, const sx_mstp_inst_port_state_t port_state)
 
sx_status_t sx_api_rstp_port_state_get (const sx_api_handle_t handle, const sx_port_log_id_t log_port, sx_mstp_inst_port_state_t *port_state_p)
 
sx_status_t sx_api_mstp_exclude_port_state_set (const sx_api_handle_t handle, const sx_port_log_id_t log_port, const sx_mstp_exclude_port_state_t port_state)
 
sx_status_t sx_api_mstp_exclude_port_state_get (const sx_api_handle_t handle, const sx_port_log_id_t log_port, sx_mstp_exclude_port_state_t *port_state_p)
 

Function Documentation

◆ sx_api_mstp_log_verbosity_level_set()

sx_status_t sx_api_mstp_log_verbosity_level_set ( const sx_api_handle_t  handle,
const sx_log_verbosity_target_t  verbosity_target,
const sx_verbosity_level_t  module_verbosity_level,
const sx_verbosity_level_t  api_verbosity_level 
)

This function sets the log verbosity level of MSTP MODULE. Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle
[in]verbosity_target- set verbosity of : API / MODULE / BOTH
[in]module_verbosity_level- MSTP module verbosity level
[in]api_verbosity_level- MSTP API verbosity level
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_ERROR if an input parameter is invalid
SX_STATUS_ERROR for a general error

◆ sx_api_mstp_log_verbosity_level_get()

sx_status_t sx_api_mstp_log_verbosity_level_get ( const sx_api_handle_t  handle,
const sx_log_verbosity_target_t  verbosity_target,
sx_verbosity_level_t *  module_verbosity_level_p,
sx_verbosity_level_t *  api_verbosity_level_p 
)

This function gets the log verbosity level of MSTP MODULE. Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle
[in]verbosity_target- get verbosity of : API / MODULE / BOTH
[out]module_verbosity_level_p- MSTP module verbosity level
[out]api_verbosity_level_p- MSTP API verbosity level
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_ERROR if an input parameter is invalid
SX_STATUS_ERROR for a general error

◆ sx_api_mstp_mode_set()

sx_status_t sx_api_mstp_mode_set ( const sx_api_handle_t  handle,
const sx_swid_t  swid,
const sx_mstp_mode_t  mode 
)

This function sets the switch STP activation mode (RSTP/MSTP/PVRST) on the SDK. As a result, the mapping between Instance(s) to VLAN(s) is deleted. Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle
[in]swid- switch ID.
[in]mode- STP activation mode. Can take any of the following values: SX_MSTP_MODE_MSTP (default) SX_MSTP_MODE_RSTP SX_MSTP_MODE_PVRST
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_EXCEEDS_RANGE if a parameters exceeds its range
SX_STATUS_MESSAGE_SIZE_ZERO if message size is zero
SX_STATUS_MESSAGE_SIZE_EXCEEDS_LIMIT if message size exceeds limit
SX_STATUS_INVALID_HANDLE if a NULL handle is received
SX_STATUS_COMM_ERROR if client communication fails

◆ sx_api_mstp_mode_get()

sx_status_t sx_api_mstp_mode_get ( const sx_api_handle_t  handle,
const sx_swid_t  swid,
sx_mstp_mode_t *  mode_p 
)

This function retrieves the switch STP activation state (RSTP/MSTP/PVRST) from the SDK. Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle
[in]swid- switch ID
[out]mode_p- MSTP activation state
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_EXCEEDS_RANGE if a parameters exceeds its range
SX_STATUS_MESSAGE_SIZE_ZERO if message size is zero
SX_STATUS_MESSAGE_SIZE_EXCEEDS_LIMIT if message size exceeds limit
SX_STATUS_INVALID_HANDLE if a NULL handle is received
SX_STATUS_COMM_ERROR if client communication fails
SX_STATUS_PARAM_NULL if a parameter is NULL

◆ sx_api_mstp_inst_set()

sx_status_t sx_api_mstp_inst_set ( const sx_api_handle_t  handle,
const sx_access_cmd_t  cmd,
const sx_swid_t  swid,
const sx_mstp_inst_id_t  inst_id 
)

This function adds/deletes an MSTP instance to/from the switch in the SDK. Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle
[in]cmd- ADD/DELETE
[in]swid- switch ID
[in]inst_id- MSTP instance ID to add/delete. Range is <1- 1024>
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_EXCEEDS_RANGE if a parameters exceeds its range
SX_STATUS_MESSAGE_SIZE_ZERO if message size is zero
SX_STATUS_MESSAGE_SIZE_EXCEEDS_LIMIT if message size exceeds limit
SX_STATUS_INVALID_HANDLE if a NULL handle is received
SX_STATUS_COMM_ERROR if client communication fails
SX_STATUS_CMD_UNSUPPORTED if command is not supported
SX_STATUS_CMD_UNPERMITTED if using it not in MSTP mode

◆ sx_api_mstp_inst_iter_get()

sx_status_t sx_api_mstp_inst_iter_get ( const sx_api_handle_t  handle,
const sx_access_cmd_t  cmd,
const sx_swid_t  swid,
const sx_mstp_inst_id_t  inst_key,
const sx_mstp_inst_filter_t *  inst_filter_p,
sx_mstp_inst_id_t *  inst_list_p,
uint32_t *  inst_cnt_p 
)

This function gets a list of MSTP instances. If cmd is GET and inst_list_p is NULL, this function will only return the count. Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle
[in]cmd- GET/GET_FIRST/GET_NEXT
[in]swid- switch ID
[in]inst_key- MSTP instance ID, used only for GET_NEXT
[in]inst_filter_p- filter used on the list: VLAN-ID
[out]inst_list_p- Pointer to list of instances
[in,out]inst_cnt_p- In: Number of instances to retrieve (max: 1024) Out: Number of instances retrieved successfully
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_EXCEEDS_RANGE if a parameters exceeds its range
SX_STATUS_MESSAGE_SIZE_ZERO if message size is zero
SX_STATUS_MESSAGE_SIZE_EXCEEDS_LIMIT if message size exceeds limit
SX_STATUS_INVALID_HANDLE if a NULL handle is received
SX_STATUS_COMM_ERROR if client communication fails
SX_STATUS_PARAM_NULL if a parameter is NULL
SX_STATUS_CMD_UNSUPPORTED if command is not supported
SX_STATUS_CMD_UNPERMITTED if using it not in MSTP mode

◆ sx_api_mstp_inst_vlan_list_set()

sx_status_t sx_api_mstp_inst_vlan_list_set ( const sx_api_handle_t  handle,
const sx_access_cmd_t  cmd,
const sx_swid_t  swid,
const sx_mstp_inst_id_t  inst_id,
const sx_vlan_id_t *  vlan_list_p,
const uint32_t  vlan_cnt 
)

This function adds/deletes a mapping between a list of VLANs to/from the MSTP instance in the SDK. Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle
[in]cmd- ADD/DELTE
[in]swid- switch ID
[in]inst_id- MSTP instance ID. Range is <1-1024>
[in]vlan_list_p- list of VLANs to map/unmap
[in]vlan_cnt- number of VLANs to map/unmap. Range is <1-4094>
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_EXCEEDS_RANGE if a parameters exceeds its range
SX_STATUS_MESSAGE_SIZE_ZERO if message size is zero
SX_STATUS_MESSAGE_SIZE_EXCEEDS_LIMIT if message size exceeds limit
SX_STATUS_INVALID_HANDLE if a NULL handle is received
SX_STATUS_COMM_ERROR if client communication fails
SX_STATUS_PARAM_NULL if a parameter is NULL
SX_STATUS_CMD_UNSUPPORTED if command is not supported
SX_STATUS_CMD_UNPERMITTED if using it not in MSTP mode

◆ sx_api_mstp_inst_vlan_list_get()

sx_status_t sx_api_mstp_inst_vlan_list_get ( const sx_api_handle_t  handle,
const sx_swid_t  swid,
const sx_mstp_inst_id_t  inst_id,
sx_vlan_id_t *  vlan_list_p,
uint32_t *  vlan_cnt_p 
)

This function retrieves a list of VLANs in the MSTP instance from the SDK. If the output list (array) is NULL, only the number of VLANs is retrieved.

Supported devices: Spectrum. Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle
[in]swid- switch ID
[in]inst_id- MSTP instance ID. Range is <1-1024>
[out]vlan_list_p- VLANs array
[in,out]vlan_cnt_p- In: Size of VLANs array. Range is <1-4094> Out: Number of VLANs retrieved successfully
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_EXCEEDS_RANGE if a parameters exceeds its range
SX_STATUS_MESSAGE_SIZE_ZERO if message size is zero
SX_STATUS_MESSAGE_SIZE_EXCEEDS_LIMIT if message size exceeds limit
SX_STATUS_INVALID_HANDLE if a NULL handle is received
SX_STATUS_COMM_ERROR if client communication fails
SX_STATUS_PARAM_NULL if a parameter is NULL
SX_STATUS_CMD_UNSUPPORTED if command is not supported
SX_STATUS_CMD_UNPERMITTED if using it not in MSTP mode

◆ sx_api_mstp_inst_port_state_set()

sx_status_t sx_api_mstp_inst_port_state_set ( const sx_api_handle_t  handle,
const sx_swid_t  swid,
const sx_mstp_inst_id_t  inst_id,
const sx_port_log_id_t  log_port,
const sx_mstp_inst_port_state_t  port_state 
)

This function sets the MSTP port state for a given instance in the SDK.

In PVRST mode, instance id equals to vlan id. (In .1D mode instance id equals to bridge id) Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle
[in]swid- switch ID
[in]inst_id- MSTP Instance ID. Ranges <1-1024>
[in]log_port- Logical Port ID (whose STP state to set)
[in]port_state- MSTP Port State. Can take any of the following values: SX_MSTP_INST_PORT_STATE_DISCARDING SX_MSTP_INST_PORT_STATE_LEARNING SX_MSTP_INST_PORT_STATE_FORWARDING
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_EXCEEDS_RANGE if a parameters exceeds its range
SX_STATUS_ENTRY_NOT_FOUND if requested element is not found in DB
SX_STATUS_MESSAGE_SIZE_ZERO if message size is zero
SX_STATUS_MESSAGE_SIZE_EXCEEDS_LIMIT if message size exceeds limit
SX_STATUS_INVALID_HANDLE if a NULL handle is received
SX_STATUS_COMM_ERROR if client communication fails

◆ sx_api_mstp_inst_port_state_get()

sx_status_t sx_api_mstp_inst_port_state_get ( const sx_api_handle_t  handle,
const sx_swid_t  swid,
const sx_mstp_inst_id_t  inst_id,
const sx_port_log_id_t  log_port,
sx_mstp_inst_port_state_t *  port_state_p 
)

This function retrieves the MSTP port state for a given instance from the SDK.

In PVRST mode, instance id equals to vlan id. (In .1D mode instance id equals to bridge id) Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle
[in]swid- switch ID
[in]inst_id- MSTP instance ID. Range is <1-1024>
[in]log_port- Logical port ID (whose STP state to retrieve)
[out]port_state_p- MSTP port state
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_EXCEEDS_RANGE if a parameters exceeds its range
SX_STATUS_MESSAGE_SIZE_ZERO if message size is zero
SX_STATUS_MESSAGE_SIZE_EXCEEDS_LIMIT if message size exceeds limit
SX_STATUS_INVALID_HANDLE if a NULL handle is received
SX_STATUS_COMM_ERROR if client communication fails
SX_STATUS_PARAM_NULL if a parameter is NULL

◆ sx_api_rstp_port_state_set()

sx_status_t sx_api_rstp_port_state_set ( const sx_api_handle_t  handle,
const sx_port_log_id_t  log_port,
const sx_mstp_inst_port_state_t  port_state 
)

This function sets the RSTP port state in the SDK. Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle
[in]log_port- Logical port ID
[in]port_state- MSTP Port state Can take any of the following values: SX_MSTP_INST_PORT_STATE_DISCARDING SX_MSTP_INST_PORT_STATE_LEARNING, SX_MSTP_INST_PORT_STATE_FORWARDING
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_EXCEEDS_RANGE if a parameters exceeds its range
SX_STATUS_MESSAGE_SIZE_ZERO if message size is zero
SX_STATUS_MESSAGE_SIZE_EXCEEDS_LIMIT if message size exceeds limit
SX_STATUS_INVALID_HANDLE if a NULL handle is received
SX_STATUS_COMM_ERROR if client communication fails

◆ sx_api_rstp_port_state_get()

sx_status_t sx_api_rstp_port_state_get ( const sx_api_handle_t  handle,
const sx_port_log_id_t  log_port,
sx_mstp_inst_port_state_t *  port_state_p 
)

This function retrieves the RSTP port state from the SDK. Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle
[in]log_port- Logical Port ID
[out]port_state_p- MSTP Port State
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_EXCEEDS_RANGE if a parameters exceeds its range
SX_STATUS_MESSAGE_SIZE_ZERO if message size is zero
SX_STATUS_MESSAGE_SIZE_EXCEEDS_LIMIT if message size exceeds limit
SX_STATUS_INVALID_HANDLE if a NULL handle is received
SX_STATUS_COMM_ERROR if client communication fails
SX_STATUS_PARAM_NULL if a parameter is NULL

◆ sx_api_mstp_exclude_port_state_set()

sx_status_t sx_api_mstp_exclude_port_state_set ( const sx_api_handle_t  handle,
const sx_port_log_id_t  log_port,
const sx_mstp_exclude_port_state_t  port_state 
)

This function excludes a port from STP and sets forwarding state to all it's vlans. Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle
[in]log_port- Logical Port ID
[in]state- excluded state NORMAL/FORWARD
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_EXCEEDS_RANGE if a parameters exceeds its range
SX_STATUS_MESSAGE_SIZE_ZERO if message size is zero
SX_STATUS_MESSAGE_SIZE_EXCEEDS_LIMIT if message size exceeds limit
SX_STATUS_INVALID_HANDLE if a NULL handle is received
SX_STATUS_COMM_ERROR if client communication fails
SX_STATUS_PARAM_NULL if a parameter is NULL

◆ sx_api_mstp_exclude_port_state_get()

sx_status_t sx_api_mstp_exclude_port_state_get ( const sx_api_handle_t  handle,
const sx_port_log_id_t  log_port,
sx_mstp_exclude_port_state_t *  port_state_p 
)

This function retrieves exclude state for a port. Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle
[in]log_port- Logical Port ID
[out]state_p- excluded state, NORMAL/FORWARD
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_EXCEEDS_RANGE if a parameters exceeds its range
SX_STATUS_MESSAGE_SIZE_ZERO if message size is zero
SX_STATUS_MESSAGE_SIZE_EXCEEDS_LIMIT if message size exceeds limit
SX_STATUS_INVALID_HANDLE if a NULL handle is received
SX_STATUS_COMM_ERROR if client communication fails
SX_STATUS_PARAM_NULL if a parameter is NULL