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

MAC Management module implementation. More...

`#include "mac_frame.h"`
`#include "mm.h"`
`#include "mm_timer.h"`
`#include "mm_bcn.h"`
`#include "co_endian.h"`
`#include "sta_mgmt.h"`
`#include "vif_mgmt.h"`
`#include "phy.h"`
`#include "dbg.h"`
`#include "rd.h"`
`#include "ps.h"`
`#include "txl_cntrl.h"`
`#include "txl_frame.h"`
`#include "rxl_cntrl.h"`
`#include "rxl_hwdesc.h"`
`#include "hal_machw.h"`
`#include "scan.h"`
`#include "chan.h"`
`#include "hal_dma.h"`
`#include "p2p.h"`
`#include "bfr.h"`
`#include "mesh.h"`
`#include "apm.h"`
`#include "reg_mac_core.h"`
`#include "reg_mac_pl.h"`
`#include "mac_ie.h"`

Go to the source code of this file.

## Defines
#define | MM_TBTT_EVT_MASK (KE_EVT_PRIMARY_TBTT_BIT | KE_EVT_SECONDARY_TBTT_BIT)
| Event mask of the TBTT kernel events.
#define | MM_BEACON_LOSS_THD 10
| Beacon loss threshold above which we consider the connection as lost.
#define | MM_KEEP_ALIVE_PERIOD (30 * 1000000)
| Periodicity of keep-alive NULL frame transmission.
#define | MM_TBTT_IRQ_MASK (NXMAC_IMP_PRI_DTIM_BIT | NXMAC_IMP_PRI_TBTT_BIT)
| Mask of the TBTT interrupts.
#define | MM_MAC_ADDR_MSK ((NX_VIRT_DEV_MAX - 1) << 8)
| Mask used for the MAC address compatibility checking.
#define | TXOP(limit)
| Macro returning the maximum duration of A-MPDUs according to the TXOP limit.
#define | TBTT_DELAY 400
| Wake up delay before TBTT is occurring.
#define | KEY_RAM_WR(key_idx, ctype, vif_idx, spp, usedefkey, clen)
| Write parameters to the key RAM.
#define | MM_TBTT_COMPUTE_MARGIN (CHAN_SWITCH_DELAY + 300)
| Margin taken when checking if the computed TBTT is not in the past.
#define | TASK_IND TASK_SM
| Task identifier used for transmission of indication from MM to UMAC.
## Functions
static void | mm_key_ram_param_get (uint8_t cipher_suite, struct mac_sec_key const *key, uint8_t *ctype, uint8_t *clen)
| Compute the cType and cLen to be set to the key RAM depending on the Cipher and the key length.
static void | mm_ap_tbtt_move_cb (void *offset)
| Callback function called when the TBTT move can be performed.
void | mm_env_max_ampdu_duration_set (void)
| Set the maximum A-MPDU duration based on TXOP registers.
void | mm_env_init (void)
| MM Module mm_env_init routine.
void | mm_init (void)
| Initialize all MM related context and data etc.
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.
static void | mm_ap_probe_cfm (void *env, uint32_t status)
| Callback function indicating the completion of the NULL frame transmission used to probe the AP in case we don't receive any more beacons.
static uint32_t | mm_compute_beacon_crc (struct bcn_frame *bcn, uint16_t len, uint32_t *tim)
| Function computing the CRC of the received beacon The function skips the information elements handled in the LMAC (such as the TIM).
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_reset (void)
| MM Module reset function.
void | mm_active (void)
| Put the HW state to active.
void | mm_sta_tbtt (void *env)
| MM timer callback for the station TBTT handling.
static void | mm_ap_tbtt (uint32_t evt)
| Handler for KE_EVT_PRIMARY_TBTT and KE_EVT_SECONDARY_TBTT events for beaconning interfaces.
void | mm_ap_pre_tbtt (void *env)
| MM timer callback for the AP pre-TBTT handling.
void | mm_tbtt_evt (int dummy)
| Kernel event handler for the TBTT event.
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.
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_sec_machwaddr_del (uint8_t sta_idx)
| Function to delete a MAC address from the MAC HW key storage.
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.
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).
int32_t | mm_ap_tbtt_move (int32_t offset)
| Request to apply an offset (positive or negative) to the next TBTT.
void | mm_back_to_host_idle (void)
| Ask MM to switch back to IDLE state requested by the host (quit BYPASSED mode).
void | mm_force_idle_req (void)
| Force the HW to go to IDLE immediately.
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.
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_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_update (void)
| Update the status of the antenna switch flag.
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_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 implementation.

Copyright (C) RivieraWaves 2011-2019

Definition in file mm.c.