# BFR
[LMAC]

Beamformer Implementation (LMAC Part). More...

Collaboration diagram for BFR:

## Data Structures
struct | bfr_mem_node
| Structure representing a piece of BFR memory. More...
struct | bfr_env_tag
| Structure representing the environment used to manage all transmissions as a beamformer. More...
struct | bfr_info_sta
| Structure containing required information for BFR transmission to a given STA. More...
## 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.
## Enumerations
enum | bfr_rx_status { BFR_RX_STATUS_NOT_VALID = 0, BFR_RX_STATUS_VALID, BFR_RX_STATUS_ERROR }
| RX Upload status returned in bfr_rx_frame_ind function. More...
enum | bfr_fback_type_val { BFR_SU_TYPE = 0, BFR_MU_TYPE }
| Feedback Type values. More...
enum | bfr_status { BFR_STATUS_IDLE = 0, BFR_STATUS_SU_CALIB, BFR_STATUS_MU_CALIB }
| BFR Environment status values. More...
enum | bfr_sta_info_status { BFR_STA_MU_CAPABLE = 0, BFR_STA_HAS_VALID_REPORT, BFR_STA_DOWNLOAD, BFR_STA_CALIBRATE, BFR_STA_REPORT_UPDATED }
| BFR STA Information Status Bit Positions. More...
## 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.
__INLINE bool | bfr_is_enabled (void)
| Return if Beamformer role can be used based on HW capabilities.
__INLINE bool | bfr_is_calibrated (uint8_t sta_idx)
| Return if a given station has been successfully calibrated.
__INLINE bool | bfr_is_bfmed_sglt_allowed (struct txdesc *txdesc)
| Return if a frame pointed by the given TX descriptor can be beamformed if transmitted as a singleton MPDU.
## 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.
struct bfr_env_tag | bfr_env
| Beamformer common environment.
struct bfr_info_sta | bfr_sta_infos [NX_REMOTE_STA_MAX]
| BFR Information for each STA.
## BFR Memory Configuration
#define | BFR_MEM_REP_NB_MAX (6)
| Maximal number of beamforming reports that can be downloaded in BFR Memory.
#define | BFR_MEM_BASE_ADDR (0x60C05000)
| Base address of BFR Memory in HW memory (FPGA B).
#define | BFM_MEM_PTR_SIZE (BFR_MEM_REP_NB_MAX * 2)
| Size of section in BFR Memory containing pointer to reports (in bytes).
#define | BFR_MEM_START_ADDR (BFM_MEM_PTR_SIZE)
| Start Address of remaining BFR Memory (Offset from BFR_MEM_BASE_ADDR).
#define | BFR_MEM_NODE_NB (BFR_MEM_REP_NB_MAX)
| Number of memory nodes that can be used to describe state of BFR Memory.
## Frame Information for NPDA
#define | BFR_NDPA_SU_LEN (MAC_LONG_CTRLFRAME_LEN + 3)
| Length of NDP Announcement Frame sent during SU Calibration (in bytes).
#define | BFR_NDPA_STA_INFO_LEN (2)
| Length of a STA Information field.
#define | BFR_NDPA_TOKEN_MAX (0x3F)
| Maximal sounding dialog token value (63).
#define | BFR_NPDA_TOKEN_POS (2)
| Position of Sounding Dialog Token Number in Sounding Dialog Token field.
#define | BFR_NDPA_TOKEN_MASK (BFR_NDPA_TOKEN_MAX << BFR_NPDA_TOKEN_POS)
| Mask allowing to get/set Dialog Token value.
#define | BFR_NPDA_AID12_POS (0)
| Position of AID12 field in STA Info field.
#define | BFR_NDPA_AID12_MASK (0xFFF)
| Mask allowing to get/set AID12 value.
#define | BFR_NPDA_FBACK_POS (12)
| Position of Feedback Type field in STA Info field.
#define | BFR_NDPA_FBACK_MASK (0x1000)
| Mask allowing to get/set Feedback Type value.
#define | BFR_NPDA_NC_IDX_POS (13)
| Position of NC Index field in STA Info field.
#define | BFR_NDPA_NC_IDX_MASK (0xFE00)
| Mask allowing to get/set NC Index value.
## VHT NDP Announcement frame format (see 802.11ac-2013, section 8.3.1.20)
Offset of Dialog Token field (from beginning of frame)
#define | BFR_NDPA_DIALOG_TOKEN_OFFSET (16)
| Offset of first STA Info field (from beginning of frame).
#define | BFR_NDPA_STA_INFO_OFFSET (17)
| Offset of first STA Info field (from beginning of frame).
#define | BFR_NDPA_STA_INFO_LENGTH (2)
| Length of STA Info field.
## Frame Information for BRP (Beamforming Report Poll)
#define | BFR_BRP_LEN (MAC_LONG_CTRLFRAME_LEN + 1)
| Length of Beamforming Report Poll Frame (in bytes).
## Beamforming Report Poll frame format (see 802.11ac-2013, section 8.3.1.21)
Offset of Retransmission Bitmap field
#define | BFR_BRP_RETX_BITMAP_OFFSET (16)
## Frame Information for VHT MIMO Control field
#define | BFR_MIMO_CTRL_NC_OFFSET (0)
| Offset of NC Index field.
#define | BFR_MIMO_CTRL_NR_OFFSET (3)
| Offset of NR Index field.
#define | BFR_MIMO_CTRL_CHAN_WIDTH_OFFSET (6)
| Offset of Channel Width field.
#define | BFR_MIMO_CTRL_GROUPING_OFFSET (8)
| Offset of Grouping field.
#define | BFR_MIMO_CTRL_CODEBOOK_OFFSET (10)
| Offset of Codebook Information field.
#define | BFR_MIMO_CTRL_FEEDBACK_OFFSET (11)
| Offset of Feedback Type field.
#define | BFR_MIMO_CTRL_REM_SEGM_OFFSET (12)
| Offset of Remaining Feedback Segments field.
#define | BFR_MIMO_CTRL_FIRST_SEGM_OFFSET (15)
| Offset of First Feedback Segment field.
#define | BFR_MIMO_CTRL_RESERVED_OFFSET (16)
| Offset of Reserved Bits.
#define | BFR_MIMO_CTRL_TOKEN_OFFSET (18)
| Offset of Sounding Dialog Token Number field.
#define | BFR_MIMO_CTRL_NC_MASK (0x7)
| Non-shifted mask for NC Index field.
#define | BFR_MIMO_CTRL_NR_MASK (0x7)
| Non-shifted mask for NR Index field.
#define | BFR_MIMO_CTRL_CHAN_WIDTH_MASK (0x3)
| Non-shifted mask for Channel Width field.
#define | BFR_MIMO_CTRL_GROUPING_MASK (0x3)
| Non-shifted mask for Grouping field.
#define | BFR_MIMO_CTRL_CODEBOOK_MASK (0x1)
| Non-shifted mask for Codebook Information field.
#define | BFR_MIMO_CTRL_FEEDBACK_MASK (0x1)
| Non-shifted mask for Feedback Type field.
#define | BFR_MIMO_CTRL_REM_SEGM_MASK (0x7)
| Non-shifted mask for Remaining Feedback Segments field.
#define | BFR_MIMO_CTRL_FIRST_SEGM_MASK (0x1)
| Non-shifted mask for First Feedback Segment field.
#define | BFR_MIMO_CTRL_TOKEN_MASK (0x3F)
| Non-shifted mask for Sounding Dialog Token Number field.
## Miscellaneous
#define | BFR_CALIB_TMR_DFLT_DUR (50000)
| Default Calibration Timer duration (in us).
#define | BFR_CALIB_MAX_DELAY (500000)
| Maximum time between two calibrations for a STA if no traffic is ongoing (in us).
#define | BFR_INVALID_SMM_INDEX (0xFF)
| Invalid SMM Index (no report can be used for the transmission).
#define | BFR_VHT_BFR_CATEGORY_OFFSET (24)
| VHT Compressed Beamforming frame format (see 802.11ac-2013, section 8.5.23.2) Offset of Category field.
#define | BFR_VHT_BFR_VHT_ACTION_OFFSET (25)
| Offset of VHT Action field.
#define | BFR_VHT_BFR_VHT_MIMO_CTRL_OFFSET (26)
| Offset of VHT MIMO Control field.
#define | BFR_VHT_REPORT_OFFSET (29)
| Offset of Report.
#define | BFR_INVALID_NC (0xFF)
| Invalid NC value.

