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

Go to the source code of this file.

Functions

sx_status_t sx_api_span_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_span_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_span_session_set (const sx_api_handle_t handle, const sx_access_cmd_t cmd, const sx_span_session_params_t *span_session_params_p, sx_span_session_id_t *span_session_id_p)
 
sx_status_t sx_api_span_session_get (const sx_api_handle_t handle, const sx_span_session_id_t span_session_id, sx_span_session_params_t *span_session_params_p)
 
sx_status_t sx_api_span_session_iter_get (const sx_api_handle_t handle, const sx_access_cmd_t cmd, const sx_span_session_id_t *span_session_key_p, const sx_span_filter_t *filter_p, sx_span_session_id_t *span_session_list_p, uint32_t *span_session_cnt_p)
 
sx_status_t sx_api_span_session_state_set (const sx_api_handle_t handle, const sx_span_session_id_t span_session_id, const boolean_t admin_state)
 
sx_status_t sx_api_span_session_state_get (const sx_api_handle_t handle, const sx_span_session_id_t span_session_id, boolean_t *admin_state_p)
 
sx_status_t sx_api_span_session_analyzer_get (const sx_api_handle_t handle, const sx_span_session_id_t span_session_id, sx_port_log_id_t *analyzer_port_p)
 
sx_status_t sx_api_span_session_mirror_get (const sx_api_handle_t handle, const sx_span_session_id_t span_session_id, sx_span_mirror_t *mirror_ports_list_p, uint32_t *mirror_ports_cnt_p)
 
sx_status_t sx_api_span_mirror_set (const sx_api_handle_t handle, const sx_access_cmd_t cmd, const sx_port_log_id_t mirror_port, const sx_mirror_direction_t mirror_direction, const sx_span_session_id_t span_session_id)
 
sx_status_t sx_api_span_mirror_get (const sx_api_handle_t handle, const sx_port_log_id_t mirror_port, const sx_mirror_direction_t mirror_direction, sx_span_session_id_t *span_session_id_p)
 
sx_status_t sx_api_span_mirror_state_set (const sx_api_handle_t handle, const sx_port_log_id_t mirror_port, const sx_mirror_direction_t mirror_direction, const boolean_t admin_state)
 
sx_status_t sx_api_span_mirror_state_get (const sx_api_handle_t handle, const sx_port_log_id_t mirror_port, const sx_mirror_direction_t mirror_direction, boolean_t *admin_state_p)
 
sx_status_t sx_api_span_analyzer_set (const sx_api_handle_t handle, const sx_access_cmd_t cmd, const sx_port_log_id_t log_port, const sx_span_analyzer_port_params_t *port_params_p, const sx_span_session_id_t span_session_id)
 
sx_status_t sx_api_span_analyzer_get (const sx_api_handle_t handle, const sx_port_log_id_t log_port, sx_span_analyzer_port_params_t *port_params_p, sx_span_session_id_t *span_session_id_list_p, uint32_t *span_sessions_cnt_p)
 
sx_status_t sx_api_span_init_set (sx_api_handle_t handle, sx_span_init_params_t *init_params_p)
 
sx_status_t sx_api_span_deinit_set (sx_api_handle_t handle)
 
sx_status_t sx_api_span_session_counter_get (const sx_api_handle_t handle, const sx_access_cmd_t cmd, const sx_span_session_id_t span_session_id, sx_span_counter_set_t *counter_set_p)
 
sx_status_t sx_api_span_mirror_tables_set (const sx_api_handle_t handle, const sx_access_cmd_t cmd, const sx_span_session_id_t span_session_id)
 
sx_status_t sx_api_span_mirror_tables_get (const sx_api_handle_t handle, sx_span_session_id_t *span_session_id_p)
 
sx_status_t sx_api_span_drop_mirror_set (const sx_api_handle_t handle, const sx_access_cmd_t cmd, const sx_span_session_id_t span_session_id, const sx_span_drop_mirroring_attr_t *drop_mirroring_attr_p, const sx_span_drop_reason_t *drop_reason_list_p, const uint32_t drop_reason_cnt)
 
