# TX_CNTRL
[TX]

Controller of TX data path. More...

Collaboration diagram for TX_CNTRL:

## Data Structures
struct | txl_agg_build_tag
| Structure containing the information about the current A-MPDU being built. More...
struct | txl_mumimo_build_info_tag
| Structure containing the information about the MU-MIMO PPDU being built. More...
struct | txl_list
| Structure of a per-AC Tx list. More...
struct | txl_cntrl_env_tag
| Context of the Tx Control block. More...
## Defines
#define | TX_IRQ_BITS
| TX IRQ bits enabled.
#define | TX_SEC_IRQ_BITS_MERGED
| Bits indicating activity on secondary users (merged trigger and buffer).
#define | TX_BW_DROP_IRQ
| Bits indicating that a BW drop has been triggered on an access category.
#define | TB_PROT_TRIGGER_BIT 0
| HE TB protocol trigger interrupt bit.
#define | TB_TX_TRIGGER_BIT 0
| HE TB transmission trigger interrupt bit.
#define | SEC_USER_TX_TRIGGER_BIT NXMAC_SEC_USER_TX_TRIGGER_BIT
| Secondary user trigger interrupt bit.
#define | TX_PROT_IRQ
| TX protocol trigger interrupt bits.
#define | TX_TRANSMIT_IRQ
| TX transmit trigger interrupt bits.
#define | FRAME_OK (DESC_DONE_TX_BIT | FRAME_SUCCESSFUL_TX_BIT)
| Flags indicating that a frame has been correctly transmitted by the HW.
#define | TX_AC0_TIMEOUT 5000000
| AC0 queue timeout.
#define | TX_AC1_TIMEOUT 2000000
| AC1 queue timeout.
#define | TX_AC2_TIMEOUT 400000
| AC2 queue timeout.
#define | TX_AC3_TIMEOUT 200000
| AC3 queue timeout.
#define | TX_BCN_TIMEOUT 50000
| BCN queue timeout.
#define | TX_AC2LLI(ac) ((ac) + IPC_DMA_LLI_DATA_AC0_TX)
| Conversion from Access Category to corresponding DMA LLI.
#define | TX_LLI2AC(idx) ((idx) - IPC_DMA_LLI_DATA_AC0_TX)
| Conversion from DMA LLI to corresponding Access Category.
#define | TX_AC2TIMER(ac) ((ac) + HAL_AC0_TIMER)
| Conversion from Access Category to corresponding TX timer.
#define | TX_LLICTRL(ac, irqenable)
| Conversion from Access Category to corresponding bridge DMA control field.
#define | AC_BCN AC_MAX
| Index of the beacon queue.
#define | TX_NTX_2_ANTENNA_SET(ntx) ((CO_BIT((ntx) + 1) - 1) << ANTENNA_SET_PT_OFT)
| Default TX antenna mask.
#define | MU_USER_MASK (CO_BIT(RW_USER_MAX) - 1)
| Default TX antenna mask.
## Enumerations
enum | { THD_CHK_STATE, BAR_THD_CHK_STATE }
| Tx trigger descriptor status check states. More...
enum | { AGG_FORMATTED = 0x01, AGG_DOWNLOADED = 0x02, AGG_ALLOC = 0x04, AGG_FIRST_DOWNLOADED = 0x08, AGG_DONE = 0x10, AGG_BA_RECEIVED = 0x20, AGG_BA_VALID = 0x40, AGG_INT = 0x80, AGG_MU = 0x100, AGG_TB = 0x200 }
| Aggregation process status bits. More...
enum | { SU_PACKET, MU_PACKET, MU_PAUSED, MU_RESTART_CHECK }
| Status of a packet pushed for aggregation, when MU-MIMO is enabled. More...
## Functions
__INLINE void | txl_smoothing_set (struct tx_hd *thd, struct tx_policy_tbl *pt, uint32_t smoothing)
| Set the smoothing bit to the correct HW descriptor.
__INLINE void | txl_timer_start (uint8_t ac)
| Start a TX timer.
__INLINE void | txl_timer_move (uint8_t ac)
| Move the TX timer according to the access category.
__INLINE void | txl_timer_clear (uint8_t ac)
| Clear a TX timer.
static void | txl_int_fake_transfer (struct txdesc *txdesc, uint8_t access_category)
| Prepare the transfer of payload from host memory to emb memory.
static bool | txl_payload_transfer (struct txdesc *txdesc, uint8_t access_category, uint8_t user_idx)
| Prepare the transfer of payload from host memory to emb memory.
static void | txl_transmit_prep (int access_category, uint8_t user_idx)
| Go through the TX list and prepare the download of the payloads.
static void | txl_hwdesc_config_pre (struct txdesc *txdesc, int access_category)
| NX_FULLY_HOSTED.
static void | txl_hwdesc_config_post (struct txdesc *txdesc, uint8_t access_category)
| Initialization of the HW descriptors, after payload download.
static void | txl_machdr_format (uint32_t machdrptr)
| Format the MAC header.
static void | txl_cntrl_newtail (uint8_t access_category)
| Set the new tail bit for the specified access category.
static void | txl_frame_exchange_done (uint8_t access_category)
| Unchains the frame exchanges that have been completed.
static void | txl_frame_exchange_manage (struct txdesc *txdesc, struct txl_buffer_tag *buffer, uint8_t access_category)
| Manage atomic frame exchange formatting and chaining of previous one to it.
static void | txl_cntrl_postpone (struct txdesc *txdesc, uint8_t access_category)
| Postpone an internal packet ready for TX.
static bool | txl_cntrl_start_pm_mon (struct mac_hdr *mac_hdr)
| Check if the PM bit monitoring shall be started on the given MAC Header.
static void | txl_check_bcmc_status (struct txdesc *txdesc, uint8_t access_category, uint32_t machdrptr)
| Set and/or Save more_data flag status for frame sent on AC_BCN queue.
static void | txl_payload_handle (struct txdesc *txdesc, struct txl_buffer_tag *buffer, uint8_t access_category)
| Perform operations on payloads that have been transfered from host memory.
## Variables
const uint32_t | TX_TIMEOUT [NX_TXQ_CNT]
| Table containing the TX timeout value per TX queue.
struct txl_cntrl_env_tag | txl_cntrl_env
| Tx Control context variable.
const uint32_t | txl_prep_evt_bit [NX_TXQ_CNT]
| Table mapping the TX prepare event bit to the queue index.
struct txl_cntrl_env_tag | txl_cntrl_env
| Tx Control context variable.
## External API
bool | txl_payload_alloc (struct txdesc *txdesc, uint8_t access_category, uint8_t user_idx)
| Prepare the transfer of payload from host memory to emb memory.
void | txl_cntrl_newhead (uint32_t desc, uint8_t access_category)
| NX_FULLY_HOSTED.
void | txl_frame_exchange_chain (struct tx_hd *first_thd, struct tx_hd *last_thd, uint8_t access_category)
| Chain a new frame exchange to the MAC HW.
void | txl_free_done_mpdu (struct txdesc *txdesc, uint8_t access_category, uint8_t user_idx)
| Free a MPDU that is marked as transmitted by the HW, and launch the download of a subsequent MPDU.
void | txl_check_done_amsdu_subframe (struct txdesc *txdesc, uint8_t access_category, uint8_t user_idx)
| Check transmission status of A-MSDU sub-frames.
void | txl_cntrl_init (void)
| Initialize the LMAC TX path.
bool | txl_cntrl_tx_check (struct vif_info_tag *vif)
| Check if a packet can be transmitted on a given VIF.
void | txl_cntrl_halt_ac (uint8_t access_category)
| Halt the MAC DMA of the specified queue.
void | txl_cntrl_flush_ac (uint8_t access_category, uint32_t status)
| Flush all the descriptors of the queue passed as parameter.
bool | txl_cntrl_push (struct txdesc *txdesc, uint8_t access_category)
| Push a Tx descriptor in an RA/TID queue.
void | txl_cntrl_inc_pck_cnt (void)
| This function increments the TX path packet counter.
bool | txl_cntrl_push_int (struct txdesc *txdesc, uint8_t access_category)
| Push an internal frame Tx descriptor for transmission.
void | txl_cntrl_dma_isr (void)
| Perform operations on payloads that have been transfered from host memory.
void | txl_prot_trigger (void)
| Function to be called on TX protocol trigger IRQ (e.g.
void | txl_transmit_trigger (void)
| Function to be called on transmission trigger IRQ.
void | txl_current_desc_get (int access_category, struct tx_hd **thd)
| This function returns the pointer to the first TX Header descriptor chained to the MAC HW queue passed as parameter.
void | txl_reset (void)
| TX path reset function.
__INLINE bool | txl_sleep_check (void)
| Get the status of TX path, i.e if some packets are currently queued for transmission.
__INLINE uint16_t | txl_get_seq_ctrl (void)
| Get the current sequence control field to be used for non-QoS frames.

## Detailed Description

Controller of TX data path.

## Define Documentation

#define TX_AC0_TIMEOUT 5000000

AC0 queue timeout.

Background - 5s

Definition at line 59 of file txl_cntrl.h.

#define TX_AC1_TIMEOUT 2000000

AC1 queue timeout.

Best effort - 2s

Definition at line 61 of file txl_cntrl.h.

#define TX_AC2_TIMEOUT 400000

AC2 queue timeout.

Video - 400ms

Definition at line 64 of file txl_cntrl.h.

#define TX_AC3_TIMEOUT 200000

AC3 queue timeout.

Voice - 200ms

Definition at line 66 of file txl_cntrl.h.

#define TX_BCN_TIMEOUT 50000

BCN queue timeout.

Beacon - 50ms

Definition at line 68 of file txl_cntrl.h.

#define TX_BW_DROP_IRQ

Value:

    (NXMAC_AC_0BW_DROP_TRIGGER_BIT | NXMAC_AC_1BW_DROP_TRIGGER_BIT | \
                             NXMAC_AC_2BW_DROP_TRIGGER_BIT | NXMAC_AC_3BW_DROP_TRIGGER_BIT)

Bits indicating that a BW drop has been triggered on an access category.

Definition at line 101 of file txl_cntrl.c.

#define TX_IRQ_BITS

Value:

    ( NXMAC_AC_0_TX_TRIGGER_BIT | NXMAC_AC_1_TX_TRIGGER_BIT |           \
                           NXMAC_AC_2_TX_TRIGGER_BIT | NXMAC_AC_3_TX_TRIGGER_BIT |           \
                           NXMAC_BCN_TX_TRIGGER_BIT )

TX IRQ bits enabled.

Definition at line 75 of file txl_cntrl.c.

#define TX_LLICTRL | ( | ac,
|  | irqenable |  | ) |

