# /space/home/slher/rel/Beken/v6_4_5/macsw/ip/umac/src/me/me_utils.c File Reference

All utility functions manipulating rates, etc. More...

`#include "me_utils.h"`
`#include "co_math.h"`
`#include "sta_mgmt.h"`
`#include "vif_mgmt.h"`
`#include "mac_ie.h"`
`#include "hal_desc.h"`
`#include "mac_frame.h"`
`#include "me.h"`
`#include "mm.h"`
`#include "rc.h"`
`#include "me_mgmtframe.h"`
`#include "tpc.h"`
`#include "txl_cfm.h"`
`#include "txl_he.h"`
`#include "bfr.h"`

Go to the source code of this file.

## Functions
static void | me_chan_ctxt_update (struct vif_info_tag *vif)
| Updates Channel context using latest bss information,.
bool | me_set_sta_ht_vht_param (struct sta_info_tag *sta, struct me_bss_info *bss)
| Compute some HT and VHT parameters for the given STA.
uint8_t | me_11ac_mcs_max (uint16_t mcs_map)
| Gets the maximum MCS supported (11ac station).
uint8_t | me_11ax_mcs_max (uint16_t mcs_map)
| Gets the maximum MCS supported (11ax station).
uint8_t | me_11ac_nss_max (uint16_t mcs_map)
| Gets the maximum number of spatial streams supported (11ac station).
uint8_t | me_11n_nss_max (uint8_t *mcs_set)
| Gets the maximum number of spatial streams supported (11n station).
uint8_t | me_legacy_ridx_min (uint16_t rate_map)
| Gets the minimum legacy rate index supported.
uint8_t | me_legacy_ridx_max (uint16_t rate_map)
| Gets the maximum legacy rate index supported.
void | me_get_ampdu_params (struct mac_htcapability const *ht_cap, struct mac_vhtcapability const *vht_cap, struct mac_hecapability const *he_cap, uint16_t *ampdu_size_max_ht, uint32_t *ampdu_size_max_vht, uint32_t *ampdu_size_max_he, uint8_t *ampdu_spacing_min)
| Compute the A-MPDU parameters of a peer STA (maximum A-MPDU length, minimum spacing), based on the HT, VHT and HE capabilities.
static void | me_erp_prot_check (uint32_t erp_addr, uint16_t *prot_status)
| Extracts ERP protection information and save it in BSS structure.
static void | me_pol_tbl_prot_upd (struct sta_info_tag *sta, uint16_t prot_status)
| Updates protection status inside the policy table linked to a STA.
static void | me_pol_tbl_bw_upd (struct sta_info_tag *sta, uint8_t new_phy_bw)
| Updates bandwidth inside the policy table linked to a STA.
uint8_t | me_rate_translate (uint8_t rate)
| Converts rate value present in (Extended) supported rates IE with enum used by HW.
uint16_t | me_legacy_rate_bitfield_build (struct mac_rateset const *rateset, bool basic_only)
| Build the legacy rate bitfield according to the rate set passed as parameter.
uint16_t | me_rate_bitfield_vht_build (uint16_t mcs_map_1, uint16_t mcs_map_2)
| Build a VHT-MCS map according to the MCS maps passed as parameters.
uint16_t | me_build_capability (uint8_t vif_idx)
| Build the capability information.
void | me_init_rate (struct sta_info_tag *sta)
| Initializes Rate control for a STA.
void | me_init_bcmc_rate (struct sta_info_tag *sta)
| Initializes Rate control for a Brodcast/Multicast STA.
struct txl_buffer_control * | me_update_buffer_control (struct sta_info_tag *sta)
| Update the field contained in the Policy Table.
void | me_bw_check (uint32_t ht_op_addr, uint32_t vht_op_addr, struct me_bss_info *bss)
| Check content of the HT and VHT operation element passed as parameters and update the bandwidth and channel information of the BSS accordingly.
void | me_beacon_check (uint8_t vif_idx, uint16_t length, uint32_t bcn_addr)
| Check in the received (in case of STA mode) or just modified (in case of AP mode) beacon if the protection and/or bandwidth of operation have been modified.
void | me_sta_bw_nss_max_upd (uint8_t sta_idx, uint8_t bw, uint8_t nss)
| Update the maximum bandwidth supported by a peer STA.
uint16_t | me_tx_cfm_amsdu (struct txdesc *txdesc)
| Return the A-MSDU size allowed for a TID of one STA.
void | me_vht_bandwidth_parse (uint8_t width, uint8_t center0, uint8_t center1, struct mac_chan_op *chan)
| Update chan bandwidth and center freqs from channel width, channel center frequency segment0 and channel center frequency segment1.

## Detailed Description

All utility functions manipulating rates, etc.

Copyright (C) RivieraWaves 2011-2019

Definition in file me_utils.c.

## Function Documentation

static void me_chan_ctxt_update | ( | struct vif_info_tag * | vif | ) | `[static]`