sx_status_t sx_api_span_drop_mirror_get (const sx_api_handle_t handle, const sx_span_session_id_t span_session_id, sx_span_drop_mirroring_attr_t *drop_mirroring_attr_p, sx_span_drop_reason_t *drop_reason_list_p, uint32_t *drop_reason_cnt_p)
 
sx_status_t sx_api_span_mirror_bind_set (const sx_api_handle_t handle, const sx_access_cmd_t cmd, const sx_span_mirror_bind_key_t *key_p, const sx_span_mirror_bind_attr_t *attr_p)
 
sx_status_t sx_api_span_mirror_bind_get (const sx_api_handle_t handle, const sx_span_mirror_bind_key_t *key_p, sx_span_mirror_bind_attr_t *attr_p)
 
sx_status_t sx_api_span_session_mirror_bound_get (const sx_api_handle_t handle, const sx_span_session_id_t span_session_id, sx_span_mirror_bind_key_t *mirror_bind_key_list_p, uint32_t *mirror_bind_key_cnt_p)
 
sx_status_t sx_api_span_mirror_enable_set (const sx_api_handle_t handle, const sx_access_cmd_t cmd, const sx_span_mirror_enable_object_t *object_p, const sx_span_mirror_enable_attr_t *attr_p)
 
sx_status_t sx_api_span_mirror_enable_get (const sx_api_handle_t handle, const sx_span_mirror_enable_object_t *object_p, sx_span_mirror_enable_attr_t *attr_p)
 
sx_status_t sx_api_span_mirror_enable_iter_get (const sx_api_handle_t handle, const sx_access_cmd_t cmd, sx_span_mirror_enable_object_t *object_key_p, sx_span_mirror_enable_iter_filter_t *filter_p, sx_span_mirror_enable_object_t *object_list_p, uint32_t *object_cnt_p)
 
sx_status_t sx_api_span_header_time_stamp_set (const sx_api_handle_t handle, const sx_access_cmd_t cmd, sx_span_hdr_ts_config_t span_ts)
 

Function Documentation

◆ sx_api_span_log_verbosity_level_set()

sx_status_t sx_api_span_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 SPAN MODULE Supported devices: Spectrum, Spectrum2.

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

◆ sx_api_span_log_verbosity_level_get()

sx_status_t sx_api_span_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 SPAN 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- SPAN module verbosity level
[out]api_verbosity_level_p- SPAN API verbosity level
Returns
SX_STATUS_SUCCESS if operation completes successfully SX_STATUS_PARAM_ERROR if any input parameters is invalid SX_STATUS_ERROR general error

◆ sx_api_span_session_set()

sx_status_t sx_api_span_session_set ( const sx_api_handle_t  handle,
const sx_access_cmd_t  cmd,
const sx_span_session_params_t *  span_session_params_p,
sx_span_session_id_t *  span_session_id_p 
)

This function creates a SPAN session and allocate the session id. To modify the session attributes, the API should be called with cmd= EDIT, the session's ID and the new session's attributes. To delete a SPAN session the API should be called we cmd = DESTROY. In Spectrum, EDIT need another session resource as interim session, so if all session resource are already allocated, EDIT will be failed due to no resource. In case packet with encapsulation header is mirrored to analyzer port with size larger than analyzer port MTU, truncation should be enabled by user to avoid packet being discarded. User should set truncate size = MTU - encapsulation or smaller.

Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle.
[in]access_cmd- CREATE / EDIT / DESTROY
[in]span_session_params_p- Generic SPAN session params
[in,out]span_session_id_p- SPAN session ID
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_NULL if pointer params is NULL
SX_STATUS_PARAM_ERROR if any input parameter is invalid
SX_STATUS_ACCESS_CMD_UNSUPPORTED if unsupported command is requested
SX_STATUS_ENTRY_NOT_FOUND if requested element is not found in DB
SX_STATUS_SXD_RETURNED_NON_ZERO if SxD driver function returns fail
SX_STATUS_NO_MEMORY if problems with memory allocation occurs
SX_STATUS_NO_RESOURCES if pool cannot provide object
SX_STATUS_ERROR if unexpected behavior occurs
SX_STATUS_INVALID_HANDLE if handle is invalid