Value:

    IPC_DMA_LLI_COUNTER_EN|(TX_AC2LLI(ac) << IPC_DMA_LLI_COUNTER_POS) |                 \
        ((irqenable)?(IPC_DMA_LLI_IRQ_EN|(TX_AC2LLI(ac) << IPC_DMA_LLI_IRQ_POS)) : 0)

Conversion from Access Category to corresponding bridge DMA control field.

Definition at line 141 of file txl_cntrl.h.

Referenced by txl_int_fake_transfer().

#define TX_PROT_IRQ

Value:

    ( NXMAC_AC_0BW_DROP_TRIGGER_BIT     |                                \
                          NXMAC_AC_1BW_DROP_TRIGGER_BIT     |                                \
                          NXMAC_AC_2BW_DROP_TRIGGER_BIT     |                                \
                          NXMAC_AC_3BW_DROP_TRIGGER_BIT     |                                \
                          TB_PROT_TRIGGER_BIT               |                                \
                          NXMAC_AC_0_PROT_TRIGGER_BIT       |                                \
                          NXMAC_AC_1_PROT_TRIGGER_BIT       |                                \
                          NXMAC_AC_2_PROT_TRIGGER_BIT       |                                \
                          NXMAC_AC_3_PROT_TRIGGER_BIT )

