# MM_BCN
[MM]

LMAC Beacon Management module. More...

Collaboration diagram for MM_BCN:

## Data Structures
struct | mm_bcn_env_tag
| MM BCN environmenent structure. More...
## Functions
static void | mm_tim_update_proceed (struct mm_tim_update_req const *param)
| Update TIM IE in the beacon.
static void | mm_bcn_desc_prep (struct vif_info_tag *vif, struct mm_bcn_change_req const *param)
| Update tx descriptor for the beacon.
static void | mm_bcn_csa_init (struct vif_info_tag *vif, struct mm_bcn_change_req const *param)
| Update CSA counter.
static void | mm_bcn_send_csa_counter_ind (uint8_t vif_index, uint8_t csa_count)
| Send CSA counter value to host.
static uint8_t | mm_bcn_build (struct vif_info_tag *vif)
| Update beacon field before transmission.
static void | mm_bcn_updated (void *env, int dma_queue)
| Callback associated to DMA transfer of beacon from host memory.
static void | mm_bcn_update (struct mm_bcn_change_req const *param)
| Initiates download of Beacon frame.
static void | mm_bcn_transmitted (void *env, uint32_t status)
| Callback associated to transmission of beacon.
static void | mm_bcn_init_p2p_noa (uint8_t vif_index)
| Initializes Buffer payload descriptor for NOA IE, so that it could be added in beacon if needed.
static void | mm_bcn_init_mesh_add_ies_desc (void)
| Initializes Buffer payload descriptor for MESH IE, so that it could be added in beacon if needed.
static void | mm_bcn_init_tim (struct vif_info_tag *vif)
| Initializes buffer of TIM IE that will be included in beacon (and related variables in the vif structure).
void | mm_bcn_init (void)
| Initialization of the MM BCN environment.
void | mm_bcn_init_vif (struct vif_info_tag *vif)
| Initialization of some BCN descriptors at AP VIF creation.
void | mm_bcn_change (struct mm_bcn_change_req const *param)
| Proceeds to the update of the beacon frame for the specified VIF.
void | mm_tim_update (struct mm_tim_update_req const *param)
| Proceeds to the update of the TIM IE for the specified VIF.
void | mm_bcn_transmit (void)
| Links the beacons to the BCN queue for transmission.
void | mm_bcn_update_p2p_noa (uint8_t vif_index, uint8_t operation)
| Add/Remove/Update P2P NOA IE in the beacon.
struct txl_buffer_tag * | mm_bcn_get_buffer (uint8_t vif_index)
| Returns a pointer to buffer that will contains the Beacon data sent on a given VIF.
__INLINE bool | mm_bcn_transmitting (void)
| Checks if transmitting beacon.
## Variables
struct mm_bcn_env_tag | mm_bcn_env
| Global data for maintaining beacon information.
struct mm_bcn_env_tag | mm_bcn_env
| Global data for maintaining beacon information.

## Detailed Description

LMAC Beacon Management module.

## Function Documentation

static uint8_t mm_bcn_build | ( | struct vif_info_tag * | vif | ) | `[static]`

Update beacon field before transmission.

This function updates "dynamic" fields of the beacon (like TIM, CSA counter) before transmission

Parameters:

  `[in]` | vif | VIF entry thal will send the beacon

Returns:
  value of the group traffic bit in the TIM IE (i.e. bit0 of Bitmap Control)

Definition at line 365 of file mm_bcn.c.

References AC_BCN, vif_info_tag::ap, BCN_MAX_CSA_CPT, co_read8p(), co_write16(), co_write8p(), CPU2HW, tx_pbd::dataendptr, tx_hd::datastartptr, tx_pbd::datastartptr, tx_hd::frmlen, HW2CPU, lmacdesc::hw_desc, vif_info_tag::index, txdesc::lmac, MAC_FCS_LEN, MAC_HEAD_CTRL_OFT, MAC_TIM_BCMC_PRESENT, MAC_TIM_BMPC_OFT, MAC_TIM_CNT_OFT, MAC_TIM_PERIOD_OFT, macif_tx_q_has_data(), mm_bcn_send_csa_counter_ind(), vif_info_tag::mvif_idx, tx_pbd::next, vif_info_tag::p2p, p2p_go_bcn_get_noa_len(), vif_info_tag::p2p_index, tx_hw_desc::thd, tpc_update_frame_tx_power(), txl_frame_desc_tag::txdesc, txl_bcn_end_desc, txl_get_seq_ctrl(), txl_mesh_add_ies_desc, txl_p2p_noa_desc, txl_tim_ie_pool, vif_info_tag::type, vif_info_tag::u, VIF_AP_BCMC_MOREDATA, and VIF_MESH_POINT.