◆ sx_api_span_session_get()

sx_status_t sx_api_span_session_get ( const sx_api_handle_t  handle,
const sx_span_session_id_t  span_session_id,
sx_span_session_params_t *  span_session_params_p 
)

This function gets the SPAN session information. Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle.
[in]span_session_id- SPAN session ID
[out]span_session_params- session params
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_ERROR if any input parameter is invalid
SX_STATUS_ENTRY_NOT_FOUND if requested element is not found in DB
SX_STATUS_ERROR if unexpected behavior occurs
SX_STATUS_INVALID_HANDLE if handle is invalid

◆ sx_api_span_session_iter_get()

sx_status_t sx_api_span_session_iter_get ( const sx_api_handle_t  handle,
const sx_access_cmd_t  cmd,
const sx_span_session_id_t *  span_session_key_p,
const sx_span_filter_t *  filter_p,
sx_span_session_id_t *  span_session_list_p,
uint32_t *  span_session_cnt_p 
)

This function iteratively returns the current SPAN sessions . Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle.
[in]cmd- supported commands:GET/GET_FIRST/GETNEXT
[in]span_session_key_p- A reference span session id key
[in]filter_p- Return only span sessions that match this filter param if enabled
[out]span_session_list_p- return list of span session ids
[in,out]span_session_cnt- [in] number of sessions to get [out] number of sessions retrieved

The following use case scenarios apply with different input parameters X = don't-care

  • 1) cmd = SX_ACCESS_CMD_GET, key = X, Filter = X, list = X, Count = 0: In this case the API will return the total number of span session count from internal db.
  • 2) cmd = SX_ACCESS_CMD_GET, key = valid/invalid, Filter = X, list = Valid, Count = 1: In this case the API will check if the specified key exists. if it does the key will be returned in the list along with a count of 1. If the key does not exist an empty list will be returned with count = 0
  • 3) cmd = SX_ACCESS_CMD_GET, key = valid, Filter = X, list is Valid, Count > 1: A count >1 will be treated as a count of 1 and the behaviour will be same as earlier GET use cases.
  • 4) cmd = SX_ACCESS_CMD_GET_FIRST/SX_ACCESS_CMD_GETNEXT, key = X, Filter = X, list = Null, Count = 0: For either SX_ACCESS_CMD_GET_FIRST/SX_ACCESS_CMD_GETNEXT a zero count will return an empty list.
  • 5) cmd = SX_ACCESS_CMD_GET_FIRST, key = X, Filter = X, list = Valid, Count > 0: In this case the API will return the first span session IDs starting from the head of the database. The total elements fetched will be returned as the return count. Note: return count may be less than or equal to the requested count. The key is dont-care but a non-Null return list pointer must be provided.
  • 6) cmd = SX_ACCESS_CMD_GETNEXT, key = valid/invalid, Filter = X, list = Valid, Count > 0: In this case the API will return the next set of IDs starting from the next valid span session id after the specified key. The total elements fetched will be returned as the return count. Note: return count may be less than or equal to the requested count. If no valid next counter exists in the DB (key = end of list, or invalid key specified, or key too large), an empty list will be returned.
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_ERROR if any input parameter is invalid
SX_STATUS_ENTRY_NOT_FOUND if requested element is not found in DB
SX_STATUS_ERROR if unexpected behavior occurs
SX_STATUS_CMD_UNSUPPORTED - if invalid cmd is passed
SX_STATUS_DB_NOT_INITIALIZED - if internal DB is not initialized

◆ sx_api_span_session_state_set()

sx_status_t sx_api_span_session_state_set ( const sx_api_handle_t  handle,
const sx_span_session_id_t  span_session_id,
const boolean_t  admin_state 
)

This function set SPAN session Admin State. Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle.
[in]span_session_id- SPAN session ID
[in]admin_state- SPAN session Admin state (Enable/Disable).
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_ERROR if any input parameter is invalid
SX_STATUS_ENTRY_NOT_FOUND if requested element is not found in DB
SX_STATUS_ERROR if unexpected behavior occurs
SX_STATUS_INVALID_HANDLE if handle is invalid