TX protocol trigger interrupt bits.

Definition at line 125 of file txl_cntrl.c.

#define TX_SEC_IRQ_BITS_MERGED

Value:

    ( NXMAC_SEC_U_3AC_3_TX_TRIGGER_BIT     |                 \
                                      NXMAC_SEC_U_3AC_2_TX_TRIGGER_BIT     |                 \
                                      NXMAC_SEC_U_3AC_1_TX_TRIGGER_BIT     |                 \
                                      NXMAC_SEC_U_3AC_0_TX_TRIGGER_BIT     |                 \
                                      NXMAC_SEC_U_2AC_3_TX_TRIGGER_BIT     |                 \
                                      NXMAC_SEC_U_2AC_2_TX_TRIGGER_BIT     |                 \
                                      NXMAC_SEC_U_2AC_1_TX_TRIGGER_BIT     |                 \
                                      NXMAC_SEC_U_2AC_0_TX_TRIGGER_BIT     |                 \
                                      NXMAC_SEC_U_1AC_3_TX_TRIGGER_BIT     |                 \
                                      NXMAC_SEC_U_1AC_2_TX_TRIGGER_BIT     |                 \
                                      NXMAC_SEC_U_1AC_1_TX_TRIGGER_BIT     |                 \
                                      NXMAC_SEC_U_1AC_0_TX_TRIGGER_BIT )

Bits indicating activity on secondary users (merged trigger and buffer).

Definition at line 85 of file txl_cntrl.c.

#define TX_TRANSMIT_IRQ

Value:

    ( SEC_USER_TX_TRIGGER_BIT           |                            \
                              TB_TX_TRIGGER_BIT                 |                            \
                              NXMAC_AC_0_TX_TRIGGER_BIT         |                            \
                              NXMAC_AC_1_TX_TRIGGER_BIT         |                            \
                              NXMAC_AC_2_TX_TRIGGER_BIT         |                            \
                              NXMAC_AC_3_TX_TRIGGER_BIT         |                            \
                              NXMAC_BCN_TX_TRIGGER_BIT          |                            \
                              NXMAC_AC_0_TX_BUF_TRIGGER_BIT     |                            \
                              NXMAC_AC_1_TX_BUF_TRIGGER_BIT     |                            \
                              NXMAC_AC_2_TX_BUF_TRIGGER_BIT     |                            \
                              NXMAC_AC_3_TX_BUF_TRIGGER_BIT     |                            \
                              NXMAC_BCN_TX_BUF_TRIGGER_BIT  )

TX transmit trigger interrupt bits.

Definition at line 136 of file txl_cntrl.c.

## Enumeration Type Documentation

anonymous enum

Tx trigger descriptor status check states.

Enumerator:

  THD_CHK_STATE | State for checking MPDU THD done status.
  BAR_THD_CHK_STATE | State for checking BAR THD done status.

Definition at line 71 of file txl_cntrl.h.

anonymous enum

Aggregation process status bits.

Enumerator:

  AGG_FORMATTED | Status indicating that the aggregation formatting is done.
  AGG_DOWNLOADED | Status indicating that enough data of the A-MPDU has been downloaded.
  AGG_ALLOC | Status indicating that enough data of the A-MPDU is allocated to be chained.
  AGG_FIRST_DOWNLOADED | Status indicating that the first MPDU of the A-MPDU has been downloaded.
  AGG_DONE | Status indicating that the A-MPDU can be confirmed to upper MAC.
  AGG_BA_RECEIVED | Status indicating that a BlockAck has been received for this frame.
  AGG_BA_VALID | Status indicating that the received BlockAck is valid.
  AGG_INT | Status indicating that this aggregate descriptor is an intermediate one, i.e. not the final aggregate descriptor of a MU-MIMO PPDU
  AGG_MU | Status indicating that this aggregate descriptor is part of a MU-MIMO PPDU.
  AGG_TB | Status indicating that this aggregate descriptor is used for a HE TB PPDU.

Definition at line 86 of file txl_cntrl.h.

anonymous enum

Status of a packet pushed for aggregation, when MU-MIMO is enabled.

Enumerator:

  SU_PACKET | Packet will be sent in a SU PPDU.
  MU_PACKET | Packet will be sent in a MU PPDU.
  MU_PAUSED | Packet cannot be handled immediately, user position is closed for now.
  MU_RESTART_CHECK | MU-MIMO check processing shall be restarted after closure of pending MU-MIMO PPDU.

