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

This file contains internal definitions and implementation used for payloads and probe packets using protocol version 1. More...

#include "protocol.h"
#include <stdbool.h>
#include <string.h>
#include "adapter_api.h"
#include "adapter_efa_probe.h"
#include "internal.h"
#include "private.h"

Data Structures

struct  PacketCommonHeader
 CDI header for payload packets that don't use data offset values (payload type is not kPayloadTypeDataOffset). More...
 
struct  PacketDataOffsetHeader
 CDI header for payload packets that contains a data offset value (payload type is kPayloadTypeDataOffset). More...
 
struct  PacketNum0Header
 CDI header for payload packet #0. This packet never uses payload_data_offset, since it is always zero. More...
 
struct  PacketHeaderUnion
 Union of payload cdi headers. Use to reserve memory that can be used to hold any type of CDI packet header. More...
 
struct  ControlPacketCommonHeader
 Common header for all probe control packets. NOTE: Last digit of Protocol Version is the probe version. This file supports probe versions 0 - 3. More...
 
struct  ControlPacketCommand
 Probe command packet that is being transmitted. More...
 
struct  ControlPacketAck
 Control ACK packet that is a response for a transmitted command. More...
 
struct  ProbePacketUnion
 Structure used to hold a union of packets that are transmitted over the control or EFA interface. More...
 

Macros

#define STREAM_IDENTIFIER_NOT_USED   (-1)
 Sentinel value for unused stream ID.
 
#define MAX_IP_STRING_LENGTH_V1   (64)
 Maximum IP string length for protocol version 1.
 
#define MAX_IPV6_GID_LENGTH_V1   (32)
 Maximum EFA device GID length for protocol version 1. Contains GID + QPN (see efa_ep_addr).
 
#define MAX_STREAM_NAME_STRING_LENGTH_V1   (128+10)
 Maximum stream name string length for protocol version 1.
 

Functions

 CDI_STATIC_ASSERT (CDI_RAW_PACKET_HEADER_SIZE_V1==sizeof(PacketHeaderUnion), "The define does not match the structure size!")
 Ensure size of the external define matches the size of our internal structure.
 
 CDI_STATIC_ASSERT (CDI_RAW_PROBE_HEADER_SIZE_V1==sizeof(ProbePacketUnion), "The define does not match the structure size!")
 Ensure size of the external define matches the size of our internal structure.
 
static void HeaderDecode (const void *encoded_data_ptr, int encoded_data_size, CdiDecodedPacketHeader *dest_header_ptr)
 Forward declaration of function.
 
static int HeaderInit (void *header_ptr, int header_buffer_size, const TxPayloadState *payload_state_ptr)
 Forward declaration of function.
 
static void PacketRxReorderInfo (const CdiRawPacketHeader *header_ptr, CdiPacketRxReorderInfo *ret_info_ptr)
 Forward declaration of function.
 
static CdiReturnStatus ProbeHeaderDecode (const void *encoded_data_ptr, int encoded_data_size, CdiDecodedProbeHeader *dest_header_ptr)
 Forward declaration of function.
 
static int ProbeHeaderEncode (const CdiDecodedProbeHeader *src_header_ptr, CdiRawProbeHeader *dest_header_ptr)
 Forward declaration of function.
 
static uint16_t CalculateChecksum (const uint16_t *buffer_ptr, int size)
 Calculate a checksum and return it.
 
void ProtocolVersionSet1 (const CdiProtocolVersionNumber *remote_version_ptr, CdiProtocolHandle protocol_handle, CdiProtocolVTableApi **ret_api_ptr)
 Set protocol version to 1.
 

Variables

static CdiProtocolVTableApi vtable_api
 VTable of APIs used to access payload header and internal data.
 

Detailed Description

This file contains internal definitions and implementation used for payloads and probe packets using protocol version 1.

Function Documentation

◆ CalculateChecksum()

static uint16_t CalculateChecksum ( const uint16_t * buffer_ptr,
int size )
static

Calculate a checksum and return it.

Parameters
buffer_ptrPointer to data to calculate checksum.
sizeSize of buffer in bytes.
Returns
Calculated checksum value.

◆ ProtocolVersionSet1()

void ProtocolVersionSet1 ( const CdiProtocolVersionNumber * remote_version_ptr,
CdiProtocolHandle protocol_handle,
CdiProtocolVTableApi ** ret_api_ptr )

Set protocol version to 1.

Parameters
remote_version_ptrPointer to remote's protocol version information.
protocol_handleAddress where to write protocol version data that is available outside of this module.
ret_api_ptrAddress where to write protocol version VTable API.

Variable Documentation

◆ vtable_api

CdiProtocolVTableApi vtable_api
static
Initial value:
= {
}
static int HeaderInit(void *header_ptr, int header_buffer_size, const TxPayloadState *payload_state_ptr)
Forward declaration of function.
Definition protocol_v1.c:236
static void PacketRxReorderInfo(const CdiRawPacketHeader *header_ptr, CdiPacketRxReorderInfo *ret_info_ptr)
Forward declaration of function.
Definition protocol_v1.c:288
static int ProbeHeaderEncode(const CdiDecodedProbeHeader *src_header_ptr, CdiRawProbeHeader *dest_header_ptr)
Forward declaration of function.
Definition protocol_v1.c:410
static CdiReturnStatus ProbeHeaderDecode(const void *encoded_data_ptr, int encoded_data_size, CdiDecodedProbeHeader *dest_header_ptr)
Forward declaration of function.
Definition protocol_v1.c:325
static void HeaderDecode(const void *encoded_data_ptr, int encoded_data_size, CdiDecodedPacketHeader *dest_header_ptr)
Forward declaration of function.
Definition protocol_v1.c:198

VTable of APIs used to access payload header and internal data.