# TASK_BAM
[BAM]

UMAC ME BAM module state machine. More...

Collaboration diagram for TASK_BAM:

## Enumerations
enum | bam_state_tag { BAM_IDLE = 0, BAM_ACTIVE, BAM_WAIT_RSP, BAM_CHECK_ADMISSION, BAM_DELETE, BAM_STATE_MAX }
| BAM Possible states. More...
enum | bam_msg_tag { BAM_ADD_BA_RSP_TIMEOUT_IND = KE_FIRST_MSG(TASK_BAM), BAM_INACTIVITY_TIMEOUT_IND }
| BAM task message. More...
## Functions
static int | bam_add_ba_rsp_timeout_ind_handler (ke_msg_id_t const msgid, void const *param, ke_task_id_t const dest_id, ke_task_id_t const src_id)
| BAM module message handler.
static void | bam_delba_status (void *env, uint32_t status)
| DELBA transmission callback.
static int | bam_inactivity_timeout_ind_handler (ke_msg_id_t const msgid, void const *param, ke_task_id_t const dest_id, ke_task_id_t const src_id)
| BAM module message handler.
static int | mm_ba_add_cfm_handler (ke_msg_id_t const msgid, struct mm_ba_add_cfm const *param, ke_task_id_t const dest_id, ke_task_id_t const src_id)
| BAM module message handler.
static int | mm_ba_del_cfm_handler (ke_msg_id_t const msgid, struct mm_ba_del_cfm const *param, ke_task_id_t const dest_id, ke_task_id_t const src_id)
| BAM module message handler.
static int | rxu_mgt_ind_handler (ke_msg_id_t const msgid, struct rxu_mgt_ind const *param, ke_task_id_t const dest_id, ke_task_id_t const src_id)
| RXU_MGT_IND message handler.
## Variables
struct ke_msg_handler | bam_default_state []
| DEFAULT handler definition.
struct ke_state_handler | bam_default_handler = KE_STATE_HANDLER(bam_default_state)
| Message handlers that are common to all states.
ke_state_t | bam_state [BAM_IDX_MAX]
| place holder for the states of the BAM task.
struct ke_state_handler | bam_default_handler
| Message handlers that are common to all states.
ke_state_t | bam_state [BAM_IDX_MAX]
| place holder for the states of the BAM task.

## Detailed Description

UMAC ME BAM module state machine.

## Enumeration Type Documentation

enum bam_msg_tag

BAM task message.

Enumerator:

  BAM_ADD_BA_RSP_TIMEOUT_IND | BAM addition response timeout.
  BAM_INACTIVITY_TIMEOUT_IND | BAM Inactivity timeout.

Definition at line 55 of file bam_task.h.

enum bam_state_tag

BAM Possible states.

Enumerator:

  BAM_IDLE | BAM_IDLE initial state of the BAM state machine.
  BAM_ACTIVE | Put the BAM as active.
  BAM_WAIT_RSP | Waits for the reception of the block ack rsp frame from the responder.
  BAM_CHECK_ADMISSION | Check admission of BA in the responder.
  BAM_DELETE | Delete BAM agreement.
  BAM_STATE_MAX | Number of states.

Definition at line 36 of file bam_task.h.

## Function Documentation

static int bam_add_ba_rsp_timeout_ind_handler | ( | ke_msg_id_t const | msgid,
|  | void const * | param,
|  | ke_task_id_t const | dest_id,
|  | ke_task_id_t const | src_id |
| ) |  |  | `[static]`

BAM module message handler.

This function handles the BAM_ADD_BA_RSP_TIMEOUT_IND message.

Parameters:

  `[in]` | msgid | Id of the message received (probably unused)
  `[in]` | param | Pointer to the parameters of the message.
  `[in]` | dest_id | TaskId of the receiving task.
  `[in]` | src_id | TaskId of the sending task.

Returns:
  Whether the message was consumed or not.

Definition at line 56 of file bam_task.c.

References BAM_IDLE, bam_param_sta_info_tab_reset(), BAM_WAIT_RSP, KE_IDX_GET, KE_MSG_CONSUMED, ke_state_get(), ke_state_set(), and TRACE_LMAC.

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

DELBA transmission callback.

If DELBA has been successfully sent, delete the BA at LMAC level, otherwise resend the DELBA. If maximum number of tentative, BAM_DELBA_MAX_TRY, is reached delete BA whatever the transmission status is.

Parameters:

  `[in]` | env | Pointer to BAM entry
  `[in]` | status | Transmission status

Definition at line 92 of file bam_task.c.