void mm_bcn_change | ( | struct mm_bcn_change_req const * | param | ) |

Proceeds to the update of the beacon frame for the specified VIF.

Parameters:

  `[in]` | param | Parameters of the new beacon

Referenced by mm_bcn_change_req_handler().

static void mm_bcn_csa_init | ( | struct vif_info_tag * | vif,
|  | struct mm_bcn_change_req const * | param |
| ) |  |  | `[static]`

Update CSA counter.

Initializes CSA counter, following a beacon update (mm_bcn_change).

Parameters:

  `[in]` | vif | VIF entry for which the beacon must be updated
  `[in]` | param | Parameters of the new beacon

Definition at line 308 of file mm_bcn.c.

References vif_info_tag::ap, BCN_MAX_CSA_CPT, co_read8p(), mm_bcn_change_req::csa_oft, tx_hd::datastartptr, lmacdesc::hw_desc, txdesc::lmac, tx_hw_desc::thd, txl_frame_desc_tag::txdesc, and vif_info_tag::u.

Referenced by mm_bcn_updated().

static void mm_bcn_desc_prep | ( | struct vif_info_tag * | vif,
|  | struct mm_bcn_change_req const * | param |
| ) |  |  | `[static]`

Update tx descriptor for the beacon.

Updates TX descriptor for beacon transmission, following a beacon update. (mm_bcn_change)

Parameters:

  `[in]` | vif | VIF entry for which the beacon must be updated
  `[in]` | param | Parameters of the new beacon

Definition at line 237 of file mm_bcn.c.

References vif_info_tag::ap, mm_bcn_change_req::bcn_len, tx_pbd::bufctrlinfo, co_read8p(), co_write8p(), CPU2HW, tx_pbd::dataendptr, tx_hd::dataendptr, tx_pbd::datastartptr, tx_hd::datastartptr, tx_hd::first_pbd_ptr, lmacdesc::hw_desc, vif_info_tag::index, txdesc::lmac, MAC_TIM_PERIOD_OFT, tx_hd::macctrlinfo2, me_beacon_check(), vif_info_tag::p2p, PHY_BAND_2G4, tx_hd::phyctrlinfo, txl_buffer_control::policy_tbl, tx_hd::policyentryaddr, tx_policy_tbl::powercntrlinfo, tx_hw_desc::thd, mm_bcn_change_req::tim_len, mm_bcn_change_req::tim_oft, TX_PWR_LEVEL_SET, txl_frame_desc_tag::txdesc, txl_bcn_end_desc, txl_buffer_control_24G, txl_buffer_control_5G, txl_tim_desc, txl_tim_ie_pool, vif_info_tag::u, and vif_mgmt_get_band().

Referenced by mm_bcn_updated().

struct txl_buffer_tag * mm_bcn_get_buffer | ( | uint8_t | vif_index | ) | `[read]`

Returns a pointer to buffer that will contains the Beacon data sent on a given VIF.

Parameters:

  `[in]` | vif_index | VIF Index on which beacon will be sent

Returns:
  pointer to the beacon buffer

void mm_bcn_init | ( | void |  | ) |

Initialization of the MM BCN environment.

static void mm_bcn_init_p2p_noa | ( | uint8_t | vif_index | ) | `[static]`

Initializes Buffer payload descriptor for NOA IE, so that it could be added in beacon if needed.

Parameters:

  `[in]` | vif_index | VIF index

Definition at line 642 of file mm_bcn.c.