◆ sx_api_span_session_state_get()

sx_status_t sx_api_span_session_state_get ( const sx_api_handle_t  handle,
const sx_span_session_id_t  span_session_id,
boolean_t *  admin_state_p 
)

This function gets the SPAN session Admin State. Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle.
[in]span_session_id- SPAN session ID
[out]admin_state- SPAN session Admin state (Enable/Disable).
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_ERROR if any input parameter is invalid
SX_STATUS_ENTRY_NOT_FOUND if requested element is not found in DB
SX_STATUS_ERROR if unexpected behavior occurs
SX_STATUS_INVALID_HANDLE if handle is invalid

◆ sx_api_span_session_analyzer_get()

sx_status_t sx_api_span_session_analyzer_get ( const sx_api_handle_t  handle,
const sx_span_session_id_t  span_session_id,
sx_port_log_id_t *  analyzer_port_p 
)

This function gets the analyzer port assigned to the SPAN session. Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle.
[in]span_session_id- SPAN session ID
[out]analyzer_port- analyzer port
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_ERROR if any input parameter is invalid
SX_STATUS_ENTRY_NOT_FOUND if requested element is not found in DB
SX_STATUS_ERROR if unexpected behavior occurs
SX_STATUS_INVALID_HANDLE if handle is invalid

◆ sx_api_span_session_mirror_get()

sx_status_t sx_api_span_session_mirror_get ( const sx_api_handle_t  handle,
const sx_span_session_id_t  span_session_id,
sx_span_mirror_t *  mirror_ports_list_p,
uint32_t *  mirror_ports_cnt_p 
)

This function gets the mirror ports assigned to the SPAN session. Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle.
[in]span_session_id- SPAN session ID
[out]mirror_ports_list_p- array of mirror ports
[in,out]mirror_ports_cnt_p- num of mirror ports
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_ERROR if any input parameter is invalid
SX_STATUS_ENTRY_NOT_FOUND if requested element is not found in DB
SX_STATUS_ERROR if unexpected behavior occurs
SX_STATUS_INVALID_HANDLE if handle is invalid

◆ sx_api_span_mirror_set()

sx_status_t sx_api_span_mirror_set ( const sx_api_handle_t  handle,
const sx_access_cmd_t  cmd,
const sx_port_log_id_t  mirror_port,
const sx_mirror_direction_t  mirror_direction,
const sx_span_session_id_t  span_session_id 
)

This function sets the SPAN mirror ports. Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle.
[in]cmd- ADD / DELETE
[in]mirror_port- mirror port
[in]mirror_direction- mirror direction: ingress/ egress
[in]span_session_id- SPAN session id
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_ERROR if any input parameter is invalid
SX_STATUS_ACCESS_CMD_UNSUPPORTED if unsupported command is requested
SX_STATUS_ENTRY_NOT_FOUND if requested element is not found in DB
SX_STATUS_NO_RESOURCES if pool cannot provide object
SX_STATUS_ERROR if unexpected behavior occurs*
SX_STATUS_INVALID_HANDLE if handle is invalid

◆ sx_api_span_mirror_get()

sx_status_t sx_api_span_mirror_get ( const sx_api_handle_t  handle,
const sx_port_log_id_t  mirror_port,
const sx_mirror_direction_t  mirror_direction,
sx_span_session_id_t *  span_session_id_p 
)

This function get the SPAN session id and direction by mirror port . Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle.
[in]mirror_port- mirror port
[in]mirror_direction- mirror direction ingress/ egress
[out]span_session_id_p- SPAN session ID
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_ERROR if any input parameter is invalid
SX_STATUS_ENTRY_NOT_FOUND if requested element is not found in DB
SX_STATUS_ERROR if unexpected behavior occurs
SX_STATUS_INVALID_HANDLE if handle is invalid

◆ sx_api_span_mirror_state_set()

sx_status_t sx_api_span_mirror_state_set ( const sx_api_handle_t  handle,
const sx_port_log_id_t  mirror_port,
const sx_mirror_direction_t  mirror_direction,
const boolean_t  admin_state 
)

