# /space/home/slher/rel/Beken/v6_4_5/macsw/ip/lmac/src/tx/txl/txl_agg.c File Reference

TX aggregation function implementation. More...

`#include "co_int.h"`
`#include "co_bool.h"`
`#include <string.h>`
`#include "dbg_assert.h"`
`#include "mac.h"`
`#include "mac_frame.h"`
`#include "mm.h"`
`#include "macif.h"`
`#include "rxl_hwdesc.h"`
`#include "txl_buffer.h"`
`#include "txl_frame.h"`
`#include "tx_swdesc.h"`
`#include "txl_cfm.h"`
`#include "txl_cntrl.h"`
`#include "rxl_cntrl.h"`
`#include "reg_mac_pl.h"`
`#include "reg_mac_core.h"`
`#include "dbg.h"`
`#include "ps.h"`
`#include "p2p.h"`
`#include "td.h"`
`#include "txu_cntrl.h"`
`#include "apm.h"`
`#include "mfp.h"`
`#include "bfr.h"`
`#include "txl_agg.h"`

Go to the source code of this file.

## Defines
#define | TX_SEC_IRQ_BITS_MERGED
| Bits indicating activity on secondary users (merged trigger and buffer).
#define | MU_AMPDU_CLOSE()
| Operations performed upon the closure of a MU-MIMO A-MPDU during A-MPDU formation.
#define | VHT_BW 4
| Number of BW configurations in VHT.
#define | VHT_MCS 10
| Number of MCS in VHT.
#define | TX_MIN_AMPDU_NB_PER_AC (3 * RW_USER_MAX)
| Minimum of A-MPDU descriptors per queue.
#define | TX_AGG_DIVIDER (8 / RW_USER_MAX)
| Number of TX descriptors for 1 AGG descriptor.
#define | TX_MAX_AMPDU_NB_PER_AC0 TX_MIN_AMPDU_NB_PER_AC
| Max number of AMPDU descriptors for the BK queue.
#define | TX_MAX_AMPDU_NB_PER_AC1 TX_MIN_AMPDU_NB_PER_AC
| Max number of AMPDU descriptors for the BE queue.
#define | TX_MAX_AMPDU_NB_PER_AC2 TX_MIN_AMPDU_NB_PER_AC
| Max number of AMPDU descriptors for the VI queue.
#define | TX_MAX_AMPDU_NB_PER_AC3 TX_MIN_AMPDU_NB_PER_AC
| Max number of AMPDU descriptors for the VO queue.
#define | TX_MAX_AMPDU_NB_PER_AC4 TX_MIN_AMPDU_NB_PER_AC
| Max number of AMPDU descriptors for the BCN queue.
#define | TX_AMPDU_DESC_QUEUE_CNT (NX_TXQ_CNT + NX_MAC_HE)
| Number of A-MPDU descriptor queues.
## Functions
static bool | txl_desc_is_agg (struct txdesc *txdesc, struct tx_agg_desc *agg_desc)
| Check if a txdesc can be aggregated in an AMPDU.
static bool | txl_ampdu_has_ht_vht_rate (struct txdesc *txdesc)
| Check if the phy_flags in TX descriptor indicate a HT or VHT rate, that would allow aggregation.
static uint32_t | txl_vht_idx_to_32us_len_get (int base_idx, uint8_t bw)
| Get the 32us length from the HT/VHT table for a given base index, bw pair.
static uint16_t | txl_vht_idx_to_1us_len_get (int base_idx, uint8_t bw)
| Get the 1us length from the HT/VHT table for a given base index, bw pair.
static int | txl_ht_vht_ampdu_param_get (struct txdesc *txdesc, uint8_t format_mod, uint32_t *max_len_sta, uint32_t *nss)
| Compute the base rate index that should be used to compute the Maximum PHY length of the HT/VHT A-MPDU and the minimum A-MPDU subframe length.
static void | txl_ampdu_constraints_get (struct txdesc *txdesc, uint8_t ac, struct txl_agg_build_tag *agg)
| Calculate number of blank delimiters to ensure MMSS after a txdesc This number will be set in the THD of the NEXT txdesc in AMPDU.
static void | txl_fill_bar (struct tx_agg_desc *agg_desc, uint16_t sn, uint8_t staid, uint8_t tid, uint8_t bw)
| Fill BAR frame (THD and payload).
static void | txl_agg_hwdesc_init (void)
| Initialize Hardware TX descriptors for A-MPDU.
static void | txl_agg_hwdesc_reset (void)
| Reset all hardware TX descriptor for A-MPDU.
static void | txl_mumimo_convert (uint8_t ac, uint8_t user_pos)
| Convert a MU-MIMO A-MPDU or MPDU into a SU one.
static uint32_t | txl_mumimo_duration_ns (uint32_t length, uint8_t mcs, bool sgi, uint8_t bw, uint8_t nss)
| Compute the duration of the data part of a MU-MIMO A-MPDU.
static void | txl_mumimo_ampdu_finish (uint8_t ac, uint8_t user_pos)
| Terminates the MU-MIMO A-MPDU under construction.
static int | txl_mumimo_check (struct txdesc *txdesc, uint8_t ac, uint8_t *user_pos)
| This function checks if the newly pushed TX descriptor can be part of a MU-MIMO PPDU under construction, or if it can start a new MU-MIMO PPDU.
static void | txl_mumimo_secondary_done (uint8_t access_category, uint8_t user_idx)
| Unchains the frame exchanges that have been completed.
External API
void | txl_agg_mumimo_close (uint8_t ac)
| Terminates the MU-MIMO PPDU.
uint16_t | txl_agg_mpdu_nb_delims (struct tx_hd *thd, uint16_t mmss_bytes)
| Calculate number of blank delimiters to ensure MMSS after a THD This number will be set in the THD of the NEXT txdesc in AMPDU.
void | txl_agg_init (void)
| Initializes the TX aggregation module.
void | txl_agg_reset (void)
| Reset the TX aggregation module.
void | txl_agg_finish (uint8_t ac)
| Terminates the non MU-MIMO A-MPDU under construction This function can be called in several cases: The new TX descriptor pushed is not compliant with the current A-MPDU The length of the current A-MPDU has reached the limit The number of MPDUs in the current A-MPDU has reached the limit The TX queue will become empty and new data shall be programmed for transmission.
int | txl_agg_push_mpdu (struct txdesc *txdesc, uint8_t ac)
| Try and aggregate txdesc, several checks are made, when they fail the MPDU goes on to be downloaded as a normal singleton MPDU.
void | txl_agg_release (struct tx_agg_desc *agg_desc)
| Release all AMPDU related space: BA, BAR, aggregate control and its AMPDU THD.
struct tx_hd * | txl_agg_change_to_singleton (struct txdesc *txdesc, bool he_tb)
| Transform a MPDU part of an A-MPDU into a singleton MPDU.
void | txl_agg_bw_drop_handle (uint8_t access_category)
| Handler of the HW BW drop mechanism interrupt Based on the actual BW of transmission, this function cuts the A-MPDU under transmission and chains the following MPDUs as singleton.
void | txl_agg_check (uint8_t access_category)
| Check if there is an A-MPDU under construction and if the TX queue is empty.
void | txl_agg_sec_transmit_trigger (void)
| Process secondary user events of the MACTX IRQ.
void | txl_agg_set_ampdu_protection (uint32_t *rc)
| Add Self-CTS protection to the A-MPDU.
void | txl_agg_check_rtscts_retry_limit (struct tx_hd *a_thd, uint8_t access_category)
| Check if the current A-MPDU header descriptor indicates that the RTS/CTS retry limit has been reached.
void | txl_agg_check_saved_agg_desc (uint8_t access_category)
| Check if an A-MPDU descriptor is currently saved and free it.
## Variables
const uint8_t | TX_VHT_RATE_TO_MIN_SEP [10 *4 *2]
| Table linking HT or VHT MCS+GI+BW to minimum number of bytes for 1us min MPDU start spacing in AMPDU Index of the table is (MCS_IDX << 3) | (BW << 1) | (GI_400) where BW is 0 for 20 MHz, 1 for 40MHz and 2 for 80MHz GI_400 is 1 if packet is being sent with 400ns GI, 0 if 800ns GI.
const uint16_t | TX_VHT_RATE_TO_32US_LEN [10 *4 *2]
| Table linking HT or VHT MCS+GI+BW to the number of bytes transmitted in 32us Index of the table is (MCS_IDX << 3) | (BW << 1) | (GI_400) where BW is 0 for 20 MHz, 1 for 40MHz and 2 for 80MHz GI_400 is 1 if packet is being sent with 400ns GI, 0 if 800ns GI.
const uint16_t | VHT_NDBPS [VHT_BW][VHT_MCS]
| IEEE P802.11ac D3.0 Chptr 22.5 Parameters for VHT MCSs Note that some BW, MCS, NSS combinations are not allowed (e.g 20MHz, MCS9, NSS 1,2) The NDBPS value given for MCS9 20MHz is for NSS=3.
static struct tx_agg_desc | tx_agg_desc_array0 [TX_MAX_AMPDU_NB_PER_AC0]
| Array of aggregation descriptors for the BK queue.
static struct tx_agg_desc | tx_agg_desc_array1 [TX_MAX_AMPDU_NB_PER_AC1]
| Array of aggregation descriptors for the BE queue.
static struct tx_agg_desc | tx_agg_desc_array2 [TX_MAX_AMPDU_NB_PER_AC2]
| Array of aggregation descriptors for the VI queue.
static struct tx_agg_desc | tx_agg_desc_array3 [TX_MAX_AMPDU_NB_PER_AC3]
| Array of aggregation descriptors for the VO queue.
static struct tx_agg_desc | tx_agg_desc_array4 [TX_MAX_AMPDU_NB_PER_AC4]
| Array of aggregation descriptors for the BCN queue.
static struct tx_agg_desc *const | tx_agg_desc_array [TX_AMPDU_DESC_QUEUE_CNT]
| Table of pointers to the different aggregation descriptor arrays.
static const int | tx_agg_desc_cnt [TX_AMPDU_DESC_QUEUE_CNT]
| Number of aggregation descriptor per queue.
struct co_list | tx_agg_desc_pool [TX_AMPDU_DESC_QUEUE_CNT]
| Per-ac pools of free aggregation descriptors.

## Detailed Description

TX aggregation function implementation.

Copyright (C) RivieraWaves 2011-2019

Definition in file txl_agg.c.