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

Go to the source code of this file.

Functions

sx_status_t sx_lib_host_ifc_unicast_ctrl_send (const sx_fd_t *fd_p, const void *packet_p, const uint32_t packet_size, const sx_swid_t swid, const sx_port_log_id_t egress_log_port, const sx_cos_priority_t prio)
 
sx_status_t sx_lib_host_ifc_data_send (const sx_fd_t *fd, const void *packet, const uint32_t packet_size, const sx_swid_t swid, const sx_cos_priority_t prio)
 
sx_status_t sx_lib_host_ifc_loopback_ctrl_send (const sx_fd_t *fd, const void *packet, const uint32_t packet_size, const sx_swid_t swid, const sx_trap_id_t trap_id, const sx_port_log_id_t ingress_log_port, const boolean_t is_lag, const sx_port_log_id_t ingress_lag_port)
 
sx_status_t sx_lib_host_ifc_recv (const sx_fd_t *fd, void *packet, uint32_t *packet_size, sx_receive_info_t *receive_info)
 
sx_status_t sx_lib_host_ifc_recv_list (const sx_fd_t *fd, sx_packet_info_t *packet_info_list_p, uint32_t *packet_info_list_size_p)
 

Function Documentation

◆ sx_lib_host_ifc_unicast_ctrl_send()

sx_status_t sx_lib_host_ifc_unicast_ctrl_send ( const sx_fd_t *  fd_p,
const void *  packet_p,
const uint32_t  packet_size,
const sx_swid_t  swid,
const sx_port_log_id_t  egress_log_port,
const sx_cos_priority_t  prio 
)

Send a unicast control packet through a specific logical port. Routing and QOS from TX header. Supported devices: Spectrum, Spectrum2.

Deprecated:
Prio parameter is deprecated and will be removed in the future.
Parameters
[in]fd- File descriptor to send from.
[in]packet_p- Buffer containing the packet to send.
[in]packet_size- Size of packet.
[in]swid- Switch ID of packet destination.
[in]egress_log_port- Logical port of packet destination.
[in]prio- Priority of the packet.
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_NULL if any input parameters is null
SX_STATUS_PARAM_ERROR if any input parameters is invalid
SX_STATUS_ERROR general error
SX_STATUS_MEMORY_ERROR error handling memory
SX_STATUS_NO_RESOURCES device was not opened
SX_STATUS_ENTRY_NOT_FOUND if requested element is not found in DB

◆ sx_lib_host_ifc_data_send()

sx_status_t sx_lib_host_ifc_data_send ( const sx_fd_t *  fd,
const void *  packet,
const uint32_t  packet_size,
const sx_swid_t  swid,
const sx_cos_priority_t  prio 
)

Send a unicast and multicast data packet. Packet forwarding is done according to the HW tables. Supported devices: Spectrum, Spectrum2.

Deprecated:
Prio parameter is deprecated and will be removed in the future.
Parameters
[in]fd- File descriptor to send from.
[in]packet- buffer containing the packet to send.
[in]packet_size- Size of packet.
[in]swid- Switch ID of packet destination.
[in]prio- priority of the packet.
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_NULL if any input parameters is null
SX_STATUS_PARAM_ERROR if any input parameters is invalid
SX_STATUS_ERROR general error
SX_STATUS_MEMORY_ERROR error handling memory
SX_STATUS_NO_RESOURCES device was not opened

◆ sx_lib_host_ifc_loopback_ctrl_send()

sx_status_t sx_lib_host_ifc_loopback_ctrl_send ( const sx_fd_t *  fd,
const void *  packet,
const uint32_t  packet_size,
const sx_swid_t  swid,
const sx_trap_id_t  trap_id,
const sx_port_log_id_t  ingress_log_port,
const boolean_t  is_lag,
const sx_port_log_id_t  ingress_lag_port 
)

Send a packet to a loopback interface. the packet will be treated as if it was received from the HW, and dispatched to the relevant application except for the application who sent it. Supported devices: Spectrum, Spectrum2.

Parameters
[in]fd- File descriptor to send from.
[in]packet- Buffer containing the packet to send.
[in]packet_size- Size of packet.
[in]swid- Switch ID of the packet.
[in]trap_id- Trap ID of the packet.
[in]ingress_log_port- Source logical port.
[in]is_lag- Is the source logical port member of a lag.
[in]ingress_lag_port- Source lag port when applicable.
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_NULL if any input parameters is null
SX_STATUS_PARAM_ERROR if any input parameters is invalid
SX_STATUS_ERROR general error
SX_STATUS_MEMORY_ERROR error handling memory
SX_STATUS_NO_RESOURCES device was not opened
SX_STATUS_ENTRY_NOT_FOUND if requested element is not found in DB

◆ sx_lib_host_ifc_recv()

sx_status_t sx_lib_host_ifc_recv ( const sx_fd_t *  fd,
void *  packet,
uint32_t *  packet_size,
sx_receive_info_t *  receive_info 
)

This API enables the user to receive Traps or Events. Trap RX : relevant returned information is packet_p and packet_size_p. Event RX : relevant returned information is event info. Receive info struct is relevant for both traps & events and it contains the logical port in a case the event is port related event , and the ingress port in case of a trap. Read operation is blocking. Supported devices: Spectrum, Spectrum2.

Parameters
[in]fd- File descriptor to listen on.
[out]packet- copy received packet to this buffer.
[in,out]packet_size- [in]: The size of packet. [out]: Size of received packet (in bytes).
[out]receive_info- Information regarding the source of the packet (RX logical port) and about the event for events
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_NULL if any input parameters is null
SX_STATUS_ERROR general error
SX_STATUS_MEMORY_ERROR error handling memory
SX_STATUS_NO_RESOURCES device was not opened
SX_STATUS_NO_MEMORY insufficient packet size, needed size filled in packet_size

◆ sx_lib_host_ifc_recv_list()

sx_status_t sx_lib_host_ifc_recv_list ( const sx_fd_t *  fd,
sx_packet_info_t *  packet_info_list_p,
uint32_t *  packet_info_list_size_p 
)

This API enables the user to receive Traps or Events list. Trap RX : relevant returned information is packet_p and packet_size_p fields of packet_info_list_p. Event RX : relevant returned information is event info.

Receive info struct is relevant for both traps & events and it contains the logical port in a case the event is port related event , and the ingress port in case of a trap. Read operation is blocking. This API internally uses a static memory buffer (around 10MB) to temporarily store and parse the packets, and a lock is used internally to protect the static buffer in case the API is called from multiple threads. Supported devices: Spectrum, Spectrum2.

Parameters
[in]fd- File descriptor to listen on.
[out]packet_info_list_p- Contain the follow fields: packet_p - Packet data. packet_size - Packet data size (minimum 64). receive_info - Information regarding the source of the packet (RX logical port) and about the event for events.
[in,out]packet_info_list_size_p- [in]: Length of provide packet_info_list. [out]: Actual number of packets.
Returns
SX_STATUS_SUCCESS if operation completes successfully
SX_STATUS_PARAM_NULL if any input parameters is null
SX_STATUS_ERROR general error
SX_STATUS_MEMORY_ERROR error handling memory
SX_STATUS_NO_RESOURCES device was not opened
SX_STATUS_NO_MEMORY insufficient packet size, needed size filled in packet_size