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

Beamformer Module Implementation. More...

`#include "bfr.h"`
`#include "sta_mgmt.h"`
`#include "vif_mgmt.h"`
`#include "co_status.h"`
`#include "hal_dma.h"`
`#include "rxl_hwdesc.h"`
`#include "tpc.h"`
`#include "mfp.h"`
`#include "txu_cntrl.h"`
`#include "td.h"`
`#include "ke_timer.h"`

Go to the source code of this file.

## Defines
#define | BFR_NB_BIT_PHY_SU (4)
| Number of bits of a PHY element in matrix for a SU feedback type.
#define | BFR_NB_BIT_PHY_MU (7)
| Number of bits of a PHY element in matrix for a MU feedback type.
#define | BFR_NB_BIT_PSY_SU (6)
| Number of bits of a PSY element in matrix for a SU feedback type.
#define | BFR_NB_BIT_PSY_MU (9)
| Number of bits of a PSY element in matrix for a MU feedback type.
#define | BFR_NDPA_SU_DURATION (56)
| Duration of NDPA frame sent for SU (in us).
#define | BFR_NDP_DURATION (47)
| Duration of NDP frame (in us).
#define | BFR_BRP_DURATION (52)
| Duration of BRP frame sent for MU (in us).
#define | BFR_BCR_DURATION (8)
| Duration of 20 bytes for a Beanforming Compressed Report Frame (in us).
#define | BFR_SIFS_DURATION (14)
| SIFS Duration (in us).
#define | BFR_GET_REPORT_DURATION(length) (((length + 20) / 20) * BFR_BCR_DURATION) \
| Get an estimation of the TX duration in us for a Beamforming Compressed Report frame based on its length.
#define | BFR_STA_INFO_SET_AID12(sta_info, aid) (sta_info = (aid & BFR_NDPA_AID12_MASK)) \
| Macro to be used in order to update AID12 value in a NDPA frame sent during a SU calibration.
#define | BFR_STA_INFO_SET_FBACK_TYPE(sta_info, fback_type) (sta_info |= (fback_type << BFR_NPDA_FBACK_POS)) \
| Macro to be used in order to update Feedback Type value in a NDPA frame sent during a SU calibration.
#define | BFR_STA_INFO_SET_NC_INDEX(sta_info, nc_index) (sta_info |= (nc_index << BFR_NPDA_NC_IDX_POS)) \
| Macro to be used in order to update NC Index value in a NDPA frame sent during a SU calibration.
#define | BFR_VHT_MIMO_GET_VALUE(vht_mimo_ctrl, field)
| Macro to be used in order to extract subfield value in VHT MIMO Control field.
#define | BFR_IS_STATUS_BIT_SET(status, bit_pos) (status & (1 << bit_pos)) \
| Macro indicating if provided status bit is set in a status bitfield.
#define | BFR_SET_STATUS_BIT(status, bit_pos) (status |= (1 << bit_pos)) \
| Set a status bit to 1 in a given status bitfield.
#define | BFR_RESET_STATUS_BIT(status, bit_pos) (status &= ~(1 << bit_pos)) \
| Set a status bit to 0 in a given status bitfield.
#define | BFR_GET_NA(nc, nr) (nc * ((2 * nr) - nc - 1)) \
| Compute the Number of Angles in function of Nc and Nr values.
## Functions
static void | bfr_start_next_calibration (void)
| Starts the next pending SU calibration.
static void | bfr_calibrate (void)
| Go through all connected beamformee-capable STAs and check if start of a new calibration is required for this connection.
__INLINE uint8_t | bfr_get_bw (struct vif_info_tag *vif)
static void | bfr_calib_tmr_exp_cb (void *env)
static void | bfr_end_calibration_for_sta (struct bfr_info_sta *bfr, bool updated)
| Handle end of calibration for a given STA If the calibration was a SU calibration, the bfr module goes back to the IDLE state.
static void | bfr_tx_frame_cfm (void *env, uint32_t status)
| Handle confirmation of either the NDPA packet or the NDP frame or one of the BFR Poll frames.
static void | bfr_dma_upload_cfm (void *env)
| Handle upload confirmation of a beamforming report segment in the host memory.
static bool | bfr_is_vht_bfr (uint8_t *frame)
| Check if provided frame is a VHT Compressed Beamforming frame.
static bool | bfr_is_frame_bf_compliant (struct txdesc *txdesc, struct bfr_info_sta *bfr)
| Check if a frame can be sent using beamforming.
static void | bfr_increase_nb_frames (struct bfr_mem_node *node)
| Increase the nb_frames value in a given bfr_mem_node structure.
static void | bfr_remove_node (struct bfr_mem_node *node)
| This function is in charge of removing a memory node from the list of used memory nodes.
static bool | bfr_check_next_nodes (uint16_t needed_length, struct bfr_mem_node **start_node, uint8_t *nb_nodes)
| Get the number of nodes that must be replaced in the list of used node starting from a given a node in order to be able to allocate the required length in the BFR memory.
static struct bfr_mem_node * | bfr_get_node (uint16_t length)
| Parse the BFR memory content in order to find a position at which a beamforming report with a given length can be downloaded.
static uint8_t | bfr_get_smm_index (struct bfr_mem_node *node)
| Look for an used SMM index to be used for a memory node.
static uint16_t | bfr_get_report_max_length (struct bfr_info_sta *bfr, bool mu)
| Compute the maximal report length that could be received from a given Beamformee based on the connection parameters.
static struct txdesc * | bfr_prep_ndpa (struct bfr_info_sta *bfr, uint8_t *nb_devs)
| Allocate a frame descriptor and build a Null Data Packet Announcement Frame to be used during SU calibration with a given peer station.
static struct txdesc * | bfr_prep_ndp (struct bfr_info_sta *bfr, uint8_t nb_devs)
| Allocate a frame descriptor and build a Null Data Packet Frame to be used during SU calibration with a given peer station.
static struct txdesc * | bfr_prep_bfr_poll (struct bfr_info_sta *bfr)
| Allocate a frame descriptor and build a Beamforming Report Poll Frame to be used during MU calibration with a given peer station.
static uint8_t | bfr_upload_report (struct bfr_info_sta *bfr, struct rxdesc *rxdesc, uint8_t *frame)
| Handle upload of a received VHT Beamforming Report in the host memory.
static uint8_t | bfr_download_report (struct bfr_info_sta *bfr, struct dma_desc *dma_desc_bfr)
| Handle download of a beamforming report from the host memory to the PHY memory so that it can be used for the following frame transmissions.
static void | bfr_init_sta_info (struct bfr_info_sta *bfr)
| Reset information stored in struct bfr_info_sta element allocated for a STA.
static void | bfr_init_index_table (void)
| Initialize index table in BFR Report Memory.
void | bfr_init (void)
| Initialize stack for support of TX Beamforming.
void | bfr_add_sta_ind (uint8_t sta_idx, bool mu_capable, uint16_t aid, uint32_t host_addr, uint16_t host_length, uint8_t nss)
| Configure the Beamformer environment for a STA that is at least SU Beamformee capable (this check has to be done before call of this function).
void | bfr_del_sta_ind (uint8_t sta_idx)
| Clean the Beamformer environment previously allocated for a given STA.
uint8_t | bfr_rx_frame_ind (uint8_t sta_idx, struct rxdesc *rxdesc, uint8_t *frame)
| Inform BFR module about reception of a frame.
bool | bfr_tx_frame_ind (struct txdesc *txdesc, struct dma_desc *dma_desc_bfr)
| This function is supposed to be called before each transmission of the first MPDU of an A-MPDU or a singleton MPDU to a STA that is at least SU Beamformee capable.
void | bfr_tx_cfm (struct txdesc *txdesc)
| Handle confirmation of transmission of a beamformed frame.
uint8_t | bfr_get_last_nc (uint8_t sta_idx)
| Returns the latest Nc value received in a Beamforming report for a given beamformee.
static void | bfr_group_update_cfm (void *env, uint32_t status)
| Handle confirmation of the group update frame transmitted to the peer STA.
void | bfr_group_update_req (struct mm_mu_group_update_req const *param)
| Handle group update request sent by the upper layers.
## Variables
struct bfr_mem_node | bfr_nodes [BFR_MEM_NODE_NB]
| Nodes that can be used to describe state of BFR Memory.
struct bfr_info_sta | bfr_sta_infos [NX_REMOTE_STA_MAX]
| BFR Information for each STA.
uint16_t | bfr_smm_ptrs [BFR_MEM_REP_NB_MAX]
| SMM Pointers.
struct bfr_env_tag | bfr_env
| BFR Environment.
const uint16_t | bfr_ns []
| Array providing Ns value in function of Channel Width and Grouping value.
const uint8_t | bfr_nsp []
| Array providing Ns' value in function of Channel Width.

## Detailed Description

Beamformer Module Implementation.

Copyright (C) RivieraWaves 2016-2019

Definition in file bfr.c.