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

Go to the source code of this file.

Functions

sx_status_t sx_api_tele_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_tele_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_tele_init_set (const sx_api_handle_t handle, sx_tele_init_params_t *params_p)
 
sx_status_t sx_api_tele_deinit_set (const sx_api_handle_t handle)
 
sx_status_t sx_api_tele_histogram_set (const sx_api_handle_t handle, const sx_access_cmd_t cmd, const sx_tele_histogram_key_t key, const sx_tele_histogram_attributes_data_t data)
 
sx_status_t sx_api_tele_histogram_get (const sx_api_handle_t handle, const sx_access_cmd_t cmd, const sx_tele_histogram_key_t key, sx_tele_histogram_attributes_data_t *data_p)
 
sx_status_t sx_api_tele_histogram_iter_get (const sx_api_handle_t handle, const sx_access_cmd_t cmd, const sx_tele_histogram_key_t *hist_key_p, const sx_tele_histogram_filter_t filter, sx_tele_histogram_key_t *hist_list_p, uint32_t *hist_cnt_p)
 
sx_status_t sx_api_tele_histogram_data_get (const sx_api_handle_t handle, const sx_access_cmd_t cmd, const sx_tele_histogram_key_t key, sx_tele_histogram_data_t *histogram_p)
 
sx_status_t sx_api_tele_threshold_set (const sx_api_handle_t handle, const sx_access_cmd_t cmd, const sx_tele_threshold_key_t key, const sx_tele_threshold_data_t data)
 
sx_status_t sx_api_tele_threshold_get (const sx_api_handle_t handle, const sx_access_cmd_t cmd, const sx_tele_threshold_key_t key, sx_tele_threshold_data_t *data_p)
 
sx_status_t sx_api_tele_threshold_crossed_data_get (const sx_api_handle_t handle, const sx_access_cmd_t cmd, const sx_tele_threshold_key_t *key_p, sx_tele_threshold_crossed_data_t *crossed_data_p, const uint32_t key_cnt)
 

Function Documentation

◆ sx_api_tele_log_verbosity_level_set()

sx_status_t sx_api_tele_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 
)

Sets the log verbosity level of TELEMETRY MODULE. Supported devices: SwitchX, SwitchX2, Spectrum.

Parameters
[in]handle- SX-API handle
[in]verbosity_target- set verbosity of : API / MODULE / BOTH
[in]module_verbosity_level- TELEMETRY module verbosity level
[in]api_verbosity_level- TELEMETRY 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_tele_log_verbosity_level_get()

sx_status_t sx_api_tele_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 
)

Gets the log verbosity level of TELEMETRY MODULE. Supported devices: SwitchX, SwitchX2, Spectrum.

Parameters
[in]handle- SX-API handle
[in]verbosity_target- get verbosity of : API / MODULE / BOTH
[out]module_verbosity_level_p- TELEMETRY module verbosity level
[out]api_verbosity_level_p- TELEMETRY 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_tele_init_set()

sx_status_t sx_api_tele_init_set ( const sx_api_handle_t  handle,
sx_tele_init_params_t *  params_p 
)

This API is used to initialize telemetry module. Supported devices: Spectrum.

Parameters
[in]handle- SX-API handle
[in]params_p- pointer to init params structure.
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_NO_RESOURCES if cannot allocate resources for telemetry.
SX_STATUS_ERROR general error

◆ sx_api_tele_deinit_set()

sx_status_t sx_api_tele_deinit_set ( const sx_api_handle_t  handle)

This API is used to deinit telemetry module. Supported devices: Spectrum.

Parameters
[in]handle- SX-API handle
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_ERROR general error

◆ sx_api_tele_histogram_set()

sx_status_t sx_api_tele_histogram_set ( const sx_api_handle_t  handle,
const sx_access_cmd_t  cmd,
const sx_tele_histogram_key_t  key,
const sx_tele_histogram_attributes_data_t  data 
)

Sets the queue depth histogram attributes. Command SET sets the histogram attributes described on key to attributes_data

For spectrum: sample time is global, last configured sample time applied to all histograms.

Supported devices: Spectrum.