Definition at line 113 of file txl_cntrl.h.

## Function Documentation

static void txl_check_bcmc_status | ( | struct txdesc * | txdesc,
|  | uint8_t | access_category,
|  | uint32_t | machdrptr |
| ) |  |  | `[static]`

Set and/or Save more_data flag status for frame sent on AC_BCN queue.

AC_BCN queue is used for beacon and BC/MC traffic in PS mode. In the latter case:

- In softmac driver cannot set MORE_DATA flag, so set it here based on the number of packet buffered for this vif in the AC_BCN queue when beacon has been sent.
- In both softmac and fullmac cases it is necessary to save whether MORE_DATA flag is set or not, so that bcmc traffic can be continued on next (potentially non dtim) beacon.

Parameters:

  `[in]` | txdesc | Txdesc for the frame
  `[in]` | access_category | AC used to send this frame
  `[in]` | machdrptr | Address of the MAC Header of the transmitted frame

Definition at line 1448 of file txl_cntrl.c.

References AC_BCN, vif_info_tag::ap, co_read16p(), co_write16p(), txdesc::host, MAC_FCTRL_MOREDATA, MAC_HEAD_FCTRL_OFT, vif_info_tag::u, VIF_AP_BCMC_MOREDATA, hostdesc::vif_idx, and vif_info_tab.

Referenced by txl_payload_handle().

void txl_check_done_amsdu_subframe | ( | struct txdesc * | txdesc,
|  | uint8_t | access_category,
|  | uint8_t | user_idx |
| ) |  |  |

Check transmission status of A-MSDU sub-frames.

If the sub-frame is done, then the buffer is freed an a new buffer is allocated for a a subsequent packet.

This function shall be called from a MAC HW transmit trigger interrupt.

Parameters:

  `[in]` | txdesc | Descriptor of the packet to be freed
  `[in]` | access_category | Access category of the descriptor
  `[in]` | user_idx | User index (for MU-MIMO TX only, 0 otherwise)

Referenced by txl_frame_exchange_done(), and txl_mumimo_secondary_done().

void txl_cntrl_dma_isr | ( | void |  | ) |

Perform operations on payloads that have been transfered from host memory.

This primitive is called by the interrupt controller ISR. It performs LLC translation and MIC computing if required.

void txl_cntrl_flush_ac | ( | uint8_t | access_category,
|  | uint32_t | status |
| ) |  |  |

Flush all the descriptors of the queue passed as parameter.

Parameters:

  `[in]` | access_category | Access category of the queue to be flushed
  `[in]` | status | Status to be sent in the confirmation

Referenced by chan_switch_start(), mm_ap_tbtt(), and p2p_update_go_ps_state().

void txl_cntrl_halt_ac | ( | uint8_t | access_category | ) |

Halt the MAC DMA of the specified queue.

Parameters:

  `[in]` | access_category | Access category of the queue to be halted

Referenced by chan_switch_start(), mm_ap_tbtt(), and p2p_update_go_ps_state().

void txl_cntrl_init | ( | void |  | ) |

Initialize the LMAC TX path.

This primitive initializes all the elements used in the TX path.

void txl_cntrl_newhead | ( | uint32_t | desc,
|  | uint8_t | access_category |
| ) |  |  |

NX_FULLY_HOSTED.

Update the header pointer and set the new head bit for the specified access category.

Parameters:

  `[in]` | desc | Pointer to the header descriptor
  `[in]` | access_category | Access category

static void txl_cntrl_newtail | ( | uint8_t | access_category | ) | `[static]`

Set the new tail bit for the specified access category.

Parameters:

  `[in]` | access_category | Access category

Definition at line 824 of file txl_cntrl.c.

References AC_BCN, AC_BE, AC_BK, AC_VI, AC_VO, and ASSERT_ERR.

static void txl_cntrl_postpone | ( | struct txdesc * | txdesc,
|  | uint8_t | access_category |
| ) |  |  | `[static]`

Postpone an internal packet ready for TX.

Parameters:

  `[in]` | txdesc | First Txdesc of the next frame exchange
  `[in]` | access_category | Access category for the frame exchanges to format

Definition at line 1377 of file txl_cntrl.c.

References apm_tx_int_ps_postpone(), co_list_push_back(), txdesc::host, txdesc::list_hdr, txl_frame_desc_tag::postponed, sta_info_tab, hostdesc::staid, hostdesc::tid, and sta_info_tag::tx_desc_post.

bool txl_cntrl_push | ( | struct txdesc * | txdesc,
|  | uint8_t | access_category |
| ) |  |  |

Push a Tx descriptor in an RA/TID queue.

This primitive allocates the different descriptors required for the MPDU described by txdesc, updates it with the required information and pushes it into the queue.

Parameters:

  `[in]` | txdesc | Descriptor of the packet to be pushed into the Tx queue
  `[in]` | access_category | Access category on which the packet has to be pushed

Returns:
  true if the IPC queue has to be paused, false otherwise.

bool txl_cntrl_push_int | ( | struct txdesc * | txdesc,
|  | uint8_t | access_category |
| ) |  |  |

Push an internal frame Tx descriptor for transmission.

Parameters:

  `[in]` | txdesc | Descriptor of the packet to be pushed into the Tx queue
  `[in]` | access_category | Access category on which the frame is sent

Returns:
  true if the internal frame was correctly pushed, false otherwise.