This function sets the SPAN mirror port Admin state. Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle.
[in]mirror_port- mirror port
[in]mirror_direction- mirror direction: ingress/ egress
[in]span_session_id- SPAN session id
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_ERROR if any input parameter is invalid
SX_STATUS_ACCESS_CMD_UNSUPPORTED if unsupported command is requested
SX_STATUS_ENTRY_NOT_FOUND if requested element is not found in DB
SX_STATUS_NO_RESOURCES if pool cannot provide object
SX_STATUS_ERROR if unexpected behavior occurs*
SX_STATUS_INVALID_HANDLE if handle is invalid

◆ sx_api_span_mirror_state_get()

sx_status_t sx_api_span_mirror_state_get ( const sx_api_handle_t  handle,
const sx_port_log_id_t  mirror_port,
const sx_mirror_direction_t  mirror_direction,
boolean_t *  admin_state_p 
)

This function get the SPAN session id and direction by mirror port . Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle.
[in]mirror_port- mirror port
[in]mirror_direction- mirror direction ingress/ egress
[out]span_session_id_p- SPAN session ID
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_ERROR if any input parameter is invalid
SX_STATUS_ENTRY_NOT_FOUND if requested element is not found in DB
SX_STATUS_ERROR if unexpected behavior occurs
SX_STATUS_INVALID_HANDLE if handle is invalid

◆ sx_api_span_analyzer_set()

sx_status_t sx_api_span_analyzer_set ( const sx_api_handle_t  handle,
const sx_access_cmd_t  cmd,
const sx_port_log_id_t  log_port,
const sx_span_analyzer_port_params_t *  port_params_p,
const sx_span_session_id_t  span_session_id 
)

This function sets the SPAN analyzer ports. Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle.
[in]cmd- ADD / DELETE
[in]log_port- analyzer port which added to SPAN
[in]port_params- analyzer port parameters
[in]span_session_id- SPAN session ID
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_ERROR if any input parameter is invalid
SX_STATUS_ENTRY_NOT_FOUND if requested element is not found in DB
SX_STATUS_ERROR if unexpected behavior occurs
SX_STATUS_INVALID_HANDLE if handle is invalid

◆ sx_api_span_analyzer_get()

sx_status_t sx_api_span_analyzer_get ( const sx_api_handle_t  handle,
const sx_port_log_id_t  log_port,
sx_span_analyzer_port_params_t *  port_params_p,
sx_span_session_id_t *  span_session_id_list_p,
uint32_t *  span_sessions_cnt_p 
)

This function gets the SPAN by analyzer ports. Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle.
[in]log_port- analyzer port which added to SPAN
[out]port_params_p- analyzer port parameters
[out]span_session_id_list_p- SPAN session ID array
[in,out]span_session_cnt_p- SPAN sessions num
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_ERROR if any input parameter is invalid
SX_STATUS_ENTRY_NOT_FOUND if requested element is not found in DB
SX_STATUS_ERROR if unexpected behavior occurs
SX_STATUS_INVALID_HANDLE if handle is invalid

◆ sx_api_span_init_set()

sx_status_t sx_api_span_init_set ( sx_api_handle_t  handle,
sx_span_init_params_t *  init_params_p 
)

This function initializes certain aspects of SPAN module behaviour. Currently the only data item controlled by this API is the version of headers attached to mirrored packets. The following rules apply:

  • Calling it is optional in Spectrum. If not called, default module configuration is used.
  • Mirroring resources may be allocated without calling this function, using default settings.
  • The function may be called repeatedly, to change configuration, but only if a call to sx_api_span_deinit_set intervenes.
  • The function fails if any mirroring sessions are already allocated when it is called.

Supported devices: Spectrum, Spectrum2.

Parameters
[in]handleSX-API handle.
[in]init_params_pmodule configuration parameters
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_ERROR if any input parameter is invalid
SX_STATUS_ERROR if unexpected behavior occurs
SX_STATUS_INVALID_HANDLE if handle is invalid
SX_STATUS_ALREADY_INITIALIZED if any mirroring resources are already allocated
SX_STATUS_ALREADY_INITIALIZED if called twice without intervening call to sx_api_span_deinit_set