Parameters
[in]handle- SX-API handle.
[in]cmd- SET/EDIT/DESTORY.
[in]attributes_key- queue depth histogram key.
[in]attributes_data- queue depth histogram attributes data.
Returns
SX_STATUS_SUCCESS if operation completes successfully.
SX_STATUS_PARAM_ERROR if any input parameter is invalid.
SX_STATUS_NO_RESOURCES if there are no resources for the operation.
SX_STAUS_ERROR on internal error.

◆ sx_api_tele_histogram_get()

sx_status_t sx_api_tele_histogram_get ( const sx_api_handle_t  handle,
const sx_access_cmd_t  cmd,
const sx_tele_histogram_key_t  key,
sx_tele_histogram_attributes_data_t *  data_p 
)

Retrieves the histogram attributes data that match the key.

Supported devices: Spectrum.

Parameters
[in]handle- SX-API handle.
[in]cmd- GET
[in]key- queue depth histogram key.
[out]data_p- queue depth histogram attributes data pointer.
Returns
SX_STATUS_SUCCESS if operation completes successfully.
SX_STATUS_PARAM_ERROR if any input parameter is invalid.
SX_STATUS_CMD_UNSUPPORTED if access command isn't supported.
SX_STAUS_ERROR general error.

◆ sx_api_tele_histogram_iter_get()

sx_status_t sx_api_tele_histogram_iter_get ( const sx_api_handle_t  handle,
const sx_access_cmd_t  cmd,
const sx_tele_histogram_key_t *  hist_key_p,
const sx_tele_histogram_filter_t  filter,
sx_tele_histogram_key_t *  hist_list_p,
uint32_t *  hist_cnt_p 
)

This function returns a list of one or more histogram keys. The following use case scenarios apply with different input parameters X = don't-care

  • 1) cmd = SX_ACCESS_CMD_GET, key = X, Filter = X, hist_list = X, Count =0: In this case the API will return the total number of histograms in the Internal db
  • 2) cmd = SX_ACCESS_CMD_GET, key = valid/invalid, Filter = X, hist_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 hist_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 = Valid, hist_list is Valid, Count =1: In this case the API will check if the specified key exists. if it does it will check it against the filter parameter. If the filter matches, the key will be returned in the hist_list along with a count of 1. If the key does not exist or the filter does not match an empty list will be returned with count = 0
  • 4) cmd = SX_ACCESS_CMD_GET, key = valid, Filter = Valid/invalid, hist_list is Valid, Count > 1: A count >1 will be treated as a count of 1 and the behavior will be same as earlier GET use cases.
  • 5) cmd = SX_ACCESS_CMD_GET_FIRST/SX_ACCESS_CMD_GETNEXT, key = X, Filter = X, hist_list = Null, Count =0: For either SX_ACCESS_CMD_GET_FIRST/SX_ACCESS_CMD_GETNEXT a zero count will return an empty list.
  • 6) cmd = SX_ACCESS_CMD_GET_FIRST, key = X, Filter = valid/invalid, hist_list = Valid, Count > 0: In this case the API will return the first count histograms 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. If a filter is specified only those histograms that match the filter will be returned. a non-Null return hist_list pointer must be provided
  • 7) cmd = SX_ACCESS_CMD_GETNEXT, key = valid/invalid, Filter = valid/invalid, hist_list = Valid, Count > 0: In this case the API will return the next set of histograms starting from the next valid histogram after the specified key. The total elements fetched will be returned as the return count. If a filter is specified only those histograms that match the filter will be returned. Note: return count may be less than or equal to the requested count. If no valid next histogram exists in the db (key = end of list, or invalid key specified, or key too large), an empty list will be returned.

Supported devices: Spectrum.

Parameters
[in]handle: SX API handle
[in]cmd: GET/GET_FIRST/GET_NEXT
[in]hist_key_p:specify a histogram key
[in]filter: specify a filter parameter
[out]hist_list_p: return list of histogram keys
[in,out]hist_cnt_p: [in] number of histograms to get. max 20 : [out] number of histograms returned
Returns
SX_STATUS_SUCCESS if operation completes successfully.
SX_STATUS_PARAM_ERROR if any input parameter is invalid.
SX_STATUS_ERROR general error.
SX_STATUS_CMD_UNSUPPORTED - if invalid cmd is passed
SX_STATUS_MODULE_UNINITIALIZED - if router module is uninitialized
SX_STATUS_CMD_ERROR - if internal RPC mechanism to SDK server fails
SX_STATUS_DB_NOT_INITIALIZED - if internal RIF DB is not initialized