References BAM_DELBA_MAX_TRY, BAM_DELETE, bam_env, BAM_IDX_MAX, bam_send_air_action_frame(), bam_send_mm_ba_del_req(), bam_env_tag::delba_count, FRAME_SUCCESSFUL_TX_BIT, KE_BUILD_ID, ke_state_get(), MAC_BA_ACTION_DELBA, MAC_RS_TIMEOUT, bam_env_tag::sta_idx, and TASK_BAM.

Referenced by bam_inactivity_timeout_ind_handler().

static int bam_inactivity_timeout_ind_handler | ( | ke_msg_id_t const | msgid,
|  | void const * | param,
|  | ke_task_id_t const | dest_id,
|  | ke_task_id_t const | src_id |
| ) |  |  | `[static]`

BAM module message handler.

This function handles the BAM_INACTIVITY_TIMEOUT_IND message.

Parameters:

  `[in]` | msgid | Id of the message received (probably unused)
  `[in]` | param | Pointer to the parameters of the message.
  `[in]` | dest_id | TaskId of the receiving task.
  `[in]` | src_id | TaskId of the sending task.

Returns:
  Whether the message was consumed or not.

Definition at line 134 of file bam_task.c.

References bam_env_tag::ba_timeout, BAM_ACTIVE, bam_delba_status(), BAM_DELETE, bam_env, bam_send_air_action_frame(), bam_start_inactivity_timer(), bam_env_tag::delba_count, hal_machw_time_past(), KE_IDX_GET, KE_MSG_CONSUMED, ke_state_get(), ke_state_set(), bam_env_tag::last_activity_time, MAC_BA_ACTION_DELBA, MAC_RS_TIMEOUT, bam_env_tag::pkt_cnt, bam_env_tag::sta_idx, TRACE_LMAC, and TU_DURATION.

static int mm_ba_add_cfm_handler | ( | ke_msg_id_t const | msgid,
|  | struct mm_ba_add_cfm const * | param,
|  | ke_task_id_t const | dest_id,
|  | ke_task_id_t const | src_id |
| ) |  |  | `[static]`

BAM module message handler.

This function handles the MM_BAADD_CFM message from LMAC.

Parameters:

  `[in]` | msgid | Id of the message received (probably unused)
  `[in]` | param | Pointer to the parameters of the message.
  `[in]` | dest_id | TaskId of the receiving task.
  `[in]` | src_id | TaskId of the sending task.

Returns:
  Whether the message was consumed or not.

Definition at line 183 of file bam_task.c.

References ASSERT_WARN, BA_AGMT_ESTABLISHED, sta_info_tag::ba_info, BA_ORIGINATOR, BA_RESPONDER, BAM_ACTIVE, bam_baw_init(), bam_build_baparamset(), BAM_CHECK_ADMISSION, bam_env, BAM_IDLE, sta_mgmt_ba_info::bam_idx_rx, bam_param_sta_info_tab_reset(), bam_send_air_action_frame(), bam_start_inactivity_timer(), bam_env_tag::buffer_size, bam_env_tag::dev_type, bam_env_tag::dialog_token, hal_machw_time(), KE_IDX_GET, KE_MSG_CONSUMED, ke_state_get(), ke_state_set(), bam_env_tag::last_activity_time, MAC_BA_ACTION_ADDBA_RSP, MAC_BA_ST_REQUEST_REFUSED, MAC_BA_ST_SUCCESS, me_credits_update_ind(), NX_DEFAULT_TX_CREDIT_CNT, bam_env_tag::sta_idx, mm_ba_add_cfm::sta_idx, sta_info_tab, mm_ba_add_cfm::status, mm_ba_add_cfm::tid, and TRACE_LMAC.

static int mm_ba_del_cfm_handler | ( | ke_msg_id_t const | msgid,
|  | struct mm_ba_del_cfm const * | param,
|  | ke_task_id_t const | dest_id,
|  | ke_task_id_t const | src_id |
| ) |  |  | `[static]`

BAM module message handler.

This function handles the MM_BADEL_CFM message from LMAC.

Parameters:

  `[in]` | msgid | Id of the message received (probably unused)
  `[in]` | param | Pointer to the parameters of the message.
  `[in]` | dest_id | TaskId of the receiving task.
  `[in]` | src_id | TaskId of the sending task.

Returns:
  Whether the message was consumed or not.

Definition at line 305 of file bam_task.c.