Referenced by bfr_start_next_calibration(), and txl_frame_push().

static bool txl_cntrl_start_pm_mon | ( | struct mac_hdr * | mac_hdr | ) | `[static]`

Check if the PM bit monitoring shall be started on the given MAC Header.

Parameters:

  `[in]` | mac_hdr | Pointer to the MAC Header of the transmitted frame

Returns:
  true if the PM monitoring is started, false otherwise.

Definition at line 1409 of file txl_cntrl.c.

References co_read16p(), CPU2HW, mac_hdr::fctl, MAC_ASSO_RSP_STATUS_OFT, MAC_FCTRL_ASSOCRSP, MAC_FCTRL_REASSOCRSP, MAC_FCTRL_TYPESUBTYPE_MASK, and MAC_SHORT_MAC_HDR_LEN.

Referenced by txl_payload_handle().

bool txl_cntrl_tx_check | ( | struct vif_info_tag * | vif | ) |

Check if a packet can be transmitted on a given VIF.

Various checks are made in this function, e.g. on the current channel, the PS state of the peer device in case of P2P, etc.

Parameters:

  `[in]` | vif | The pointer to the VIF we have to check.

Returns:
  true if the transmission is allowed for this VIF, false otherwise.

void txl_current_desc_get | ( | int | access_category,
|  | struct tx_hd ** | thd |
| ) |  |  |

This function returns the pointer to the first TX Header descriptor chained to the MAC HW queue passed as parameter.

It is used for error logging when an issue is detected in the LMAC.

Parameters:

  `[in]` | access_category | TX queue for which the first THD is retrieved
  `[out]` | thd | Pointer to the first tX Header descriptor chained to the MAC HW

void txl_frame_exchange_chain | ( | struct tx_hd * | first_thd,
|  | struct tx_hd * | last_thd,
|  | uint8_t | access_category |
| ) |  |  |

Chain a new frame exchange to the MAC HW.

Depending if there is already a frame exchange ongoing or not, this function will proceed to a newTail or newHead action.

Parameters:

  `[in]` | first_thd | Pointer to the first THD of the frame exchange
  `[in]` | last_thd | Pointer to the last THD of the frame exchange
  `[in]` | access_category | Access category

Referenced by txl_frame_exchange_manage().

static void txl_frame_exchange_done | ( | uint8_t | access_category | ) | `[static]`

Unchains the frame exchanges that have been completed.

This primitive goes through the list of completed frame exchanges, check their status, and put them in the correct list (cfm or waiting block-ack)

Parameters:

  `[in]` | access_category | Access category for the frame exchanges to unchain

Definition at line 863 of file txl_cntrl.c.

References tx_agg_desc::a_thd, txl_list::agg, AGG_BA_RECEIVED, txl_list::agg_desc, lmacdesc::agg_desc, txl_list::agg_desc_prev, AGG_DONE, AGG_INT, txl_list::aggregates, ASSERT_ERR, ASSERT_REC, tx_agg_desc::bar_thd, BAR_THD_CHK_STATE, tx_pbd::bufctrlinfo, tx_agg_desc::cfm, txl_cfm_env_tag::cfmlist, txl_list::chk_state, co_list_concat(), co_list_is_empty(), co_list_next(), co_list_pick(), co_list_pop_front(), txl_agg_build_tag::desc, DESC_DONE_TX_BIT, tx_hd::first_pbd_ptr, FRAME_SUCCESSFUL_TX_BIT, get_user_pos(), HW2CPU, lmacdesc::hw_desc, is_int_frame(), is_mpdu_agg(), is_mpdu_first(), is_mpdu_last(), ke_evt_set(), txl_list::last_frame_exch, tx_agg_desc::list_hdr, txdesc::lmac, tx_hd::macctrlinfo2, macif_tx_q_has_data(), txl_list::mumimo, txl_cntrl_env_tag::mumimo_ppdu_cnt, tx_hd::nextfrmexseq_ptr, tx_hd::nextmpdudesc_ptr, txl_list::ppdu_cnt, tx_agg_desc::prim_agg_desc, PROF_AGG_BAR_DONETX_CLR, PROF_AGG_BAR_DONETX_SET, PROF_AGG_SMPDU_DONETX_CLR, PROF_AGG_SMPDU_DONETX_SET, PROF_MU_USER_POS_IRQ_SET, rxl_immediate_frame_get(), tx_hd::statinfo, tx_agg_desc::status, tx_cfm_tag::status, TBD_DONE_HW, tx_hw_desc::thd, THD_CHK_STATE, txl_list::transmitting, txl_agg_check_rtscts_retry_limit(), txl_agg_check_saved_agg_desc(), txl_agg_finish(), txl_agg_mumimo_close(), txl_cfm_env, txl_cfm_evt_bit, txl_cfm_push(), txl_cfm_tag_get(), txl_check_done_amsdu_subframe(), txl_cntrl_env, txl_frame_cfm(), txl_free_done_mpdu(), txl_timer_clear(), txl_timer_move(), txl_cntrl_env_tag::txlist, tx_agg_desc::user_cnt, txl_mumimo_build_info_tag::users, WHICHDESC_AMPDU_EXTRA, and WHICHDESC_MSK.

static void txl_frame_exchange_manage | ( | struct txdesc * | txdesc,
|  | struct txl_buffer_tag * | buffer,
|  | uint8_t | access_category |
| ) |  |  | `[static]`

Manage atomic frame exchange formatting and chaining of previous one to it.