◆ sx_api_tele_histogram_data_get()

sx_status_t sx_api_tele_histogram_data_get ( const sx_api_handle_t  handle,
const sx_access_cmd_t  cmd,
const sx_tele_histogram_key_t  key,
sx_tele_histogram_data_t *  histogram_p 
)

Retrieves the histogram data. Where histogram is created, histogram data is being sampled. The occupancy is being sampled according to the attributes configured in sx_api_tele_histogram_set. The relevant bin is being increased according to the current sample occupancy.

For Spectrum: Bin sampling stop when one of the bins reaches max value by bits according to resource manager variable tele_histogram_data_bin_bits_max.

Supported devices: Spectrum.

Parameters
[in]handle- SX-API handle.
[in]cmd- SX_ACCESS_CMD_READ | SX_ACCESS_CMD_READ_CLEAR
[in]key- queue depth histogram key.
[out]histogram_p- queue depth histogram data. out - num of bins and bins.
Returns
SX_STATUS_SUCCESS if operation completes successfully.
SX_STATUS_PARAM_ERROR if any input parameter is invalid.
SX_STATUS_CMD_UNSUPPORTED if access command isn't supported.
SX_STAUS_ERROR general error.

◆ sx_api_tele_threshold_set()

sx_status_t sx_api_tele_threshold_set ( const sx_api_handle_t  handle,
const sx_access_cmd_t  cmd,
const sx_tele_threshold_key_t  key,
const sx_tele_threshold_data_t  data 
)

Sets the congestion threshold for a specific port and enables a specific TC (in addition to enabled ones). Note: SET command cannot be called on an existing entry. in order to modify, use EDIT. For port related thresholds: 1. network and LAG ports are supported.

  1. On spectrum, the last threshold that was set on a port will apply to all TC's in the port.

Supported devices: Spectrum.

Parameters
[in]handle- SX-API handle.
[in]cmd- SET/EDIT/DESTORY.
[in]key- threshold key.
[in]data- threshold data.
Returns
SX_STATUS_SUCCESS if operation completes successfully.
SX_STATUS_PARAM_ERROR if any input parameter is invalid.
SX_STATUS_NO_RESOURCES if there are no resources for the operation.
SX_STAUS_ERROR on internal error.

◆ sx_api_tele_threshold_get()

sx_status_t sx_api_tele_threshold_get ( const sx_api_handle_t  handle,
const sx_access_cmd_t  cmd,
const sx_tele_threshold_key_t  key,
sx_tele_threshold_data_t *  data_p 
)

Retrieves the congestion threshold for a specific port and the TC's the threshold is configured to. For port related threshold types, network and LAG ports are supported.

Supported devices: Spectrum.

Parameters
[in]handle- SX-API handle.
[in]cmd- GET.
[in]key- threshold attributes key.
[in,out]data- threshold attributes data.
Returns
SX_STATUS_SUCCESS if operation completes successfully.
SX_STATUS_PARAM_ERROR if any input parameter is invalid.
SX_STATUS_NO_RESOURCES if there are no resources for the operation.
SX_STAUS_ERROR on internal error.

◆ sx_api_tele_threshold_crossed_data_get()

sx_status_t sx_api_tele_threshold_crossed_data_get ( const sx_api_handle_t  handle,
const sx_access_cmd_t  cmd,
const sx_tele_threshold_key_t *  key_p,
sx_tele_threshold_crossed_data_t *  crossed_data_p,
const uint32_t  key_cnt 
)

Retrieves the current threshold congestion state (below / above threshold) for a list of keys. For port related threshold types, only network ports are supported.

Supported devices: Spectrum.

Parameters
[in]handle- SX-API handle.
[in]cmd- GET.
[in]key_p- list of threshold key.
[out]crossed_data_p- list of threshold crossed data.
[in]key_cnt- number of elements in key list and crossed data list.
Returns
SX_STATUS_SUCCESS if operation completes successfully.
SX_STATUS_PARAM_ERROR if any input parameter is invalid.
SX_STATUS_NO_RESOURCES if there are no resources for the operation.
SX_STAUS_ERROR on internal error.