References BA_AGMT_DELETED, BA_ORIGINATOR, BAM_DELETE, bam_delete_ba_agg(), bam_env, bam_flush_baw(), bam_env_tag::baw, bam_env_tag::buffer_size, bam_env_tag::dev_type, KE_BUILD_ID, KE_IDX_GET, KE_MSG_CONSUMED, ke_state_get(), me_credits_update_ind(), NX_DEFAULT_TX_CREDIT_CNT, mm_ba_del_cfm::sta_idx, mm_ba_del_cfm::status, TASK_BAM, and mm_ba_del_cfm::tid.

static int rxu_mgt_ind_handler | ( | ke_msg_id_t const | msgid,
|  | struct rxu_mgt_ind const * | param,
|  | ke_task_id_t const | dest_id,
|  | ke_task_id_t const | src_id |
| ) |  |  | `[static]`

RXU_MGT_IND message handler.

This function handles the different frames that can be received for the establishment and deletion of BlockAck agreement.

Parameters:

  `[in]` | msgid | Id of the message received (probably unused)
  `[in]` | param | Pointer to the parameters of the message.
  `[in]` | dest_id | TaskId of the receiving task.
  `[in]` | src_id | TaskId of the sending task.

Returns:
  Whether the message was consumed or not.

Definition at line 346 of file bam_task.c.

References bam_env_tag::amsdu, bam_env_tag::ba_policy, BA_RESPONDER, bam_env_tag::ba_timeout, BAM_ACTIVE, BAM_ADD_BA_RSP_TIMEOUT_IND, BAM_ADDBAREQ_BA_PARAM_OFFSET, BAM_ADDBAREQ_BA_SSC_OFFSET, BAM_ADDBAREQ_BA_TIMEOUT_OFFSET, BAM_ADDBARSP_BA_PARAM_OFFSET, BAM_ADDBARSP_STATUS_OFFSET, bam_alloc_new_task(), BAM_BA_PARAM_GET, BAM_CHECK_ADMISSION, BAM_DELBA_PARAM_GET, BAM_DELBA_PARAM_OFFSET, BAM_DELETE, bam_delete_ba_agg(), bam_env, BAM_IDLE, BAM_INACTIVITY_TIMEOUT_IND, BAM_INACTIVITY_TO_DURATION, BAM_INVALID_TASK_IDX, bam_param_sta_info_tab_reset(), bam_send_air_action_frame(), bam_send_mm_ba_add_req(), bam_send_mm_ba_del_req(), BAM_WAIT_RSP, bam_env_tag::buffer_size, co_min(), co_read16p(), co_read8p(), CPU2HW, bam_env_tag::dev_type, bam_env_tag::dialog_token, INVALID_STA_IDX, KE_BUILD_ID, KE_MSG_CONSUMED, ke_state_get(), ke_state_set(), ke_timer_clear(), MAC_ACTION_ACTION_OFT, MAC_ACTION_TOKEN_OFT, MAC_BA_ACTION_ADDBA_REQ, MAC_BA_ACTION_ADDBA_RSP, MAC_BA_ACTION_DELBA, MAC_BA_ST_INVALID_PARAMETERS, MAC_BA_ST_REQUEST_REFUSED, MAC_BA_ST_SUCCESS, MAC_SEQCTRL_NUM_OFT, mm_ba_agmt_rx_exists(), NX_REORD_BUF_SIZE, rxu_mgt_ind::payload, bam_env_tag::pkt_cnt, PS_MODE_ON, sta_info_tag::ps_state, bam_env_tag::ssn, rxu_mgt_ind::sta_idx, bam_env_tag::sta_idx, sta_info_tab, sta_mgmt_get_rx_bam_idx(), sta_mgmt_get_tx_bam_idx(), TASK_BAM, bam_env_tag::tid, TID_MAX, and TRACE_LMAC.

## Variable Documentation

struct ke_msg_handler bam_default_state[]

Initial value:

    {

        {BAM_ADD_BA_RSP_TIMEOUT_IND,    (ke_msg_func_t)bam_add_ba_rsp_timeout_ind_handler},

        {BAM_INACTIVITY_TIMEOUT_IND,    (ke_msg_func_t)bam_inactivity_timeout_ind_handler},
        {MM_BA_DEL_CFM,                 (ke_msg_func_t)mm_ba_del_cfm_handler},
        {MM_BA_ADD_CFM,                 (ke_msg_func_t)mm_ba_add_cfm_handler},

        {RXU_MGT_IND,                   (ke_msg_func_t)rxu_mgt_ind_handler},
    }

DEFAULT handler definition.

Definition at line 641 of file bam_task.c.