Parameters:

  `[in]` | txdesc | First Txdesc of the next frame exchange
  `[in]` | buffer | Pointer to the buffer that was just downloaded
  `[in]` | access_category | Access category for the frame exchanges to format

Definition at line 1234 of file txl_cntrl.c.

References tx_agg_desc::a_thd, AC_MAX, lmacdesc::agg_desc, AGG_DOWNLOADED, AGG_FORMATTED, tx_agg_desc::bar_thd, BUF_ALLOC_OK, CO_BIT, tx_agg_desc::download, mac_hdr::fctl, txl_buffer_tag::flags, tx_hd::frmlen, txdesc::host, HW2CPU, lmacdesc::hw_desc, is_in_mumimo_ppdu(), is_mpdu_agg(), tx_agg_desc::last_bar_thd, txdesc::lmac, MAC_SEQCTRL_NUM_OFT, txl_cntrl_env_tag::mumimo_ppdu_cnt, tx_agg_desc::prim_agg_desc, mac_hdr::seq, hostdesc::staid, tx_agg_desc::status, tx_hw_desc::thd, TRACE_AP, TRACE_LMAC, txl_buffer_machdr_get(), txl_cntrl_env, txl_frame_exchange_chain(), txl_buffer_tag::user_idx, and hostdesc::vif_idx.

Referenced by txl_payload_handle().

void txl_free_done_mpdu | ( | struct txdesc * | txdesc,
|  | uint8_t | access_category,
|  | uint8_t | user_idx |
| ) |  |  |

Free a MPDU that is marked as transmitted by the HW, and launch the download of a subsequent MPDU.

This function shall be called from a MAC HW transmit trigger interrupt.

Parameters:

  `[in]` | txdesc | Descriptor of the packet to be freed
  `[in]` | access_category | Access category of the descriptor
  `[in]` | user_idx | User index (for MU-MIMO TX only, 0 otherwise)

Referenced by txl_frame_exchange_done(), and txl_mumimo_secondary_done().

__INLINE uint16_t txl_get_seq_ctrl | ( | void |  | ) |

Get the current sequence control field to be used for non-QoS frames.

The sequence control is also incremented by this function.

Returns:
  The sequence control field to be used

Definition at line 328 of file txl_cntrl.h.

References MAC_SEQCTRL_NUM_OFT, txl_cntrl_env_tag::seqnbr, and txl_cntrl_env.

Referenced by mm_bcn_build(), and txl_frame_send_null_frame().

static void txl_hwdesc_config_post | ( | struct txdesc * | txdesc,
|  | uint8_t | access_category |
| ) |  |  | `[static]`

Initialization of the HW descriptors, after payload download.

This primitive configures the HW descriptors prior to transmission

Parameters:

  `[in]` | txdesc | Descriptor of the packet to be pushed into the Tx queue
  `[in]` | access_category | TX queue index

Definition at line 507 of file txl_cntrl.c.

References tx_agg_desc::a_thd, mac_hdr::addr1, lmacdesc::agg_desc, AGG_FIRST_DOWNLOADED, ASSERT_ERR, bfr_is_bfmed_sglt_allowed(), lmacdesc::bfr_node, BMFED_BIT, txl_buffer_control::comp_pol_tbl, CPU2HW, EXPECTED_ACK_COMPRESSED_BLOCK_ACK, EXPECTED_ACK_MSK, EXPECTED_ACK_NO_ACK, EXPECTED_ACK_NORMAL_ACK, FEC_CODING_CPT_OFT, FEC_CODING_PT_BIT, FEC_CODING_PT_OFT, hostdesc::flags, txl_buffer_tag::flags, GID_TX_MASK, umacdesc::head_len, txdesc::host, HW2CPU, lmacdesc::hw_desc, INTERRUPT_EN_TX, is_htc_sglt_allowed(), is_in_mumimo_ppdu(), is_mpdu_agg(), is_mpdu_first(), is_primary_user(), KEYSRAM_INDEX_CPT_OFT, KEYSRAM_INDEX_MASK, KEYSRAM_INDEX_OFT, txdesc::lmac, LONG_RETRY_LIMIT_MASK, MAC_ADDR_GROUP, txl_buffer_control::mac_control_info, MAC_SHORT_MAC_HDR_LEN, tx_policy_tbl::maccntrlinfo1, tx_policy_tbl::maccntrlinfo2, tx_hd::macctrlinfo1, tx_hd::macctrlinfo2, MCS_IDX_TX_CPT_OFT, MCS_INDEX_TX_RCX_MASK, MCS_INDEX_TX_RCX_OFT, mfp_add_mgmt_mic(), NX_FULLY_HOSTED, hostdesc::packet_len, PAID_TX_MASK, txl_buffer_control::phy_control_info, umacdesc::phy_flags, tx_policy_tbl::phycntrlinfo1, tx_policy_tbl::phycntrlinfo2, tx_hd::phyctrlinfo, POLICY_TABLE_PATTERN, txl_buffer_control::policy_tbl, tx_hd::policyentryaddr, tx_policy_tbl::powercntrlinfo, tx_policy_tbl::ratecntrlinfo, tx_compressed_policy_tbl::sec_user_control, SHORT_RETRY_LIMIT_MASK, bfr_mem_node::smm_index, SMM_INDEX_CPT_OFT, SMM_INDEX_PT_MASK, SMM_INDEX_PT_OFT, SMOOTHING_TX_BIT, tx_hd::statinfo, tx_agg_desc::status, STBC_PT_MASK, umacdesc::tail_len, tx_hw_desc::thd, txl_agg_set_ampdu_protection(), txl_buffer_control_get(), txl_buffer_get(), txl_buffer_is_amsdu_multi_buf(), txl_buffer_machdr_get(), txl_smoothing_set(), TXU_CNTRL_MGMT, TXU_CNTRL_MGMT_ROBUST, txu_cntrl_protect_mgmt_frame(), txu_cntrl_tkip_mic_append(), txdesc::umac, UNDER_BA_SETUP_BIT, tx_compressed_policy_tbl::upatterntx, USE_MUMIMO_TX_BIT, VHT_NSS_MASK, and WHICHDESC_MSK.

