|
Mellanox SwitchX SDK API Guide
4.3.2104
|
Go to the source code of this file.
Functions | |
| sx_status_t | sx_api_tunnel_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_tunnel_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_tunnel_set (const sx_api_handle_t handle, const sx_access_cmd_t cmd, const sx_tunnel_attribute_t *tunnel_attr_p, sx_tunnel_id_t *tunnel_id_p) |
| sx_status_t | sx_api_tunnel_get (const sx_api_handle_t handle, const sx_tunnel_id_t tunnel_id, sx_tunnel_attribute_t *tunnel_attr_p) |
| sx_status_t | sx_api_tunnel_counter_get (const sx_api_handle_t handle, const sx_access_cmd_t cmd, const sx_tunnel_id_t tunnel_id, sx_tunnel_counter_t *counter) |
| sx_status_t | sx_api_tunnel_decap_rules_set (const sx_api_handle_t handle, const sx_access_cmd_t cmd, const sx_tunnel_decap_entry_key_t *decap_key_p, const sx_tunnel_decap_entry_data_t *decap_data_p) |
| sx_status_t | sx_api_tunnel_decap_rules_get (const sx_api_handle_t handle, const sx_tunnel_decap_entry_key_t *decap_key_p, sx_tunnel_decap_entry_data_t *decap_data_p) |
| sx_status_t | sx_api_tunnel_init_set (const sx_api_handle_t handle, sx_tunnel_general_params_t *params_p) |
| sx_status_t | sx_api_tunnel_deinit_set (const sx_api_handle_t handle) |
| sx_status_t | sx_api_tunnel_map_set (const sx_api_handle_t handle, const sx_access_cmd_t cmd, const sx_tunnel_id_t tunnel_id, const sx_tunnel_map_entry_t *map_entries_p, const uint32_t map_entries_cnt) |
| sx_status_t | sx_api_tunnel_map_get (const sx_api_handle_t handle, const sx_access_cmd_t cmd, const sx_tunnel_id_t tunnel_id, sx_tunnel_map_entry_t map_entry_key, sx_tunnel_map_entry_t *map_entries_p, uint32_t *map_entries_cnt_p) |
| sx_status_t | sx_api_tunnel_ttl_set (const sx_api_handle_t handle, const sx_tunnel_id_t tunnel_id, const sx_tunnel_ttl_data_t *ttl_data_p) |
| sx_status_t | sx_api_tunnel_ttl_get (const sx_api_handle_t handle, const sx_tunnel_id_t tunnel_id, sx_tunnel_ttl_data_t *ttl_data_p) |
| sx_status_t | sx_api_tunnel_hash_set (const sx_api_handle_t handle, const sx_tunnel_id_t tunnel_id, const sx_tunnel_hash_data_t *hash_data_p) |
| sx_status_t | sx_api_tunnel_hash_get (const sx_api_handle_t handle, const sx_tunnel_id_t tunnel_id, sx_tunnel_hash_data_t *hash_data_p) |
| sx_status_t | sx_api_tunnel_cos_set (const sx_api_handle_t handle, const sx_tunnel_id_t tunnel_id, const sx_tunnel_cos_data_t *cos_data_p) |
| sx_status_t | sx_api_tunnel_cos_get (const sx_api_handle_t handle, const sx_tunnel_id_t tunnel_id, sx_tunnel_cos_data_t *cos_data_p) |
| sx_status_t | sx_api_tunnel_iter_get (const sx_api_handle_t handle, const sx_access_cmd_t cmd, const sx_tunnel_id_t tunnel_id, const sx_tunnel_filter_t *filter_p, sx_tunnel_id_t *tunnel_id_list_p, uint32_t *tunnel_id_cnt_p) |
| sx_status_t sx_api_tunnel_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 API sets the log verbosity level of TUNNEL MODULE. Supported devices: Spectrum, Spectrum2.
| [in] | handle | - SX-API handle |
| [in] | verbosity_target | - set verbosity of : API / MODULE / BOTH |
| [in] | module_verbosity_level | - TUNNEL module verbosity level |
| [in] | api_verbosity_level | - TUNNEL API verbosity level |
| sx_status_t sx_api_tunnel_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 API gets the log verbosity level of TUNNEL MODULE. Supported devices: Spectrum, Spectrum2.
| [in] | handle | - SX-API handle |
| [in] | verbosity_target | - get verbosity of : API / MODULE / BOTH |
| [out] | module_verbosity_level_p | - TUNNEL module verbosity level |
| [out] | api_verbosity_level_p | - TUNNEL API verbosity level |
| sx_status_t sx_api_tunnel_set | ( | const sx_api_handle_t | handle, |
| const sx_access_cmd_t | cmd, | ||
| const sx_tunnel_attribute_t * | tunnel_attr_p, | ||
| sx_tunnel_id_t * | tunnel_id_p | ||
| ) |
This API is used to create/edit/destroy tunnels.
When destroying a tunnel, tunnel_attr_p is ignored. By default tunnel is created with TTL 255. On Spectrum2 SDK user may configure from which port (ingress or egress) he want to get packet ethertype. By default packet ethertype will be taken from ingress port. To change default logic SDK user should create VxLAN tunnel with ethertype SX_ETHERTYPE_FROM_EGRESS_PORT.
VxLAN tunnels support the lazy delete feature. If the LAZY_DELETE is OFF and the reference counter of a tunnel is 0, the API call with command DELETE deletes a tunnel, otherwise SDK returns SX_STATUS_RESOURCE_IN_USE.
If the LAZY_DELETE is ON and the reference counter of a tunnel is not 0, the API call with command DELETE marks a tunnel as deleted, and SDK returns SX_STATUS_SUCCESS. Once the reference counter of a tunnel becomes 0, SDK will delete the tunnel and will generate a notification with the trap id SX_TRAP_ID_OBJECT_DELETED_EVENT and a tunnel id of a tunnel that was deleted.
The list of objects that increase a reference counter of a NVE tunnel:
Supported devices: Spectrum, Spectrum2.
| [in] | handle | - SX-API handle |
| [in] | cmd | - CREATE / DESTROY / EDIT |
| [in] | tunnel_attr_p | - pointer to tunnel attributes structure. |
| [in,out] | tunnel_id_p | - Tunnel ID |
| sx_status_t sx_api_tunnel_get | ( | const sx_api_handle_t | handle, |
| const sx_tunnel_id_t | tunnel_id, | ||
| sx_tunnel_attribute_t * | tunnel_attr_p | ||
| ) |
This API get Tunnels configuration. Supported devices: Spectrum, Spectrum2.
| [in] | handle | - SX-API handle |
| [in] | tunnel_id | - Tunnel ID |
| [out] | tunnel_attr_p | - pointer to tunnel attributes structure. |
| sx_status_t sx_api_tunnel_counter_get | ( | const sx_api_handle_t | handle, |
| const sx_access_cmd_t | cmd, | ||
| const sx_tunnel_id_t | tunnel_id, | ||
| sx_tunnel_counter_t * | counter | ||
| ) |
This API get/clear tunnel counters. Supported devices: Spectrum, Spectrum2.
| [in] | handle | - SX-API handle |
| [in] | cmd | - READ / READ_CLEAR |
| [in] | tunnel_id | - Tunnel ID |
| [out] | counter | - pointer to tunnel counters structure. |
| sx_status_t sx_api_tunnel_decap_rules_set | ( | const sx_api_handle_t | handle, |
| const sx_access_cmd_t | cmd, | ||
| const sx_tunnel_decap_entry_key_t * | decap_key_p, | ||
| const sx_tunnel_decap_entry_data_t * | decap_data_p | ||
| ) |
This API is used to manage decap table rules. The decap table is used to terminate encapsulated packets.
The key provides packet matching mechanism. so each key is mapped to one tunnel.
Supported devices: Spectrum, Spectrum2.
| [in] | handle | - SX-API handle |
| [in] | cmd | - CREATE / DESTROY / EDIT |
| [in] | decap_key_p | - decap key |
| [in] | decap_data_p | - decap data |
| sx_status_t sx_api_tunnel_decap_rules_get | ( | const sx_api_handle_t | handle, |
| const sx_tunnel_decap_entry_key_t * | decap_key_p, | ||
| sx_tunnel_decap_entry_data_t * | decap_data_p | ||
| ) |
This API is used to get decap rules from decap table.
Supported devices: Spectrum, Spectrum2.
| [in] | handle | - SX-API handle |
| [in] | decap_key_p | - Key to query. |
| [out] | decap_data_p | - Data associated with key. |
| sx_status_t sx_api_tunnel_init_set | ( | const sx_api_handle_t | handle, |
| sx_tunnel_general_params_t * | params_p | ||
| ) |
This API is used to init tunneling module. Please note that you should set correct parsing depth with sx_api_port_parsing_depth_set accordingly to tunneling usage scenarios. Supported devices: Spectrum, Spectrum2.
| [in] | handle | - SX-API handle |
| [in] | params_p | - pointer to general params structure. |
| sx_status_t sx_api_tunnel_deinit_set | ( | const sx_api_handle_t | handle | ) |
This API is used to deinit tunneling module. Supported devices: Spectrum, Spectrum2.
| [in] | handle | - SX-API handle |
| sx_status_t sx_api_tunnel_map_set | ( | const sx_api_handle_t | handle, |
| const sx_access_cmd_t | cmd, | ||
| const sx_tunnel_id_t | tunnel_id, | ||
| const sx_tunnel_map_entry_t * | map_entries_p, | ||
| const uint32_t | map_entries_cnt | ||
| ) |
This API is used to manage tunnel to bridge/VLAN mapping.
When using command delete all, map_entries_p is deprecated.
VxLAN tunnel mappings support the lazy delete feature. If the LAZY_DELETE is OFF and the reference counter of a tunnel mapping is 0, the API call with command DELETE deletes a tunnel mapping, otherwise SDK returns SX_STATUS_RESOURCE_IN_USE.
If the LAZY_DELETE is ON and the reference counter of a tunnel mapping is not 0, the API call with command DELETE marks a tunnel mapping as deleted, and SDK returns SX_STATUS_SUCCESS. Once the reference counter of a tunnel mapping becomes 0, SDK will delete the tunnel mapping and will generate a notification with the trap id SX_TRAP_ID_OBJECT_DELETED_EVENT and a copy of tunnel mapping that was deleted. If the user tries to re-create a tunnel map entry before getting a notification, SDK returns the error SX_STATUS_RESOURCE_IN_USE.
The list of objects that increase a reference counter of a tunnel map entry:
The map_entries_cnt parameter is limited by TUNNEL_MAP_ENTRIES_SET_MAX_NUM.
Supported devices: Spectrum, Spectrum2.
| [in] | handle | - SX-API handle |
| [in] | cmd | - ADD / DELETE / DELETE_ALL |
| [in] | tunnel_id | - Tunnel ID |
| [in] | map_entries_p | - Array of map entries |
| [in] | map_entries_cnt | - amount of entries in map_entries_p |
| sx_status_t sx_api_tunnel_map_get | ( | const sx_api_handle_t | handle, |
| const sx_access_cmd_t | cmd, | ||
| const sx_tunnel_id_t | tunnel_id, | ||
| sx_tunnel_map_entry_t | map_entry_key, | ||
| sx_tunnel_map_entry_t * | map_entries_p, | ||
| uint32_t * | map_entries_cnt_p | ||
| ) |
This API gets the tunnel to bridge/VLAN mapping information.
The function can receive three types of input:
Supported devices: Spectrum, Spectrum2.
| [in] | handle | - SX-API handle. |
| [in] | cmd | - GET_FIRST/ GET_NEXT. |
| [in] | tunnel_id | - Tunnel ID |
| [in] | map_entry_key | - map entry, as a key to get next entries |
| [out] | map_entries_p | - Array of map entries |
| [in,out] | map_entries_cnt_p | - amount of entries in map_entries_p |
| sx_status_t sx_api_tunnel_ttl_set | ( | const sx_api_handle_t | handle, |
| const sx_tunnel_id_t | tunnel_id, | ||
| const sx_tunnel_ttl_data_t * | ttl_data_p | ||
| ) |
This API is used to set tunnel TTL parameters.
Note for Spectrum:
Supported devices: Spectrum, Spectrum2.
| [in] | handle | - SX-API handle |
| [in] | tunnel_id | - Tunnel ID |
| [in] | ttl_data_p | - pointer to tunnel ttl data structure. |
| sx_status_t sx_api_tunnel_ttl_get | ( | const sx_api_handle_t | handle, |
| const sx_tunnel_id_t | tunnel_id, | ||
| sx_tunnel_ttl_data_t * | ttl_data_p | ||
| ) |
This API is used to get tunnel TTL parameters.
Supported devices: Spectrum, Spectrum2.
| [in] | handle | - SX-API handle |
| [in] | tunnel_id | - Tunnel ID |
| [in,out] | ttl_data_p | - pointer to tunnel ttl data structure, set direction field for which you want get config. |
| sx_status_t sx_api_tunnel_hash_set | ( | const sx_api_handle_t | handle, |
| const sx_tunnel_id_t | tunnel_id, | ||
| const sx_tunnel_hash_data_t * | hash_data_p | ||
| ) |
This API is used to set tunnel hash parameters.
Note for Spectrum:
Supported devices: Spectrum, Spectrum2.
| [in] | handle | - SX-API handle |
| [in] | tunnel_id | - Tunnel ID |
| [in] | hash_data_p | - pointer to tunnel hash data structure. |
| sx_status_t sx_api_tunnel_hash_get | ( | const sx_api_handle_t | handle, |
| const sx_tunnel_id_t | tunnel_id, | ||
| sx_tunnel_hash_data_t * | hash_data_p | ||
| ) |
This API is used to get tunnel hash parameters.
Supported devices: Spectrum, Spectrum2.
| [in] | handle | - SX-API handle |
| [in] | tunnel_id | - Tunnel ID |
| [in,out] | hash_data_p | - pointer to tunnel hash data structure, set hash_field_type field for which you want get config. |
| sx_status_t sx_api_tunnel_cos_set | ( | const sx_api_handle_t | handle, |
| const sx_tunnel_id_t | tunnel_id, | ||
| const sx_tunnel_cos_data_t * | cos_data_p | ||
| ) |
This API is used to set tunnel CoS attributes.
The key is the tunnel id. User is capable to set a tunnel CoS behaviour per tunnel type. Changes in 1 tunnel will change the CoS behaviour for all tunnels from the same type.
The API configures QoS parameters for encapsulation and decapsulation flow separately based on value in cos_data_p->param_type. Next parameters can be configured with the API:
Whether packet switch priority and color should be preserved or a new one must be set (cos_data_p->update_priority_color) If update_priority_color set to TRUE, new prio and color are taken from cos_data_p->prio_color DSCP rewrite can be disabled/enabled or a value that was set on packet ingress port can be preserved (cos_data_p->dsc_rewrite)
If DSCP rewrite is disabled: DSCP value can be depending on cos_data_p->dscp_action
Supported devices: Spectrum, Spectrum2.
| [in] | handle | - SX-API handle |
| [in] | tunnel | id - Tunnel ID. |
| [in] | cos_data_p | - Pointer to CoS data structure. |
| sx_status_t sx_api_tunnel_cos_get | ( | const sx_api_handle_t | handle, |
| const sx_tunnel_id_t | tunnel_id, | ||
| sx_tunnel_cos_data_t * | cos_data_p | ||
| ) |
This API is used to retrieve CoS data. The user has to fill cos_data_p->param_type to specify the CoS direction they would like to get (ENCAP or DECAP). Supported devices: Spectrum, Spectrum2.
| [in] | handle | - SX-API handle |
| [in] | tunnel | id - Tunnel ID. |
| [in/out] | cos_data_p - Pointer to CoS data structure - by CoS param type (ENCAP/DECAP). |
| sx_status_t sx_api_tunnel_iter_get | ( | const sx_api_handle_t | handle, |
| const sx_access_cmd_t | cmd, | ||
| const sx_tunnel_id_t | tunnel_id, | ||
| const sx_tunnel_filter_t * | filter_p, | ||
| sx_tunnel_id_t * | tunnel_id_list_p, | ||
| uint32_t * | tunnel_id_cnt_p | ||
| ) |
This API retrieves a list of one or more Tunnel IDs. The following use case scenarios apply with different input parameters X = don't-care
Two type of filter can be used, 1) sx_tunnel_type_e: it exactly match the type defined for the tunnels 2) sx_tunnel_direction_e: if tunnel direction is SX_TUNNEL_DIRECTION_SYMMETRIC, it will match any direction(ENCAP/DECAP/SYMMETRIC) of filter, otherwise, it will only match the same direction of filter.
Supported devices: Spectrum, Spectrum2.
| [in] | handle | - SX-API handle |
| [in] | cmd | - GET/GET_FIRST/GET_NEXT |
| [in] | tunnel_id | - tunnel ID |
| [in] | filter_p | - specify a filter parameter |
| [out] | tunnel_id_list_p | - return list of tunnel IDs |
| [in,out] | tunnel_id_cnt_p | - [in] number of tunnel IDs to get
|
1.8.16