## Detailed Description

Beamformer Implementation (LMAC Part).

## Define Documentation

#define BFR_BRP_LEN (MAC_LONG_CTRLFRAME_LEN + 1)

Length of Beamforming Report Poll Frame (in bytes).

See 802.11ac-2013, section 8.3.1.21

Definition at line 113 of file bfr.h.

Referenced by bfr_prep_bfr_poll().

#define BFR_GET_NA | ( | nc,
|  | nr |  | ) | (nc * ((2 * nr) - nc - 1)) \

Compute the Number of Angles in function of Nc and Nr values.

Parameters:

  `[in]` | nc | Nc Value
  `[in]` | nr | Nr Value

Returns:
  Computed Na value Na = Nc * (2 * Nr - Nc - 1)

Definition at line 196 of file bfr.c.

Referenced by bfr_get_report_max_length().

#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.

Parameters:

  `[in]` | length | Report length.

Definition at line 100 of file bfr.c.

Referenced by bfr_prep_ndpa().

#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.

Parameters:

  `[in]` | status | Status bitfield value
  `[in]` | bit_pos | Position index of the bit in the bit field

Definition at line 164 of file bfr.c.

Referenced by bfr_calibrate(), and bfr_prep_ndpa().

#define BFR_MEM_REP_NB_MAX (6)

Maximal number of beamforming reports that can be downloaded in BFR Memory.

Shall be a multiple of 2.

Definition at line 58 of file bfr.h.

Referenced by bfr_get_smm_index(), bfr_init_index_table(), and bfr_remove_node().

#define BFR_NB_BIT_PHY_MU (7)

Number of bits of a PHY element in matrix for a MU feedback type.

We are considering here the worst case for received report length, hence codebook = 1

Definition at line 65 of file bfr.c.

Referenced by bfr_get_report_max_length().

#define BFR_NB_BIT_PHY_SU (4)

Number of bits of a PHY element in matrix for a SU feedback type.

We are considering here the worst case for received report length, hence codebook = 1

Definition at line 60 of file bfr.c.

Referenced by bfr_get_report_max_length().

#define BFR_NB_BIT_PSY_MU (9)

Number of bits of a PSY element in matrix for a MU feedback type.

We are considering here the worst case for received report length, hence codebook = 1

Definition at line 75 of file bfr.c.

Referenced by bfr_get_report_max_length().

#define BFR_NB_BIT_PSY_SU (6)

Number of bits of a PSY element in matrix for a SU feedback type.

We are considering here the worst case for received report length, hence codebook = 1

Definition at line 70 of file bfr.c.

Referenced by bfr_get_report_max_length().

#define BFR_NDPA_SU_LEN (MAC_LONG_CTRLFRAME_LEN + 3)

Length of NDP Announcement Frame sent during SU Calibration (in bytes).

See 802.11ac-2013, section 8.3.1.20

Definition at line 76 of file bfr.h.

Referenced by bfr_prep_ndpa().

#define BFR_RESET_STATUS_BIT | ( | status,
|  | bit_pos |  | ) | (status &= ~(1 << bit_pos)) \

Set a status bit to 0 in a given status bitfield.

Parameters:

  `[in]` | status | Status bitfield value
  `[in]` | bit_pos | Position index of the bit in the bit field

Definition at line 184 of file bfr.c.

Referenced by bfr_end_calibration_for_sta().

