Synopsis
typedef struct {
  CTL_ETH_HEADER_t *header;
  unsigned short header_byte_count;
  unsigned short payload_byte_count;
  void *payload;
  void *payload_free;
} CTL_ETH_TX_FRAME_t;
Description

Transmit frames are allocated from the network stack's private heap by the highest-level stack code (TCP or UDP or ICMP) and then passed down the stack to the MAC layer, which ctl_net_mem_free()s the memory allocated to the frame and its header data.

A separate pointer, payload_free, is provided for the MAC layer to free payload data. This is decoupled from the actual 'payload' pointer for a number of reasons:

The members are:

header
A pointer to the header data to transmit, guaranteed to be correctly aligned for the MAC. Data transmission starts with header->ethDstMac.
header_byte_count
The number of header bytes to transmit. This byte count always excludes the __required_align member from the count. Frames presented to the MAC driver for transmission are guaranteed that header_byte_count+2 is divisible by four.
payload
A pointer to the payload data, if any, and guaranteed to be correctly aligned for the MAC. If there is no payload, this member must be set to zero.
payload_byte_count
The number of bytes in the payload. If there is no payload, this member must be set to zero.
payload_free
The data to free once the frame is sent. If there is nothing to free, this member must be zero.