◆ sx_api_span_deinit_set()

sx_status_t sx_api_span_deinit_set ( sx_api_handle_t  handle)

This function undoes sx_api_span_init_set by returning configured parameters to default. The following rules apply:

  • Calls to this function require a prior call to sx_api_span_init_set.
  • The function fails if any mirroring sessions are already allocated when it is called.

Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle.
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_ERROR if unexpected behavior occurs
SX_STATUS_INVALID_HANDLE if handle is invalid
SX_STATUS_RESOURCE_IN_USE if any mirroring resources are already allocated
SX_STATUS_DB_NOT_INITIALIZED if called without prior call to sx_api_span_init_set

◆ sx_api_span_session_counter_get()

sx_status_t sx_api_span_session_counter_get ( const sx_api_handle_t  handle,
const sx_access_cmd_t  cmd,
const sx_span_session_id_t  span_session_id,
sx_span_counter_set_t *  counter_set_p 
)

This function retrieves or clears dropped packet counters for a mirroring session.

Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle.
[in]cmd- READ / READ_CLEAR
[in]span_session_id- SPAN session ID
[out]counter_set_p- set of counter values
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_UNSUPPORTED if not supported on this device
SX_STATUS_CMD_UNSUPPORTED if cmd parameter is invalid
SX_STATUS_PARAM_ERROR if any input parameter is invalid
SX_STATUS_ENTRY_NOT_FOUND if requested element is not found in DB
SX_STATUS_ERROR if unexpected behavior occurs
SX_STATUS_INVALID_HANDLE if handle is invalid

◆ sx_api_span_mirror_tables_set()

sx_status_t sx_api_span_mirror_tables_set ( const sx_api_handle_t  handle,
const sx_access_cmd_t  cmd,
const sx_span_session_id_t  span_session_id 
)

This function enables or disables mirroring via the MIRROR trap id, for modules whose own API does not refer to an explicit mirroring session. When enabling, it associates the trap group to which the MIRROR trap id is mapped with the given mirroring session. Disabling breaks that association. It is permitted to call the function repeatedly to replace one mirroring session with another.

Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle.
[in]cmd- ADD / DELETE
[in]span_session_id- SPAN session ID
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_CMD_UNSUPPORTED if not supported on this device
SX_STATUS_PARAM_ERROR if any input parameter is invalid
SX_STATUS_ENTRY_NOT_FOUND if requested element is not found in DB
SX_STATUS_ERROR if unexpected behavior occurs
SX_STATUS_INVALID_HANDLE if handle is invalid

◆ sx_api_span_mirror_tables_get()

sx_status_t sx_api_span_mirror_tables_get ( const sx_api_handle_t  handle,
sx_span_session_id_t *  span_session_id_p 
)

This function retrieves the mirroring session configured for mirroring via the MIRROR trap id, for modules whose own API does not refer to an explicit mirroring session.

Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle.
[out]span_session_id_p- SPAN session ID
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_CMD_UNSUPPORTED if not supported on this device
SX_STATUS_ENTRY_NOT_FOUND if no mirroring session exists
SX_STATUS_ERROR if unexpected behavior occurs
SX_STATUS_INVALID_HANDLE if handle is invalid

◆ sx_api_span_drop_mirror_set()

sx_status_t sx_api_span_drop_mirror_set ( const sx_api_handle_t  handle,
const sx_access_cmd_t  cmd,
const sx_span_session_id_t  span_session_id,
const sx_span_drop_mirroring_attr_t *  drop_mirroring_attr_p,
const sx_span_drop_reason_t *  drop_reason_list_p,
const uint32_t  drop_reason_cnt 
)

