# RX_CNTRL

Initialization and control of LMAC SW Rx path. More...

## Data Structures
struct | rxl_cntrl_env_tag
| RX control environment declaration. More...
struct | rx_upload_cntrl_tag
| Descriptor used to handle the actions performed when uploading the MPDU. More...
## Defines
#define | RX_TIMEOUT 200
| Traffic Detection Module Definition.
#define | RX_FRAME_PREP_THD 4
| Threshold of frame upload preparation before which we handle the DMA interrupts.
#define | RX_DATA_UPLOAD_CHAN IPC_DMA_CHANNEL_DATA_RX
| DMA channel used for data upload.
#define | DMA_HD_RXPATTERN 0xAAAAAA00
| Pattern indicating to the host that the buffer is ready for him.
#define | RXL_CNTRL_FRAME_INFO_SET(bit) (rxl_cntrl_env.rx_status.frame_info |= RXL_CNTRL_ ## bit)
| Set bit in frame_info value (struct rxl_cntrl_rx_status).
#define | RXL_CNTRL_FRAME_INFO_GET(bit) (rxl_cntrl_env.rx_status.frame_info & RXL_CNTRL_ ## bit)
| Get if bit set to 1 in frame_info value (struct rxl_cntrl_rx_status).
#define | RX_LLICTRL(irqenable)
| Configure the bridge DMA control field.
## Typedefs
typedef void(* | cb_rx_dma_func_ptr )(void *)
| Pointer to callback function.
## Enumerations
enum | rx_upload_flags { RX_NO_UPLOAD = CO_BIT(0) }
| RX upload control flag bits. More...
## Functions
__INLINE struct rx_upload_cntrl_tag * | rxl_upload_cntrl_pick_pending (void)
| Pick an upload control descriptor from the pending queue.
__INLINE struct rx_upload_cntrl_tag * | rxl_upload_cntrl_pop_pending (void)
| Pop an upload control descriptor from the pending queue.
static bool | rxl_lli_done (uint16_t next_lli_cnt)
| This function checks if the IPC DMA already processed the transfers up to the target count.
static void | rxl_pm_check (uint8_t *frame, uint8_t sta_idx, uint8_t vif_idx)
| This function processes Power Management information in a received frames.
static uint8_t | rxl_frame_handle (struct rxdesc *rxdesc, bool *dont_free)
| This function processes the received frames that could carry useful information for some LMAC features (connection monitoring, power-save mode, etc.
static void | rxl_cntrl_init (void)
| This function initializes the Rx Context Data.
static void | rxl_host_irq_mitigation_timeout_set (void)
| Start the host interrupt mitigation timer.
void | rxl_host_irq_mitigation_update (void *env)
| Update uploaded packet counter upon a frame upload and call the indication function if the counter passes the threshold.
void | rxl_timeout_int_handler (void)
| Handling of the SW RX timeout.
void | rxl_init (void)
| This function initializes the RX path.
void | rxl_cntrl_evt (int dummy)
| RX path background packet handler.
void | rxl_dma_int_handler (void)
| RX IPC DMA interrupt handler.
void | rxl_dma_evt (int dummy)
| RX DMA event handler.
void | rxl_reset (void)
| RX path reset function.
__INLINE void | rxl_upload_cntrl_push_pending (struct rx_upload_cntrl_tag *upload_cntrl)
| Push an upload control descriptor to the pending queue.
__INLINE bool | rxl_upload_pending (void)
| Check if some packets are pending for upload.
## Variables
struct rxl_cntrl_env_tag | rxl_cntrl_env
| RXL module environment variable.
struct rxl_cntrl_env_tag | rxl_cntrl_env
| RXL module environment variable.

## Detailed Description

Initialization and control of LMAC SW Rx path.

It is responsible to initialize the data structures required for the RX path. These include: -Tuple initialization -TID Info table initialization -LMAC SW Rx descriptor initialization -Defragmentation table initialization

It initializes the Rx context that includes the lists maintained at SW to host the received frames and the HW descriptor details. It configures the MAC HW registers for the Rx operation.

Controls the operations to be performed on the received frame.

It is responsible to validate the frame and control the sequence of operations to be performed in the receive and the deferred context.

## Define Documentation

#define RX_LLICTRL | ( | irqenable |  | ) |

Value:

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

Configure the bridge DMA control field.

Definition at line 90 of file rxl_cntrl.h.

Referenced by rxl_mpdu_transfer(), rxl_payload_transfer(), and rxu_cntrl_desc_init().

#define RX_TIMEOUT 200

Traffic Detection Module Definition.

TX Beamforming Module Definition TDLS module definition Reception timeout 200us

Definition at line 87 of file rxl_cntrl.c.

Referenced by rxl_host_irq_mitigation_timeout_set().

## Enumeration Type Documentation

enum rx_upload_flags

RX upload control flag bits.

Enumerator:

  RX_NO_UPLOAD | No upload was done on this buffer.

Definition at line 68 of file rxl_cntrl.h.

## Function Documentation

void rxl_cntrl_evt | ( | int | dummy | ) |

RX path background packet handler.

This function is a kernel event handler triggered upon packet reception. It performs the platform DMA programming for the upload of the packet to the host memory.

Parameters:

  `[in]` | dummy | Parameter not used but required to follow the kernel event callback format

void rxl_dma_evt | ( | int | dummy | ) |

RX DMA event handler.

This function is used as a deferred processing of the DMA interrupt from the DMA engine. It processes the DMA'd packets.

Parameters:

  `[in]` | dummy | Parameter not used but required to follow the kernel event callback format

void rxl_dma_int_handler | ( | void |  | ) |

RX IPC DMA interrupt handler.

This function sets an event to schedule the processing of the DMA'd packets in background.

static uint8_t rxl_frame_handle | ( | struct rxdesc * | rxdesc,
|  | bool * | dont_free |
| ) |  |  | `[static]`

This function processes the received frames that could carry useful information for some LMAC features (connection monitoring, power-save mode, etc.

)

Parameters:

  `[in]` | rxdesc | SW header descriptor of the frame
  `[out]` | dont_free | Whether this frame should be freed if not uploaded or not

Returns:
  true if the frame shall be uploaded to UMAC, false otherwise

Definition at line 380 of file rxl_cntrl.c.

References vif_info_tag::active, sta_info_tag::aid, ASSERT_REC_VAL, bfr_is_enabled(), bfr_rx_frame_ind(), BFR_RX_STATUS_NOT_VALID, BFR_RX_STATUS_VALID, co_read16(), rx_pbd::datastartptr, rx_hd::first_pbd_ptr, rx_hd::frmlen, rx_dmadesc::hd, HW2CPU, vif_info_tag::index, sta_info_tag::inst_nbr, sta_info_tag::is_tdls, sta_info_tag::linked_sta, MAC_BEACON_VARIABLE_PART_OFT, MAC_FCTRL_ACTION, MAC_FCTRL_BEACON, MAC_FCTRL_DATA_T, MAC_FCTRL_MGT_T, MAC_FCTRL_TYPE_MASK, MAC_FCTRL_TYPESUBTYPE_MASK, mac_ie_tim_find(), MAC_SEQCTRL_NUM_OFT, mm_check_beacon(), MM_KEY_TO_STA, MM_SEC_DEFAULT_KEY_COUNT, MM_STA_TO_KEY, mm_tbtt_compute(), vif_info_tag::p2p, p2p_cli_bcn_check_noa(), p2p_cli_handle_action(), ps_check_beacon(), ps_check_frame(), RX_HD_KEYID, RX_HD_KEYID_GET, RX_HD_KEYID_LSB, RX_HD_KEYIDV, RX_HD_SUCCESS, rxl_dmadesc_get(), rxl_pm_check(), sta_info_tab, sta_mgmt_is_valid(), STA_REF_BSSID_AID, sta_info_tag::staid, rx_hd::statinfo, td_pck_ind(), tdls_check_frame(), TRACE_LMAC, TRACE_STA, rx_hd::tsflo, vif_info_tag::type, vif_info_tab, VIF_MESH_POINT, vif_mgmt_bcn_recv(), and VIF_STA.

static void rxl_host_irq_mitigation_timeout_set | ( | void |  | ) | `[static]`

Start the host interrupt mitigation timer.

The timer is started upon each frame upload confirmation in case the packet count is different from its default value.

Definition at line 633 of file rxl_cntrl.c.

References hal_machw_time(), HAL_RX_TIMER, HAL_RX_TIMER_BIT, rxl_cntrl_env_tag::packet_cnt, rxl_cntrl_env_tag::packet_thd, RX_TIMEOUT, and rxl_cntrl_env.

void rxl_host_irq_mitigation_update | ( | void * | env | ) |

Update uploaded packet counter upon a frame upload and call the indication function if the counter passes the threshold.

Parameters:

  `[in]` | env | Parameter not used but required to follow the upload confirmation callback format

Referenced by rxl_rxdesc_ready_for_processing(), and rxu_upload_cfm().

static bool rxl_lli_done | ( | uint16_t | next_lli_cnt | ) | `[static]`

This function checks if the IPC DMA already processed the transfers up to the target count.

Parameters:

  `[in]` | next_lli_cnt | The target LLI count

Returns:
  true if the target is reached or exceeded, false otherwise

Definition at line 137 of file rxl_cntrl.c.

References IPC_DMA_LLI_DATA_RX0.

static void rxl_pm_check | ( | uint8_t * | frame,
|  | uint8_t | sta_idx,
|  | uint8_t | vif_idx |
| ) |  |  | `[static]`

This function processes Power Management information in a received frames.

For AP interfaces, it checks if a STA enters of leaves Power Save mode and takes corresponding action.

Parameters:

  `[in]` | frame | Pointer to the MAC header of the frame
  `[in]` | sta_idx | Index of the sending sta
  `[in]` | vif_idx | Index of the VIF that received the frame

Definition at line 157 of file rxl_cntrl.c.

References vif_info_tag::ap, apm_tx_int_ps_clear(), co_read16(), vif_info_tag::index, sta_info_tag::info, mac_ac2uapsd, MAC_FCTRL_DATA_T, MAC_FCTRL_FROMDS, MAC_FCTRL_MGT_T, MAC_FCTRL_MOREFRAG, MAC_FCTRL_PSPOLL, MAC_FCTRL_PWRMGT, MAC_FCTRL_TODS, MAC_FCTRL_TYPE_MASK, MAC_FCTRL_TYPESUBTYPE_MASK, MAC_QOS_ST_BIT, MAC_QOSCTRL_EOSP, MAC_QOSCTRL_UP_MSK, MAC_QOSCTRL_UP_OFT, MAC_SEQCTRL_NUM_OFT, mac_tid2ac, sta_capa_info::max_sp_len, mm_ps_change_ind(), mm_traffic_req_ind(), NO_SERVICE_PERIOD, vif_info_tag::p2p, p2p_go_ps_state_update(), PROF_PS_BCMC_STATE_CLR, PROF_PS_BCMC_STATE_SET, PROF_PS_PEER_STATE_CLR, PROF_PS_PEER_STATE_SET, PROF_PS_PSPOLL_RX_CLR, PROF_PS_PSPOLL_RX_SET, PROF_PS_STATE_VAL_SET, PS_MODE_OFF, PS_MODE_ON, PS_SERVICE_PERIOD, sta_info_tag::ps_service_period, sta_info_tag::ps_state, PS_TRAFFIC_INT, mac_hdr_qos::qos, mac_hdr_long_qos::qos, sta_info_tab, sta_mgmt_send_postponed_frame(), sta_info_tag::staid, TRACE_AP, sta_info_tag::traffic_avail, txl_frame_send_qosnull_frame(), vif_info_tag::type, vif_info_tag::u, sta_capa_info::uapsd_queues, UAPSD_SERVICE_PERIOD, UAPSD_SERVICE_PERIOD_HOST, UAPSD_SERVICE_PERIOD_INT, UAPSD_TRAFFIC, UAPSD_TRAFFIC_HOST, UAPSD_TRAFFIC_INT, VIF_AP, vif_info_tab, and VIF_TO_BCMC_IDX.

Referenced by rxl_frame_handle().

void rxl_reset | ( | void |  | ) |

RX 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 RX path and exits when all of them have been indicated to the driver

void rxl_timeout_int_handler | ( | void |  | ) |

Handling of the SW RX timeout.

This function is called when the SW RX timeout expires, that indicates that a pending A-MPDU reception is over. In this handler we warn the host about the packets that are available.

Referenced by hal_machw_abs_timer_handler().

__INLINE struct rx_upload_cntrl_tag* rxl_upload_cntrl_pick_pending | ( | void |  | ) | `[read]`

Pick an upload control descriptor from the pending queue.

Returns:
  Pointer to the picked upload control descriptor

Definition at line 109 of file rxl_cntrl.c.

References co_list_pick(), rxl_cntrl_env, and rxl_cntrl_env_tag::upload_pending.

__INLINE struct rx_upload_cntrl_tag* rxl_upload_cntrl_pop_pending | ( | void |  | ) | `[read]`

Pop an upload control descriptor from the pending queue.

Returns:
  Pointer to the popped upload control descriptor

Definition at line 121 of file rxl_cntrl.c.

References co_list_pop_front(), rxl_cntrl_env, and rxl_cntrl_env_tag::upload_pending.

__INLINE void rxl_upload_cntrl_push_pending | ( | struct rx_upload_cntrl_tag * | upload_cntrl | ) |

Push an upload control descriptor to the pending queue.

Parameters:

  `[in]` | upload_cntrl | Pointer to the upload control descriptor

Definition at line 158 of file rxl_cntrl.h.

References co_list_push_back(), rx_upload_cntrl_tag::list_hdr, rxl_cntrl_env, and rxl_cntrl_env_tag::upload_pending.

Referenced by macif_rx_desc_upload(), rxl_mpdu_free(), rxl_mpdu_partial_transfer(), and rxl_mpdu_transfer().

__INLINE bool rxl_upload_pending | ( | void |  | ) |

Check if some packets are pending for upload.

Returns:
  true if packets are pending, false otherwise

Definition at line 171 of file rxl_cntrl.h.

References co_list_is_empty(), rxl_cntrl_env, and rxl_cntrl_env_tag::upload_pending.

Referenced by rxl_mpdu_free().