References tx_pbd::bufctrlinfo, CPU2HW, tx_pbd::datastartptr, tx_pbd::next, TX_PAYLOAD_DESC_PATTERN, txl_p2p_noa_desc, txl_p2p_noa_ie_pool, and tx_pbd::upatterntx.

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

Initializes buffer of TIM IE that will be included in beacon (and related variables in the vif structure).

Parameters:

  `[in]` | vif | VIF entry

Definition at line 690 of file mm_bcn.c.

References vif_info_tag::ap, tx_pbd::bufctrlinfo, co_write8p(), CPU2HW, tx_pbd::dataendptr, tx_pbd::datastartptr, vif_info_tag::index, MAC_ELTID_TIM, MAC_TIM_BMP_OFT, MAC_TIM_BMPC_OFT, MAC_TIM_CNT_OFT, MAC_TIM_ID_OFT, MAC_TIM_LEN_OFT, MAC_TIM_PERIOD_OFT, tx_pbd::next, TX_PAYLOAD_DESC_PATTERN, txl_bcn_end_desc, txl_tim_bitmap_pool, txl_tim_desc, txl_tim_ie_pool, vif_info_tag::u, and tx_pbd::upatterntx.

void mm_bcn_init_vif | ( | struct vif_info_tag * | vif | ) |

Initialization of some BCN descriptors at AP VIF creation.

Parameters:

  `[in]` | vif | Pointer to the VIF that needs to be initialized

static void mm_bcn_send_csa_counter_ind | ( | uint8_t | vif_index,
|  | uint8_t | csa_count |
| ) |  |  | `[static]`

Send CSA counter value to host.

Sends new value of CSA counter to host after beacon transmission. This allow the host to keep CSA counter up to date if needed in other mgmt frame (e.g. probe response)

Parameters:

  `[in]` | vif_index | Index of the VIF entry
  `[in]` | csa_count | CSA counter

Definition at line 340 of file mm_bcn.c.

References mm_csa_counter_ind::csa_count, KE_MSG_ALLOC, ke_msg_send(), MM_CSA_COUNTER_IND, TASK_MM, and mm_csa_counter_ind::vif_index.

Referenced by mm_bcn_build().

void mm_bcn_transmit | ( | void |  | ) |

Links the beacons to the BCN queue for transmission.

Referenced by mm_ap_tbtt(), and mm_bcn_updated().

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

Callback associated to transmission of beacon.

Once beacon has been transmitted, this function will take care to:

- process pending updates (like tim or complete beacon update)
- and all post beacon actions (like channel switch if CSA is over)

Parameters:

  `[in]` | env | Vif entry that just send the beacon
  `[in]` | status | Status of the transmission

Definition at line 581 of file mm_bcn.c.

References vif_info_tag::ap, ASSERT_ERR, co_list_is_empty(), co_list_pop_front(), vif_info_tag::index, ke_msg2param(), mm_bcn_env, mm_bcn_update(), mm_bcn_update_p2p_noa(), mm_no_idle_stop(), mm_tim_update_proceed(), P2P_BCN_UPD_OP_NONE, mm_bcn_env_tag::p2p_noa_req, mm_bcn_env_tag::param, mm_bcn_env_tag::tim_list, mm_bcn_env_tag::tx_cfm, vif_info_tag::u, mm_bcn_env_tag::update_pending, and vif_mgmt_switch_channel().

__INLINE bool mm_bcn_transmitting | ( | void |  | ) |

Checks if transmitting beacon.

Returns:
  true if at least one beacon is currently being transmitted, false otherwise.

Definition at line 136 of file mm_bcn.h.

References mm_bcn_env, and mm_bcn_env_tag::tx_cfm.

Referenced by chan_switch_start(), and p2p_update_go_ps_state().

static void mm_bcn_update | ( | struct mm_bcn_change_req const * | param | ) | `[static]`

Initiates download of Beacon frame.

Following a call to mm_bcn_change, this fucntion configures the DMA transfer to download beacon from host memory. mm_bcn_updated is called once the transfer is complete.

Parameters:

  `[in]` | param | Parameters of the new beacon

Definition at line 529 of file mm_bcn.c.