Updates Channel context using latest bss information,.

This function is called a bss parameters change implies a modification on the channel configuration. (e.g. bandwidth change)

Parameters:

  `[in]` | vif | VIF entry

Definition at line 59 of file me_utils.c.

References ASSERT_ERR, vif_info_tag::bss_info, me_bss_info::chan, mm_chan_ctxt_update_req::chan, vif_info_tag::chan_ctxt, mm_chan_ctxt_update_req::chan_index, chan_ctxt_tag::idx, KE_MSG_ALLOC, ke_msg_send(), MM_CHAN_CTXT_UPDATE_REQ, TASK_ME, and TASK_MM.

Referenced by me_beacon_check().

static void me_erp_prot_check | ( | uint32_t | erp_addr,
|  | uint16_t * | prot_status |
| ) |  |  | `[static]`

Extracts ERP protection information and save it in BSS structure.

Parameters:

  `[in]` | erp_addr | Address of ERP IE.
  `[out]` | prot_status | Pointer of prot_status in me_bss_info structure

Definition at line 333 of file me_utils.c.

References co_read8p(), MAC_ERP_BARKER_PREAMBLE_MODE, MAC_ERP_NON_ERP_PRESENT, MAC_ERP_PARAM_OFT, MAC_ERP_USE_PROTECTION, MAC_PROT_BARKER_PREAMB_BIT, MAC_PROT_ERP_STATUS_MASK, MAC_PROT_NONERP_PRESENT_BIT, and MAC_PROT_USE_PROTECTION_BIT.

Referenced by me_beacon_check().

static void me_pol_tbl_bw_upd | ( | struct sta_info_tag * | sta,
|  | uint8_t | new_phy_bw |
| ) |  |  | `[static]`

Updates bandwidth inside the policy table linked to a STA.

Parameters:

  `[in]` | sta | STA entry
  `[in]` | new_phy_bw | New bandwidth to use

Definition at line 430 of file me_utils.c.

References ASSERT_ERR, sta_capa_info::bw_cur, CO_BIT, co_min(), me_env_tag::ht_cap, sta_capa_info::ht_cap, sta_info_tag::info, LOCAL_CAPA, mac_htcapability::mcs_rate, me_11ac_nss_max(), me_11n_nss_max(), me_env, me_get_sta_bw(), me_phy2mac_bw(), sta_capa_info::phy_bw_max, sta_info_tag::pol_tbl, rc_update_bw_nss_max(), STA_CAPA, STA_MGMT_POL_UPD_BW, sta_info_tag::staid, and sta_pol_tbl_cntl::upd_field.

Referenced by me_beacon_check().

static void me_pol_tbl_prot_upd | ( | struct sta_info_tag * | sta,
|  | uint16_t | prot_status |
| ) |  |  | `[static]`

Updates protection status inside the policy table linked to a STA.

Parameters:

  `[in]` | sta | STA entry
  `[in]` | prot_status | New protection status to use

Definition at line 373 of file me_utils.c.

References vif_info_tag::bss_info, CO_BIT, me_bss_info::high_11b_rate, sta_info_tag::inst_nbr, MAC_PROT_BARKER_PREAMB_BIT, MAC_PROT_USE_PROTECTION_BIT, MCS_INDEX_PROT_TX_RCX_OFT, sta_info_tag::pol_tbl, sta_pol_tbl_cntl::ppdu_tx_cfg, PRE_TYPE_TX_RCX_MASK, sta_pol_tbl_cntl::prot_cfg, PROT_SELF_CTS, rc_update_preamble_type(), STA_MGMT_POL_UPD_PROT, sta_info_tag::staid, sta_pol_tbl_cntl::upd_field, and vif_info_tab.

Referenced by me_beacon_check().

uint8_t me_rate_translate | ( | uint8_t | rate | ) |

Converts rate value present in (Extended) supported rates IE with enum used by HW.

Parameters:

  `[in]` | rate | Rate to convert

Returns:
  enum value corresponding to `rate`

Definition at line 517 of file me_utils.c.

References HW_RATE_11MBPS, HW_RATE_12MBPS, HW_RATE_18MBPS, HW_RATE_1MBPS, HW_RATE_24MBPS, HW_RATE_2MBPS, HW_RATE_36MBPS, HW_RATE_48MBPS, HW_RATE_54MBPS, HW_RATE_5_5MBPS, HW_RATE_6MBPS, HW_RATE_9MBPS, MAC_BASIC_RATE, MAC_RATE_11MBPS, MAC_RATE_12MBPS, MAC_RATE_18MBPS, MAC_RATE_1MBPS, MAC_RATE_24MBPS, MAC_RATE_2MBPS, MAC_RATE_36MBPS, MAC_RATE_48MBPS, MAC_RATE_54MBPS, MAC_RATE_5_5MBPS, MAC_RATE_6MBPS, and MAC_RATE_9MBPS.

Referenced by me_init_bcmc_rate(), and me_legacy_rate_bitfield_build().