CDI SDK
SDK for transporting chunks of data reliably and with low latency using a polled mode network driver.
Loading...
Searching...
No Matches
adapter_efa_probe_control.c File Reference

This file contains internal definitions and implementation used within the SDK to support functionality that is not part of the API. More...

#include "adapter_efa.h"
#include "adapter_efa_probe_control.h"
#include "adapter_api.h"
#include "adapter_efa_probe_rx.h"
#include "adapter_efa_probe_tx.h"
#include "cdi_os_api.h"
#include "endpoint_manager.h"
#include "internal_utility.h"
#include "protocol.h"

Functions

static CdiReturnStatus EncodeProbeHeader (ProbeEndpointState *probe_ptr, ProbeCommand command, CdiDecodedProbeHeader *decoded_hdr_ptr, ProbePacketWorkRequest *work_request_ptr)
 
static bool ProcessPacket (ProbeEndpointState *probe_ptr, const ControlCommand *control_command_ptr, uint64_t *wait_timeout_ms_ptr)
 
bool ProbeControlEfaConnectionStart (ProbeEndpointState *probe_ptr)
 
void ProbeControlEfaConnectionQueueReset (ProbeEndpointState *probe_ptr, const char *error_msg_str)
 
void ProbeControlQueueStateChange (ProbeEndpointState *probe_ptr, ProbeState probe_state)
 
void ProbeControlEfaConnectionEnableApplication (ProbeEndpointState *probe_ptr)
 
ProbePacketWorkRequestProbeControlWorkRequestGet (CdiPoolHandle work_request_pool_handle)
 
void ProbeControlWorkRequestPacketSizeSet (ProbePacketWorkRequest *work_request_ptr, int packet_size)
 
CdiReturnStatus ProbeControlSendCommand (ProbeEndpointState *probe_ptr, ProbeCommand command, bool requires_ack)
 
CdiReturnStatus ProbeControlSendAck (ProbeEndpointState *probe_ptr, ProbeCommand ack_command, uint16_t ack_probe_packet_num)
 
void ProbeControlMessageFromBidirectionalEndpoint (void *param_ptr, Packet *packet_ptr, EndpointMessageType message_type)
 
CDI_THREAD ProbeControlThread (void *ptr)
 

Detailed Description

This file contains internal definitions and implementation used within the SDK to support functionality that is not part of the API.

Function Documentation

◆ EncodeProbeHeader()

static CdiReturnStatus EncodeProbeHeader ( ProbeEndpointState * probe_ptr,
ProbeCommand command,
CdiDecodedProbeHeader * decoded_hdr_ptr,
ProbePacketWorkRequest * work_request_ptr )
static

Initialize the command packet header of a control interface packet.

Parameters
probe_ptrPointer to probe endpoint state data.
commandProbe command to use.
decoded_hdr_ptrPointer to decoded header data. On entry, the union data must already be set.
work_request_ptrPointer to work request state data.
Returns
A value from the CdiReturnStatus enumeration.

◆ ProbeControlEfaConnectionEnableApplication()

void ProbeControlEfaConnectionEnableApplication ( ProbeEndpointState * probe_ptr)

Call this when EFA probe has successfully completed. It will enable the application connection.

NOTE: This function is called from PollThread().

Parameters
probe_ptrPointer to probe endpoint state data.

◆ ProbeControlEfaConnectionQueueReset()

void ProbeControlEfaConnectionQueueReset ( ProbeEndpointState * probe_ptr,
const char * error_msg_str )

Queue a reset of the EFA connection to the endpoint manager. Also, notify the application that the connection state has changed.

NOTE: This function is called from ProbeControlThread().

Parameters
probe_ptrPointer to probe endpoint state data.
error_msg_strPointer to optional error message string. Use NULL if no message.

◆ ProbeControlEfaConnectionStart()

bool ProbeControlEfaConnectionStart ( ProbeEndpointState * probe_ptr)

Start the EFA connection for use for probing.

NOTE: For a Tx connection, the remote GID must be valid before calling this function. See remote_ipv6_gid_array in EfaTxEndpointStart().

NOTE: We don't want to update the application's connection state until after the EFA probe has completed. EFA probe must use this function to start the probe.

NOTE: This function is called from ProbeControlThread().

Parameters
probe_ptrPointer to probe endpoint state data.
Returns
bool True if successful, otherwise false is returned.

◆ ProbeControlMessageFromBidirectionalEndpoint()

void ProbeControlMessageFromBidirectionalEndpoint ( void * param_ptr,
Packet * packet_ptr,
EndpointMessageType message_type )

Process a control packet message from a probe control interface bidirectional endpoint.

NOTE: This function is called from PollThread().

Parameters
param_ptrPointer to user parameter.
packet_ptrPointer to packet containing the control message.
message_typeEndpoint message type.

◆ ProbeControlQueueStateChange()

void ProbeControlQueueStateChange ( ProbeEndpointState * probe_ptr,
ProbeState probe_state )

Post a state change control command to FIFO used by ProbeControlThread().

Parameters
probe_ptrPointer to probe endpoint state data.
probe_stateProbe state to use.

◆ ProbeControlSendAck()

CdiReturnStatus ProbeControlSendAck ( ProbeEndpointState * probe_ptr,
ProbeCommand ack_command,
uint16_t ack_probe_packet_num )

Send an ACK to an endpoint using the adapter control interface.

Parameters
probe_ptrPointer to probe endpoint state data.
ack_commandCommand to send ACK for.
ack_probe_packet_numPacket number that was received in the command being ACKed.
Returns
kCdiStatusOk if successful, otherwise a value that indicates the nature of the failure is returned.

◆ ProbeControlSendCommand()

CdiReturnStatus ProbeControlSendCommand ( ProbeEndpointState * probe_ptr,
ProbeCommand command,
bool requires_ack )

Send a command using the control interface to an endpoint associated with the probe connection.

Parameters
probe_ptrPointer to probe endpoint state data.
commandCommand to send.
requires_ackTrue if the command requires an ACK in response, otherwise false.
Returns
kCdiStatusOk if successful, otherwise a value that indicates the nature of the failure is returned.

◆ ProbeControlThread()

CDI_THREAD ProbeControlThread ( void * ptr)

Thread used to run the probe.

Parameters
ptrPointer to probe endpoint state data (ProbeEndpointState*).
Returns
The return code is not used.

◆ ProbeControlWorkRequestGet()

ProbePacketWorkRequest * ProbeControlWorkRequestGet ( CdiPoolHandle work_request_pool_handle)

Get a control interface work request from the work request memory pool. The work request is used to send a command to an endpoint using the control interface.

Parameters
work_request_pool_handleHandle of work request memory pool.
Returns
Pointer to work request. NULL is returned if the function failed.

◆ ProbeControlWorkRequestPacketSizeSet()

void ProbeControlWorkRequestPacketSizeSet ( ProbePacketWorkRequest * work_request_ptr,
int packet_size )

Set packet size of a work request.

Parameters
work_request_ptrPointer to work request.
packet_sizeSize of packet in bytes.

◆ ProcessPacket()

static bool ProcessPacket ( ProbeEndpointState * probe_ptr,
const ControlCommand * control_command_ptr,
uint64_t * wait_timeout_ms_ptr )
static

Process a received control packet.

NOTE: This function is called from ProbeControlThread().

Parameters
probe_ptrPointer to probe endpoint state data.
control_command_ptrPointer to control packet to process.
wait_timeout_ms_ptrPointer to current wait timeout. This function may alter the contents of the value depending on the command contained within the control packet.