#define BFR_SET_STATUS_BIT | ( | status,
|  | bit_pos |  | ) | (status |= (1 << bit_pos)) \

Set a status bit to 1 in a given status bitfield.

Parameters:

  `[in]` | status | Status bitfield value
  `[in]` | bit_pos | Position index of the bit in the bit field

Definition at line 174 of file bfr.c.

Referenced by bfr_end_calibration_for_sta(), and bfr_start_next_calibration().

#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.

Warning: Clear all other subfields of the STA Info field.

Parameters:

  `[in]` | sta_info | Pointer to the STA Info field value to be updated
  `[in]` | aid | Full AID

Definition at line 111 of file bfr.c.

#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.

Parameters:

  `[in]` | sta_info | Pointer to the STA Info field value to be updated
  `[in]` | fback_type | Feedback Type value

Definition at line 122 of file bfr.c.

Referenced by bfr_prep_ndpa().

#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.

Parameters:

  `[in]` | sta_info | Pointer to the STA Info field value to be updated
  `[in]` | nc_index | NC Index

Definition at line 133 of file bfr.c.

Referenced by bfr_prep_ndpa().

#define BFR_VHT_MIMO_GET_VALUE | ( | vht_mimo_ctrl,
|  | field |  | ) |

Value:

    ((vht_mimo_ctrl >> BFR_MIMO_CTRL_ ## field ## _OFFSET) &           \
                                   BFR_MIMO_CTRL_ ## field ## _MASK)               \

Macro to be used in order to extract subfield value in VHT MIMO Control field.

Parameters:

  `[in]` | vht_mimo_ctrl | VHT MIMO Control field value
  `[in]` | field | Field to be read. Possible values are: NC -> Nc Index, NR -> Nr Index, CHAN_WIDTH -> Channel Width, GROUPING -> Grouping, CODEBOOK -> Codebook Information, FEEDBACK -> Feedback Type, REM_SEGM -> Remaining Feedback Segments FIRST_SEGM -> First Feedback Segment TOKEN -> Sounding Dialog Token Number

Definition at line 153 of file bfr.c.

Referenced by bfr_upload_report().

## Enumeration Type Documentation

enum bfr_fback_type_val

Feedback Type values.

Enumerator:

  BFR_SU_TYPE | SU Feedback.
  BFR_MU_TYPE | MU Feedback.

Definition at line 203 of file bfr.h.

enum bfr_rx_status

RX Upload status returned in bfr_rx_frame_ind function.

Enumerator:

  BFR_RX_STATUS_NOT_VALID | Frame is not a VHT Compressed Beamforming Frame or peer STA is not beamformee capable.
  BFR_RX_STATUS_VALID | Frame is expected and we can handle upload of the report in the host memory.
  BFR_RX_STATUS_ERROR | Frame was expected but not enough DMA descriptors have been found for the upload.

Definition at line 192 of file bfr.h.

enum bfr_sta_info_status

BFR STA Information Status Bit Positions.

Enumerator:

  BFR_STA_MU_CAPABLE | Peer STA is MU beamforming capable.
  BFR_STA_HAS_VALID_REPORT | A valid report has been uploaded in host memory.
  BFR_STA_DOWNLOAD | Report is being downloaded from host to phy memory for this STA.
  BFR_STA_CALIBRATE | Calibration in progress for this STA.
  BFR_STA_REPORT_UPDATED | Report has been updated in host memory.

Definition at line 223 of file bfr.h.

enum bfr_status

BFR Environment status values.

Enumerator:

  BFR_STATUS_IDLE | BFR Module is IDLE.
  BFR_STATUS_SU_CALIB | SU Calibration is in progress.
  BFR_STATUS_MU_CALIB | MU Calibration is in progress.

Definition at line 212 of file bfr.h.

## Function Documentation

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).

Once the link with the STA is disconnected, bfr_del_sta_ind function should be called in order to clean the environment.

Parameters:

  `[in]` | sta_idx | STA Index
  `[in]` | mu_capable | Indicate if peer STA is MU capable
  `[in]` | aid | Association ID (relevant only if VIF type is AP)
  `[in]` | host_addr | Address in host memory at which received beamforming reports can be uploaded using a DMA transfer.
  `[in]` | host_length | Length allocated by the host for the reports
  `[in]` | nss | Maximum number of spatial stream supported by the STA

Referenced by mm_bfmer_enable_req_handler().

static void bfr_calib_tmr_exp_cb | ( | void * | env | ) | `[static]`

Parameters:

  `[in]` | env | Should always be a NULL pointer

Definition at line 282 of file bfr.c.

References bfr_calibrate(), bfr_env, bfr_env_tag::calib_tmr, bfr_env_tag::calib_tmr_dur, ke_time(), and mm_timer_set().

static bool bfr_check_next_nodes | ( | uint16_t | needed_length,
|  | struct bfr_mem_node ** | start_node,
|  | uint8_t * | nb_nodes |
| ) |  |  | `[static]`

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.

Parameters:

  `[in]` | needed_length | Length to be found in the BFR memory
  `[in,out]` | start_node | First node to consider. If a non-free node is found before we found the needed length, the pointer value is modified with the address of the node following the non-free node in order to make the node research faster.
  `[in,out]` | nb_nodes | Pointer to the variable indicating the number of nodes to be replaced.

Returns:
  True if the requested length has been found, else false.

Definition at line 609 of file bfr.c.

References bfr_env, bfr_env_tag::bfr_mem_eaddr, co_min(), bfr_mem_node::hdr, bfr_mem_node::length, bfr_mem_node::nb_frames, co_list_hdr::next, and bfr_mem_node::start_addr.

Referenced by bfr_get_node().

void bfr_del_sta_ind | ( | uint8_t | sta_idx | ) |

Clean the Beamformer environment previously allocated for a given STA.

This function is supposed to be called once the link with the STA has been disconnected.

Parameters:

  `[in]` | sta_idx | STA Index

static void bfr_dma_upload_cfm | ( | void * | env | ) | `[static]`

Handle upload confirmation of a beamforming report segment in the host memory.

This function is intended to be used only once the last descriptor has been uploaded, If the uploaded segment is the last expected segment, the calibration for the STA can be considered as done.

Parameters:

  `[in]` | env | Pointer to the BFR information associated with a given STA (struct bfr_info_sta).

Definition at line 396 of file bfr.c.

References bfr_end_calibration_for_sta(), INVALID_STA_IDX, bfr_info_sta::nb_segments, PROF_BFR_UPLOAD_CLR, and bfr_info_sta::sta_idx.

Referenced by bfr_upload_report().

static uint8_t bfr_download_report | ( | struct bfr_info_sta * | bfr,
|  | struct dma_desc * | dma_desc_bfr |
| ) |  |  | `[static]`

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.

It first checks if a report used by the provided STA is already present in the PHY memory and if it can be overwritten. If not, it searches for a new memory node that could contain the report.

Parameters:

  `[in]` | bfr | Beamformer information for a given STA.
  `[in]` | dma_desc_bfr | DMA descriptor to be fulfilled in case download of a report from the host memory to the phy memory is required.

Returns:
  SMM index of the slot in which report has been downloaded and BFR_INVALID_SMM_INDEX if no slot has been found.

Definition at line 1390 of file bfr.c.

References ASSERT_ERR, bfr_env, bfr_get_node(), bfr_get_smm_index(), BFR_INVALID_SMM_INDEX, BFR_MEM_BASE_ADDR, BFR_MEM_NODE_NB, bfr_remove_node(), dma_desc::ctrl, dma_desc::dest, bfr_info_sta::host_report_addr, bfr_info_sta::host_report_idx, bfr_info_sta::host_report_len, INVALID_STA_IDX, dma_desc::length, bfr_mem_node::length, bfr_mem_node::nb_frames, bfr_env_tag::nb_used_nodes, bfr_info_sta::node, PROF_BFR_DOWNLOAD_CLR, PROF_BFR_DOWNLOAD_SET, bfr_mem_node::smm_index, dma_desc::src, bfr_info_sta::sta_idx, bfr_mem_node::sta_idx, and bfr_mem_node::start_addr.

static void bfr_end_calibration_for_sta | ( | struct bfr_info_sta * | bfr,
|  | bool | updated |
| ) |  |  | `[static]`

Handle end of calibration for a given STA If the calibration was a SU calibration, the bfr module goes back to the IDLE state.

If it was a MU calibration and the uploaded segment is the last segment of the last expected report, the bfr module goes back to the IDLE state. Finally the RX software descriptor is free.

Parameters:

  `[in]` | bfr | STA for which calibration is over
  `[in]` | updated | Indicate if report is host memory has been updated and must be downloaded in PHY memory upon next transmission request

Definition at line 303 of file bfr.c.

References bfr_env, BFR_RESET_STATUS_BIT, BFR_SET_STATUS_BIT, BFR_STA_CALIBRATE, BFR_STA_HAS_VALID_REPORT, BFR_STA_REPORT_UPDATED, bfr_start_next_calibration(), BFR_STATUS_IDLE, BFR_STATUS_SU_CALIB, hal_machw_time(), bfr_info_sta::host_report_idx, bfr_info_sta::last_calib_time, bfr_env_tag::nb_reports, PROF_BFR_MU_CALIB_CLR, PROF_BFR_SU_CALIB_CLR, bfr_env_tag::status, and bfr_info_sta::status.

Referenced by bfr_dma_upload_cfm(), bfr_tx_frame_cfm(), and bfr_upload_report().

__INLINE uint8_t bfr_get_bw | ( | struct vif_info_tag * | vif | ) |

Parameters:

  `[in]` | vif | Vif pointer

Returns:
  Bandwith to use to send BFR control frame for this vif.

Definition at line 261 of file bfr.c.

References ASSERT_ERR, vif_info_tag::chan_ctxt, chan_ctxt_tag::channel, PHY_CHNL_BW_OTHER, phy_get_channel(), PHY_INFO_BW, PHY_PRIM, and mac_chan_op::type.

Referenced by bfr_get_report_max_length(), and bfr_prep_ndpa().

uint8_t bfr_get_last_nc | ( | uint8_t | sta_idx | ) |

Returns the latest Nc value received in a Beamforming report for a given beamformee.

Parameters:

  `[in]` | sta_idx | STA Index of the Beamformee device

Returns:
  latest NC value

Referenced by me_update_buffer_control().

static struct bfr_mem_node* bfr_get_node | ( | uint16_t | length | ) | `[static, read]`

Parse the BFR memory content in order to find a position at which a beamforming report with a given length can be downloaded.

Parameters:

  `[in]` | length | Length of the report to be downloaded.

Returns:
  A pointer to the found/created memory node, or NULL if download cannot be done due to a lack of memory.

Definition at line 674 of file bfr.c.

References ASSERT_ERR, bfr_check_next_nodes(), bfr_env, bfr_env_tag::bfr_mem_eaddr, BFR_MEM_START_ADDR, bfr_remove_node(), co_list_insert_after(), co_list_pick(), co_list_pop_front(), bfr_env_tag::free_nodes, bfr_mem_node::hdr, bfr_mem_node::length, bfr_mem_node::nb_frames, co_list_hdr::next, bfr_env_tag::nodes, and bfr_mem_node::start_addr.

Referenced by bfr_download_report().

static uint16_t bfr_get_report_max_length | ( | struct bfr_info_sta * | bfr,
|  | bool | mu |
| ) |  |  | `[static]`

Compute the maximal report length that could be received from a given Beamformee based on the connection parameters.

In order to consider the worst case, it is considered that no carriers are grouped together and that codebook is used.

Parameters:

  `[in]` | bfr | BFR Information for a given STA
  `[in]` | mu | Indicate if report will be received as part of a MU calibration. In that the length of the MU Exclusive Beamforming Report will be computed.

Returns:
  Computed length of the report.

Definition at line 875 of file bfr.c.

References bfr_info_sta::bfee_nss, bfr_env_tag::bfer_nss, bfr_env, bfr_get_bw(), BFR_GET_NA, BFR_NB_BIT_PHY_MU, BFR_NB_BIT_PHY_SU, BFR_NB_BIT_PSY_MU, BFR_NB_BIT_PSY_SU, bfr_ns, bfr_nsp, bfr_mem_node::length, bfr_info_sta::vif_idx, and vif_info_tab.

Referenced by bfr_prep_ndpa().

static uint8_t bfr_get_smm_index | ( | struct bfr_mem_node * | node | ) | `[static]`

Look for an used SMM index to be used for a memory node.

Parameters:

  `[in]` | node | Memory node waiting for a SMM Index

Returns:
  BFR_INVALID_SMM_INDEX if no free SMM index is available, else the SMM Index to be used.

Definition at line 818 of file bfr.c.

References BFR_INVALID_SMM_INDEX, BFR_MEM_BASE_ADDR, BFR_MEM_REP_NB_MAX, bfr_smm_ptrs, REG_PL_WR, bfr_mem_node::smm_index, and bfr_mem_node::start_addr.

Referenced by bfr_download_report().

static void bfr_group_update_cfm | ( | void * | env,
|  | uint32_t | status |
| ) |  |  | `[static]`

Handle confirmation of the group update frame transmitted to the peer STA.

Parameters:

  `[in]` | env | Has been configured so that value is the address of the parameter pointer of the group update request sent by the host.
  `[in]` | status | Transmission status provided by the HW.

Definition at line 2097 of file bfr.c.

References ke_msg::dest_id, ke_msg_free(), ke_msg_send_basic(), ke_param2msg(), MM_MU_GROUP_UPDATE_CFM, and ke_msg::src_id.

void bfr_group_update_req | ( | struct mm_mu_group_update_req const * | param | ) |

Handle group update request sent by the upper layers.

Parameters:

  `[in]` | param | Pointer to the group update message parameters

Referenced by mm_mu_group_update_req_handler().

static void bfr_increase_nb_frames | ( | struct bfr_mem_node * | node | ) | `[static]`

Increase the nb_frames value in a given bfr_mem_node structure.

It allows maintaining the number of downloaded nodes that are currently being used. If no node can be reused, any download will be refused.

Parameters:

  `[in]` | node | Node to be updated

Definition at line 549 of file bfr.c.

References bfr_env, bfr_mem_node::nb_frames, and bfr_env_tag::nb_used_nodes.

void bfr_init | ( | void |  | ) |

Initialize stack for support of TX Beamforming.

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

Initialize index table in BFR Report Memory.

Definition at line 1701 of file bfr.c.

References BFR_MEM_BASE_ADDR, BFR_MEM_REP_NB_MAX, and HW2CPU.

static void bfr_init_sta_info | ( | struct bfr_info_sta * | bfr | ) | `[static]`

Reset information stored in struct bfr_info_sta element allocated for a STA.

Parameters:

  `[in]` | bfr | BFR Information for a given STA

Definition at line 1687 of file bfr.c.

References INVALID_STA_IDX, and bfr_info_sta::sta_idx.

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

Return if a frame pointed by the given TX descriptor can be beamformed if transmitted as a singleton MPDU.

Parameters:

  `[in]` | txdesc | TX Descriptor to be checked

Returns:
  true if the frame could be beamformed when sent as a singleton MPDU, false otherwise

Definition at line 382 of file bfr.h.

References umacdesc::buf_control, hostdesc::flags, txdesc::host, txl_buffer_control::tx_flags, TX_SWDESC_UMAC_BEAMFORM_BIT, TX_SWDESC_UMAC_TRIAL_BEAMFORM_BIT, TXU_CNTRL_RC_TRIAL, and txdesc::umac.

Referenced by bfr_is_frame_bf_compliant(), and txl_hwdesc_config_post().

__INLINE bool bfr_is_enabled | ( | void |  | ) |

Return if Beamformer role can be used based on HW capabilities.

Returns:
  true if beamformer role is enabled, false otherwise.

Definition at line 352 of file bfr.h.

References bfr_env_tag::bfr_enabled, and bfr_env.

Referenced by mm_bfmer_enable_req_handler(), rxl_frame_handle(), txl_buffer_bfr_dma_desc_conf(), txl_cfm_evt(), txl_cfm_flush(), and txl_cfm_flush_desc().

static bool bfr_is_frame_bf_compliant | ( | struct txdesc * | txdesc,
|  | struct bfr_info_sta * | bfr |
| ) |  |  | `[static]`

Check if a frame can be sent using beamforming.

Following conditions have to be fulfilled:

- The frame is a VHT frame
- The MPDU is a singleton, or is the first MPDU of an AMPDU
  Parameters:

    `[in]` | txdesc | TX Descriptor containing information about the frame to transmit
    `[in]` | bfr | BFR info for the STA.

  Returns:
    True if the frame can be sent using beamforming, else False.

Definition at line 471 of file bfr.c.

References bfr_is_bfmed_sglt_allowed(), FORMAT_MOD_TX_RCX_MASK, FORMAT_MOD_TX_RCX_OFT, FORMATMOD_VHT, is_in_mumimo_ppdu(), is_mpdu_agg(), is_mpdu_first(), bfr_info_sta::last_rx_nc, MCS_INDEX_TX_RCX_MASK, MCS_INDEX_TX_RCX_OFT, umacdesc::phy_flags, phy_get_ntx(), txdesc::umac, VHT_NSS_MASK, and VHT_NSS_OFT.

static bool bfr_is_vht_bfr | ( | uint8_t * | frame | ) | `[static]`

Check if provided frame is a VHT Compressed Beamforming frame.

Parameters:

  `[in]` | frame | Pointer to the first byte of the frame.

Returns:
  false for frame format is not correct else true.

Definition at line 426 of file bfr.c.

References BFR_VHT_BFR_CATEGORY_OFFSET, BFR_VHT_BFR_VHT_ACTION_OFFSET, co_read8p(), CPU2HW, mac_hdr::fctl, MAC_COMP_BEAMFORMING_VHT_ACTION, MAC_FCTRL_ACTION_NO_ACK, MAC_FCTRL_TYPESUBTYPE_MASK, and MAC_VHT_ACTION_CATEGORY.

static struct txdesc* bfr_prep_bfr_poll | ( | struct bfr_info_sta * | bfr | ) | `[static, read]`

Allocate a frame descriptor and build a Beamforming Report Poll Frame to be used during MU calibration with a given peer station.

It has been checked before that:

- Peer STA supports VHT and is MU Beamformee capable
- Current channel for the STA is on 5GHz band (use of VHT)
  Parameters:

    `[in]` | bfr | BFR Information for a given STA

  Returns:
    A pointer to the TX Descriptor structure allocated for the BFR Poll.

Definition at line 1209 of file bfr.c.

References mac_hdr_ctrl::addr1, mac_hdr_ctrl::addr2, BFR_BRP_LEN, bfr_env, bfr_tx_frame_cfm(), BW_TX_RCX_MASK, BW_TX_RCX_OFT, bfr_env_tag::calib_bw, txl_frame_desc_tag::cfm, txl_frame_cfm_tag::cfm_func, co_write8p(), CPU2HW, DONT_TOUCH_DUR, mac_hdr_ctrl::durid, txl_frame_cfm_tag::env, EXPECTED_ACK_MSK, EXPECTED_ACK_NORMAL_ACK, mac_hdr_ctrl::fctl, txdesc::host, HW2CPU, lmacdesc::hw_desc, txdesc::lmac, MAC_FCTRL_BFM_REPORT_POLL, tx_hd::macctrlinfo1, tx_hd::macctrlinfo2, tx_hd::nextfrmexseq_ptr, tx_hd::nextmpdudesc_ptr, sta_info_tag::paid_gid, tx_hd::phyctrlinfo, tx_hd::policyentryaddr, tx_policy_tbl::ratecntrlinfo, bfr_info_sta::sta_idx, sta_info_tab, sta_mgmt_get_peer_addr(), hostdesc::staid, tx_hd::statinfo, tx_hw_desc::thd, TX_DEFAULT_NDPA_BRP, txl_frame_desc_tag::txdesc, txl_buffer_payload_get(), txl_frame_get(), UNDER_BA_SETUP_BIT, hostdesc::vif_idx, bfr_info_sta::vif_idx, vif_mgmt_get_addr(), and WHICHDESC_MSK.

Referenced by bfr_start_next_calibration().

static struct txdesc* bfr_prep_ndp | ( | struct bfr_info_sta * | bfr,
|  | uint8_t | nb_devs |
| ) |  |  | `[static, read]`

Allocate a frame descriptor and build a Null Data Packet Frame to be used during SU calibration with a given peer station.

It has been checked before that:

- Peer STA supports VHT and is SU Beamformee capable
- Current channel for the STA is on 5GHz band (use of VHT)
  Parameters:

    `[in]` | bfr | BFR Information for a given STA
    `[in]` | nb_devs | Number of devices to which the NDP is sent.

  Returns:
    A pointer to the TX Descriptor structure allocated for the NDP.

Definition at line 1141 of file bfr.c.

References bfr_env, bfr_tx_frame_cfm(), BW_TX_RCX_MASK, BW_TX_RCX_OFT, bfr_env_tag::calib_bw, txl_frame_desc_tag::cfm, txl_frame_cfm_tag::cfm_func, DONT_TOUCH_DUR, txl_frame_cfm_tag::env, EXPECTED_ACK_MSK, EXPECTED_ACK_NORMAL_ACK, GID_TX_MASK, GID_TX_OFT, txdesc::host, HW2CPU, lmacdesc::hw_desc, txdesc::lmac, tx_hd::macctrlinfo1, tx_hd::macctrlinfo2, tx_hd::nextfrmexseq_ptr, tx_hd::nextmpdudesc_ptr, sta_info_tag::paid_gid, PAID_TX_MASK, tx_hd::phyctrlinfo, tx_hd::policyentryaddr, tx_policy_tbl::ratecntrlinfo, bfr_info_sta::sta_idx, sta_info_tab, hostdesc::staid, tx_hd::statinfo, tx_hw_desc::thd, TX_DEFAULT_NDP, txl_frame_desc_tag::txdesc, txl_frame_get(), UNDER_BA_SETUP_BIT, bfr_info_sta::vif_idx, hostdesc::vif_idx, and WHICHDESC_MSK.

Referenced by bfr_start_next_calibration().

static struct txdesc* bfr_prep_ndpa | ( | struct bfr_info_sta * | bfr,
|  | uint8_t * | nb_devs |
| ) |  |  | `[static, read]`

Allocate a frame descriptor and build a Null Data Packet Announcement Frame to be used during SU calibration with a given peer station.

See 802.11ac-2013, section 8.3.1.20 for more details. It has been checked before that:

- Peer STA supports VHT and is SU Beamformee capable
- Current channel for the STA is on 5GHz band (use of VHT)
  Parameters:

    `[in]` | bfr | BFR Information for a given STA
    `[out]` | nb_devs | Pointer on number of calibration

  Returns:
    A pointer to the TX Header Descriptor structure allocated for the NDPA. This descriptor shall be linked with the TX Header Descriptor allocated for the NDP frame.

Definition at line 934 of file bfr.c.

References mac_hdr_ctrl::addr1, mac_hdr_ctrl::addr2, bfr_env, bfr_get_bw(), BFR_GET_REPORT_DURATION, bfr_get_report_max_length(), BFR_IS_STATUS_BIT_SET, BFR_MU_TYPE, BFR_NDP_DURATION, BFR_NDPA_AID12_MASK, BFR_NDPA_DIALOG_TOKEN_OFFSET, BFR_NDPA_STA_INFO_LEN, BFR_NDPA_STA_INFO_LENGTH, BFR_NDPA_STA_INFO_OFFSET, BFR_NDPA_SU_DURATION, BFR_NDPA_SU_LEN, BFR_NDPA_TOKEN_MAX, BFR_NPDA_TOKEN_POS, BFR_SIFS_DURATION, BFR_STA_INFO_SET_FBACK_TYPE, BFR_STA_INFO_SET_NC_INDEX, BFR_STA_MU_CAPABLE, BW_TX_RCX_MASK, BW_TX_RCX_OFT, bfr_env_tag::calib_bw, vif_info_tag::chan_ctxt, co_write16p(), co_write8p(), CPU2HW, DONT_TOUCH_DUR, mac_hdr_ctrl::durid, EXPECTED_ACK_MSK, mac_hdr_ctrl::fctl, GID_TX_OFT, bfr_info_sta::hdr, txdesc::host, HW2CPU, lmacdesc::hw_desc, bfr_info_sta::last_token, txdesc::lmac, mac_addr_bcst, MAC_FCTRL_VHT_NDPA, tx_hd::macctrlinfo1, tx_hd::macctrlinfo2, co_list_hdr::next, tx_hd::nextfrmexseq_ptr, tx_hd::nextmpdudesc_ptr, sta_info_tag::paid_gid, tx_hd::phyctrlinfo, tx_hd::policyentryaddr, PROT_FRM_DURATION_OFT, tx_policy_tbl::ratecntrlinfo, bfr_info_sta::sta_idx, bfr_info_sta::sta_info, sta_info_tab, sta_mgmt_get_peer_addr(), hostdesc::staid, tx_hd::statinfo, bfr_info_sta::status, tx_hw_desc::thd, bfr_env_tag::token, TX_DEFAULT_NDPA_BRP, txl_frame_desc_tag::txdesc, txl_buffer_payload_get(), txl_frame_get(), vif_info_tag::type, UNDER_BA_SETUP_BIT, hostdesc::vif_idx, bfr_info_sta::vif_idx, vif_info_tab, vif_mgmt_get_addr(), VIF_STA, and WHICHDESC_MSK.

Referenced by bfr_start_next_calibration().

static void bfr_remove_node | ( | struct bfr_mem_node * | node | ) | `[static]`

This function is in charge of removing a memory node from the list of used memory nodes.

Parameters:

  `[in]` | node | Node to be extracted

Definition at line 566 of file bfr.c.

References ASSERT_ERR, ASSERT_WARN, bfr_env, BFR_INVALID_SMM_INDEX, BFR_MEM_REP_NB_MAX, bfr_smm_ptrs, bfr_sta_infos, co_list_extract(), co_list_push_back(), bfr_env_tag::free_nodes, bfr_mem_node::hdr, INVALID_STA_IDX, bfr_info_sta::node, bfr_env_tag::nodes, bfr_mem_node::smm_index, and bfr_mem_node::sta_idx.

Referenced by bfr_download_report(), and bfr_get_node().

uint8_t bfr_rx_frame_ind | ( | uint8_t | sta_idx,
|  | struct rxdesc * | rxdesc,
|  | uint8_t * | frame |
| ) |  |  |

Inform BFR module about reception of a frame.

This function will check if a calibration was in progress with the STA, if the received frame is well the expected beamforming report. In that case, the received report will be uploaded in host memory using a DMA transfer. Note that this function could be called several times for a report as the report can be splited into several segment, hence several MPDU composing a same AMPDU.

Parameters:

  `[in]` | sta_idx | Index of the STA for which report has been received
  `[in]` | rxdesc | RX Descriptor containing all the details about the received frame
  `[in]` | frame | Frame data

Returns:
  A status indicating if the frame content has been uploaded in host memory or not (see enum bfr_rx_status). -> If status is BFR_RX_STATUS_NOT_VALID, packet is not a VHT Compressed Report and can be forwarded to the host -> If status is BFR_RX_STATUS_VALID, the frame is an expected VHT Compressed Report and the report is being uploaded in host memory. The BFR module is in charge of the SW descriptor. -> If status is BFR_RX_STATUS_ERROR, the frame is a VHT Compressed Report but the report was not expected or an error has been raised during the DMA transfer preparation.

Referenced by rxl_frame_handle().

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

Starts the next pending SU calibration.

The beamformer shall send a Null Data Packet Announcement (NDPA) frame followed by a Null Data Packet (NDP) after SIFS. This frame has a known fixed format. By analysing the NDP, the beamformee calculates a feedback matrix that is sent to the beamformer after SIFS.

Definition at line 1471 of file bfr.c.

References AC_VO, ASSERT_ERR, bfr_env_tag::bfee_sta_list, bfr_env, bfr_prep_bfr_poll(), bfr_prep_ndp(), bfr_prep_ndpa(), BFR_SET_STATUS_BIT, BFR_STA_CALIBRATE, BFR_STATUS_IDLE, BFR_STATUS_MU_CALIB, BFR_STATUS_SU_CALIB, bfr_env_tag::calib_sched, co_list_next(), co_list_pick(), co_list_pop_front(), co_list_push_back(), GLOBAL_INT_DISABLE, GLOBAL_INT_RESTORE, bfr_info_sta::hdr, INVALID_STA_IDX, bfr_env_tag::nb_reports, PROF_BFR_MU_CALIB_SET, PROF_BFR_SU_CALIB_SET, RW_USER_MAX, bfr_info_sta::sta_idx, bfr_info_sta::status, bfr_env_tag::status, txl_cntrl_push_int(), and txl_frame_release().

Referenced by bfr_end_calibration_for_sta().

void bfr_tx_cfm | ( | struct txdesc * | txdesc | ) |

Handle confirmation of transmission of a beamformed frame.

Note that this function has to be called ONLY if the frame was programmed as a beamformed frame. It is in charge of decrementing the nb_frames counter for the report used for the beamforming.

Parameters:

  `[in]` | txdesc | TX Descriptor containing information about the frame to transmit

Referenced by txl_cfm_evt(), txl_cfm_flush(), and txl_cfm_flush_desc().

static void bfr_tx_frame_cfm | ( | void * | env,
|  | uint32_t | status |
| ) |  |  | `[static]`

Handle confirmation of either the NDPA packet or the NDP frame or one of the BFR Poll frames.

-> Case of a SU calibration: in case of unsuccessful reception of beamforming report response, the NDP is marked as done with retry limit reached.

Parameters:

  `[in]` | env | Has been configured so that value is the address of the struct bfr_info_sta for which frame has been sent.
  `[in]` | status | Transmission status provided by the HW.

Definition at line 362 of file bfr.c.

References bfr_end_calibration_for_sta(), DESC_DONE_TX_BIT, INVALID_STA_IDX, RETRY_LIMIT_REACHED_BIT, and bfr_info_sta::sta_idx.

Referenced by bfr_prep_bfr_poll(), and bfr_prep_ndp().

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.

Its purpose is to check if a Beamforming report is already available in the phy memory. If the report has already been downloaded, the known smm index is returned. Else if a report is available in the host memory and can be inserted in the phy memory, start the download procedure. In any other cases the returned smm index will be BFR_INVALID_SMM_INDEX.

Parameters:

  `[in]` | txdesc | TX Descriptor containing information about the frame to transmit
  `[in]` | dma_desc_bfr | DMA descriptor to be fulfilled in case download of a report from the host memory to the phy memory is required.

Returns:
  True if a report download has been prepared, else False

Referenced by txl_buffer_bfr_dma_desc_conf().

static uint8_t bfr_upload_report | ( | struct bfr_info_sta * | bfr,
|  | struct rxdesc * | rxdesc,
|  | uint8_t * | frame |
| ) |  |  | `[static]`

Handle upload of a received VHT Beamforming Report in the host memory.

If report length exceeds maximum MPDU length, the report shall be split in several segments by the beamformee:

- Up to 8 segments.
- All the segments shall be sent in a single A-MPDU in an ordered way.
- Remaining Feedback Segments and First Feedback Segment subfields of VHT MIMO Control field allows identification of segments. When received in SW a MPDU is described and split over several buffers (and several Payload Descriptors). Hence two levels of fragmentation are handled.

bfr_dma_upload_cfm callback will be called after end of segment upload. Once all segments have been uploaded, calibration can be considered as over for the STA.

Parameters:

  `[in]` | bfr | Beamformer information for a given STA.
  `[in]` | rxdesc | Software descriptor containing information about the received MPDU.
  `[in]` | frame | Pointer to the received VHT Compressed Beamforming report frame

Returns:
  A boolean value indicating if the operation has been properly finished and if the provided software descriptor can be freed. If true, bfr module will be in charge of freeing the descriptor. Else it is rxl_cntrl module responsability.

Definition at line 1301 of file bfr.c.

References bfr_dma_upload_cfm(), bfr_end_calibration_for_sta(), bfr_env, BFR_RX_STATUS_ERROR, BFR_RX_STATUS_VALID, BFR_VHT_BFR_VHT_MIMO_CTRL_OFFSET, BFR_VHT_MIMO_GET_VALUE, BFR_VHT_REPORT_OFFSET, bfr_env_tag::calib_bw, co_read32p(), co_write16p(), CPU2HW, rx_hd::frmlen, rx_dmadesc::hd, bfr_info_sta::host_max_report_len, bfr_info_sta::host_report_addr, bfr_info_sta::host_report_idx, bfr_info_sta::host_report_len, bfr_info_sta::last_rx_nc, bfr_info_sta::nb_segments, PROF_BFR_UPLOAD_SET, rxl_dmadesc_get(), and rxl_mpdu_partial_transfer().

## Variable Documentation

struct bfr_env_tag bfr_env

BFR Environment.

Beamformer common environment.

Definition at line 211 of file bfr.c.

Referenced by bfr_calib_tmr_exp_cb(), bfr_calibrate(), bfr_check_next_nodes(), bfr_download_report(), bfr_end_calibration_for_sta(), bfr_get_node(), bfr_get_report_max_length(), bfr_increase_nb_frames(), bfr_is_enabled(), bfr_prep_bfr_poll(), bfr_prep_ndp(), bfr_prep_ndpa(), bfr_remove_node(), bfr_start_next_calibration(), and bfr_upload_report().

const uint16_t bfr_ns[]

Initial value:

     {
        [PHY_CHNL_BW_20] = 52,
        [PHY_CHNL_BW_40] = 108,
        [PHY_CHNL_BW_80] = 234,
        [PHY_CHNL_BW_160] = 468,
        [PHY_CHNL_BW_80P80] = 468,
    }

Array providing Ns value in function of Channel Width and Grouping value.

* As this array is used in order to compute the expected report length in worst case, it is assumed that beamformee do not use grouping. Ns = Number of carriers in Compressed Beamforming Feedback. Refer to Table 8-53g in IEEE Std 802.11ac-2013 specification for details.

Definition at line 220 of file bfr.c.

Referenced by bfr_get_report_max_length().

const uint8_t bfr_nsp[]

Initial value:

     {
        [PHY_CHNL_BW_20] = 30,
        [PHY_CHNL_BW_40] = 58,
        [PHY_CHNL_BW_80] = 122,
        [PHY_CHNL_BW_160] = 244,
        [PHY_CHNL_BW_80P80] = 244,
    }

Array providing Ns' value in function of Channel Width.

As this array is used in order to compute the expected report length in worst case, it is assumed that beamformee do not use grouping. Ns' = Number of carriers in MU Exclusive Beamforming Feedback. Refer to Table 8-53g in IEEE Std 802.11ac-2013 specification for details.

Definition at line 235 of file bfr.c.

Referenced by bfr_get_report_max_length().