Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

NetIF_GetTxDataAlignPtr()

...

1264653Get an aligned pointer into a transmit application data buffer. Anchor11932091193209

Files

...

11932101193210net_if.h/net_if.c Anchor11932691193269

Prototype

...

rowspan3

...

 

Arguments

if_nbr

Network interface number to get a transmit application buffer's aligned data pointer.

Anchor11932751193275p_data Anchor12539901253990

Pointer to transmit application data buffer to get an aligned pointer into (see also Note #2b).

Anchor12011991201199perr Anchor12539971253997

Pointer to variable that will receive the return error code from this function :

...

NET_IF_ERR_NONE

...

...

NET_IF_ERR_NULL_PTR

...

NET_IF_ERR_INVALID_IF

...

...

NET_IF_ERR_ALIGN_NOT_AVAIL

...

NET_ERR_INIT_INCOMPLETE

...

...

NET_ERR_INVALID_TRANSACTION

...

NET_OS_ERR_LOCK

...

Returned Value

...

Pointer to aligned transmit application data buffer address, if no errors. Anchor11932861193286

Pointer to NULL, otherwise. Anchor11932871193287

Required Configuration

...

None. Anchor12711501271150

Notes/Warnings #1

...

Otherwise, a single, fixed alignment between application data buffers and network interface's buffer data areas is not possible.

...

For any single read/write of data to/from application data buffers and network buffer data areas, optimal alignment occurs if, and only if, all of the following conditions are true:

...

...

In other words, the modulus of the specific read/write address in the application data buffer with the CPU's data word size must be equal to the modulus of the specific read/write address in the network buffer data area with the CPU's data word size.

...

This condition might not be satisfied whenever:

...

...

Data is read/written to/from fragmented packets

...

Data is not maximally read/written to/from stream-type packets (e.g., TCP data segments)

...

...

Packets include variable number of header options (e.g., IP options)

...

However, even though optimal alignment between application data buffers and network buffer data areas is not guaranteed for every read/write; optimal alignment should not occur more frequently, leading to improved network data throughput.

...

Notes/Warnings #2

...

Since the first aligned address in the application data buffer may be 0 to (CPU_CFG_DATA_SIZE-1) bytes after the application data buffer's starting address, the application data buffer should allocate and reserve an additional (CPU_CFG_DATA_SIZE-1) number of bytes. Anchor12711651271165

However, the application data buffer's effective, useable size is still limited to its original declared size (before reserving additional bytes), and should not be increased by the additional, reserved bytes.