Referenced by txl_payload_handle().

static void txl_hwdesc_config_pre | ( | struct txdesc * | txdesc,
|  | int | access_category |
| ) |  |  | `[static]`

NX_FULLY_HOSTED.

Initialization of the HW descriptors prior to payload download This primitive configures the HW descriptors prior to the download of the payloads

Parameters:

  `[in]` | txdesc | Descriptor of the packet to be pushed into the Tx queue
  `[in]` | access_category | TX queue index

Definition at line 439 of file txl_cntrl.c.

References tx_hd::dataendptr, tx_hd::datastartptr, tx_hd::first_pbd_ptr, tx_hd::frmlen, tx_hd::frmlifetime, umacdesc::head_len, txdesc::host, lmacdesc::hw_desc, txdesc::lmac, MAC_FCS_LEN, tx_hd::macctrlinfo2, tx_hd::nextfrmexseq_ptr, tx_hd::nextmpdudesc_ptr, tx_hd::optlen, hostdesc::packet_cnt, hostdesc::packet_len, tx_hd::policyentryaddr, tx_hd::statinfo, umacdesc::tail_len, tx_hw_desc::thd, TX_HEADER_DESC_PATTERN, txdesc::umac, tx_hd::upatterntx, and WHICHDESC_UNFRAGMENTED_MSDU.

static void txl_int_fake_transfer | ( | struct txdesc * | txdesc,
|  | uint8_t | access_category |
| ) |  |  | `[static]`

Prepare the transfer of payload from host memory to emb memory.

This primitive first allocates a buffer of the required size, and then updates the bridge descriptor according to the allocated buffer.

Parameters:

  `[in]` | txdesc | Descriptor of the packet to be pushed into the Tx list
  `[in]` | access_category | Access category where to push the descriptor

Returns:
  The status of the transfer (TRUE: programmed, FALSE: not programmed due to buffer full)

Definition at line 265 of file txl_cntrl.c.

References CPU2HW, dma_desc::ctrl, dma_desc::dest, txl_buffer_tag::dma_desc_pat, dma_push(), txl_buffer_tag::flags, IPC_DMA_CHANNEL_DATA_TX, dma_desc::length, macif_tx_pattern_addr_get(), sizeof_b, dma_desc::src, txl_buffer_tag::tbd, TX_LLICTRL, txl_buffer_tag::txdesc, txl_buffer_get(), txl_buffer_push(), and tx_pbd::upatterntx.

Referenced by txl_payload_transfer().

static void txl_machdr_format | ( | uint32_t | machdrptr | ) | `[static]`

Format the MAC header.

Parameters:

  `[in]` | machdrptr | HW Address of the MAC header in shared memory

Definition at line 797 of file txl_cntrl.c.

References co_read8p(), co_write16p(), MAC_HEAD_CTRL_OFT, MAC_SEQCTRL_FRAG_MSK, MAC_SEQCTRL_NUM_OFT, txl_cntrl_env_tag::seqnbr, and txl_cntrl_env.

Referenced by txl_payload_handle().

bool txl_payload_alloc | ( | struct txdesc * | txdesc,
|  | uint8_t | access_category,
|  | uint8_t | user_idx |
| ) |  |  |

Prepare the transfer of payload from host memory to emb memory.

This primitive first allocates a buffer of the required size, and then updates the bridge descriptor according to the allocated buffer.

Parameters:

  `[in]` | txdesc | Descriptor of the packet to be pushed into the Tx list
  `[in]` | access_category | Access category where to push the descriptor
  `[in]` | user_idx | User index (for MU-MIMO TX only, 0 otherwise)

Returns:
  The status of the transfer (TRUE: programmed, FALSE: not programmed due to buffer full)

Referenced by txl_mumimo_convert().

static void txl_payload_handle | ( | struct txdesc * | txdesc,
|  | struct txl_buffer_tag * | buffer,
|  | uint8_t | access_category |
| ) |  |  | `[static]`

Perform operations on payloads that have been transfered from host memory.

This primitive is called by the TX DMA ISR in case of split partitioning and from the background context or TX trigger interrupt context in case of full host partitioning.

Parameters:

  `[in]` | txdesc | TX descriptor attached to the available payload
  `[in]` | buffer | Buffer structure attached to the available payload
  `[in]` | access_category | AC used to send this frame

Definition at line 1492 of file txl_cntrl.c.

References mac_hdr::addr1, BUF_INT_MSDU, hostdesc::flags, txl_buffer_tag::flags, txdesc::host, HW2CPU, is_int_frame(), is_qos_data(), PROF_TX_PAYL_HDL_CLR, PROF_TX_PAYL_HDL_SET, rxu_cntrl_monitor_pm(), txl_buffer_get(), txl_buffer_machdr_get(), txl_check_bcmc_status(), txl_cntrl_start_pm_mon(), txl_frame_exchange_manage(), txl_hwdesc_config_post(), txl_machdr_format(), TXU_CNTRL_MGMT, and TXU_CNTRL_MGMT_PM_MON.

