# /space/home/slher/rel/Beken/v6_4_5/macsw/ip/lmac/src/mm/mm.h File Reference

MAC Management module definitions. More...

`#include "co_int.h"`
`#include "co_bool.h"`
`#include "co_utils.h"`
`#include "ke_timer.h"`
`#include "mm_timer.h"`
`#include "mm_task.h"`
`#include "hal_desc.h"`
`#include "hal_machw.h"`
`#include "hal_dma.h"`
`#include "sta_mgmt.h"`

Go to the source code of this file.

## Data Structures
struct | antenna_diversity
| Antenna Diversity structure. More...
struct | mm_env_tag
| LMAC MAC Management Context. More...
## Defines
#define | MM_DEFAULT_TX_POWER 15
| Default TX power to apply when no regulatory info is available.
#define | MM_DEFAULT_MAX_AMPDU_DURATION 150
| Maximum duration of an A-MPDU (in 32us units).
#define | MM_AP_CLK_ACCURACY 20
| Default peer device accuracy (in ppm).
#define | MM_RX_FILTER_MONITOR
| RX filter for monitoring mode (all packets allowed).
#define | MM_RX_FILTER_ACTIVE
| RX filter for active mode (i.e. not monitoring).
#define | MM_SEC_MAX_KEY_NBR 64
| Number of supported Default+Pairwise keys.
#define | MM_SEC_VLAN_COUNT 6
| Number of VLAN Id.
#define | MM_SEC_DEFAULT_KEY_COUNT (MAC_DEFAULT_KEY_COUNT * MM_SEC_VLAN_COUNT)
| Number of default keys.
#define | MM_SEC_DEFAULT_VIF_KEY_COUNT (MAC_DEFAULT_KEY_COUNT * NX_VIRT_DEV_MAX)
| Number of default keys for number of supported VIFs.
#define | MM_SEC_CTYPE_NULL 0
| NULL cipher.
#define | MM_SEC_CTYPE_WEP 1
| WEP (RC4) cipher.
#define | MM_SEC_CTYPE_TKIP 2
| TKIP cipher.
#define | MM_SEC_CTYPE_CCMP 3
| CCMP cipher.
#define | MM_SEC_CTYPE_WPI_SMS4 4
| WAPI (SMS4) cipher.
#define | MM_VIF_TO_KEY(key_idx, vif_idx) ((key_idx) + ((vif_idx) * MAC_DEFAULT_KEY_COUNT))
| Macro converting a default key index to its HW index in key memory.
#define | MM_STA_TO_KEY(sta_idx) ((sta_idx) + MM_SEC_DEFAULT_KEY_COUNT)
| Macro converting a STA index to the its HW pairwise key index in key memory.
#define | MM_MLINK_TO_KEY(key_idx, mlink_idx) (((NX_VIRT_DEV_MAX + mlink_idx) * MAC_DEFAULT_KEY_COUNT) + key_idx)
| Macro converting a Mesh Link Index and a key index to its HW index in key memory.
#define | MM_KEY_TO_STA(hw_key_idx) ((hw_key_idx) - MM_SEC_DEFAULT_KEY_COUNT)
| Macro converting HW pairwise key index (>= MAC_DEFAULT_KEY_COUNT) to a STA index.
#define | MM_KEY_TO_VIF(hw_key_idx) (((hw_key_idx) & ~(MAC_DEFAULT_KEY_COUNT - 1)) / MAC_DEFAULT_KEY_COUNT)
| Macro converting a hw_key_idx (< MAC_DEFAULT_KEY_COUNT) to the VIF index it corresponds.
#define | MM_KEY_TO_KEYID(hw_key_idx) ((hw_key_idx) & (MAC_DEFAULT_KEY_COUNT - 1))
| Macro converting a hw_key_idx (< MAC_DEFAULT_KEY_COUNT) to the default key id it corresponds.
#define | MM_KEY_TO_MLINK(hw_key_idx) (((hw_key_idx & ~(MAC_DEFAULT_KEY_COUNT - 1)) / MAC_DEFAULT_KEY_COUNT) - NX_VIRT_DEV_MAX)
| Macro converting a hw_key_idx (< MAC_DEFAULT_KEY_COUNT) to the Mesh Link index it corresponds.
#define | MM_SEC_MFP_KEY_COUNT (MAC_DEFAULT_MFP_KEY_COUNT - MAC_DEFAULT_KEY_COUNT)
| Number of MFP keys per VIF.
#define | MM_SEC_MAX_MFP_KEY_NBR MM_SEC_MAX_KEY_NBR + (MM_SEC_MFP_KEY_COUNT * MM_SEC_VLAN_COUNT)
| Maximum number of hardware key that can be defined when MFP is enabled.
#define | MM_VIF_TO_MFP_KEY(key_idx, vif_idx) ((((key_idx) - MAC_DEFAULT_KEY_COUNT) + ((vif_idx) * MM_SEC_MFP_KEY_COUNT)) + MM_SEC_MAX_KEY_NBR)
| Macro converting mfp key (0/1) and vif index to HW key index.
#define | MM_MFP_KEY_TO_VIF(hw_key_idx) (((hw_key_idx) - MM_SEC_MAX_KEY_NBR) / MM_SEC_MFP_KEY_COUNT)
| Macro converting a hw_key_idx, in range [MM_SEC_MAX_KEY_NBR MM_SEC_MAX_MFP_KEY_NBR], to the Vif Index it corresponds.
#define | MM_MFP_KEY_TO_KEYID(hw_key_idx) ((((hw_key_idx) - MM_SEC_MAX_KEY_NBR) & (MM_SEC_MFP_KEY_COUNT - 1)) + MAC_DEFAULT_KEY_COUNT)
| Macro converting a hw_key_idx, in range [MM_SEC_MAX_KEY_NBR MM_SEC_MAX_MFP_KEY_NBR], to the MFP key id it corresponds.
#define | MM_SEC_MAX_MESH_MFP_KEY_NBR (MM_SEC_MAX_MFP_KEY_NBR + (MM_SEC_MFP_KEY_COUNT * NX_REMOTE_STA_MAX))
| Maximum number of hardware key that can be defined when MESH and MFP are enabled.
#define | MM_STA_TO_MESH_MFP_KEY(key_idx, sta_idx) (MM_SEC_MAX_MFP_KEY_NBR + (MM_SEC_MFP_KEY_COUNT * sta_idx) + key_idx)
| Macro converting mfp key index (0/1) and sta index to HW key index.
#define | MM_MESH_MFP_KEY_TO_KEYID(hw_key_idx) ((hw_key_idx - MM_SEC_MAX_MFP_KEY_NBR) & (MM_SEC_MFP_KEY_COUNT - 1))
| Macro converting a hw_key_idx, in range [MM_SEC_MAX_MFP_KEY_NBR MM_SEC_MAX_MESH_MFP_KEY_NBR], to the MFP key id it corresponds.
#define | MM_PRE_AP_TBTT_DELAY_US (1000)
| Delay between call to tbtt_timer callback for AP VIFs and AP_TBTT.
#define | ANT_DIV_RSSI_THD (20)
| Antenna Diversity RSSI threshold.
#define | ANT_DIV_RSSI_GOLDEN_MIN (-55)
| Antenna Diversity RSSI golden range min.
#define | ANT_DIV_RSSI_GOLDEN_MAX (-20)
| Antenna Diversity RSSI golden range max.
#define | ANT_DIV_RSSI_STEP_CHANGE (5)
| Antenna Diversity RSSI step change.
#define | ANT_DIV_BEACON_LOSS_THD (3)
| Antenna Diversity beacon loss threshold.
#define | ANT_DIV_RSSI_RESET (-128)
| Antenna Diversity RSSI reset value.
#define | ANT_DIV_UPDATE_CNT_THD (100)
| Antenna Diversity update counter threshold.
## Enumerations
enum | { BA_AGMT_TX, BA_AGMT_RX }
| BA agreement types. More...
enum | { BA_AGMT_ESTABLISHED, BA_AGMT_ALREADY_EXISTS, BA_AGMT_DELETED, BA_AGMT_DOESNT_EXIST, BA_AGMT_NO_MORE_BA_AGMT, BA_AGMT_NOT_SUPPORTED }
| BA agreement related status. More...
enum | mm_features { MM_FEAT_BCN_BIT = 0, MM_FEAT_AUTOBCN_BIT, MM_FEAT_HWSCAN_BIT, MM_FEAT_CMON_BIT, MM_FEAT_MROLE_BIT, MM_FEAT_RADAR_BIT, MM_FEAT_PS_BIT, MM_FEAT_UAPSD_BIT, MM_FEAT_DPSM_BIT, MM_FEAT_AMPDU_BIT, MM_FEAT_AMSDU_BIT, MM_FEAT_CHNL_CTXT_BIT, MM_FEAT_REORD_BIT, MM_FEAT_P2P_BIT, MM_FEAT_P2P_GO_BIT, MM_FEAT_UMAC_BIT, MM_FEAT_VHT_BIT, MM_FEAT_BFMEE_BIT, MM_FEAT_BFMER_BIT, MM_FEAT_WAPI_BIT, MM_FEAT_MFP_BIT, MM_FEAT_MU_MIMO_RX_BIT, MM_FEAT_MU_MIMO_TX_BIT, MM_FEAT_MESH_BIT, MM_FEAT_TDLS_BIT, MM_FEAT_ANT_DIV_BIT, MM_FEAT_UF_BIT, MM_AMSDU_MAX_SIZE_BIT0, MM_AMSDU_MAX_SIZE_BIT1, MM_FEAT_MON_DATA_BIT, MM_FEAT_HE_BIT }
| Features supported by LMAC - Positions. More...
## Functions
__INLINE void | mm_rx_filter_set (void)
| This function applies the RX filter requested by the UMAC and LMAC.
__INLINE void | mm_rx_filter_umac_set (uint32_t filter)
| This function sets the RX filter for the UMAC.
__INLINE void | mm_rx_filter_lmac_enable_set (uint32_t filter)
| This function enables some RX filter bits on the LMAC filter.
__INLINE void | mm_rx_filter_lmac_enable_clear (uint32_t filter)
| This function disables some RX filter bits on the LMAC filter.
__INLINE void | mm_ps_change_ind (uint8_t sta_idx, uint8_t ps_state)
| This function indicates a PS state change of a peer device to the upper layers.
__INLINE void | mm_traffic_req_ind (uint8_t sta_idx, uint8_t pkt_cnt, bool uapsd)
| This function requests some buffered packets to be transmitted.
__INLINE uint8_t | mm_get_golden_range_distance (int8_t rssi)
| This function calculates the distance of the RSSI from the golden range.
void | mm_init (void)
| Initialize all MM related context and data etc.
void | mm_reset (void)
| MM Module reset function.
void | mm_active (void)
| Put the HW state to active.
void | mm_env_init (void)
| MM Module mm_env_init routine.
void | mm_env_max_ampdu_duration_set (void)
| Set the maximum A-MPDU duration based on TXOP registers.
uint8_t | mm_sec_machwaddr_wr (uint8_t sta_idx, uint8_t inst_nbr)
| Function to add a MAC address in the MAC HW key storage.
void | mm_sec_machwaddr_del (uint8_t sta_idx)
| Function to delete a MAC address from the MAC HW key storage.
uint8_t | mm_sec_machwkey_wr (struct mm_key_add_req const *param)
| Function to write key in MAC HW.
void | mm_sec_machwkey_del (uint8_t hw_key_idx)
| Function to delete a key from the MAC HW.
void | mm_tbtt_evt (int dummy)
| Kernel event handler for the TBTT event.
bool | mm_check_beacon (struct rx_hd *rhd, struct vif_info_tag *vif, struct sta_info_tag *sta, uint32_t *tim)
| Function responsible for all the connection monitoring stuff.
void | mm_hw_idle_evt (int dummy)
| Kernel event handler for the HW IDLE event.
void | mm_hw_info_set (struct mac_addr const *mac_addr)
| Setting of general HW info upon the first interface creation.
void | mm_hw_ap_info_set (void)
| Set the correct HW information for an AP.
void | mm_hw_ap_info_reset (void)
| Reset the HW information for an AP.
void | mm_tbtt_compute (struct bcn_frame *bcn, uint16_t len, struct rx_hd *rhd, struct vif_info_tag *vif, struct sta_info_tag *sta, uint32_t tim)
| Configure tbtt_timer for next beacon.
void | mm_sta_tbtt (void *env)
| MM timer callback for the station TBTT handling.
void | mm_ap_pre_tbtt (void *env)
| MM timer callback for the AP pre-TBTT handling.
int32_t | mm_ap_tbtt_move (int32_t offset)
| Request to apply an offset (positive or negative) to the next TBTT.
bool | mm_ba_agmt_tx_exists (uint8_t sta_idx, uint8_t tid)
| Simple check for existence of a BA agreement for a certain (STA, TID) pair (TX).
bool | mm_ba_agmt_rx_exists (uint8_t sta_idx, uint8_t tid)
| Simple check for existence of a BA agreement for a certain (STA, TID) pair (RX).
void | mm_force_idle_req (void)
| Force the HW to go to IDLE immediately.
uint8_t | mm_sta_add (struct mm_sta_add_req const *param, uint8_t *sta_idx, uint8_t *hw_sta_idx)
| Add a station to the list of known stations.
void | mm_sta_del (uint8_t sta_idx)
| Delete a station from the list of known stations.
void | mm_back_to_host_idle (void)
| Ask MM to switch back to IDLE state requested by the host (quit BYPASSED mode).
void | mm_no_idle_start (void)
| Ask MM to disallow the switch to IDLE state.
void | mm_no_idle_stop (void)
| Ask MM to allow again the switch to IDLE state.
void | mm_send_connection_loss_ind (struct vif_info_tag *vif)
| Inform the host that connection has been lost with an AP.
void | mm_check_rssi (struct vif_info_tag *vif, int8_t rssi)
| Check RSSI level and inform the host if RSSI is decreased below the threshold or if it is increased above the threshold.
void | mm_send_pktloss_ind (struct vif_info_tag *vif, uint8_t sta_idx, uint32_t num_pkts)
| Send the MM_PKTLOSS_IND message to the host.
void | mm_send_csa_traffic_ind (uint8_t vif_index, bool enable)
| Send host message to stop (resp restarted) tx traffic because CSA is in progress (resp.
void | mm_ant_div_init (bool enable)
| Initialize the antenna diversity parameters.
void | mm_ant_div_switch_and_stop (void)
| Switch antenna, if no other active connections are set up and if the algorithm is enabled.
void | mm_ant_div_restore (bool active)
| Update the number of active VIF and update accordingly the status of the antenna switch flag.
void | mm_ant_div_update (void)
| Update the status of the antenna switch flag.
void | mm_ant_div_switch_antenna (void)
| Change the antenna connected to path_0, reset the update counter and request an update of the initial RSSI (case 1x1 station).
void | mm_ant_div_reset_rssi (uint8_t ant)
| Reset the current and the initial RSSI values in the antenna diversity structure for the requested antenna.
void | mm_ant_div_update_rssi (int8_t *rssi)
| Update the RSSI values for both antennas.
void | mm_ant_div_check (uint8_t beacon_loss_cnt)
| This function is called at each tbtt, it updates the counter of beacon periods without any antenna switch (2x2 station only) and it checks if the antenna connected to path_0 should be switched.
## Variables
struct mm_env_tag | mm_env
| Global data for maintaining BSS and STA information.

## Detailed Description

MAC Management module definitions.

Copyright (C) RivieraWaves 2011-2019

Definition in file mm.h.