This function configures mirroring to a SPAN session of dropped packets. SET: Sets the SPAN session to the new settings, overriding current configuration. ADD: Add more Drop Reasons to the existing configuration. DELETE: Remove Drop Reasons from existing configuration. DELETE_ALL: Remove all Drop Reasons from existing configuration. Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle.
[in]cmd- SET / ADD / DELETE / DELETE_ALL
[in]span_session_id- SPAN session ID
[in]drop_mirroring_attr_p- Drop Mirroring configuration, only valid for SET.
[in]drop_reason_list_p- List of Drop Reasons, ignored for DELETE_ALL.
[in]drop_reason_cnt- Count of Drop Reasons, ignored for DELETE_ALL.
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_CMD_UNSUPPORTED if not supported on this device
SX_STATUS_PARAM_ERROR if any input parameter is invalid
SX_STATUS_ENTRY_NOT_FOUND if requested element is not found in DB
SX_STATUS_ERROR if unexpected behavior occurs
SX_STATUS_INVALID_HANDLE if handle is invalid

◆ sx_api_span_drop_mirror_get()

sx_status_t sx_api_span_drop_mirror_get ( const sx_api_handle_t  handle,
const sx_span_session_id_t  span_session_id,
sx_span_drop_mirroring_attr_t *  drop_mirroring_attr_p,
sx_span_drop_reason_t *  drop_reason_list_p,
uint32_t *  drop_reason_cnt_p 
)

This function retrieves the mirroring session drop reasons configured for router-drop mirroring via the trap ids for router drops. If drop_reason_list is NULL, the number of drop reasons will be returned in drop_reason_cnt.

Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle.
[in]span_session_id- SPAN session ID
[out]drop_mirroring_attr_p- Drop Mirroring configuration
[out]drop_reason_list_p- List of Drop Reasons
[out]drop_reason_cnt_p- Count of Drop Reasons
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_CMD_UNSUPPORTED if not supported on this device
SX_STATUS_PARAM_ERROR if any input parameter is invalid
SX_STATUS_ERROR if unexpected behavior occurs
SX_STATUS_INVALID_HANDLE if handle is invalid

◆ sx_api_span_mirror_bind_set()

sx_status_t sx_api_span_mirror_bind_set ( const sx_api_handle_t  handle,
const sx_access_cmd_t  cmd,
const sx_span_mirror_bind_key_t *  key_p,
const sx_span_mirror_bind_attr_t *  attr_p 
)

This function binds the mirror binding point to span session with sampling rate.

Supported devices: Spectrum, Spectrum.

Parameters
[in]handle- SX-API handle
[in]cmd- bind/unbind
[in]key- bind key
[in]attr- bind attribute
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_ERROR if any input parameter is invalid
SX_STATUS_PARAM_NULL if any input parameter is NULL
SX_STATUS_ACCESS_CMD_UNSUPPORTED if unsupported command is requested
SX_STATUS_ENTRY_ALREADY_BOUND if requested element is not found in DB
SX_STATUS_ERROR if unexpected behavior occurs
SX_STATUS_INVALID_HANDLE if handle is invalid

◆ sx_api_span_mirror_bind_get()

sx_status_t sx_api_span_mirror_bind_get ( const sx_api_handle_t  handle,
const sx_span_mirror_bind_key_t *  key_p,
sx_span_mirror_bind_attr_t *  attr_p 
)

This function gets the mirror binding attribute

Supported devices: Spectrum, Spectrum2.

Parameters
[in]handle- SX-API handle
[in]key_p- bind key
[out]attr_p- bind attribute
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_ERROR if any input parameter is invalid
SX_STATUS_PARAM_NULL if any input parameter is NULL
SX_STATUS_ACCESS_CMD_UNSUPPORTED if unsupported command is requested
SX_STATUS_ENTRY_NOT_BOUND if requested element is not found in DB
SX_STATUS_ERROR if unexpected behavior occurs
SX_STATUS_INVALID_HANDLE if handle is invalid

◆ sx_api_span_session_mirror_bound_get()

sx_status_t sx_api_span_session_mirror_bound_get ( const sx_api_handle_t  handle,
const sx_span_session_id_t  span_session_id,
sx_span_mirror_bind_key_t *  mirror_bind_key_list_p,
uint32_t *  mirror_bind_key_cnt_p 
)

This function gets the mirror type bound to the SPAN session. Supported devices: Spectrum2.

