This file contains internal definitions and implementation used for payloads and probe packets using protocol version 2.
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"
|
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...
|
|
|
#define | MAX_IP_STRING_LENGTH_V2 (64) |
| Maximum IP string length for protocol version 1.
|
|
#define | MAX_IPV6_GID_LENGTH_V2 (32) |
| Maximum EFA device GID length for protocol version 1. Contains GID + QPN (see efa_ep_addr).
|
|
#define | MAX_STREAM_NAME_STRING_LENGTH_V2 (128+10) |
| Maximum stream name string length for protocol version 1.
|
|
|
| CDI_STATIC_ASSERT (CDI_RAW_PACKET_HEADER_SIZE_V2==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_V2==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.
|
|
bool | ProtocolVersionSet2 (const CdiProtocolVersionNumber *remote_version_ptr, CdiProtocolHandle protocol_handle, CdiProtocolVTableApi **ret_api_ptr) |
| Set protocol version 2 if remote is compatible with it.
|
|
This file contains internal definitions and implementation used for payloads and probe packets using protocol version 2.
NOTE: The differences between version 1 and this version are: PacketCommonHeader.payload_num : Changed from 8-bits to 16-bits. PacketCommonHeader.packet_id : New value. PacketNum0Header.tx_start_time_microseconds : New value. ControlPacketCommonHeader.senders_stream_identifier : Obsolete, removed.
◆ CalculateChecksum()
static uint16_t CalculateChecksum |
( |
const uint16_t * | buffer_ptr, |
|
|
int | size ) |
|
static |
Calculate a checksum and return it.
- Parameters
-
buffer_ptr | Pointer to data to calculate checksum. |
size | Size of buffer in bytes. |
- Returns
- Calculated checksum value.
◆ ProtocolVersionSet2()
Set protocol version 2 if remote is compatible with it.
- Parameters
-
remote_version_ptr | Pointer to remote's protocol version information. |
protocol_handle | Address where to write protocol version data that is available outside of this module. |
ret_api_ptr | Address where to write protocol version VTable API. Only used if true is returned. |
- Returns
- true if protocol version 2 is set, otherwise false is returned. Must then fallback to version 1 using PayloadProtocolVersionSet1().
◆ vtable_api
Initial value:= {
}
static int HeaderInit(void *header_ptr, int header_buffer_size, const TxPayloadState *payload_state_ptr)
Forward declaration of function.
Definition protocol_v2.c:243
static void PacketRxReorderInfo(const CdiRawPacketHeader *header_ptr, CdiPacketRxReorderInfo *ret_info_ptr)
Forward declaration of function.
Definition protocol_v2.c:297
static int ProbeHeaderEncode(const CdiDecodedProbeHeader *src_header_ptr, CdiRawProbeHeader *dest_header_ptr)
Forward declaration of function.
Definition protocol_v2.c:418
static CdiReturnStatus ProbeHeaderDecode(const void *encoded_data_ptr, int encoded_data_size, CdiDecodedProbeHeader *dest_header_ptr)
Forward declaration of function.
Definition protocol_v2.c:334
static void HeaderDecode(const void *encoded_data_ptr, int encoded_data_size, CdiDecodedPacketHeader *dest_header_ptr)
Forward declaration of function.
Definition protocol_v2.c:202
VTable of APIs used to access payload header and internal data.