CDI SDK
SDK for transporting chunks of data reliably and with low latency using a polled mode network driver.
|
When packets are received from the transmitter, they can arrive in any order. The routines here will put the packets in order. More...
#include <stdbool.h>
#include "rx_reorder_packets.h"
#include "cdi_core_api.h"
#include "cdi_logger_api.h"
#include "cdi_pool_api.h"
#include "cdi_raw_api.h"
#include "private.h"
#include "utilities_api.h"
Functions | |
static bool | AddSgListToReorderList (CdiProtocolHandle protocol_handle, CdiPoolHandle payload_sgl_entry_pool_handle, CdiSgList *sglist_ptr, const CdiSgList *new_sglist_ptr, int initial_offset, int *num_bytes_added_ptr) |
Adds a scatter-gather list to a reorder list. First entry of the SGL may have an offset. | |
static bool | AddSgListToRxReorderListTop (CdiProtocolHandle protocol_handle, CdiPoolHandle payload_sgl_entry_pool_handle, CdiReorderList *cur_reorder_list_ptr, const CdiSgList *new_sglist_ptr, int sequence_num, int initial_offset, int *num_bytes_added_ptr) |
Adds an SGL list to the top of an existing reorder list. First SGL entry of SGL list may have offset. | |
static bool | AddSgListToRxReorderListBottom (CdiProtocolHandle protocol_handle, CdiPoolHandle payload_sgl_entry_pool_handle, CdiReorderList *cur_reorder_list_ptr, const CdiSgList *new_sglist_ptr, int sequence_num, int initial_offset, int *num_bytes_added_ptr) |
Adds an SGL list to the bottom of an existing reorder list. First SGL entry of SGL list may have offset. | |
static void | InsertRxReorderList (CdiReorderList *prev_reorder_list_ptr, CdiReorderList *next_reorder_list_ptr, CdiReorderList *new_reorder_list_ptr) |
Inserts a reorder list between two reorder lists. | |
static void | AttachNextRxReorderList (CdiPoolHandle reorder_entries_pool_handle, CdiReorderList *cur_reorder_list_ptr) |
Attaches a list that is to the right of the current list and frees the attached list's memory space. | |
static bool | CreateAndInsertRxReorderList (CdiProtocolHandle protocol_handle, CdiPoolHandle reorder_entries_pool_handle, CdiPoolHandle payload_sgl_entry_pool_handle, const CdiSgList *new_sglist_ptr, int sequence_num, int initial_offset, int *num_bytes_added_ptr, CdiReorderList *prev_reorder_list_ptr, CdiReorderList *next_reorder_list_ptr, CdiReorderList **new_reorder_list_ptr) |
Creates a new reorder list and then inserts it between two reorder lists. The SGL list is added to the created reorder list. First SGL entry of SGL list may have offset. | |
static bool | ProcessList (CdiProtocolHandle protocol_handle, CdiPoolHandle reorder_entries_pool_handle, CdiPoolHandle payload_sgl_entry_pool_handle, int *num_bytes_added_ptr, CdiReorderList **cur_reorder_list_ptr, const CdiSgList *new_sglist_ptr, int sequence_num, int initial_offset) |
Walks the rxreorder list to the right, looking for a spot to place the new SGL list. | |
void | RxReorderPacketFreeLists (CdiReorderList *reorder_list_ptr, CdiPoolHandle payload_sgl_entry_pool_handle, CdiPoolHandle reorder_entries_pool_handle) |
removes all lists and sgls used in processing the out of order packets | |
bool | RxReorderPacketPayloadStateInit (CdiProtocolHandle protocol_handle, CdiPoolHandle payload_sgl_entry_pool_handle, CdiPoolHandle reorder_entries_pool_handle, RxPayloadState *payload_state_ptr, const CdiSgList *new_sglist_ptr, int initial_offset, int sequence_num) |
Adds initial entry to payload_state_ptr->reorder_list_ptr. | |
bool | RxReorderPacket (CdiProtocolHandle protocol_handle, CdiPoolHandle payload_sgl_entry_pool_handle, CdiPoolHandle reorder_entries_pool_handle, RxPayloadState *payload_state_ptr, const CdiSgList *new_sglist_ptr, int initial_offset, int sequence_num) |
Adds an entry to the payload sgl. Also checks for and maintains outstanding packets that are received out of order. If an SGL arrives that is out of order, it will be added to a doubly linked list (reorder list) of outstanding dangling lists. | |
When packets are received from the transmitter, they can arrive in any order. The routines here will put the packets in order.
For more information, including Theory of Operation: Rx Reorder Home Page
|
static |
Adds a scatter-gather list to a reorder list. First entry of the SGL may have an offset.
protocol_handle | Handle for protocol being used. |
payload_sgl_entry_pool_handle | Handle for free SGL memory. |
sglist_ptr | list Which will be appended to. |
new_sglist_ptr | Pointer to entry to be added to list. |
initial_offset | First SGL entry will have this offset applied. |
num_bytes_added_ptr | Pointer to the number of bytes that were successfully added to list. |
|
static |
Adds an SGL list to the bottom of an existing reorder list. First SGL entry of SGL list may have offset.
protocol_handle | Handle for protocol being used. |
payload_sgl_entry_pool_handle | Handle for free SGL memory. |
cur_reorder_list_ptr | Pointer to list which will be appended to. |
new_sglist_ptr | Pointer to entry to be added to list. |
sequence_num | The sequence number of this SGL list. |
initial_offset | First SGL entry will have this offset applied. |
num_bytes_added_ptr | Pointer to the number of bytes that were successfully added to list. |
|
static |
Adds an SGL list to the top of an existing reorder list. First SGL entry of SGL list may have offset.
protocol_handle | Handle for protocol being used. |
payload_sgl_entry_pool_handle | Handle for free SGL memory. |
cur_reorder_list_ptr | Pointer to list which will be appended to. |
new_sglist_ptr | Pointer to entry to be added to list. |
sequence_num | The sequence number of this SGL list. |
initial_offset | First SGL entry will have this offset applied. |
num_bytes_added_ptr | Pointer to the number of bytes that were successfully added to list. |
|
static |
Attaches a list that is to the right of the current list and frees the attached list's memory space.
reorder_entries_pool_handle | Handle for free rx reorder list memory. |
cur_reorder_list_ptr | Pointer to the list that will have it's next list attached. |
|
static |
Creates a new reorder list and then inserts it between two reorder lists. The SGL list is added to the created reorder list. First SGL entry of SGL list may have offset.
protocol_handle | Handle for protocol being used. |
reorder_entries_pool_handle | Handle for free rx reorder list memory. |
payload_sgl_entry_pool_handle | Handle for free SGL memory. |
new_sglist_ptr | Pointer to entry to be added to list. |
sequence_num | The sequence number of this SGL list. |
initial_offset | First SGL entry will have this offset applied. |
num_bytes_added_ptr | Pointer to the number of bytes that were successfully added to list. |
prev_reorder_list_ptr | Pointer to list to left of new list being added. |
next_reorder_list_ptr | Pointer to list to right of new list being added. |
new_reorder_list_ptr | Pointer to pointer of newly created list. |
|
static |
Inserts a reorder list between two reorder lists.
prev_reorder_list_ptr | Pointer to list to left of new list being added. |
next_reorder_list_ptr | Pointer to list to right of new list being added. |
new_reorder_list_ptr | Pointer to list being added. |
|
static |
Walks the rxreorder list to the right, looking for a spot to place the new SGL list.
protocol_handle | Handle for protocol being used. |
reorder_entries_pool_handle | Handle for free rx reorder list memory. |
payload_sgl_entry_pool_handle | Handle for free SGL memory. |
num_bytes_added_ptr | Pointer to the number of bytes that were successfully added to list. |
cur_reorder_list_ptr | Pointer to list which will have new_sgl_list added to it. |
new_sglist_ptr | Pointer to entry to be added to list. |
sequence_num | The sequence number of this SGL list. |
initial_offset | First SGL entry will have this offset applied. |
bool RxReorderPacket | ( | CdiProtocolHandle | protocol_handle, |
CdiPoolHandle | payload_sgl_entry_pool_handle, | ||
CdiPoolHandle | reorder_entries_pool_handle, | ||
RxPayloadState * | payload_state_ptr, | ||
const CdiSgList * | new_sglist_ptr, | ||
int | initial_offset, | ||
int | sequence_num ) |
Adds an entry to the payload sgl. Also checks for and maintains outstanding packets that are received out of order. If an SGL arrives that is out of order, it will be added to a doubly linked list (reorder list) of outstanding dangling lists.
Once all of the data for a payload is received, then the entries for payload_state_ptr->reorder_list_ptr->next_ptr and payload_state_ptr->reorder_list_ptr->prev_ptr will be NULL, otherwise there are dangling lists that have not been attached to the single payload list.
protocol_handle | Handle for protocol being used. |
payload_sgl_entry_pool_handle | Handle to memory pool of payload SGL entries. |
reorder_entries_pool_handle | Handle to memory pool of rx_reorder entries. |
payload_state_ptr | Current state of the payload, specifically a single rx_reorder entry. |
new_sglist_ptr | An SGL to be added to the end of the payload sgl. |
initial_offset | First SGL entry will have this offset applied |
sequence_num | The sequence number of this SGL list. |
void RxReorderPacketFreeLists | ( | CdiReorderList * | reorder_list_ptr, |
CdiPoolHandle | payload_sgl_entry_pool_handle, | ||
CdiPoolHandle | reorder_entries_pool_handle ) |
removes all lists and sgls used in processing the out of order packets
reorder_list_ptr | pointer to a single list entry to start the removal process |
payload_sgl_entry_pool_handle | handle to memory pool of sgls |
reorder_entries_pool_handle | handle to memory pool of rx reorder lists |
bool RxReorderPacketPayloadStateInit | ( | CdiProtocolHandle | protocol_handle, |
CdiPoolHandle | payload_sgl_entry_pool_handle, | ||
CdiPoolHandle | reorder_entries_pool_handle, | ||
RxPayloadState * | payload_state_ptr, | ||
const CdiSgList * | new_sglist_ptr, | ||
int | initial_offset, | ||
int | sequence_num ) |
Adds initial entry to payload_state_ptr->reorder_list_ptr.
protocol_handle | Handle for protocol being used. |
payload_sgl_entry_pool_handle | Handle to memory pool of payload SGL entries. |
reorder_entries_pool_handle | Handle to memory pool of rx_reorder entries. |
payload_state_ptr | Current state of the payload, specifically a single rx_reorder entry. |
new_sglist_ptr | An SGL to be added to the end of the payload sgl. |
initial_offset | First SGL entry will have this offset applied. |
sequence_num | The sequence number of this SGL list. |