Parameters
[in]handle- SX-API handle.
[in]span_session_id- SPAN session ID
[out]mirror_bind_key_list_p- array of mirror bind keys
[in,out]mirror_bind_key_cnt_p- num of mirror bind keys
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_ERROR if any input parameter is invalid
SX_STATUS_PARAM_NULL if any input parameter is NULL
SX_STATUS_ENTRY_NOT_FOUND if requested element is not found in DB
SX_STATUS_ERROR if unexpected behavior occurs
SX_STATUS_INVALID_HANDLE if handle is invalid

◆ sx_api_span_mirror_enable_set()

sx_status_t sx_api_span_mirror_enable_set ( const sx_api_handle_t  handle,
const sx_access_cmd_t  cmd,
const sx_span_mirror_enable_object_t *  object_p,
const sx_span_mirror_enable_attr_t *  attr_p 
)

This function enables mirroring on mirror object which is port TC or port PG or port on different mirror enable type

Supported devices: Spectrum2.

Parameters
[in]handle- SX-API handle
[in]cmd- set/delete
[in]object_p- mirror enable object
[in]attr_p- mirror enable attribute
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_ERROR if any input parameter is invalid
SX_STATUS_ERROR if unexpected behavior occurs
SX_STATUS_INVALID_HANDLE if handle is invalid

◆ sx_api_span_mirror_enable_get()

sx_status_t sx_api_span_mirror_enable_get ( const sx_api_handle_t  handle,
const sx_span_mirror_enable_object_t *  object_p,
sx_span_mirror_enable_attr_t *  attr_p 
)

This function get the enable attribute for mirror object

Supported devices: Spectrum2.

Parameters
[in]handle- SX-API handle
[in]object_p- mirror enable object
[out]attr_p- mirror enable attribute
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_ENTRY_NOT_FOUND if input object is not found
SX_STATUS_PARAM_ERROR if any input parameter is invalid
SX_STATUS_PARAM_NULL if any input parameter is NULL
SX_STATUS_ERROR if unexpected behavior occurs
SX_STATUS_INVALID_HANDLE if handle is invalid

◆ sx_api_span_mirror_enable_iter_get()

sx_status_t sx_api_span_mirror_enable_iter_get ( const sx_api_handle_t  handle,
const sx_access_cmd_t  cmd,
sx_span_mirror_enable_object_t *  object_key_p,
sx_span_mirror_enable_iter_filter_t *  filter_p,
sx_span_mirror_enable_object_t *  object_list_p,
uint32_t *  object_cnt_p 
)

This function iteratively returns the objects per object type. Supported devices: Spectrum2.

Parameters
[in]handle- SX-API handle.
[in]cmd- supported commands:GET/GET_FIRST/GETNEXT
[in]object_key_p- A reference mirror enable object key
[in]filter_p- Return only enabled object that match this filter param if valid
[out]object_list_p- return list of objects
[in,out]object_cnt_p- [in] number of objects to get [out] number of objects retrieved
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_ERROR if any input parameter is invalid
SX_STATUS_PARAM_NULL if any input parameter is NULL
SX_STATUS_ENTRY_NOT_FOUND if requested element is not found in DB
SX_STATUS_ERROR if unexpected behavior occurs
SX_STATUS_CMD_UNSUPPORTED - if invalid cmd is passed
SX_STATUS_DB_NOT_INITIALIZED - if internal DB is not initialized

◆ sx_api_span_header_time_stamp_set()

sx_status_t sx_api_span_header_time_stamp_set ( const sx_api_handle_t  handle,
const sx_access_cmd_t  cmd,
sx_span_hdr_ts_config_t  span_ts 
)

Set current UTC time in the device that is used to update timestamp in SPAN headers. Note - This API should not be used when PTP protocol is active and running. Note - UTC is also used for updating time stamp for ingress/egress packets to/from CPU.

Supported devices: Spectrum, Spectrum2.

Parameters: [in] handle - SX-API handle [in] cmd - SX_ACCESS_CMD_SET [in] span_ts - current UTC time configuration.

Returns: SX_STATUS_SUCCESS if operation completes successfully SX_STATUS_PARAM_ERROR if input parameter is invalid SX_STATUS_ERROR general error