oal_uint32  hmac_fsm_call_func_sta(hmac_vap_stru *pst_hmac_vap, hmac_fsm_input_type_enum_uint8 en_input, oal_void *p_param)
{
    if (OAL_UNLIKELY(OAL_PTR_NULL == pst_hmac_vap))
    {
        OAM_ERROR_LOG0(0, OAM_SF_ANY, "{hmac_fsm_call_func_sta::vap is null ptr.}");
        return OAL_ERR_CODE_PTR_NULL;
    }

#if (_PRE_MULTI_CORE_MODE_OFFLOAD_DMAC == _PRE_MULTI_CORE_MODE)
    if (MAC_VAP_STA_STATE_BUTT == pst_hmac_vap->st_vap_base_info.en_vap_state)
    {
        OAM_WARNING_LOG1(pst_hmac_vap->st_vap_base_info.uc_vap_id, OAM_SF_ANY,
                         "{hmac_fsm_call_func_sta::the vap has been deleted, its state is STATE_BUTT, input type is %d}",
                         en_input);
        return OAL_SUCC;
    }
    else
#endif
    {
        if (pst_hmac_vap->st_vap_base_info.en_vap_state >= MAC_VAP_STA_STATE_BUTT ||
            en_input >= HMAC_FSM_STA_INPUT_TYPE_BUTT)
        {
            OAM_ERROR_LOG2(pst_hmac_vap->st_vap_base_info.uc_vap_id, OAM_SF_ANY,
                            "{hmac_fsm_call_func_sta::vap state[%d] or input type[%d] is over limit!}",
                            pst_hmac_vap->st_vap_base_info.en_vap_state, en_input);
            return OAL_ERR_CODE_ARRAY_OVERFLOW;
        }
    }

    return g_pa_hmac_sta_fsm_func[pst_hmac_vap->st_vap_base_info.en_vap_state][en_input](pst_hmac_vap, p_param);
}
Beispiel #2
0
/*****************************************************************************
 函 数 名  : hmac_roam_alg_init
 功能描述  :
 输入参数  :
 输出参数  : 无
 返 回 值  : OAL_SUCC 或 失败错误码
 调用函数  :
 被调函数  :

 修改历史      :
  1.日    期   : 2015年7月10日
    作    者   : g00260350
    修改内容   : 新生成函数

*****************************************************************************/
oal_void hmac_roam_alg_init(hmac_roam_info_stru *pst_roam_info, oal_int8 c_current_rssi)
{
    hmac_roam_alg_stru         *pst_roam_alg;

    if (pst_roam_info == OAL_PTR_NULL)
    {
        OAM_ERROR_LOG0(0, OAM_SF_ROAM, "{hmac_roam_alg_init::param null.}");
        return;
    }
    /*lint -e571*/
    OAM_WARNING_LOG1(0, OAM_SF_ROAM, "{hmac_roam_alg_init c_current_rssi = %d.}", c_current_rssi);
    /*lint +e571*/

    pst_roam_alg = &(pst_roam_info->st_alg);
    if (c_current_rssi == ROAM_RSSI_LINKLOSS_TYPE)
    {
        pst_roam_info->st_static.ul_trigger_linkloss_cnt++;
    }
    else
    {
        pst_roam_info->st_static.ul_trigger_rssi_cnt++;
    }

    pst_roam_alg->ul_max_capacity       = 0;
    pst_roam_alg->pst_max_capacity_bss  = OAL_PTR_NULL;
    pst_roam_alg->c_current_rssi        = c_current_rssi;
    pst_roam_alg->c_max_rssi            = 0;
    pst_roam_alg->uc_another_bss_scaned = 0;
    /* 首次关联时初始化 pst_roam_alg->uc_invalid_scan_cnt   = 0x0; */
    pst_roam_alg->pst_max_rssi_bss      = OAL_PTR_NULL;

    return;
}
Beispiel #3
0
/*****************************************************************************
 函 数 名  : dmac_board_init
 功能描述  : 在hmac和dmac中调用时,分别直接对全局变量赋值
 输入参数  : board对象指针
 输出参数  : 无
 返 回 值  : 成功或失败
 调用函数  : mac_chip_init、oal_bit_set_bit_one_byte、mac_board_register_table_instance
 被调函数  :

 修改历史      :
  1.日    期   : 2012年10月19日
    作    者   : huxiaotong
    修改内容   : 新生成函数

*****************************************************************************/
oal_uint32  dmac_board_init(mac_board_stru *pst_board)
{
    oal_uint8  uc_chip;
    oal_uint32 ul_ret;

    if (OAL_UNLIKELY(OAL_PTR_NULL == pst_board))
    {
        OAM_ERROR_LOG0(0, OAM_SF_ANY, "{dmac_board_init::pst_board null.}");

        return OAL_ERR_CODE_PTR_NULL;
    }

    /*公共部分初始化*/
    mac_board_init(pst_board);

    /* chip支持的最大数由PCIe总线处理提供; */
    for (uc_chip = 0; uc_chip < oal_bus_get_chip_num(); uc_chip++)
    {
        ul_ret = dmac_chip_init(&pst_board->ast_chip[uc_chip], uc_chip);
        if (OAL_SUCC != ul_ret)
        {
            OAM_WARNING_LOG1(0, OAM_SF_ANY, "{dmac_board_init::dmac_chip_init failed[%d].}", ul_ret);

            return ul_ret;
        }

        oal_bit_set_bit_one_byte(&pst_board->uc_chip_id_bitmap, uc_chip);
    }

    return OAL_SUCC;
}
Beispiel #4
0
/*****************************************************************************
 函 数 名  : dmac_config_set_txop_ps_machw
 功能描述  : 配置mac txop ps使能寄存器
 输入参数  : 无
 输出参数  : 无
 返 回 值  :
 调用函数  :
 被调函数  :

 修改历史      :
  1.日    期   : 2014年7月16日
    作    者   : z00237171
    修改内容   : 新生成函数

*****************************************************************************/
oal_uint32 dmac_config_set_txop_ps_machw(mac_vap_stru *pst_mac_vap, oal_uint8 uc_len, oal_uint8 *puc_param)
{

    /* 只有sta需要设置,如果是ap,直接返回 */
    if (WLAN_VAP_MODE_BSS_STA != pst_mac_vap->en_vap_mode)
    {
        OAM_WARNING_LOG1(pst_mac_vap->uc_vap_id, OAM_SF_TXOP,
                         "{dmac_config_set_txop_ps_machw::vap mode is not sta-->mode is [%d]}.", pst_mac_vap->en_vap_mode);
        return OAL_SUCC;
    }

    /* 如果不是11ac的,不涉及txop ps,直接返回 */
    if ((WLAN_VHT_MODE != pst_mac_vap->en_protocol) && (WLAN_VHT_ONLY_MODE != pst_mac_vap->en_protocol))
    {
        OAM_WARNING_LOG1(pst_mac_vap->uc_vap_id, OAM_SF_TXOP,
                         "{dmac_config_set_txop_ps_machw::vap is not 11ac, mode[%d].}", pst_mac_vap->en_protocol);
        return OAL_SUCC;
    }

    return dmac_txopps_set_machw_en_sta(pst_mac_vap, (dmac_txopps_machw_param_stru *)puc_param);
}
Beispiel #5
0
/*****************************************************************************
 函 数 名  : dmac_chip_exit
 功能描述  :
 输入参数  : 无
 输出参数  : 无
 返 回 值  :
 调用函数  :
 被调函数  :

 修改历史      :
  1.日    期   : 2015年5月7日
    作    者   : 张炜 64406
    修改内容   : 新生成函数

*****************************************************************************/
OAL_STATIC oal_uint32  dmac_chip_exit(mac_board_stru *pst_board, mac_chip_stru *pst_chip)
{
    dmac_device_stru  *pst_dmac_device;
    oal_uint32         ul_ret;
    oal_uint8          uc_device;

    if (OAL_UNLIKELY(OAL_PTR_NULL == pst_chip || OAL_PTR_NULL == pst_board))
    {
        OAM_ERROR_LOG0(0, OAM_SF_ANY, "{hmac_chip_exit::param null.}");
        return OAL_ERR_CODE_PTR_NULL;
    }

    for (uc_device = 0; uc_device < pst_chip->uc_device_nums; uc_device++)
    {
         pst_dmac_device = dmac_res_get_mac_dev(pst_chip->auc_device_id[uc_device]);

         /* TBD 置换位置 释放资源 */
         dmac_res_free_mac_dev(pst_chip->auc_device_id[uc_device]);

         ul_ret = dmac_device_exit(pst_board, pst_chip, pst_dmac_device);
         if (OAL_SUCC != ul_ret)
         {
             OAM_WARNING_LOG1(0, OAM_SF_ANY, "{hmac_chip_exit::hmac_device_exit failed[%d].}", ul_ret);
             return ul_ret;
         }
    }

    /*释放基础结构*/
    ul_ret = mac_chip_exit(pst_board, pst_chip);
    if (OAL_SUCC != ul_ret)
    {
        OAM_WARNING_LOG1(0, OAM_SF_ANY, "{hmac_chip_exit::mac_chip_exit failed[%d].}", ul_ret);
        return ul_ret;
    }

    return OAL_SUCC;
}
Beispiel #6
0
/*****************************************************************************
 函 数 名  : dmac_board_exit
 功能描述  : 删除board
 输入参数  : 无
 输出参数  : 无
 返 回 值  :
 调用函数  :
 被调函数  :

 修改历史      :
  1.日    期   : 2015年5月7日
    作    者   : 张炜 64406
    修改内容   : 新生成函数

*****************************************************************************/
oal_uint32  dmac_board_exit(mac_board_stru *pst_board)
{
    oal_uint8        uc_chip_idx;
    oal_uint32       ul_ret;

    if (OAL_UNLIKELY(OAL_PTR_NULL == pst_board))
    {
        OAM_ERROR_LOG0(0, OAM_SF_ANY, "{hmac_board_exit::pst_board null.}");
        return OAL_ERR_CODE_PTR_NULL;
    }

    while (0 != pst_board->uc_chip_id_bitmap)
    {
        /* 获取最右边一位为1的位数,此值即为chip的数组下标 */
        uc_chip_idx = oal_bit_find_first_bit_one_byte(pst_board->uc_chip_id_bitmap);
        if (OAL_UNLIKELY(uc_chip_idx >= WLAN_CHIP_MAX_NUM_PER_BOARD))
        {
            OAM_ERROR_LOG2(0, OAM_SF_ANY, "{hmac_board_exit::invalid uc_chip_idx[%d] uc_chip_id_bitmap=%d.}",
                           uc_chip_idx, pst_board->uc_chip_id_bitmap);
            return OAL_ERR_CODE_ARRAY_OVERFLOW;
        }

        ul_ret = dmac_chip_exit(pst_board, &(pst_board->ast_chip[uc_chip_idx]));
        if (OAL_SUCC != ul_ret)
        {
            OAM_WARNING_LOG1(0, OAM_SF_ANY, "{hmac_board_exit::mac_chip_exit failed[%d].}", ul_ret);
            return ul_ret;
        }

        /* 清除对应的bitmap位 */
        oal_bit_clear_bit_one_byte(&pst_board->uc_chip_id_bitmap, uc_chip_idx);
    }

    /*公共部分的初始化*/
    mac_board_exit(pst_board);

    return OAL_SUCC;
}
int32 hwifi_config_init(int32 cus_tag)
{
    int32               l_cfg_id;
    int32               l_ret = INI_FAILED;
    int32               l_ori_val;
    wlan_cfg_cmd*       pgast_wifi_config;
    int32*              pgal_params;
    int32               l_cfg_value = 0;
    int32               l_wlan_cfg_butt;

    switch (cus_tag)
    {
        case CUS_TAG_NV:
            return hwifi_config_init_nvram();
        case CUS_TAG_INI:
            host_params_init_first();
            pgast_wifi_config = g_ast_wifi_config_cmds;
            pgal_params = g_al_host_init_params;
            l_wlan_cfg_butt = WLAN_CFG_INIT_BUTT;
            break;
        case CUS_TAG_DTS:
            original_value_for_dts_params();
            pgast_wifi_config = g_ast_wifi_config_dts;
            pgal_params = g_al_dts_params;
            l_wlan_cfg_butt = WLAN_CFG_DTS_BUTT;
            break;
        default:
            OAM_ERROR_LOG1(0, OAM_SF_ANY, "hisi_customize_wifi tag number[0x%x] not correct!", cus_tag);
            return INI_FAILED;
    }

    for(l_cfg_id=0; l_cfg_id<l_wlan_cfg_butt; ++l_cfg_id)
    {
        if(CUS_TAG_INI == cus_tag && WLAN_CFG_INIT_COUNTRY_CODE == l_cfg_id)
        {
            /* 获取ini中的国家码 */
            l_ret = get_cust_conf_string(INI_MODU_WIFI, pgast_wifi_config[l_cfg_id].name, g_ac_country_code, sizeof(g_ac_country_code));
            if(INI_FAILED == l_ret)
            {
                OAM_WARNING_LOG0(0, OAM_SF_ANY, "hisi_customize_wifi read country code failed, check if it exists!");
                strncpy(g_ac_country_code, "99", 2);
            }
            g_ac_country_code[2] = '\0';
            continue;
        }

        /* 获取ini或dts中的配置值 */
        l_ret = get_cust_conf_int32(INI_MODU_WIFI, pgast_wifi_config[l_cfg_id].name, &l_cfg_value);
        if (INI_FAILED == l_ret)
        {
            l_ret = get_cust_conf_int32(CUST_MODU_DTS, pgast_wifi_config[l_cfg_id].name, &l_cfg_value);
            if(INI_FAILED == l_ret)
            {
                OAM_WARNING_LOG1(0, OAM_SF_ANY, "hisi_customize_wifi read ini or dts file failed, check if cfg_id[%d] exists!", l_cfg_id);
                continue;
            }
        }

        l_ori_val = pgal_params[l_cfg_id];
        pgal_params[l_cfg_id] = l_cfg_value;
        OAM_WARNING_LOG3(0, OAM_SF_ANY, "hisi_customize_wifi [cfg_id:%d]value changed from [init:%d] to [config:%d]. \n", l_cfg_id, l_ori_val, pgal_params[l_cfg_id]);
    }

    return INI_SUCC;
}
Beispiel #8
0
/*****************************************************************************
 函 数 名  : dmac_vap_init
 功能描述  : 初始化要添加的dmac vap的一些特性信息
 输入参数  : 指向要添加的vap的指针
 输出参数  : 无
 返 回 值  : 成功或者失败原因
 调用函数  :
 被调函数  :

 修改历史      :
  1.日    期   : 2012年10月24日
    作    者   : 康国昌
    修改内容   : 新生成函数

*****************************************************************************/
oal_uint32  dmac_vap_init(
                dmac_vap_stru              *pst_dmac_vap,
                oal_uint8                   uc_chip_id,
                oal_uint8                   uc_device_id,
                oal_uint8                   uc_vap_id,
                mac_cfg_add_vap_param_stru *pst_param)
{
#if (_PRE_MULTI_CORE_MODE_OFFLOAD_DMAC == _PRE_MULTI_CORE_MODE)
    oal_uint32  ul_ret;
#endif
    mac_device_stru               *pst_mac_device = mac_res_get_dev(uc_device_id);
    if (OAL_UNLIKELY(OAL_PTR_NULL == pst_mac_device))
    {
        OAM_ERROR_LOG1(0, OAM_SF_ANY, "{dmac_vap_init::pst_mac_device[%d] null!}", uc_device_id);
        return OAL_ERR_CODE_PTR_NULL;
    }

    /* DMAC VAP 部分初始清零 */
    OAL_MEMZERO(((oal_uint8 *)pst_dmac_vap) + OAL_SIZEOF(mac_vap_stru), OAL_SIZEOF(dmac_vap_stru) - OAL_SIZEOF(mac_vap_stru));
#if (_PRE_PRODUCT_ID == _PRE_PRODUCT_ID_HI1151)

    /* 统计信息清零 */
    oam_stats_clear_vap_stat_info(uc_vap_id);
#endif

#if (_PRE_MULTI_CORE_MODE_OFFLOAD_DMAC == _PRE_MULTI_CORE_MODE)
    /* 在非OFFLOAD情况下,这些操作HMAC都已经做过了 */
    /* 初始化mac vap */
    ul_ret = mac_vap_init(&pst_dmac_vap->st_vap_base_info,
                           uc_chip_id,
                           uc_device_id,
                           uc_vap_id,
                           pst_param);
    if (OAL_SUCC != ul_ret)
    {
        OAM_WARNING_LOG1(uc_vap_id, OAM_SF_CFG,
                         "{dmac_vap_init::dmac_vap_init failed[%d].", ul_ret);
        return ul_ret;
    }
    pst_dmac_vap->bit_beacon_timeout_times = 0;
#endif

    pst_dmac_vap->en_bfer_actived       = pst_mac_device->bit_su_bfmer;
    pst_dmac_vap->en_bfee_actived       = pst_mac_device->bit_su_bfmee;
    pst_dmac_vap->en_mu_bfee_actived    = pst_mac_device->bit_mu_bfmee;
    pst_dmac_vap->en_txstbc_actived     = pst_mac_device->bit_tx_stbc;
    pst_dmac_vap->en_multi_user_multi_ac_flag = OAL_FALSE;
    pst_dmac_vap->uc_traffic_type    = OAL_TRAFFIC_NORMAL;

    /* 初始化特性标识中BEACON帧不轮流发送 */
    pst_dmac_vap->en_beacon_chain_active = OAL_FALSE;

    /* VAP发送通道默认值赋值,按照device下能力赋值 */
    pst_dmac_vap->uc_vap_tx_chain = pst_mac_device->uc_tx_chain;

    /* 速率结构体赋初值 */
    /* 按照PHY给出的初始值 ul_value = 0x00800211 */
    pst_dmac_vap->st_tx_alg.ast_per_rate[0].rate_bit_stru.bit_tx_count = 1;
#if (_PRE_PRODUCT_ID == _PRE_PRODUCT_ID_HI1151)
    pst_dmac_vap->st_tx_alg.ast_per_rate[0].rate_bit_stru.bit_stbc_mode = 0;
#endif
    pst_dmac_vap->st_tx_alg.ast_per_rate[0].rate_bit_stru.bit_tx_chain_selection = 1;
    pst_dmac_vap->st_tx_alg.ast_per_rate[0].rate_bit_stru.uc_tx_data_antenna = 2;


    /* FPGA zhangyu Debug 11n */
    pst_dmac_vap->st_tx_alg.ast_per_rate[0].rate_bit_stru.un_nss_rate.st_ht_rate.bit_ht_mcs = 0;
    pst_dmac_vap->st_tx_alg.ast_per_rate[0].rate_bit_stru.un_nss_rate.st_ht_rate.bit_protocol_mode = WLAN_HT_PHY_PROTOCOL_MODE;

    /* 默认是HOST VAP */
    pst_dmac_vap->en_is_host_vap = OAL_TRUE;

    /* 默认天线组合 */
    pst_dmac_vap->uc_default_ant_bitmap = 0xFF;

    /* 初始化节能相关参数 */
    pst_dmac_vap->uc_ps_user_num = 0;
    pst_dmac_vap->uc_dtim_count  = WLAN_DTIM_DEFAULT;
#ifdef _PRE_WLAN_CHIP_TEST
    pst_dmac_vap->pst_wow_probe_resp = OAL_PTR_NULL;
    pst_dmac_vap->pst_wow_null_data  = OAL_PTR_NULL;
#endif
    pst_dmac_vap->uc_sw_retry_limit  = DMAC_MAX_SW_RETRIES;

    if (WLAN_VAP_MODE_BSS_AP == pst_dmac_vap->st_vap_base_info.en_vap_mode)
    {
        /* DTS2015050301014,双芯片实现时bitmap_len计算要乘以device(也即是chip)个数  */
        pst_dmac_vap->uc_tim_bitmap_len = (oal_uint8)(2 + (((g_us_max_asoc_user + WLAN_SERVICE_VAP_MAX_NUM_PER_DEVICE)* MAC_RES_MAX_DEV_NUM + 7 ) >> 3));
        pst_dmac_vap->puc_tim_bitmap = OAL_MEM_ALLOC(OAL_MEM_POOL_ID_LOCAL, pst_dmac_vap->uc_tim_bitmap_len, OAL_TRUE);
        if (OAL_PTR_NULL == pst_dmac_vap->puc_tim_bitmap)
        {
            OAM_ERROR_LOG0(uc_vap_id, OAM_SF_ANY, "{dmac_vap_init::puc_tim_bitmap null.}");

            return OAL_ERR_CODE_ALLOC_MEM_FAIL;
        }

        OAL_MEMZERO(pst_dmac_vap->puc_tim_bitmap, pst_dmac_vap->uc_tim_bitmap_len);
        /* TIM bitmap len is default 1*/
        pst_dmac_vap->puc_tim_bitmap[0] = 1;
    }
Beispiel #9
0
/*****************************************************************************
 函 数 名  : dmac_chip_init
 功能描述  : chip对象初始化函数
 输入参数  : chip对象指针、chip id
 输出参数  : 无
 返 回 值  : 成功或失败原因
 调用函数  : mac_device_init
 被调函数  :

 修改历史      :
  1.日    期   : 2012年10月19日
    作    者   : huxiaotong
    修改内容   : 新生成函数

*****************************************************************************/
OAL_STATIC oal_uint32  dmac_chip_init(mac_chip_stru *pst_chip, oal_uint8 uc_chip_id)
{
    oal_uint8  uc_device;
    oal_uint8  uc_device_max;
    oal_uint32 ul_ret;

    if (OAL_UNLIKELY(OAL_PTR_NULL == pst_chip))
    {
        OAM_ERROR_LOG0(0, OAM_SF_ANY, "{dmac_chip_init::pst_chip null.}");

        return OAL_ERR_CODE_PTR_NULL;
    }

    /*公共部分初始化*/
    mac_chip_init(pst_chip, uc_chip_id);

    pst_chip->uc_chip_id = uc_chip_id;

    /*根据芯片id,获取hal_to_dmac_chip_stru结构体*/
    ul_ret = hal_chip_get_chip(uc_chip_id, &pst_chip->pst_chip_stru);
    if (OAL_SUCC != ul_ret)
    {
     OAM_WARNING_LOG1(0, OAM_SF_ANY, "{dmac_device_init::hal_chip_get_chip failed[%d].}", ul_ret);
     return ul_ret;
    }


    /* CHIP调用接口 hal_get_chip_version*/
    hal_get_chip_version(pst_chip->pst_chip_stru, &pst_chip->ul_chip_ver);


    /* HAL接口获取支持device个数 */
    ul_ret = hal_chip_get_device_num(uc_chip_id, &uc_device_max);
    if (OAL_SUCC != ul_ret)
    {
        OAM_WARNING_LOG1(0, OAM_SF_ANY, "{dmac_chip_init::hal_chip_get_device_num failed[%d].}", ul_ret);

        return ul_ret;
    }

    for (uc_device = 0; uc_device < uc_device_max; uc_device++)
    {
        ul_ret = dmac_device_init(&pst_chip->auc_device_id[uc_device], uc_chip_id, uc_device, pst_chip->ul_chip_ver);
        {
            if (OAL_SUCC != ul_ret)
            {
                OAM_WARNING_LOG1(0, OAM_SF_ANY, "{dmac_chip_init::dmac_device_init failed[%d].}", ul_ret);

                return ul_ret;
            }
        }
    }

    /* 保存device数量 */
    pst_chip->uc_device_nums        = uc_device_max;

    /* 初始化最后再将state置为TRUE */
    pst_chip->en_chip_state         = OAL_TRUE;

    return OAL_SUCC;
}
Beispiel #10
0
/*****************************************************************************
 函 数 名  : dmac_device_init
 功能描述  : device的初始化函数
 输入参数  : 指向要进行初始化的device指针
 输出参数  : 无
 返 回 值  : 成功或者失败原因
 调用函数  :
 被调函数  :

 修改历史      :
  1.日    期   : 2012年10月19日
    作    者   : huxiaotong
    修改内容   : 新生成函数

*****************************************************************************/
OAL_STATIC oal_uint32  dmac_device_init(oal_uint8 *puc_device_id, oal_uint8 uc_chip_id, oal_uint8 uc_device_id, oal_uint32 ul_chip_ver)
{
    oal_uint32                 ul_ret;
    oal_uint8                  uc_dev_id;
    mac_device_stru           *pst_device;
    mac_data_rate_stru        *pst_data_rate;
    oal_uint32                 ul_rate_num = 0;
    oal_uint32                 ul_idx;
    oal_uint32                 ul_loop = 0;
    dmac_device_stru          *pst_dmac_device;
    hal_cfg_rts_tx_param_stru  st_hal_rts_tx_param;

#ifdef _PRE_WLAN_DFT_STAT
    oam_stats_phy_node_idx_stru st_phy_node_idx = {{OAM_STATS_PHY_NODE_TX_CNT,
                                                    OAM_STATS_PHY_NODE_RX_OK_CNT,
                                                    OAM_STATS_PHY_NODE_11B_HDR_ERR_CNT,
                                                    OAM_STATS_PHY_NODE_OFDM_HDR_ERR_CNT}};
#endif

    /*申请公共mac device结构体,修改下 名称*/
    ul_ret = mac_res_alloc_dmac_dev(&uc_dev_id);
    if(OAL_UNLIKELY(ul_ret != OAL_SUCC))
    {
        OAM_ERROR_LOG1(0, OAM_SF_ANY, "{dmac_device_init::mac_res_alloc_dmac_dev failed[%d].}", ul_ret);

        return OAL_FAIL;
    }

    pst_device = mac_res_get_dev(uc_dev_id);

    if (OAL_PTR_NULL == pst_device)
    {
       OAM_ERROR_LOG0(0, OAM_SF_ANY, "{dmac_device_init::pst_device null.}");

       return OAL_ERR_CODE_PTR_NULL;
    }

#if 0
    pst_device->uc_chip_id   = uc_chip_id;
    pst_device->uc_device_id = uc_dev_id;
#endif

    /* 申请dmac device资源 */
    if(OAL_UNLIKELY(dmac_res_alloc_mac_dev(uc_dev_id) != OAL_SUCC))
    {
        OAM_ERROR_LOG0(0, OAM_SF_ANY, "{dmac_device_init::dmac_res_alloc_mac_dev failed.}");
        return OAL_FAIL;
    }

#if (_PRE_MULTI_CORE_MODE_OFFLOAD_DMAC == _PRE_MULTI_CORE_MODE)
    /* 初始化device级别的一些参数 */
    ul_ret = mac_device_init(pst_device, ul_chip_ver, uc_chip_id, uc_dev_id);
    if (OAL_SUCC != ul_ret)
    {
        OAM_ERROR_LOG2(0, OAM_SF_ANY, "{dmac_device_init::mac_device_init failed[%d], chip_ver[0x%x].}", ul_ret, ul_chip_ver);
        dmac_res_free_mac_dev(uc_dev_id);
        mac_res_free_dev(uc_dev_id);
        return ul_ret;
    }
#endif

    /* 获取hmac device,并进行相关参数赋值 */
    pst_dmac_device = dmac_res_get_mac_dev(uc_dev_id);
    if (OAL_PTR_NULL == pst_dmac_device)
    {
       OAM_ERROR_LOG0(0, OAM_SF_ANY, "{dmac_device_init::pst_dmac_device null.}");
       mac_res_free_dev(uc_dev_id);
       return OAL_ERR_CODE_PTR_NULL;
    }

    /* 结构体初始化 */
    OAL_MEMZERO(pst_dmac_device, OAL_SIZEOF(*pst_dmac_device));
    pst_dmac_device->pst_device_base_info = pst_device;

#ifdef _PRE_WLAN_FEATURE_DFR
    pst_dmac_device->en_dfr_hw_reset_enable = OAL_FALSE;
#endif //#ifdef _PRE_WLAN_FEATURE_DFR


    /* 硬mac结构指针只存在于DMAC中,需要针对device对象中私有部分
       的内容进行初始化,用于逻辑和物理device的对应 */
    ul_ret = hal_chip_get_device(uc_chip_id, uc_device_id, &pst_device->pst_device_stru);

    pst_device->ul_core_id = pst_device->pst_device_stru->ul_core_id;

    if (OAL_SUCC != ul_ret)
    {
        OAM_WARNING_LOG1(0, OAM_SF_ANY, "{dmac_device_init::hal_chip_get_device failed[%d].}", ul_ret);

        dmac_res_free_mac_dev(uc_dev_id);
        mac_res_free_dev(uc_dev_id);
        return ul_ret;
    }

    /* 保存mac层的device id */
    pst_device->pst_device_stru->uc_mac_device_id = uc_dev_id;

    if(OAL_SUCC != mac_fcs_init(&pst_device->st_fcs_mgr, pst_device->uc_chip_id, pst_device->uc_device_id))
    {
        OAM_WARNING_LOG0(0, OAM_SF_ANY, "{dmac_device_init::mac_fcs_init failed.}");
        dmac_res_free_mac_dev(uc_dev_id);
        mac_res_free_dev(uc_dev_id);
        return OAL_FAIL;
    }

    /* 算法框架初始化 */
    ul_ret = dmac_alg_init(pst_device);
    if (OAL_SUCC != ul_ret)
    {
        OAM_WARNING_LOG1(0, OAM_SF_ANY, "{dmac_device_init::dmac_alg_init failed[%d].}", ul_ret);
        dmac_res_free_mac_dev(uc_dev_id);
        mac_res_free_dev(uc_dev_id);
        return ul_ret;
    }

    /* 算法距离、干扰等状态初始化 */
    dmac_alg_stat_init(pst_dmac_device);

    pst_device->us_total_mpdu_num = 0;
    /* 错误计数初始化 */
    OAL_MEMZERO(pst_device->aul_mac_err_cnt, OAL_SIZEOF(pst_device->aul_mac_err_cnt));

    /*初始化记录性能统计第一次时间戳*/
    pst_device->ul_first_timestamp = 0;

    pst_device->ul_rx_buf_too_small_show_counter = 0;
#if (_PRE_PRODUCT_ID == _PRE_PRODUCT_ID_HI1151)
    pst_device->ul_rx_fsm_st_timeout_show_counter = 0;
    pst_device->ul_tx_fsm_st_timeout_show_counter = 0;
    pst_device->ul_beacon_miss_show_counter = 0;
    pst_device->us_user_nums_max = WLAN_ASSOC_USER_MAX_NUM_SPEC;
    pst_device->ul_pcie_reg110_timeout_counter = 0;
    pst_device->ul_pcie_read_counter = 0;

    /* DTS2015100700205,特殊网卡兼容性问题规避方案: 会发生DataFlow Break时候会影响性能 */
    pst_device->st_dataflow_brk_bypass.en_brk_limit_aggr_enable = OAL_FALSE;
    pst_device->st_dataflow_brk_bypass.ul_tx_dataflow_brk_cnt = 0;
    pst_device->st_dataflow_brk_bypass.ul_last_tx_complete_isr_cnt = 0;
#endif
    for (ul_loop = 0; ul_loop < WLAN_WME_AC_BUTT; ul_loop++)
    {
        pst_device->aus_ac_mpdu_num[ul_loop] = 0;
    }

    for (ul_loop = 0; ul_loop < WLAN_VAP_SUPPORT_MAX_NUM_LIMIT; ul_loop++)
    {
        pst_device->aus_vap_mpdu_num[ul_loop] = 0;
    }

    for (ul_loop = WLAN_WME_AC_BE; ul_loop < WLAN_WME_AC_BUTT; ul_loop++)
    {
        pst_device->aus_ac_mpdu_num[ul_loop] = 0;
    }

#ifdef _PRE_WLAN_DFT_STAT
    /* 初始化维测参数,空口环境类参数 */
    OAL_MEMZERO(&(pst_device->st_dbb_env_param_ctx), OAL_SIZEOF(mac_device_dbb_env_param_ctx_stru));
#endif


    #ifdef _PRE_WLAN_FEATURE_PM
    pst_device->en_pm_enable   = OAL_FALSE;
    mac_pm_arbiter_init(pst_device);
    #endif

    /* 初始化TXOP特性相关值 */
    pst_device->en_txop_enable       = OAL_FALSE;
    pst_device->uc_tx_ba_num = 0;

    /* 从eeprom或flash获得MAC地址 */
    hal_get_hw_addr(pst_device->pst_device_stru, pst_device->auc_hw_addr);

    /* 初始化DEVICE下的速率集 */
    hal_get_rate_80211g_table(pst_device->pst_device_stru, (oal_void *)&pst_data_rate);
    hal_get_rate_80211g_num(pst_device->pst_device_stru, &ul_rate_num);

    for (ul_idx = 0; ul_idx < ul_rate_num; ul_idx++)
    {
        oal_memcopy(&(pst_device->st_mac_rates_11g[ul_idx]),&pst_data_rate[ul_idx],OAL_SIZEOF(mac_data_rate_stru));
    }

    /* 初始化2.4G和5G的RTS速率, RTS[0~2]设为24Mbps,  RTS[3]在2.4G设为1Mbps、5G设为24Mbps*/
    st_hal_rts_tx_param.auc_protocol_mode[0]    = WLAN_LEGACY_OFDM_PHY_PROTOCOL_MODE;
    st_hal_rts_tx_param.auc_rate[0]             = WLAN_LEGACY_OFDM_24M_BPS;
    st_hal_rts_tx_param.auc_protocol_mode[1]    = WLAN_LEGACY_OFDM_PHY_PROTOCOL_MODE;
    st_hal_rts_tx_param.auc_rate[1]             = WLAN_LEGACY_OFDM_24M_BPS;
    st_hal_rts_tx_param.auc_protocol_mode[2]    = WLAN_LEGACY_OFDM_PHY_PROTOCOL_MODE;
    st_hal_rts_tx_param.auc_rate[2]             = WLAN_LEGACY_OFDM_24M_BPS;

    st_hal_rts_tx_param.en_band                 = WLAN_BAND_2G;
    st_hal_rts_tx_param.auc_protocol_mode[3]    = WLAN_11B_PHY_PROTOCOL_MODE;
    st_hal_rts_tx_param.auc_rate[3]             = WLAN_LONG_11b_1_M_BPS;
    hal_set_rts_rate_params(pst_device->pst_device_stru, &st_hal_rts_tx_param);

    st_hal_rts_tx_param.en_band                 = WLAN_BAND_5G;
    st_hal_rts_tx_param.auc_protocol_mode[3]    = WLAN_LEGACY_OFDM_PHY_PROTOCOL_MODE;
    st_hal_rts_tx_param.auc_rate[3]             = WLAN_LEGACY_OFDM_24M_BPS;
    hal_set_rts_rate_params(pst_device->pst_device_stru, &st_hal_rts_tx_param);

#if (_PRE_OS_VERSION_LINUX == _PRE_OS_VERSION)||(_PRE_OS_VERSION_RAW == _PRE_OS_VERSION)
    /* TBD  */
    /* hal_enable_radar_det(pst_device->pst_device_stru, OAL_TRUE); */
    pst_device->us_dfs_timeout = 0;
#endif

    /* 初始化DMAC SCANNER */
    dmac_scan_init(pst_device);

#ifdef _PRE_SUPPORT_ACS
    /* 初始化ACS结构体 */
    dmac_acs_init(pst_device);
#endif

#ifdef _PRE_WLAN_DFT_REG
    /* 初始化寄存器读取定时器 */
    FRW_TIMER_CREATE_TIMER(&pst_device->st_reg_prd_timer,
                               dmac_reg_timeout,
                               OAM_REGSTER_REFRESH_TIME_MS,
                               pst_device->pst_device_stru,
                               OAL_TRUE,
                               OAM_MODULE_ID_DMAC,
                               pst_device->ul_core_id);
#endif


    /* 出参赋值,CHIP中需要保存该device id */
    *puc_device_id = uc_dev_id;

#ifdef _PRE_WLAN_FEATURE_AMPDU
#ifdef _PRE_DEBUG_MODE
//#if ((_PRE_TARGET_PRODUCT_TYPE_5610DMB != _PRE_CONFIG_TARGET_PRODUCT) )
    //OAL_MEMZERO(g_ast_tx_ba_track[pst_device->uc_device_id], OAL_SIZEOF(dmac_tx_ba_track_stru) * HAL_MAX_AMPDU_LUT_SIZE);
//#endif
#endif
#endif

#ifdef _PRE_DEBUG_MODE
    OAL_MEMZERO(&(pst_device->st_exception_report_timer), OAL_SIZEOF(frw_timeout_stru));

    FRW_TIMER_CREATE_TIMER(&(pst_device->st_exception_report_timer),
                            dmac_device_exception_report_timeout_fn,
                            MAC_EXCEPTION_TIME_OUT,
                            pst_device->pst_device_stru,
                            OAL_TRUE,
                            OAM_MODULE_ID_MAC,
                            pst_device->ul_core_id);

#endif

#ifdef _PRE_WLAN_DFT_STAT
        /* 初始化phy统计节点 */
        dmac_dft_set_phy_stat_node(pst_device, &st_phy_node_idx);
#endif

    ul_ret = dmac_cfg_vap_init(pst_device);
    if(OAL_UNLIKELY(ul_ret != OAL_SUCC))
    {
        OAM_ERROR_LOG1(0, OAM_SF_ANY, "{hmac_chip_init::hmac_cfg_vap_init failed[%d].}", ul_ret);
        return OAL_FAIL;
    }

    return OAL_SUCC;
}
Beispiel #11
0
/*****************************************************************************
 函 数 名  : dmac_device_exit
 功能描述  : device结构以及对应特性退出
 输入参数  : 无
 输出参数  : 无
 返 回 值  :
 调用函数  :
 被调函数  :

 修改历史      :
  1.日    期   : 2015年5月7日
    作    者   : 张炜 64406
    修改内容   : 新生成函数

*****************************************************************************/
oal_uint32  dmac_device_exit(mac_board_stru *pst_board, mac_chip_stru *pst_chip, dmac_device_stru *pst_dmac_device)
{
    mac_device_stru   *pst_device;
    oal_uint32         ul_ret;
    hal_to_dmac_device_stru            *pst_hal_dev_stru;

    if (OAL_UNLIKELY(OAL_PTR_NULL == pst_dmac_device))
    {
        OAM_ERROR_LOG0(0, OAM_SF_ANY, "{dmac_device_exit::param null.}");
        return OAL_ERR_CODE_PTR_NULL;
    }

    pst_device = pst_dmac_device->pst_device_base_info;
    if (OAL_UNLIKELY(OAL_PTR_NULL == pst_device))
    {
        return OAL_SUCC;
    }

    /* 算法框架退出 */
    dmac_alg_exit(pst_device);

	/* DTS2015071603951 mac和phy没有异常情况,不要进行mac和phy复位, 不然会导致PCIE异常 */
    /* 挂起硬件发送 */
    //hal_set_machw_tx_suspend(pst_device->pst_device_stru);

    /* 复位MAC and PHY */
    //hal_reset_phy_machw(pst_device->pst_device_stru, HAL_RESET_HW_TYPE_ALL, HAL_RESET_MAC_ALL, 1, 1);

    pst_hal_dev_stru = pst_device->pst_device_stru;

    dmac_free_hd_tx_dscr_queue(pst_hal_dev_stru);

#ifdef _PRE_WLAN_FEATURE_PM
    mac_pm_arbiter_destroy(pst_device);
#endif
    pst_device->pst_device_stru = OAL_PTR_NULL;

    /*释放公共结构体*/
    /*释放公共结构体 以及 对应衍生特性*/
#if 0
    ul_ret = pst_board->p_device_destroy_fun(pst_device);
#else
    ul_ret = mac_device_exit(pst_device);
#endif

    if (OAL_SUCC != ul_ret)
    {
        OAM_WARNING_LOG1(0, OAM_SF_ANY, "{mac_device_exit failed[%d].}", ul_ret);

        return ul_ret;
    }


#ifdef _PRE_SUPPORT_ACS
    /* 清除dmac acs */
    dmac_acs_exit(pst_device);
#endif

#ifdef _PRE_WLAN_DFT_REG
        /* 寄存器读取删除定时器 */
    FRW_TIMER_IMMEDIATE_DESTROY_TIMER(&(pst_device->st_reg_prd_timer));
#endif

#ifdef _PRE_DEBUG_MODE
    FRW_TIMER_IMMEDIATE_DESTROY_TIMER(&(pst_device->st_exception_report_timer));
#endif

    /* 取消keepalive定时器 */
    if(OAL_TRUE == pst_device->st_keepalive_timer.en_is_registerd)
    {
        FRW_TIMER_IMMEDIATE_DESTROY_TIMER(&(pst_device->st_keepalive_timer));
    }

#ifdef _PRE_WLAN_DFT_STAT
    if (OAL_TRUE == pst_device->st_dbb_env_param_ctx.st_collect_period_timer.en_is_registerd)
    {
        FRW_TIMER_IMMEDIATE_DESTROY_TIMER(&(pst_device->st_dbb_env_param_ctx.st_collect_period_timer));
    }
#endif

    /* 指向基础mac device的指针为空,待定时解耦后,本处理提前 */
    pst_dmac_device->pst_device_base_info = OAL_PTR_NULL;

    return OAL_SUCC;
}
oal_uint32 dmac_11w_rx_filter(dmac_vap_stru *pst_dmac_vap, oal_netbuf_stru  *pst_netbuf)
{
    oal_uint32                           ul_relt = OAL_SUCC;
    oal_uint8                           *puc_da;
    dmac_rx_ctl_stru                    *pst_rx_ctl;
    mac_ieee80211_frame_stru            *pst_frame_hdr;
    mac_user_stru                       *pst_user;
    oal_uint16                           us_ta_user_idx;
    wlan_ciper_protocol_type_enum_uint8  en_cipher_protocol_type;

    pst_frame_hdr = (mac_ieee80211_frame_stru *)OAL_NETBUF_HEADER(pst_netbuf);
    puc_da        = pst_frame_hdr->auc_address1;
    pst_rx_ctl    = (dmac_rx_ctl_stru *)oal_netbuf_cb(pst_netbuf);
    en_cipher_protocol_type = hal_ctype_to_cipher_suite(pst_rx_ctl->st_rx_status.bit_cipher_protocol_type);
#if (_PRE_MULTI_CORE_MODE_OFFLOAD_DMAC == _PRE_MULTI_CORE_MODE)
    us_ta_user_idx  = pst_rx_ctl->st_rx_info.bit_ta_user_idx;
#else
    us_ta_user_idx  = pst_rx_ctl->st_rx_info.us_ta_user_idx;
#endif

    pst_user = (mac_user_stru *)mac_res_get_dmac_user(us_ta_user_idx);
    if (OAL_PTR_NULL == pst_user)
    {
        return OAL_SUCC;
    }

    if ((OAL_TRUE != pst_user->st_cap_info.bit_pmf_active) ||
        (OAL_TRUE != dmac_11w_robust_frame(pst_netbuf) ))
    {
       return OAL_SUCC;
    }

    /* 广播Robust帧过滤 */
    if (OAL_TRUE == ETHER_IS_MULTICAST(puc_da))
    {
        ul_relt = OAL_SUCC;

#if(_PRE_WLAN_FEATURE_PMF == _PRE_PMF_HW_CCMP_BIP)

        if (WLAN_80211_CIPHER_SUITE_BIP !=  en_cipher_protocol_type)
        {
            OAM_WARNING_LOG1(pst_dmac_vap->st_vap_base_info.uc_vap_id, OAM_SF_PMF,
                "{dmac_11w_rx_filter::PMF is open,but is Robust muti frame chipertype is[%d].}", en_cipher_protocol_type);
            return OAL_ERR_CODE_PMF_NO_PROTECTED_ERROR;
        }
#else
        /* 11w组播管理帧解密 */
        ul_relt = dmac_bip_decrypto(pst_dmac_vap, pst_netbuf);
        if (OAL_SUCC != ul_relt)
        {
            /* 组播解密失败,不上报管理帧 */
            OAM_WARNING_LOG1(pst_dmac_vap->st_vap_base_info.uc_vap_id, OAM_SF_PMF,
                           "{dmac_11w_rx_filter::dmac_bip_decrypto failed[%d].}", ul_relt);
        }
#endif
        return ul_relt;
    }

    /* pmf使能,对硬件不能过滤的未加密帧进行过滤 */
    if (WLAN_80211_CIPHER_SUITE_NO_ENCRYP ==  en_cipher_protocol_type)
    {
        OAM_WARNING_LOG0(pst_dmac_vap->st_vap_base_info.uc_vap_id, OAM_SF_PMF,
                  "{dmac_11w_rx_filter::PMF is open,but the Robust frame is CIPHER_SUITE_NO_ENCRYP.}");
        return OAL_ERR_CODE_PMF_NO_PROTECTED_ERROR;
    }

    /* PMF单播管理帧校验 */
    if ((OAL_FALSE == pst_frame_hdr->st_frame_control.bit_protected_frame)||
        (WLAN_80211_CIPHER_SUITE_CCMP !=  en_cipher_protocol_type))
    {
        OAM_WARNING_LOG2(pst_dmac_vap->st_vap_base_info.uc_vap_id, OAM_SF_PMF,
                      "{dmac_11w_rx_filter::robust_action protecter incorect. bit_protected_frame[%d], cipher_type[%d].}",
                      pst_frame_hdr->st_frame_control.bit_protected_frame,
                      en_cipher_protocol_type);
        return OAL_ERR_CODE_PMF_NO_PROTECTED_ERROR;
    }

    return OAL_SUCC;
}
Beispiel #13
0
/*****************************************************************************
 函 数 名  : hmac_smps_update_status
 功能描述  : AP侧接收到对应STA的关联请求消息
 输入参数  : 无
 输出参数  : 无
 返 回 值  :
 调用函数  :
 被调函数  :

 修改历史      :
  1.日    期   : 2014年4月16日
    作    者   : zhangyu
    修改内容   : 新生成函数

*****************************************************************************/
oal_uint32 hmac_smps_update_status(mac_vap_stru *pst_mac_vap, mac_user_stru *pst_mac_user, oal_bool_enum_uint8 en_plus_user)
{
    mac_device_stru                        *pst_mac_device;
    wlan_mib_mimo_power_save_enum_uint8     en_user_smps_mode;
    frw_event_mem_stru                     *pst_event_mem;
    frw_event_stru                         *pst_event;
    oal_uint32                              ul_ret;
    oal_bool_enum_uint8                     en_ht_cap;
    mac_cfg_smps_mode_stru                  st_smps_mode = {0};

    if ((OAL_PTR_NULL == pst_mac_vap) || (OAL_PTR_NULL == pst_mac_user))
    {
        OAM_ERROR_LOG2(0, OAM_SF_SMPS, "{hmac_smps_update_status: NULL PTR pst_mac_vap is [%d] and pst_mac_user is [%d].}", pst_mac_vap, pst_mac_user);
        return OAL_ERR_CODE_PTR_NULL;
    }

    if (OAL_FALSE == mac_mib_get_HighThroughputOptionImplemented(pst_mac_vap))
    {
        OAM_INFO_LOG0(pst_mac_vap->uc_vap_id, OAM_SF_SMPS, "{hmac_smps_update_status: pst_mac_vap is mimo.}");
        return OAL_SUCC;
    }

    pst_mac_device = mac_res_get_dev(pst_mac_vap->uc_device_id);
    if (OAL_PTR_NULL == pst_mac_device)
    {
        OAM_ERROR_LOG0(pst_mac_vap->uc_vap_id, OAM_SF_SMPS, "{hmac_smps_update_status: pst_mac_device is null.}");
        return OAL_ERR_CODE_PTR_NULL;
    }

    st_smps_mode.uc_smps_mode = WLAN_MIB_MIMO_POWER_SAVE_BUTT;
    st_smps_mode.us_user_idx = 0;

    en_user_smps_mode = (wlan_mib_mimo_power_save_enum_uint8)pst_mac_user->st_ht_hdl.bit_sm_power_save;
    en_ht_cap = (oal_bool_enum_uint8)pst_mac_user->st_ht_hdl.en_ht_capable;

    if (OAL_TRUE == en_plus_user)
    {
        if ((OAL_TRUE == en_ht_cap) && (WLAN_MIB_MIMO_POWER_SAVE_MIMO != en_user_smps_mode))
        {
            /* 如果不是第一个用户,则直接返回 */
            if (1 < pst_mac_device->uc_asoc_user_cnt)
            {
                return OAL_SUCC;
            }
            /* 如果是第一个用户,则进入SMPS模式 */
            /* 设置SMPS模式信息 mib值 */
            st_smps_mode.uc_smps_mode = (oal_uint8)pst_mac_vap->st_cap_flag.bit_smps;
        }
        else
        {
            pst_mac_device->uc_no_smps_user_cnt++;
            if (OAL_FALSE == pst_mac_device->en_smps)
            {
                return OAL_SUCC;
            }
            /* 设置SMPS模式disable */
            st_smps_mode.uc_smps_mode = WLAN_MIB_MIMO_POWER_SAVE_MIMO;
            hmac_smps_all_vap_update(pst_mac_device, WLAN_MIB_MIMO_POWER_SAVE_MIMO);
        }
     }
     else
     {
         if ((OAL_TRUE == en_ht_cap) && (WLAN_MIB_MIMO_POWER_SAVE_MIMO != en_user_smps_mode))
         {
             return OAL_SUCC;
         }

         if (0 < pst_mac_device->uc_no_smps_user_cnt)
         {
             pst_mac_device->uc_no_smps_user_cnt--;
         }

         if ((0 == pst_mac_device->uc_no_smps_user_cnt) && (OAL_FALSE == pst_mac_device->en_smps))
         {
             /* 设置SMPS模式信息 mib值 */
             st_smps_mode.uc_smps_mode = mac_mib_get_smps(pst_mac_vap);
             hmac_smps_all_vap_update(pst_mac_device, mac_mib_get_smps(pst_mac_vap));
         }
         else
         {
             return OAL_SUCC;
         }
     }


     /* 抛事件到DMAC, 申请事件内存 */
     pst_event_mem = FRW_EVENT_ALLOC(OAL_SIZEOF(st_smps_mode));
     if (OAL_PTR_NULL == pst_event_mem)
     {
         OAM_ERROR_LOG0(pst_mac_vap->uc_vap_id, OAM_SF_SMPS, "{hmac_smps_update_status: FRW_EVENT_ALLOC fail.}");
         return OAL_ERR_CODE_PTR_NULL;
     }

     ul_ret = mac_vap_find_user_by_macaddr(pst_mac_vap, pst_mac_user->auc_user_mac_addr, &(st_smps_mode.us_user_idx));

     /* 查找用户失败或没有找到对应的用户 */
     if (OAL_SUCC != ul_ret)
     {
         OAM_WARNING_LOG1(pst_mac_vap->uc_vap_id, OAM_SF_SMPS, "{hmac_smps_update_status::mac_vap_find_user_by_macaddr failed[%d].}", ul_ret);
         return ul_ret;
     }

     /* 填写事件 */
     pst_event = (frw_event_stru *)pst_event_mem->puc_data;

     FRW_EVENT_HDR_INIT(&(pst_event->st_event_hdr),
                        FRW_EVENT_TYPE_WLAN_CTX,
                        DMAC_WLAN_CTX_EVENT_SUB_TYPE_SET_SMPS,
                        OAL_SIZEOF(st_smps_mode),
                        FRW_EVENT_PIPELINE_STAGE_1,
                        pst_mac_vap->uc_chip_id,
                        pst_mac_vap->uc_device_id,
                        pst_mac_vap->uc_vap_id);

     /* 拷贝参数 */
     oal_memcopy(pst_event->auc_event_data, (oal_void *)&st_smps_mode, OAL_SIZEOF(st_smps_mode));

     /* 分发事件 */
     ul_ret = frw_event_dispatch_event(pst_event_mem);
     if (OAL_SUCC != ul_ret)
     {
        FRW_EVENT_FREE(pst_event_mem);
        return OAL_FAIL;
     }

     FRW_EVENT_FREE(pst_event_mem);

     return OAL_SUCC;
}
/*****************************************************************************
 函 数 名  : hmac_protection_update_mib_ap
 功能描述  : 更新AP保护相关mib量
 输入参数  : pst_hmac_vap : hmac vap结构体指针
 输出参数  : 无
 返 回 值  : oal_uint32
 调用函数  :
 被调函数  :

 修改历史      :
  1.日    期   : 2014年1月18日
    作    者   : c00260463
    修改内容   : 新生成函数

*****************************************************************************/
oal_uint32 hmac_protection_update_mib_ap(mac_vap_stru *pst_mac_vap)
{
    oal_uint32           ul_ret         = OAL_SUCC;
    mac_protection_stru *pst_protection = OAL_PTR_NULL;
    oal_bool_enum_uint8  en_lsig_txop_full_protection_activated;
    oal_bool_enum_uint8  en_non_gf_entities_present;
    oal_bool_enum_uint8  en_rifs_mode;
    oal_bool_enum_uint8  en_ht_protection;

    if (OAL_PTR_NULL == pst_mac_vap)
    {
        return OAL_ERR_CODE_PTR_NULL;
    }

    pst_protection = &(pst_mac_vap->st_protection);

    /*更新vap的en_dot11NonGFEntitiesPresent字段*/
    en_non_gf_entities_present = (0 != pst_protection->uc_sta_non_gf_num) ? OAL_TRUE : OAL_FALSE;
    mac_mib_set_NonGFEntitiesPresent(pst_mac_vap, en_non_gf_entities_present);

    /*更新vap的en_dot11LSIGTXOPFullProtectionActivated字段*/
    en_lsig_txop_full_protection_activated = (0 == pst_protection->uc_sta_no_lsig_txop_num) ? OAL_TRUE : OAL_FALSE;

    mac_mib_set_LsigTxopFullProtectionActivated(pst_mac_vap, en_lsig_txop_full_protection_activated);

    ul_ret = hmac_protection_update_ht_protection(pst_mac_vap);
    if(OAL_SUCC != ul_ret)
    {
        OAM_WARNING_LOG1(0, OAM_SF_ANY, "{hmac_protection_update_mib_ap::hmac_protection_update_ht_protection fail.err code %u}",ul_ret);
        return ul_ret;
    }

    /*更新vap的en_dot11HTProtection和en_dot11RIFSMode字段*/
    if (0 != pst_protection->uc_sta_non_ht_num)
    {
        en_ht_protection = WLAN_MIB_HT_NON_HT_MIXED;
        en_rifs_mode     = OAL_FALSE;
    }
    else if (OAL_TRUE == pst_protection->bit_obss_non_ht_present)
    {
        en_ht_protection = WLAN_MIB_HT_NONMEMBER_PROTECTION;
        en_rifs_mode     = OAL_FALSE;
    }
    else if ((WLAN_BAND_WIDTH_20M != pst_mac_vap->st_channel.en_bandwidth)
               && (0 != pst_protection->uc_sta_20M_only_num))
    {
        en_ht_protection = WLAN_MIB_HT_20MHZ_PROTECTION;
        en_rifs_mode     = OAL_TRUE;
    }
    else
    {
        en_ht_protection = WLAN_MIB_HT_NO_PROTECTION;
        en_rifs_mode     = OAL_TRUE;
    }

    mac_mib_set_HtProtection(pst_mac_vap, en_ht_protection);
    mac_mib_set_RifsMode(pst_mac_vap, en_rifs_mode);

    ul_ret = hmac_protection_update_mode_ap(pst_mac_vap);
    return ul_ret;
}