# TX_BUFFER
[TX]

Definition and management of Tx payload buffers. More...

Collaboration diagram for TX_BUFFER:

## Data Structures
struct | txl_buffer_hw_desc_tag
| Structure containing the HW descriptors needed to handle non-contiguous buffers. More...
struct | txl_buffer_list_tag
| Buffer list structure. More...
struct | txl_buffer_idx_tag
| Tx rate structure. More...
struct | txl_buffer_env_tag
| Context of the Tx buffer management block. More...
struct | txl_buffer_tag
| Buffer header structure. More...
## Defines
#define | TX_BUFFER_MTU 1536
| MTU of the MAC SW.
#define | TX_ADD_BUFFER 64
| Additional buffering (for headers).
#define | TX_MPDU_LEN_MAX (TX_BUFFER_MTU + TX_ADD_BUFFER)
| Maximum MPDU size.
#define | TX_BUFFER_MAX (sizeof_b(struct txl_buffer_tag) + TX_MPDU_LEN_MAX)
| Max buffer size.
#define | TX_BUFFER_POOL_MAX (AC_MAX * RW_USER_MAX + NX_BEACONING)
| Number of TX buffer pools.
#define | TX_MIN_DOWNLOAD_CNT 4
| Size of the memory area reserved for one buffer pool (in number of 32-bit words).
#define | TX_BUFFER_POOL_SIZE ((TX_MIN_DOWNLOAD_CNT * TX_BUFFER_MAX) / 4)
| Size of the buffer pool (in number of 32-bit words) per queue.
#define | TX_BUFFER_NULL 0xFFFFFFFF
| Buffer is allocated.
#define | TX_BUFFER_PADDING_MAX 0
| Maximum size of the padding between the Buffer Control structure and the payload.
#define | TX_BUFFER_PADDING_MASK 0x00000003
| Mask of the padding bits in the SW control information field.
#define | TX_BUFFER_PADDING_OFT 0
| Offset of the padding bits in the SW control information field.
#define | TX_BUFFER_MIN_SIZE 256
| Minimum amount of 32-bit words that form a super buffer.
#define | TX_BUFFER_MIN_AMPDU_DWNLD 500
| Minimum amount of data that has to be downloaded to chain an AMPDU.
#define | TX_DMA_DESC_MAX NX_TX_PAYLOAD_MAX
| Number of DMA descriptors present in the TX buffer header structure.
## Enumerations
enum | { BUF_FRONTIER = CO_BIT(0), BUF_SPLIT = CO_BIT(1), BUF_ALLOC_OK = CO_BIT(2), BUF_INT_MSDU = CO_BIT(3) }
| Buffer flags. More...
## Functions
static struct dma_desc * | txl_buffer_bfr_dma_desc_conf (struct txdesc *txdesc, struct dma_desc *dma_desc_bfr, struct dma_desc *dma_desc)
| Add the DMA descriptor used for the report download if required.
static uint32_t | txl_buffer_get_params (struct txdesc *txdesc, uint16_t *size, uint16_t *head_len, uint8_t pkt_idx)
| Get the different parameters (head_len, number of pool elements to allocate, etc.
static struct txl_buffer_tag * | txl_buffer_get_space (struct txl_buffer_idx_tag *idx, uint32_t needed, uint16_t head_len, uint32_t *remaining)
| Perform the allocation in the buffer space based on the parameters.
static void | txl_buffer_transfer (struct txdesc *txdesc, uint8_t access_category, struct txl_buffer_tag *buf, struct txl_buffer_idx_tag *idx, uint16_t size, uint32_t remaining, uint16_t head_len, uint8_t pkt_idx)
| Create the platform DMA descriptor list that will be used to perform the download of the payload.
## Variables
struct txl_buffer_env_tag | txl_buffer_env
| Environment of the Tx buffer management module.
uint32_t | txl_buffer_pool [TX_BUFFER_POOL_MAX][TX_BUFFER_POOL_SIZE]
| TX buffer space.
struct txl_buffer_hw_desc_tag | txl_buffer_hw_desc [TX_BUFFER_POOL_MAX]
| Additional HW descriptors used for non-contiguous buffers.
struct txl_buffer_env_tag | txl_buffer_env
| Environment of the Tx buffer management module.
struct txl_buffer_control | txl_buffer_control_desc [NX_REMOTE_STA_MAX]
| Per-STA buffer control descriptor pairs.
struct txl_buffer_control | txl_buffer_control_desc_bcmc [NX_VIRT_DEV_MAX]
| Per-VIF BC/MC buffer control descriptors.
uint32_t | txl_buffer_pool [TX_BUFFER_POOL_MAX][TX_BUFFER_POOL_SIZE]
| TX buffer space.
struct txl_buffer_hw_desc_tag | txl_buffer_hw_desc [TX_BUFFER_POOL_MAX]
| Additional HW descriptors used for non-contiguous buffers.
struct txl_buffer_control | txl_buffer_control_desc [NX_REMOTE_STA_MAX]
| NX_FULLY_HOSTED.
struct txl_buffer_control | txl_buffer_control_desc_bcmc [NX_VIRT_DEV_MAX]
| Per-VIF BC/MC buffer control descriptors.
## External API
void | txl_buffer_reinit (void)
| Re-initializes the Tx buffer area (upon recovery procedure).
void | txl_buffer_reset (uint8_t access_category)
| Reset a Tx pool.
struct txl_buffer_tag * | txl_buffer_alloc (struct txdesc *txdesc, uint8_t access_category, uint8_t user_idx, uint8_t pkt_idx)
| Allocates a Tx buffer.
bool | txl_buffer_free (struct txl_buffer_tag *buf, uint8_t access_category)
| Releases a Tx buffer.
void | txl_buffer_free_all (struct txdesc *txdesc, uint8_t access_category)
| Free the Tx buffer(s) attached to a TX descriptor.
void | txl_buffer_init (void)
| NX_FULLY_HOSTED.
__INLINE void | txl_buffer_push (uint8_t access_category, struct txl_buffer_tag *buf)
| Push a TX buffer in the buffer list.
__INLINE struct txl_buffer_tag * | txl_buffer_pop (uint8_t access_category)
| Pop a TX buffer from the buffer list.
__INLINE struct txl_buffer_tag * | txl_buffer_pick (uint8_t access_category)
| Pick a TX buffer from the buffer list.
__INLINE bool | txl_buffer_list_empty (uint8_t access_category)
| Check if the buffer list is empty.
__INLINE struct txl_buffer_tag * | txl_buffer_get (struct txdesc *txdesc)
| NX_FULLY_HOSTED.
__INLINE struct txl_buffer_control * | txl_buffer_control_get (struct txdesc *txdesc)
| Get the pointer to the buffer control structure.
__INLINE void * | txl_buffer_payload_get (struct txdesc *txdesc)
| Get the pointer to the buffer payload.
__INLINE uint32_t | txl_buffer_machdr_get (struct txdesc *txdesc)
| Get the address of the MAC header This function is supposed to be called when the payload is present in the shared memory.
__INLINE void | txl_buffer_control_trial (struct txdesc *txdesc, struct txl_buffer_tag *buf)
| If a trial transmission is requested, copy the trial rate configuration into the buffer and update the trial status.
__INLINE void | txl_buffer_control_copy (struct txdesc *txdesc, struct txl_buffer_tag *buf)
| Copy the buffer control structure into the buffer.
__INLINE int | txl_buffer_padding (struct txdesc *txdesc)
| Get the padding value from the SW control information field.
__INLINE bool | txl_buffer_is_amsdu_multi_buf (struct txdesc *txdesc)
| Check whether a MPDU is an A-MPDU stored in multiple TX buffers.
__INLINE bool | txl_buffer_is_amsdu_single_buf (struct txdesc *txdesc)
| Check whether a MPDU is an A-MPDU stored in a single TX buffer.
__INLINE void | txl_buffer_update_thd (struct txdesc *txdesc, uint8_t access_category)
| Update the THD and TBD after allocation of the TX buffer.
__INLINE void | txl_buffer_update_tbd (struct txdesc *txdesc, uint8_t access_category, uint8_t pkt_idx)
| Update the TBD of A-MSDU sub-frames after the first one.
__INLINE void | txl_buffer_mic_compute (struct txdesc *txdesc, uint32_t *mic_key, uint32_t start, uint32_t len, uint8_t access_category)
| Compute the TKIP MIC over the TX buffer.
__INLINE uint32_t | txl_buffer_used (uint8_t access_category, uint8_t user_idx)
| Returns the amount of data currently allocated in the TX buffer.
__INLINE uint8_t | txl_buffer_count (uint8_t access_category, uint8_t user_idx)
| Indicates if the TX buffer pool for this queue is full or not.

## Detailed Description

Definition and management of Tx payload buffers.

## Define Documentation

#define TX_MIN_DOWNLOAD_CNT 4

Size of the memory area reserved for one buffer pool (in number of 32-bit words).

Maximum number of payloads prepared in one call to the TX prepare function

Definition at line 72 of file txl_buffer.h.

Referenced by txl_transmit_prep().

## Enumeration Type Documentation

anonymous enum

Buffer flags.

Enumerator:

  BUF_FRONTIER | Flag indicating that the buffer is a frontier.
  BUF_SPLIT | Flag indicating that the buffer is split.
  BUF_ALLOC_OK | Flag indicating that enough data of the A-MPDU is downloaded.
  BUF_INT_MSDU | Flag indicating that the downloaded data is not the first MSDU of an A-MSDU.

Definition at line 126 of file txl_buffer.h.

## Function Documentation

struct txl_buffer_tag * txl_buffer_alloc | ( | struct txdesc * | txdesc,
|  | uint8_t | access_category,
|  | uint8_t | user_idx,
|  | uint8_t | pkt_idx |
| ) |  |  | `[read]`

Allocates a Tx buffer.

This primitive allocates a Tx buffer from the free pool according to the priority (one pool per access category).

Parameters:

  `[in]` | txdesc | TX Descriptor for which we need to allocate the buffer
  `[in]` | access_category | Access category for which the buffer is allocated
  `[in]` | user_idx | User index (for MU-MIMO TX only, 0 otherwise)
  `[in]` | pkt_idx | Indicates which payload is transfered when several payloads are present in the TX descriptors (i.e. in case of A-MSDU). 0xFF is a specific value indicating that the txdesc describes a small A-MSDU that shall be fully allocated in a single buffer.

Returns:
  A pointer to the allocated buffer, NULL if allocation failed.

Referenced by txl_payload_transfer().

static struct dma_desc* txl_buffer_bfr_dma_desc_conf | ( | struct txdesc * | txdesc,
|  | struct dma_desc * | dma_desc_bfr,
|  | struct dma_desc * | dma_desc |
| ) |  |  | `[static, read]`

Add the DMA descriptor used for the report download if required.

Parameters:

  `[in]` | txdesc | TX Descriptor for which we need to allocate the buffer
  `[in]` | dma_desc_bfr | Pointer to the DMA descriptor reserved for beamforming
  `[in]` | dma_desc | Last DMA descriptor currently in the chain

Returns:
  The pointer to the new DMA descriptor at the end of the chain (maybe unchanged)

Definition at line 66 of file txl_buffer.c.

References bfr_is_enabled(), bfr_tx_frame_ind(), CPU2HW, and dma_desc::next.

__INLINE void txl_buffer_control_copy | ( | struct txdesc * | txdesc,
|  | struct txl_buffer_tag * | buf |
| ) |  |  |

Copy the buffer control structure into the buffer.

Parameters:

  `[in]` | txdesc | The pointer to the TX descriptor
  `[in]` | buf | The pointer to the buffer allocated for the frame transmission

Definition at line 503 of file txl_buffer.h.

References umacdesc::buf_control, txl_buffer_tag::buffer_control, sizeof_b, txl_buffer_control_trial(), and txdesc::umac.

__INLINE struct txl_buffer_control* txl_buffer_control_get | ( | struct txdesc * | txdesc | ) | `[read]`

Get the pointer to the buffer control structure.

Parameters:

  `[in]` | txdesc | The pointer to the TX descriptor

Returns:
  The pointer to the buffer control structure

Definition at line 393 of file txl_buffer.h.

References txl_buffer_tag::buffer_control, and txl_buffer_get().

Referenced by txl_frame_prepare(), txl_frame_tdls_add_security_header(), txl_hwdesc_config_post(), and txu_cntrl_sec_hdr_append().

__INLINE void txl_buffer_control_trial | ( | struct txdesc * | txdesc,
|  | struct txl_buffer_tag * | buf |
| ) |  |  |

If a trial transmission is requested, copy the trial rate configuration into the buffer and update the trial status.

Parameters:

  `[in]` | txdesc | The pointer to the TX descriptor
  `[in]` | buf | The pointer to the buffer allocated for the frame transmission

Definition at line 456 of file txl_buffer.h.

References umacdesc::buf_control, txl_buffer_tag::buffer_control, hostdesc::flags, txdesc::host, tx_policy_tbl::phycntrlinfo1, txl_buffer_control::policy_tbl, tx_policy_tbl::powercntrlinfo, PROF_RC_SET_TRIAL_BUFFER_CLR, PROF_RC_SET_TRIAL_BUFFER_SET, tx_policy_tbl::ratecntrlinfo, rc_get_sta_stats(), hostdesc::staid, STBC_PT_MASK, rc_sta_stats::trial_rate, txl_buffer_control::tx_flags, TX_SWDESC_UMAC_TRIAL_STBC_BIT, TXU_CNTRL_RC_TRIAL, and txdesc::umac.

Referenced by txl_buffer_control_copy().

__INLINE uint8_t txl_buffer_count | ( | uint8_t | access_category,
|  | uint8_t | user_idx |
| ) |  |  |

Indicates if the TX buffer pool for this queue is full or not.

Parameters:

  `[in]` | access_category | Access category for which the buffer data is checked
  `[in]` | user_idx | User index (for MU-MIMO TX only, 0 otherwise)

Returns:
  true if the buffer pool is full, false otherwise

Definition at line 1087 of file txl_buffer.h.

References txl_buffer_env_tag::buf_idx, txl_buffer_idx_tag::count, and txl_buffer_env.

Referenced by txl_transmit_prep().

bool txl_buffer_free | ( | struct txl_buffer_tag * | buf,
|  | uint8_t | access_category |
| ) |  |  |

Releases a Tx buffer.

Parameters:

  `[in]` | buf | Pointer to the buffer to be freed
  `[in]` | access_category | Access category for which the buffer is freed

Returns:
  true if a new buffer allocation attempt can occur, false otherwise

void txl_buffer_free_all | ( | struct txdesc * | txdesc,
|  | uint8_t | access_category |
| ) |  |  |

Free the Tx buffer(s) attached to a TX descriptor.

Parameters:

  `[in]` | txdesc | TX Descriptor for which we need to free the buffer(s)
  `[in]` | access_category | Access category on which the buffer(s) are freed

Referenced by txl_cfm_flush(), and txl_cfm_flush_desc().

__INLINE struct txl_buffer_tag* txl_buffer_get | ( | struct txdesc * | txdesc | ) | `[read]`

NX_FULLY_HOSTED.

Get the pointer to the buffer structure

Parameters:

  `[in]` | txdesc | The pointer to the TX descriptor

Returns:
  The pointer to the buffer structure

Definition at line 372 of file txl_buffer.h.

References lmacdesc::buffer, and txdesc::lmac.

Referenced by txl_buffer_control_get(), txl_buffer_machdr_get(), txl_buffer_mic_compute(), txl_buffer_payload_get(), txl_buffer_update_thd(), txl_frame_prepare(), txl_hwdesc_config_post(), txl_int_fake_transfer(), and txl_payload_handle().

static uint32_t txl_buffer_get_params | ( | struct txdesc * | txdesc,
|  | uint16_t * | size,
|  | uint16_t * | head_len,
|  | uint8_t | pkt_idx |
| ) |  |  | `[static]`

Get the different parameters (head_len, number of pool elements to allocate, etc.

) for the current allocation.

Parameters:

  `[in]` | txdesc | TX Descriptor for which we need to allocate the buffer
  `[out]` | size | Amount of data to transfer via DMA after allocation
  `[out]` | head_len | Amount of space reserved at the beginning of buffer
  `[in]` | pkt_idx | Indicates which payload is transfered when several payloads are present in the TX descriptors (i.e. in case of A-MSDU). 0xFF is a specific value indicating that the txdesc describes a small A-MSDU that shall be fully allocated in a single buffer.

Returns:
  The number of pool elements that need to be allocated

Definition at line 98 of file txl_buffer.c.

References CO_ALIGN4_HI, hostdesc::flags, tx_hd::frmlen, umacdesc::head_len, txdesc::host, lmacdesc::hw_desc, txdesc::lmac, MAC_FCS_LEN, hostdesc::packet_cnt, hostdesc::packet_len, sizeof_b, umacdesc::tail_len, tx_hw_desc::thd, TX_BUFFER_PADDING_MAX, TXU_CNTRL_MGMT_ROBUST, and txdesc::umac.

static struct txl_buffer_tag* txl_buffer_get_space | ( | struct txl_buffer_idx_tag * | idx,
|  | uint32_t | needed,
|  | uint16_t | head_len,
|  | uint32_t * | remaining |
| ) |  |  | `[static, read]`

Perform the allocation in the buffer space based on the parameters.

Parameters:

  `[in]` | idx | Pointer to the TX buffer pool in which the allocation is done
  `[in]` | needed | Number of pool elements to allocate
  `[in]` | head_len | Amount of space reserved at the beginning of the buffer
  `[out]` | remaining | Number of pool elements between the allocated buffer position and the end of the buffer space.

Returns:
  The pointer to the allocated buffer structure

Definition at line 176 of file txl_buffer.c.

References ASSERT_ERR, BUF_FRONTIER, txl_buffer_idx_tag::buf_size, txl_buffer_idx_tag::count, txl_buffer_tag::flags, txl_buffer_idx_tag::free, txl_buffer_idx_tag::free_size, txl_buffer_idx_tag::last, txl_buffer_tag::length, txl_buffer_idx_tag::next_needed, txl_buffer_idx_tag::pool, sizeof_b, TX_BUFFER_MIN_SIZE, TX_BUFFER_NULL, TX_BUFFER_PADDING_MAX, TX_BUFFER_POOL_SIZE, and txl_buffer_idx_tag::used_area.

void txl_buffer_init | ( | void |  | ) |

NX_FULLY_HOSTED.

Initializes the Tx buffer area

NX_FULLY_HOSTED

__INLINE bool txl_buffer_is_amsdu_multi_buf | ( | struct txdesc * | txdesc | ) |

Check whether a MPDU is an A-MPDU stored in multiple TX buffers.

Parameters:

  `[in]` | txdesc | The pointer to the TX descriptor to be checked.

Returns:
  true if the MPDU is an A-MPDU stored in multiple TX buffers, false otherwise.

Definition at line 554 of file txl_buffer.h.

References tx_hd::frmlen, lmacdesc::hw_desc, is_mpdu_split(), txdesc::lmac, tx_hw_desc::thd, and TX_MPDU_LEN_MAX.

Referenced by txl_buffer_update_thd(), and txl_hwdesc_config_post().

__INLINE bool txl_buffer_is_amsdu_single_buf | ( | struct txdesc * | txdesc | ) |

Check whether a MPDU is an A-MPDU stored in a single TX buffer.

Parameters:

  `[in]` | txdesc | The pointer to the TX descriptor to be checked.

Returns:
  true if the MPDU is an A-MPDU stored in a single TX buffer, false otherwise.

Definition at line 568 of file txl_buffer.h.

References tx_hd::frmlen, lmacdesc::hw_desc, is_mpdu_split(), txdesc::lmac, tx_hw_desc::thd, and TX_MPDU_LEN_MAX.

Referenced by txl_buffer_update_thd(), and txl_payload_transfer().

__INLINE bool txl_buffer_list_empty | ( | uint8_t | access_category | ) |

Check if the buffer list is empty.

Parameters:

  `[in]` | access_category | The index of the TX queue

Returns:
  true if the list is empty, false otherwise

Definition at line 353 of file txl_buffer.h.

References txl_buffer_list_tag::first, txl_buffer_env_tag::list, and txl_buffer_env.

__INLINE uint32_t txl_buffer_machdr_get | ( | struct txdesc * | txdesc | ) |

Get the address of the MAC header This function is supposed to be called when the payload is present in the shared memory.

Parameters:

  `[in]` | txdesc | The pointer to the TX descriptor

Returns:
  HW address of the MAC header

Definition at line 426 of file txl_buffer.h.

References ASSERT_ERR, tx_pbd::datastartptr, tx_hd::datastartptr, tx_hd::first_pbd_ptr, HW2CPU, lmacdesc::hw_desc, txdesc::lmac, tx_hw_desc::thd, and txl_buffer_get().

Referenced by txl_frame_exchange_manage(), txl_hwdesc_config_post(), and txl_payload_handle().

__INLINE void txl_buffer_mic_compute | ( | struct txdesc * | txdesc,
|  | uint32_t * | mic_key,
|  | uint32_t | start,
|  | uint32_t | len,
|  | uint8_t | access_category |
| ) |  |  |

Compute the TKIP MIC over the TX buffer.

This function handles split buffers (i.e. buffers split accross the end and the start of the buffer pool. The resulting MIC is copied at the end of the buffer.

Parameters:

  `[in]` | txdesc | The pointer to the TX descriptor linked to the buffer
  `[in]` | mic_key | The pointer to the MIC key to be used
  `[in]` | start | Start address of the payload on which the MIC is computed
  `[in]` | len | Length of the payload on which the MIC is computed
  `[in]` | access_category | The corresponding queue index

Definition at line 927 of file txl_buffer.h.

References txl_buffer_env_tag::buf_idx, co_copy8p(), CPU2HW, hostdesc::eth_dest_addr, hostdesc::eth_src_addr, txdesc::host, me_mic_calc(), me_mic_end(), me_mic_init(), mic_calc::mic_key_least, txl_buffer_idx_tag::pool, sizeof_b, hostdesc::tid, TX_BUFFER_POOL_SIZE, txl_buffer_env, txl_buffer_get(), and txl_buffer_tag::user_idx.

__INLINE int txl_buffer_padding | ( | struct txdesc * | txdesc | ) |

Get the padding value from the SW control information field.

Parameters:

  `[in]` | txdesc | The pointer to the TX descriptor for which the padding value has to be retrieved

Returns:
  The padding value

Definition at line 534 of file txl_buffer.h.

References txdesc::host.

Referenced by txl_buffer_update_thd().

__INLINE void* txl_buffer_payload_get | ( | struct txdesc * | txdesc | ) |

Get the pointer to the buffer payload.

Parameters:

  `[in]` | txdesc | The pointer to the TX descriptor

Returns:
  The pointer to the buffer payload

Definition at line 409 of file txl_buffer.h.

References txl_buffer_tag::payload, and txl_buffer_get().

Referenced by bfr_prep_bfr_poll(), bfr_prep_ndpa(), ps_send_pspoll(), txl_frame_init(), txl_frame_init_desc(), txl_frame_send_null_frame(), txl_frame_send_qosnull_frame(), txl_frame_send_tdls_channel_switch_req_frame(), txl_frame_send_tdls_channel_switch_rsp_frame(), and txl_frame_send_tdls_peer_traffic_ind_frame().

__INLINE struct txl_buffer_tag* txl_buffer_pick | ( | uint8_t | access_category | ) | `[read]`

Pick a TX buffer from the buffer list.

This function returns the first TX buffer in the list, without popping it.

Parameters:

  `[in]` | access_category | The index of the TX queue

Returns:
  The pointer to the first TX buffer in the list

Definition at line 337 of file txl_buffer.h.

References txl_buffer_list_tag::first, txl_buffer_env_tag::list, and txl_buffer_env.

__INLINE struct txl_buffer_tag* txl_buffer_pop | ( | uint8_t | access_category | ) | `[read]`

Pop a TX buffer from the buffer list.

This function is called upon the completion of the payload DMA transfer of a pushed buffer.

Parameters:

  `[in]` | access_category | The index of the TX queue for which the buffer was pushed

Returns:
  The pointer to the TX buffer pushed

Definition at line 311 of file txl_buffer.h.

References txl_buffer_list_tag::first, txl_buffer_env_tag::list, txl_buffer_tag::next, and txl_buffer_env.

__INLINE void txl_buffer_push | ( | uint8_t | access_category,
|  | struct txl_buffer_tag * | buf |
| ) |  |  |

Push a TX buffer in the buffer list.

This function is called when a specific handling needs to be performed upon completion of the payload DMA transfer (e.g. for singleton MPDUs or first MPDU of A-MPDUs).

Parameters:

  `[in]` | access_category | The index of the TX queue for which the buffer is pushed
  `[in]` | buf | The pointer to the TX buffer to be pushed

Definition at line 279 of file txl_buffer.h.

References txl_buffer_list_tag::first, txl_buffer_list_tag::last, txl_buffer_env_tag::list, txl_buffer_tag::next, and txl_buffer_env.

Referenced by txl_int_fake_transfer().

void txl_buffer_reinit | ( | void |  | ) |

Re-initializes the Tx buffer area (upon recovery procedure).

void txl_buffer_reset | ( | uint8_t | access_category | ) |

Reset a Tx pool.

This primitive frees all the allocated buffers of a Tx pool.

Parameters:

  `[in]` | access_category | Access category for which the pool is reset

static void txl_buffer_transfer | ( | struct txdesc * | txdesc,
|  | uint8_t | access_category,
|  | struct txl_buffer_tag * | buf,
|  | struct txl_buffer_idx_tag * | idx,
|  | uint16_t | size,
|  | uint32_t | remaining,
|  | uint16_t | head_len,
|  | uint8_t | pkt_idx |
| ) |  |  | `[static]`

Create the platform DMA descriptor list that will be used to perform the download of the payload.

Parameters:

  `[in]` | txdesc | TX Descriptor for which we need to allocate the buffer
  `[in]` | access_category | TX queue index for the TX
  `[in]` | buf | Pointer to the allocated buffer structure
  `[in]` | idx | Pointer to the TX buffer pool in which the allocation is done
  `[in]` | size | Amount of bytes that will need to be transfered using DMA
  `[in]` | remaining | Number of pool elements between the allocated buffer position and the end of the buffer space (used to detect buffer wrapping).
  `[in]` | head_len | Amount of space reserved at the beginning of the buffer
  `[in]` | pkt_idx | Indicates which payload is transfered when several payloads are present in the TX descriptors (i.e. in case of A-MSDU). 0xFF is a specific value indicating that the txdesc describes a small A-MSDU that shall be fully allocated in a single buffer.

Definition at line 282 of file txl_buffer.c.

References CPU2HW, dma_desc::ctrl, txl_buffer_idx_tag::desc, dma_desc::dest, txl_buffer_hw_desc_tag::dma_desc, txl_buffer_tag::dma_desc, txl_buffer_tag::dma_desc_pat, hostdesc::flags, umacdesc::head_len, txdesc::host, dma_desc::length, MAC_SHORT_MAC_HDR_LEN, dma_desc::next, offsetof_b, hostdesc::packet_addr, hostdesc::packet_cnt, hostdesc::packet_len, txl_buffer_idx_tag::pool, sizeof_b, dma_desc::src, TX_BUFFER_PADDING_MAX, TXU_CNTRL_MGMT_ROBUST, and txdesc::umac.

__INLINE void txl_buffer_update_tbd | ( | struct txdesc * | txdesc,
|  | uint8_t | access_category,
|  | uint8_t | pkt_idx |
| ) |  |  |

Update the TBD of A-MSDU sub-frames after the first one.

This function initializes the TBD linked to A-MSDU sub-frames #2 - #n (Sub-frame #1 THD/TBD is updated in txl_buffer_update_thd).

Parameters:

  `[in]` | txdesc | The pointer to the TX descriptor for which the TBD has to be updated
  `[in]` | access_category | The corresponding queue index
  `[in]` | pkt_idx | Index of the MSDU inside the A-MSDU

Returns:
  The padding value

Definition at line 836 of file txl_buffer.h.

References ASSERT_ERR, BUF_FRONTIER, txl_buffer_env_tag::buf_idx, BUF_SPLIT, tx_pbd::bufctrlinfo, lmacdesc::buffer, CPU2HW, tx_pbd::dataendptr, tx_pbd::datastartptr, txl_buffer_idx_tag::desc, txl_buffer_tag::flags, txdesc::host, is_mpdu_last(), txl_list::last_pbd, txdesc::lmac, tx_pbd::next, hostdesc::packet_cnt, hostdesc::packet_len, txl_buffer_tag::payload, txl_buffer_hw_desc_tag::pbd, txl_buffer_idx_tag::pool, sizeof_b, umacdesc::tail_len, txl_buffer_tag::tbd, TBD_INTERRUPT_EN, TX_BUFFER_POOL_SIZE, txl_buffer_env, txl_cntrl_env, txl_cntrl_env_tag::txlist, txdesc::umac, and txl_buffer_tag::user_idx.

Referenced by txl_payload_transfer().

__INLINE void txl_buffer_update_thd | ( | struct txdesc * | txdesc,
|  | uint8_t | access_category |
| ) |  |  |

Update the THD and TBD after allocation of the TX buffer.

This function initializes various pointers of the HW descriptors to memory areas that are inside the allocated TX buffer, and that can therefore not be set prior to the allocation.

Parameters:

  `[in]` | txdesc | The pointer to the TX descriptor for which the THD and TBD have to be updated
  `[in]` | access_category | The corresponding queue index

****************************************************************************************

Definition at line 688 of file txl_buffer.h.

References ASSERT_ERR, BUF_FRONTIER, txl_buffer_env_tag::buf_idx, BUF_SPLIT, tx_pbd::bufctrlinfo, txl_buffer_idx_tag::count, CPU2HW, tx_hd::dataendptr, tx_pbd::dataendptr, tx_hd::datastartptr, tx_pbd::datastartptr, txl_buffer_idx_tag::desc, tx_hd::first_pbd_ptr, txl_buffer_tag::flags, tx_hd::frmlen, umacdesc::head_len, txdesc::host, lmacdesc::hw_desc, INTERRUPT_EN_TX, is_mpdu_agg(), is_mpdu_last(), is_mpdu_split(), txl_list::last_pbd, txdesc::lmac, MAC_FCS_LEN, tx_hd::macctrlinfo2, umacdesc::machead_len, tx_pbd::next, hostdesc::packet_len, txl_buffer_tag::payload, txl_buffer_hw_desc_tag::pbd, txl_buffer_idx_tag::pool, sizeof_b, umacdesc::tail_len, txl_buffer_tag::tbd, TBD_INTERRUPT_EN, tx_hw_desc::thd, TX_BUFFER_POOL_SIZE, txl_buffer_env, txl_buffer_get(), txl_buffer_is_amsdu_multi_buf(), txl_buffer_is_amsdu_single_buf(), txl_buffer_padding(), txl_cntrl_env, txl_cntrl_env_tag::txlist, txdesc::umac, txl_buffer_tag::user_idx, and WHICHDESC_UNFRAGMENTED_MSDU.

Referenced by txl_payload_transfer().

__INLINE uint32_t txl_buffer_used | ( | uint8_t | access_category,
|  | uint8_t | user_idx |
| ) |  |  |

Returns the amount of data currently allocated in the TX buffer.

Parameters:

  `[in]` | access_category | Access category for which the buffer data is checked
  `[in]` | user_idx | User index (for MU-MIMO TX only, 0 otherwise)

Returns:
  The allocated data size, in 32-bit words

Definition at line 1071 of file txl_buffer.h.

References txl_buffer_env_tag::buf_idx, txl_buffer_env, and txl_buffer_idx_tag::used_area.

## Variable Documentation

struct txl_buffer_control txl_buffer_control_desc[NX_REMOTE_STA_MAX]

NX_FULLY_HOSTED.

Per-STA buffer control descriptor pairs.

Definition at line 38 of file txl_buffer_shared.c.