static bool txl_payload_transfer | ( | struct txdesc * | txdesc,
|  | uint8_t | access_category,
|  | uint8_t | user_idx |
| ) |  |  | `[static]`

Prepare the transfer of payload from host memory to emb memory.

This primitive first allocates a buffer of the required size, and then updates the bridge descriptor according to the allocated buffer.

Parameters:

  `[in]` | txdesc | Descriptor of the packet to be pushed into the Tx list
  `[in]` | access_category | Access category where to push the descriptor
  `[in]` | user_idx | User index (for MU-MIMO TX only, 0 otherwise)

Returns:
  The status of the transfer (TRUE: programmed, FALSE: not programmed due to buffer full)

Definition at line 299 of file txl_cntrl.c.

References ASSERT_ERR, lmacdesc::buffer, txl_list::dwnld_index, txl_list::first_to_download, txdesc::host, is_int_frame(), txdesc::lmac, hostdesc::packet_cnt, txl_buffer_tag::txdesc, txl_buffer_alloc(), txl_buffer_is_amsdu_single_buf(), txl_buffer_update_tbd(), txl_buffer_update_thd(), txl_cntrl_env, txl_int_fake_transfer(), and txl_cntrl_env_tag::txlist.

Referenced by txl_transmit_prep().

void txl_prot_trigger | ( | void |  | ) |

Function to be called on TX protocol trigger IRQ (e.g.

BW drop or HE TB trigger)

void txl_reset | ( | void |  | ) |

TX path reset function.

This function is part of the recovery mechanism invoked upon an error detection in the LMAC. It flushes all the packets currently in the TX path and exits when all of them have been confirmed to the driver

__INLINE bool txl_sleep_check | ( | void |  | ) |

Get the status of TX path, i.e if some packets are currently queued for transmission.

It is used by the PS module to know if the TX path allows sleeping or not.

Returns:
  true if the TX path allows sleeping (i.e. no packets queued), and false otherwise.

Definition at line 313 of file txl_cntrl.h.

References txl_cntrl_env_tag::pck_cnt, and txl_cntrl_env.

__INLINE void txl_smoothing_set | ( | struct tx_hd * | thd,
|  | struct tx_policy_tbl * | pt,
|  | uint32_t | smoothing |
| ) |  |  |

Set the smoothing bit to the correct HW descriptor.

Parameters:

  `[in]` | thd | TX Header Descriptor attached to the PPDU
  `[in]` | pt | Policy table attached to the PPDU
  `[in]` | smoothing | Smoothing bit to be set in the descriptor

Definition at line 184 of file txl_cntrl.c.

References tx_policy_tbl::phycntrlinfo1, and tx_hd::phyctrlinfo.

Referenced by txl_hwdesc_config_post().

__INLINE void txl_timer_clear | ( | uint8_t | ac | ) |

Clear a TX timer.

Parameters:

  `[in]` | ac | Access category for which the timer has to be cleared

Definition at line 240 of file txl_cntrl.c.

References CO_BIT, and TX_AC2TIMER.

Referenced by txl_frame_exchange_done().

__INLINE void txl_timer_move | ( | uint8_t | ac | ) |

Move the TX timer according to the access category.

Parameters:

  `[in]` | ac | Access category for which the timer has to be moved

Definition at line 224 of file txl_cntrl.c.

References hal_machw_time(), TX_AC2TIMER, and TX_TIMEOUT.

Referenced by txl_frame_exchange_done().

__INLINE void txl_timer_start | ( | uint8_t | ac | ) |

Start a TX timer.

Parameters:

  `[in]` | ac | Access category for which the timer has to be started

Definition at line 202 of file txl_cntrl.c.

References CO_BIT, hal_machw_time(), TX_AC2TIMER, and TX_TIMEOUT.

static void txl_transmit_prep | ( | int | access_category,
|  | uint8_t | user_idx |
| ) |  |  | `[static]`

Go through the TX list and prepare the download of the payloads.

The process repeats until either no more payloads have to be downloaded, or enough have been downloaded

Parameters:

  `[in]` | access_category | Access category on which preparation is invoked
  `[in]` | user_idx | Index of the queue to prepare inside the access_category (if MU-MIMO is not used, this parameter is supposed to be always 0)

Definition at line 386 of file txl_cntrl.c.

References txl_list::dwnld_index, txl_list::first_to_download, txdesc::host, hostdesc::packet_cnt, tx_desc_next(), TX_MIN_DOWNLOAD_CNT, txl_buffer_count(), txl_cntrl_env, txl_payload_transfer(), and txl_cntrl_env_tag::txlist.

void txl_transmit_trigger | ( | void |  | ) |

Function to be called on transmission trigger IRQ.

This primitive will chain new frame exchanges to HW, confirm transmitted ones and prepare subsequent transmission. The function retrieves the access category which generated the interrupt from the MAC HW status register.

## Variable Documentation

const uint32_t TX_TIMEOUT[NX_TXQ_CNT]

Initial value:

    {
        TX_AC0_TIMEOUT,
        TX_AC1_TIMEOUT,
        TX_AC2_TIMEOUT,
        TX_AC3_TIMEOUT,

        TX_BCN_TIMEOUT

    }

Table containing the TX timeout value per TX queue.

Definition at line 154 of file txl_cntrl.c.

Referenced by txl_timer_move(), and txl_timer_start().