References mm_bcn_change_req::bcn_len, mm_bcn_change_req::bcn_ptr, CPU2HW, mm_bcn_env_tag::dma, DMA_DL, hal_dma_desc_tag::env, hal_dma_push(), mm_bcn_change_req::inst_nbr, mm_bcn_env, mm_bcn_updated(), NX_FULLY_HOSTED, txl_buffer_tag::payload, txl_bcn_pool, vif_info_tag::type, mm_bcn_env_tag::update_ongoing, mm_bcn_env_tag::update_pending, vif_info_tab, and VIF_MESH_POINT.

Referenced by mm_bcn_transmitted().

void mm_bcn_update_p2p_noa | ( | uint8_t | vif_index,
|  | uint8_t | operation |
| ) |  |  |

Add/Remove/Update P2P NOA IE in the beacon.

Parameters:

  `[in]` | vif_index | VIF index
  `[in]` | operation | Operation to execute (p2p_bcn_upd_op)

Referenced by mm_bcn_transmitted(), and p2p_noa_timer_end().

static void mm_bcn_updated | ( | void * | env,
|  | int | dma_queue |
| ) |  |  | `[static]`

Callback associated to DMA transfer of beacon from host memory.

This function will re-initialize beacon infomration once a new beacon has been downloaded from host memory.

Parameters:

  `[in]` | env | VIF entry
  `[in]` | dma_queue | DMA queue used for transfer

Definition at line 491 of file mm_bcn.c.

References ke_msg_free(), ke_msg_send_basic(), ke_param2msg(), MM_BCN_CHANGE_CFM, mm_bcn_csa_init(), mm_bcn_desc_prep(), mm_bcn_env, mm_bcn_transmit(), mm_bcn_env_tag::param, ke_msg::src_id, TASK_MM, mm_bcn_env_tag::tx_pending, and mm_bcn_env_tag::update_ongoing.

Referenced by mm_bcn_update().

void mm_tim_update | ( | struct mm_tim_update_req const * | param | ) |

Proceeds to the update of the TIM IE for the specified VIF.

Parameters:

  `[in]` | param | Parameters of the TIM

Referenced by mm_tim_update_req_handler().

static void mm_tim_update_proceed | ( | struct mm_tim_update_req const * | param | ) | `[static]`

Update TIM IE in the beacon.

Proceeds with the update of TIM IE in the beacon, following a call to mm_tim_update. Message MM_TIM_UPDATE_CFM is send to requester to confirm update.

Parameters:

  `[in]` | param | Traffic indication to update

Definition at line 73 of file mm_bcn.c.

References mm_tim_update_req::aid, vif_info_tag::ap, CO_BIT, co_read8p(), co_write8p(), CPU2HW, tx_pbd::dataendptr, tx_pbd::datastartptr, mm_tim_update_req::inst_nbr, ke_msg_free(), ke_msg_send_basic(), ke_param2msg(), MAC_TIM_BMP_OFT, MAC_TIM_BMPC_OFT, MAC_TIM_LEN_OFT, MAC_TIM_SIZE, MM_TIM_UPDATE_CFM, tx_pbd::next, TASK_MM, TRACE_AP, mm_tim_update_req::tx_avail, txl_bcn_end_desc, txl_tim_bitmap_pool, txl_tim_desc, txl_tim_ie_pool, vif_info_tag::u, VIF_AP_BCMC_BUFFERED, and vif_info_tab.

Referenced by mm_bcn_transmitted().

## Variable Documentation

struct mm_bcn_env_tag mm_bcn_env

Global data for maintaining beacon information.

LMAC MM BCN Context variable, used to store MM BCN Context data

Definition at line 61 of file mm_bcn.c.

Referenced by mm_bcn_transmitted(), mm_bcn_transmitting(), mm_bcn_update(), and mm_bcn_updated().

struct mm_bcn_env_tag mm_bcn_env

Global data for maintaining beacon information.

LMAC MM BCN Context variable, used to store MM BCN Context data

Definition at line 61 of file mm_bcn.c.

Referenced by mm_bcn_transmitted(), mm_bcn_transmitting(), mm_bcn_update(), and mm_bcn_updated().