示例#1
0
/*****************************************************************************
 函 数 名  : dmac_txopps_set_machw_partialaid_sta
 功能描述  : sta将partial aid写入到mac寄存器
 输入参数  : 无
 输出参数  : 无
 返 回 值  :
 调用函数  :
 被调函数  :

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

*****************************************************************************/
oal_uint32  dmac_txopps_set_machw_partialaid_sta(mac_vap_stru *pst_mac_vap, oal_uint8 uc_len, oal_uint8 *puc_param)
{
    oal_uint16                           us_partial_aid;
    mac_device_stru                     *pst_mac_dev;
    mac_cfg_txop_sta_stru               *pst_txop_info;

    if (OAL_PTR_NULL == puc_param)
    {
        OAM_ERROR_LOG0(0, OAM_SF_CFG, "{dmac_txopps_set_machw_partialaid_sta::INPUT NULL PTR.}");
        return OAL_ERR_CODE_PTR_NULL;
    }

    pst_txop_info = (mac_cfg_txop_sta_stru *)puc_param;
    us_partial_aid = pst_txop_info->us_partial_aid;

    pst_mac_dev = (mac_device_stru *)mac_res_get_dev(pst_mac_vap->uc_device_id);
    if (OAL_UNLIKELY(OAL_PTR_NULL == pst_mac_dev))
    {
        OAM_ERROR_LOG0(0, OAM_SF_TXOP, "{dmac_txopps_set_machw_partialaid_sta:: device is null}.");
        return OAL_ERR_CODE_PTR_NULL;
    }
    hal_set_txop_ps_partial_aid(pst_mac_dev->pst_device_stru, us_partial_aid);

    return OAL_SUCC;
}
示例#2
0
/*****************************************************************************
 函 数 名  : dmac_psm_clean_state
 功能描述  : this func must be called before any save ps state operate,because save ps state will use netbuf mem
             clean state including:
             1. stop sys timer
             2. free alloced netbuf
 输入参数  :
 输出参数  : 无
 返 回 值  :
 调用函数  :
 被调函数  :

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

*****************************************************************************/
oal_uint8 dmac_psm_clean_state (oal_void)
{
    hal_to_dmac_device_stru     *pst_hal_device;
    mac_device_stru             *pst_device;
    oal_uint32                   ul_is_netbuf_empty;
    extern frw_event_mem_stru   *g_pst_first_rx_event;

    /*低功耗前面的流程已检查过合法性,不需要重复检查*/
    pst_device      = mac_res_get_dev(0);

    pst_hal_device  = pst_device->pst_device_stru;

    if(g_pst_first_rx_event)
    {
        FRW_EVENT_FREE(g_pst_first_rx_event);
        g_pst_first_rx_event = OAL_PTR_NULL;
    }

    hcc_slave_clean();

    hal_rx_destroy_dscr_queue(pst_hal_device,OAL_TRUE);

    /* 检查除oam子池外的三个netbuf子池,深睡前应该这三个子池的netbuf内存都已经释放 */
    ul_is_netbuf_empty = oal_mem_is_netbuf_empty();

    if (ul_is_netbuf_empty != OAL_TRUE)
    {
        OAM_ERROR_LOG0(0,OAM_SF_PWR,"{dmac_psm_clean_state::before deep sleep netbuf is not empty.}");
        OAL_MEM_INFO_PRINT(OAL_MEM_POOL_ID_NETBUF);
    }

    return OAL_SUCC;
}
oal_uint32 dmac_11w_get_pmf_cap(mac_vap_stru *pst_mac_vap, wlan_pmf_cap_status_uint8 *pen_pmf_cap)
{
    oal_bool_enum_uint8 en_MFPC;
    oal_bool_enum_uint8 en_MFPR;

    *pen_pmf_cap = MAC_PMF_DISABLED;
    en_MFPC = pst_mac_vap->pst_mib_info->st_wlan_mib_privacy.en_dot11RSNAMFPC;
    en_MFPR = pst_mac_vap->pst_mib_info->st_wlan_mib_privacy.en_dot11RSNAMFPR;

    /* 判断vap的PMF能力 */
    if ((OAL_FALSE == en_MFPC) && (OAL_TRUE == en_MFPR))
    {
         OAM_ERROR_LOG0(pst_mac_vap->uc_vap_id, OAM_SF_PMF, "{dmac_11w_get_pmf_cap::invalid en_MFPR.}");
         return OAL_ERR_CODE_PMF_VAP_CAP_FAIL;
    }

    if ((OAL_FALSE == en_MFPC) && (OAL_FALSE == en_MFPR))
    {
        *pen_pmf_cap = MAC_PMF_DISABLED;
        return OAL_SUCC;
    }

    if ((OAL_TRUE == en_MFPC) && (OAL_FALSE == en_MFPR))
    {
        *pen_pmf_cap = MAC_PMF_ENABLED;
        return OAL_SUCC;
    }

    *pen_pmf_cap = MAC_PME_REQUIRED;

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

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

*****************************************************************************/
oal_void hmac_smps_all_vap_update(mac_device_stru *pst_mac_device, wlan_mib_mimo_power_save_enum_uint8 en_smps_mode)
{
    mac_vap_stru                         *pst_mac_vap = OAL_PTR_NULL;
    oal_uint8                             uc_vap_idx;

    /* 遍历device下所有vap,设置vap 下的信道号 */
    for (uc_vap_idx = 0; uc_vap_idx < pst_mac_device->uc_vap_num; uc_vap_idx++)
    {
        pst_mac_vap = mac_res_get_mac_vap(pst_mac_device->auc_vap_id[uc_vap_idx]);
        if (OAL_PTR_NULL == pst_mac_vap)
        {
            OAM_ERROR_LOG0(0, OAM_SF_CFG, "{hmac_smps_all_vap_update::pst_mac_vap null.}");
            continue;
        }

        if (OAL_TRUE != pst_mac_vap->pst_mib_info->st_wlan_mib_sta_config.en_dot11HighThroughputOptionImplemented)
        {
            continue;
        }
        /* 信道设置只针对AP模式,非AP模式则跳出 */
        if (WLAN_VAP_MODE_BSS_AP != pst_mac_vap->en_vap_mode)
        {
            /* STA暂时不开发 */
            /* 设置STA的SMPS能力,并发送SM Power Save Frame帧 */
            continue;
        }

        /* 设置VAP的当前SMPS模式 */
        pst_mac_vap->st_cap_flag.bit_smps = en_smps_mode;
    }
}
示例#5
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;
}
示例#6
0
/*****************************************************************************
 函 数 名  : dmac_txopps_set_en
 功能描述  : 设置11ac模式vap的txop ps使能,如果是ap模式只要设置mib和能力;如
             果是sta模式还要设置相应的mac寄存器
 输入参数  : pst_mac_vap: mac_vap结构
             en_switch  : 开关
 输出参数  : 无
 返 回 值  :
 调用函数  :
 被调函数  :

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

*****************************************************************************/
oal_uint32  dmac_txopps_set_en(mac_vap_stru *pst_mac_vap, oal_switch_enum_uint8 en_switch)
{
    if (OAL_UNLIKELY(OAL_PTR_NULL == pst_mac_vap))
    {
        OAM_ERROR_LOG0(0, OAM_SF_TXOP, "{dmac_txopps_set_en:: vap is null!}.");
        return OAL_ERR_CODE_PTR_NULL;
    }

    if (en_switch >= OAL_SWITCH_BUTT)
    {
        OAM_ERROR_LOG1(pst_mac_vap->uc_vap_id, OAM_SF_TXOP, "{dmac_txopps_set_en:: en_switch=[%d]}.", en_switch);
        return OAL_ERR_CODE_INVALID_CONFIG;
    }

    /* ap和sta都需要配置mib和vap的能力 */
    //pst_mac_vap->st_cap_flag.bit_txop_ps = en_switch;
    pst_mac_vap->pst_mib_info->st_wlan_mib_vht_sta_config.en_dot11VHTTXOPPowerSaveOptionImplemented = en_switch;

    /* sta模式还需要配置mac寄存器 */
    if (WLAN_VAP_MODE_BSS_STA == pst_mac_vap->en_vap_mode)
    {
        dmac_txopps_set_machw(pst_mac_vap);
    }

    return OAL_SUCC;
}
示例#7
0
/*****************************************************************************
 函 数 名  : dmac_txopps_set_machw_en_sta
 功能描述  : sta模式,配置mac txop_ps使能寄存器,包括使能位,condition1和co-
             ndition2
 输入参数  : pst_mac_vap            : mac_vap结构
             pst_txopps_machw_param : 设置mac txop ps使能寄存器参数结构
 输出参数  : 无
 返 回 值  :
 调用函数  :
 被调函数  :

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

*****************************************************************************/
oal_uint32  dmac_txopps_set_machw_en_sta(
                                    mac_vap_stru *pst_mac_vap,
                                    dmac_txopps_machw_param_stru *pst_txopps_machw_param)
{
    mac_device_stru     *pst_device;

    if (OAL_UNLIKELY(OAL_PTR_NULL == pst_mac_vap || OAL_PTR_NULL == pst_txopps_machw_param))
    {
        OAM_ERROR_LOG2(0, OAM_SF_TXOP,
                       "{dmac_txopps_set_machw_en_sta::param is null,vap=[%d],machw_param=[%d]}.",
                       pst_mac_vap, pst_txopps_machw_param);
        return OAL_ERR_CODE_PTR_NULL;
    }

    pst_device = mac_res_get_dev(pst_mac_vap->uc_device_id);
    if (OAL_UNLIKELY(OAL_PTR_NULL == pst_device))
    {
        OAM_ERROR_LOG0(pst_mac_vap->uc_vap_id, OAM_SF_TXOP,
                       "{dmac_txopps_set_machw_en_sta:: mac_device is null}.");
        return OAL_ERR_CODE_PTR_NULL;
    }

    hal_set_txop_ps_enable(pst_device->pst_device_stru, pst_txopps_machw_param->en_machw_txopps_en);
    hal_set_txop_ps_condition1(pst_device->pst_device_stru, pst_txopps_machw_param->en_machw_txopps_condition1);
    hal_set_txop_ps_condition2(pst_device->pst_device_stru, pst_txopps_machw_param->en_machw_txopps_condition2);

    return OAL_SUCC;
}
oal_uint32  dmac_data_acq_recv_msg(oal_uint8 *puc_data, oal_uint32 ul_len)
{
    dmac_data_acq_data_head_stru   *pst_frag_hdr;

    pst_frag_hdr = (dmac_data_acq_data_head_stru *)puc_data;

    switch (pst_frag_hdr->en_send_type)
    {
        case DMAC_DATA_ACQ_SEND_TYPE_READY:
            /*  APP侧接收数据成功,继续发送  */
            dmac_data_acq_set_send_flag(OAL_TRUE);
            break;

        case DMAC_DATA_ACQ_SEND_TYPE_FAIL:
            /*  APP侧接收数据失败  */
            OAM_ERROR_LOG0(0, OAM_SF_ANY, "{dmac_data_acq_report_data_info::DMAC_DATA_ACQ_SEND_TYPE_FAIL.}");

            g_st_data_acq.en_daq_app_error = OAL_TRUE;
            break;

        case DMAC_DATA_ACQ_SEND_TYPE_ACK:
            /* APP收到ACK */

            g_st_data_acq.uc_ack_flag = OAL_TRUE;
            break;
        default:
            return OAL_FAIL;
    }

    return OAL_SUCC;

}
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);
}
示例#10
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;
}
oal_uint32  dmac_data_acq_get_record(oal_void)
{
    oal_netbuf_stru                *pst_queue_netbuf;
    dmac_data_acq_info_stru        *pst_daq_info;
    oal_uint32                      ul_ret = OAL_FAIL;

    /* 采集完成可以上传数据 */
    if (DMAC_DATA_ACQ_STATUS_COMPLETE == g_st_data_acq.en_daq_status)
    {
        /* 上传数据 */
        g_st_data_acq.en_daq_app_error = OAL_FALSE;
        pst_queue_netbuf = OAL_MEM_NETBUF_ALLOC(OAL_NORMAL_NETBUF, DMAC_DATA_ACQ_UNIT_MAX_LEN, OAL_NETBUF_PRIORITY_MID);

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

            return OAL_ERR_CODE_PTR_NULL;
        }
        pst_daq_info = (dmac_data_acq_info_stru *)oal_netbuf_data(pst_queue_netbuf);

        pst_daq_info->ul_daq_addr = (oal_uint32)g_st_data_acq.st_daq_prep_info.puc_start_addr;
        pst_daq_info->ul_data_len = g_st_data_acq.ul_length;
        pst_daq_info->ul_unit_len = DMAC_DATA_ACQ_UNIT_DATA_LEN;

        oal_netbuf_add_to_list_tail(pst_queue_netbuf, &g_st_data_acq.st_daq_workqueue.rx_daq_dbg_seq);

        oal_queue_work(g_st_data_acq.st_daq_workqueue.daq_rx_workqueue, &g_st_data_acq.st_daq_workqueue.rx_daq_work);

        ul_ret = OAL_SUCC;
    }
    else
    {
        /* 数据采集未完成,不允许上传数据 */
        OAM_ERROR_LOG0(0, OAM_SF_ANY, "{dmac_data_acq_get_record::data acq is running.}");

        ul_ret = OAL_FAIL;
    }

    return ul_ret;
}
示例#12
0
/*****************************************************************************
 函 数 名  : dmac_txopps_init_machw_sta
 功能描述  : STA模式,VAP初始化时设置mac txop ps使能寄存器,如果支持则使能位
             ,condition1以及condition2都为1
 输入参数  : 无
 输出参数  : 无
 返 回 值  :
 调用函数  :
 被调函数  :

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

*****************************************************************************/
oal_uint32  dmac_txopps_init_machw_sta(dmac_vap_stru *pst_dmac_vap)
{
    if (OAL_UNLIKELY(OAL_PTR_NULL == pst_dmac_vap))
    {
        OAM_ERROR_LOG0(0, OAM_SF_TXOP, "{dmac_txopps_init_machw_sta::dmac_vap is null!}.");
        return OAL_ERR_CODE_PTR_NULL;
    }

    dmac_txopps_set_machw(&pst_dmac_vap->st_vap_base_info);

    return OAL_SUCC;
}
oal_uint32 dmac_data_acq_report_data_info(oal_uint8 *puc_daq_addr, oal_uint32 ul_len, oal_netbuf_stru *pst_netbuf)
{
    dmac_data_acq_info_stru        *pst_daq_data_info           = OAL_PTR_NULL;
    dmac_data_acq_data_head_stru   *pst_daq_data_head           = OAL_PTR_NULL;
    oal_int32                       l_bytes = 0;
    oal_uint32                      ul_time = 0;

    /***** 发送数采基本信息给app 填写消息头 *****/
    pst_daq_data_head = (dmac_data_acq_data_head_stru *)oal_netbuf_data(pst_netbuf);

    pst_daq_data_head->en_send_type = DMAC_DATA_ACQ_SEND_TYPE_INFO;
    pst_daq_data_head->ul_msg_sn    = 0;
    pst_daq_data_head->ul_data_len  = OAL_SIZEOF(dmac_data_acq_info_stru);

    /***** 发送数采基本信息给app 填写消息内容 *****/
    pst_daq_data_info = (dmac_data_acq_info_stru *)(oal_netbuf_data(pst_netbuf) + DMAC_DATA_ACQ_DATA_HEAD_LEN);

    pst_daq_data_info->ul_daq_addr    = (oal_uint32)puc_daq_addr;
    pst_daq_data_info->ul_data_len    = ul_len;
    pst_daq_data_info->ul_unit_len    = DMAC_DATA_ACQ_UNIT_DATA_LEN;


    /***** 将daq info通知app侧 *****/
    l_bytes = oam_netlink_kernel_send(oal_netbuf_data(pst_netbuf), OAL_SIZEOF(dmac_data_acq_info_stru) + DMAC_DATA_ACQ_DATA_HEAD_LEN, OAM_NL_CMD_DAQ);

    if (l_bytes <= 0)
    {
        OAM_ERROR_LOG1(0, OAM_SF_ANY, "{dmac_data_acq_report_data_info::invalid l_bytes[%d].}", l_bytes);

        return OAL_FAIL;
    }

    g_st_data_acq.uc_ack_flag = OAL_FALSE;

    while(!g_st_data_acq.uc_ack_flag)
    {

        oal_msleep(1000);

        if (DMAC_DATA_ACQ_MAX_WAIT_TIME <= ul_time)
        {
            OAM_ERROR_LOG0(0, OAM_SF_ANY, "{dmac_data_acq_report_data_info::wait app ack timeout. Try again.}");

            return OAL_FAIL;
        }

        ul_time++;
    }

    return OAL_SUCC;
}
int32 hwifi_get_mac_addr(uint8 *puc_buf)
{
    struct hisi_nve_info_user st_info;
    int32 l_ret = -1;
    int32 l_sum = 0;

    if (NULL == puc_buf)
    {
        OAM_ERROR_LOG0(0, OAM_SF_ANY, "hisi_customize_wifi::buf is NULL!");
        return INI_FAILED;
    }

    oal_memset(puc_buf, 0, MAC_LEN);

    oal_memset(&st_info, 0, sizeof(st_info));
    st_info.nv_number  = NV_WLAN_NUM;   //nve item

    strncpy(st_info.nv_name, "MACWLAN", sizeof("MACWLAN"));

    st_info.valid_size = NV_WLAN_VALID_SIZE;
    st_info.nv_operation = NV_READ;

    if (0 != g_auc_wifimac[0] || 0 != g_auc_wifimac[1] || 0 != g_auc_wifimac[2] || 0 != g_auc_wifimac[3]
        || 0 != g_auc_wifimac[4] || 0 != g_auc_wifimac[5])
    {
        memcpy(puc_buf, g_auc_wifimac, MAC_LEN);
        return INI_SUCC;
    }

    l_ret = hisi_nve_direct_access(&st_info);

    if (!l_ret)
    {
        l_sum = char2byte(st_info.nv_data, puc_buf);
        if (0 != l_sum)
        {
            INI_WARNING("hisi_customize_wifi get MAC from NV: mac="MACFMT"\n", MAC2STR(puc_buf));
            oal_memcopy(g_auc_wifimac, puc_buf, MAC_LEN);
        }else{
            random_ether_addr(puc_buf);
            puc_buf[1] = 0x11;
            puc_buf[2] = 0x02;
        }
    }else{
        random_ether_addr(puc_buf);
        puc_buf[1] = 0x11;
        puc_buf[2] = 0x02;
    }

    return INI_SUCC;
}
/*****************************************************************************
 函 数 名  : dmac_get_device_freq_level
 功能描述  : 获取device的调频等级
 输入参数  : 无
 输出参数  : device的调频类型
 返 回 值  : oal_uint8
 调用函数  :
 被调函数  :

 修改历史      :
  1.日    期   : 2015年11月16日
    作    者   : z00185449
    修改内容   : 新生成函数

*****************************************************************************/
oal_uint8 dmac_get_device_freq_level(void)
{
    oal_uint8 uc_vap_id;
    mac_vap_stru *pst_mac_vap;
    wlan_auto_freq_bw_enum_uint8 uc_auto_freq_bw_type = WLAN_BW_20;

    for (uc_vap_id = 0; uc_vap_id < WLAN_VAP_MAX_NUM_PER_DEVICE_LIMIT; uc_vap_id++)
    {
        pst_mac_vap = (mac_vap_stru *)mac_res_get_mac_vap(uc_vap_id);
        if (OAL_PTR_NULL == pst_mac_vap)
        {
            OAM_ERROR_LOG0(0, OAM_SF_ANY, "{dmac_get_device_freq_type pst_mac_vap is null.}");
            continue;
        }
        if ((MAC_VAP_STATE_UP != pst_mac_vap->en_vap_state) &&
            (MAC_VAP_STATE_PAUSE != pst_mac_vap->en_vap_state))
        {
            continue;
        }
        if ((pst_mac_vap->en_protocol != WLAN_VHT_MODE) &&
            (pst_mac_vap->en_protocol != WLAN_VHT_ONLY_MODE))   /*非11ac*/
        {
            if ((WLAN_BAND_WIDTH_40MINUS == pst_mac_vap->st_channel.en_bandwidth) ||
                (WLAN_BAND_WIDTH_40PLUS == pst_mac_vap->st_channel.en_bandwidth))
            {
                if (uc_auto_freq_bw_type <= WLAN_HT_BW_40)
                {
                    uc_auto_freq_bw_type = WLAN_HT_BW_40;
                }
            }
        }
        else
        {
            if ((WLAN_BAND_WIDTH_20M == pst_mac_vap->st_channel.en_bandwidth) ||
                (WLAN_BAND_WIDTH_40PLUS == pst_mac_vap->st_channel.en_bandwidth) ||
                (WLAN_BAND_WIDTH_40MINUS == pst_mac_vap->st_channel.en_bandwidth))
            {
                if (uc_auto_freq_bw_type <= WLAN_VHT_BW_40)
                {
                    uc_auto_freq_bw_type = WLAN_VHT_BW_40;
                }
            }
            else
            {
                uc_auto_freq_bw_type = WLAN_VHT_BW_80;
            }
        }
    }
//    OAM_WARNING_LOG1(0, OAM_SF_ANY, "{dmac_config_get_device_freq_type uc_auto_freq_bw_type = %d.}",uc_auto_freq_bw_type);
    return uc_auto_freq_bw_type;
}
示例#16
0
/*****************************************************************************
 函 数 名  : frw_task_event_handler_register
 功能描述  : 供外部模块注册tasklet处理函数中执行的函数
 输入参数  : p_func: 需要被执行的函数
 输出参数  : 无
 返 回 值  : 无
 调用函数  :
 被调函数  :

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

*****************************************************************************/
oal_void  frw_task_event_handler_register(oal_void (*p_func)(oal_uint))
{
    oal_uint32 ul_core_id;

    if (OAL_UNLIKELY(OAL_PTR_NULL == p_func))
    {
        OAM_ERROR_LOG0(0, OAM_SF_FRW, "{frw_task_event_handler_register:: p_func is null ptr}");
        return;
    }

    for (ul_core_id = 0; ul_core_id < WLAN_FRW_MAX_NUM_CORES; ul_core_id++)
    {
        g_ast_event_task[ul_core_id].p_event_handler_func = p_func;
    }
}
oal_uint32  dmac_data_acq_get_status(mac_vap_stru *pst_mac_vap,oal_uint8 *puc_param, mac_device_stru *pst_device)
{
    oal_uint32                  ul_reg_value = 0;

    /* 回读寄存器 */
    hal_get_daq_status(pst_device->pst_device_stru, &ul_reg_value);

    /* 采集完成 */
    if (BIT0 == ul_reg_value)
    {
        g_st_data_acq.en_daq_status = DMAC_DATA_ACQ_STATUS_COMPLETE;
        OAM_ERROR_LOG0(pst_mac_vap->uc_vap_id, OAM_SF_ANY, "{dmac_data_acq_get_status::end func.}");
    }

    return OAL_SUCC;
}
示例#18
0
oal_bool_enum_uint8 hmac_protection_need_sync(mac_vap_stru *pst_mac_vap,
                                mac_h2d_protection_stru *pst_h2d_prot)
{
    mac_h2d_protection_stru *pst_prot_old;
    hmac_vap_stru       *pst_hmac_vap;
    mac_protection_stru *pst_old;
    mac_protection_stru *pst_new;

    pst_hmac_vap = (hmac_vap_stru *)mac_res_get_hmac_vap(pst_mac_vap->uc_vap_id);
    if (OAL_PTR_NULL == pst_hmac_vap)
    {
        OAM_ERROR_LOG0(pst_mac_vap->uc_vap_id, OAM_SF_ANY,
                    "{hmac_protection_need_sync::null hmac_vap}");
        return OAL_FALSE;
    }
    pst_prot_old = &pst_hmac_vap->st_prot;

    if ( (pst_prot_old->en_dot11HTProtection != pst_h2d_prot->en_dot11HTProtection) ||
         (pst_prot_old->en_dot11RIFSMode != pst_h2d_prot->en_dot11RIFSMode) ||
         (pst_prot_old->en_dot11LSIGTXOPFullProtectionActivated != pst_h2d_prot->en_dot11LSIGTXOPFullProtectionActivated) ||
         (pst_prot_old->en_dot11NonGFEntitiesPresent != pst_h2d_prot->en_dot11NonGFEntitiesPresent)
         )
    {
        oal_memcopy(pst_prot_old, pst_h2d_prot, OAL_SIZEOF(mac_h2d_protection_stru));
        return OAL_TRUE;
    }

    pst_old = &pst_prot_old->st_protection;
    pst_new = &pst_h2d_prot->st_protection;

    if ( (pst_old->en_protection_mode != pst_new->en_protection_mode) ||
         (pst_old->bit_auto_protection != pst_new->bit_auto_protection) ||
         (pst_old->bit_obss_non_erp_present != pst_new->bit_obss_non_erp_present) ||
         (pst_old->bit_obss_non_ht_present != pst_new->bit_obss_non_ht_present) ||
         (pst_old->bit_rts_cts_protect_mode != pst_new->bit_rts_cts_protect_mode) ||
         (pst_old->bit_lsig_txop_protect_mode != pst_new->bit_lsig_txop_protect_mode) ||
         (pst_old->uc_sta_non_ht_num != pst_new->uc_sta_non_ht_num)
      )
    {
        oal_memcopy(pst_prot_old, pst_h2d_prot, OAL_SIZEOF(mac_h2d_protection_stru));
        return OAL_TRUE;
    }

    return OAL_FALSE;
}
示例#19
0
/*****************************************************************************
 函 数 名  : dmac_scan_verify_init
 功能描述  : SCAN验证功能初始化函数
 输入参数  : 无
 输出参数  : 无
 返 回 值  :
 调用函数  :
 被调函数  :

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

*****************************************************************************/
oal_void  dmac_scan_verify_init(oal_void)
{
#if defined(_PRE_WLAN_CHIP_TEST) && (_PRE_OS_VERSION_LINUX == _PRE_OS_VERSION)
    /* 创建PROC目录 */
    g_pst_scan_proc_entry = SCANNER_CREATE_PROC_ENTRY(SCANNER_VERIFY_PROC_NAME, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH, NULL);
    if (OAL_PTR_NULL == g_pst_scan_proc_entry)
    {
        OAM_ERROR_LOG0(0, OAM_SF_SCAN,"dmac_scan_verify: proc entry init failed");
        return;
    }

    g_pst_scan_proc_entry->data  = 0;
    g_pst_scan_proc_entry->nlink = 1;        /* linux创建proc默认值 */
    g_pst_scan_proc_entry->proc_fops  = &dmac_scan_proc_fops;

    OAL_MEMZERO(&g_st_scanner_record, OAL_SIZEOF(g_st_scanner_record));
#endif
}
oal_uint32 dmac_data_acq_mem_alloc(oal_void)
{
    /*  先释放内存 */
    dmac_data_acq_mem_free();

    OAL_MEMZERO(&(g_st_data_acq.st_daq_prep_info), OAL_SIZEOF(dmac_data_acq_prep_stru));

    /* 申请内存 */
    g_st_data_acq.st_daq_prep_info.puc_start_addr = (oal_uint8 *)oal_memalloc(DMAC_DATA_ACQ_MAX_LEN);

    if (OAL_PTR_NULL == g_st_data_acq.st_daq_prep_info.puc_start_addr)
    {
        OAM_ERROR_LOG0(0, OAM_SF_ANY, "{dmac_data_acq_mem_alloc::puc_start_addr null.}");

        return OAL_FAIL;
    }

    return OAL_SUCC;
}
int32 hwifi_fetch_ori_caldata(uint8* auc_caldata, int32 l_nvm_len)
{
    int32 l_ret = INI_FAILED;
    int32 l_cfg_id;
    int32 aul_nvram_params[NVRAM_PARAMS_INDEX_BUTT]={0};

    if (l_nvm_len != HISI_CUST_NVRAM_LEN)
    {
        OAM_ERROR_LOG2(0, OAM_SF_ANY, "hwifi_fetch_ori_caldata atcmd[nv_len:%d] and plat_ini[nv_len:%d] model have different nvm lenth!!",
                        l_nvm_len, HISI_CUST_NVRAM_LEN);
        return INI_FAILED;
    }

    oal_memset(auc_caldata, 0x00, HISI_CUST_NVRAM_LEN);

    for (l_cfg_id = NVRAM_PARAMS_INDEX_0; l_cfg_id < NVRAM_PARAMS_INDEX_BUTT; l_cfg_id++)
    {
        l_ret = get_cust_conf_int32(INI_MODU_WIFI, g_ast_nvram_config_ini[l_cfg_id].name, &aul_nvram_params[l_cfg_id]);
        if(INI_FAILED == l_ret)
        {
            OAM_ERROR_LOG1(0, OAM_SF_ANY, "hwifi_fetch_ori_caldata read ori caldata %d from ini failed!", l_cfg_id);
            break;
        }
    }

    if (NVRAM_PARAMS_INDEX_BUTT == l_cfg_id)
    {
        OAM_INFO_LOG0(0, OAM_SF_ANY, "hwifi_fetch_ori_caldata read ori caldata from ini success!");
        oal_memcopy(auc_caldata, aul_nvram_params, HISI_CUST_NVRAM_LEN);
        return INI_SUCC;
    }

    l_ret = get_cust_conf_string(CUST_MODU_DTS, NVRAM_PARAMS_ARRAY, auc_caldata, HISI_CUST_NVRAM_LEN);
    if(INI_FAILED == l_ret)
    {
        OAM_ERROR_LOG0(0, OAM_SF_ANY, "hwifi_fetch_ori_caldata read ori caldata from dts failed!");
        return INI_FAILED;
    }

    return INI_SUCC;
}
示例#22
0
/*****************************************************************************
 函 数 名  : dmac_reg_timeout
 功能描述  : 周期定时器超时处理函数
 输入参数  : 无
 输出参数  : 无
 返 回 值  :
 调用函数  :
 被调函数  :

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

*****************************************************************************/
OAL_STATIC oal_uint32  dmac_reg_timeout(void *p_arg)
{
    hal_to_dmac_device_stru    *pst_device;

    pst_device = (hal_to_dmac_device_stru *)p_arg;
    if (OAL_PTR_NULL == pst_device)
    {
        MAC_ERR_LOG(0, "ptr is null !");
        OAM_ERROR_LOG0(0, OAM_SF_ANY, "{dmac_reg_timeout::pst_device null.}");

        return OAL_ERR_CODE_PTR_NULL;
    }

    if(OAL_SUCC != hi1151_debug_refresh_reg(pst_device, OAM_REG_EVT_PRD))
    {
        return OAL_FAIL;
    }
    hi1151_debug_frw_evt(pst_device);

    return OAL_SUCC;
}
oal_uint8 device_psm_main_function(oal_void)
{
#ifdef _PRE_WLAN_FEATURE_BTCOEX
    mac_device_stru         *pst_mac_device;
    hal_to_dmac_device_stru *pst_hal_device;
#endif

    device_main_function();

#ifdef _PRE_WLAN_FEATURE_BTCOEX
    pst_mac_device = mac_res_get_dev(0);
    if (OAL_UNLIKELY(OAL_PTR_NULL == pst_mac_device))
    {
        OAM_ERROR_LOG0(0, OAM_SF_ANY, "{device_psm_main_function::pst_device[id:0] is NULL!}");
        return OAL_ERR_CODE_PTR_NULL;
    }
    pst_hal_device = pst_mac_device->pst_device_stru;
    hal_btcoex_process_bt_status(pst_hal_device);
#endif

    return OAL_SUCC;
}
示例#24
0
/*****************************************************************************
 函 数 名  : dmac_wep_remove_key
 功能描述  : 将一个wep密钥从硬件LUT表中删除
 输入参数  : mac_vap_stru *pst_mac_vap, oal_uint8 uc_key_id
 输出参数  : 无
 返 回 值  :
 调用函数  :
 被调函数  :

 修改历史      :
  1.日    期   : 2013年10月17日
    作    者   : l00218984
    修改内容   : 新生成函数

*****************************************************************************/
oal_void  dmac_wep_remove_key(mac_vap_stru *pst_mac_vap, oal_uint8 uc_key_id)
{
    hal_security_key_stru    st_wep_key         = {0};
    dmac_vap_stru           *pst_dmac_vap       = OAL_PTR_NULL;

    pst_dmac_vap = mac_res_get_dmac_vap(pst_mac_vap->uc_vap_id);
    if (OAL_PTR_NULL == pst_dmac_vap)
    {
        OAM_ERROR_LOG0(pst_mac_vap->uc_vap_id, OAM_SF_WEP, "{dmac_wep_remove_key::pst_dmac_vap null.}");

        return;
    }

    st_wep_key.uc_key_id     = uc_key_id;
    st_wep_key.en_key_type   = WLAN_KEY_TYPE_TX_GTK;
    st_wep_key.uc_lut_idx    = pst_dmac_vap->pst_hal_vap->uc_vap_id;

    /* 写硬件寄存器   */
    hal_ce_del_key(pst_dmac_vap->pst_hal_device, &st_wep_key);


}
示例#25
0
/*****************************************************************************
 函 数 名  : hmac_roam_alg_bss_in_ess
 功能描述  :
 输入参数  :
 输出参数  : 无
 返 回 值  : OAL_SUCC 或 失败错误码
 调用函数  :
 被调函数  :

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

*****************************************************************************/
oal_uint32 hmac_roam_alg_bss_in_ess(hmac_roam_info_stru *pst_roam_info, mac_bss_dscr_stru *pst_bss_dscr)
{
    hmac_vap_stru              *pst_hmac_vap;
    mac_vap_stru               *pst_mac_vap;
    hmac_roam_alg_stru         *pst_roam_alg;
    mac_cfg_ssid_param_stru     st_cfg_ssid;
    oal_uint8                   uc_stru_len;

    if ((OAL_PTR_NULL == pst_roam_info) || (OAL_PTR_NULL == pst_bss_dscr))
    {
        OAM_ERROR_LOG0(0, OAM_SF_ROAM, "{hmac_roam_alg_bss_in_ess::param null.}");
        return OAL_ERR_CODE_PTR_NULL;
    }

    pst_hmac_vap = pst_roam_info->pst_hmac_vap;
    if (OAL_PTR_NULL == pst_hmac_vap)
    {
        return OAL_ERR_CODE_ROAM_INVALID_VAP;
    }

    pst_mac_vap   = &(pst_hmac_vap->st_vap_base_info);
    mac_mib_get_ssid(pst_mac_vap, &uc_stru_len, (oal_uint8 *)(&st_cfg_ssid));

    if ((OAL_STRLEN(pst_bss_dscr->ac_ssid) != st_cfg_ssid.uc_ssid_len) ||
        (0 != oal_memcmp(st_cfg_ssid.ac_ssid, pst_bss_dscr->ac_ssid, st_cfg_ssid.uc_ssid_len)))
    {
        return OAL_SUCC;
    }
    pst_roam_alg = &(pst_roam_info->st_alg);

    /* 是否扫描到了当前关联的 bss, 仅置位,不过滤 */
    if (0 != oal_compare_mac_addr(pst_mac_vap->auc_bssid, pst_bss_dscr->auc_bssid))
    {
        pst_roam_alg->uc_another_bss_scaned = 1;
        hmac_roam_ignore_rssi_trigger(pst_hmac_vap, OAL_FALSE);
    }

    return OAL_SUCC;
}
示例#26
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;
}
示例#27
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;
}
示例#28
0
/*****************************************************************************
 函 数 名  : hmac_protection_obss_aging_ap
 功能描述  : OBSS老化处理, 本函数定期对device每个VAP进行保护老化处理(5000ms 执行一次)
 输入参数  : p_arg : 定时器传入的指针参数
 输出参数  : 无
 返 回 值  : oal_uint32
 调用函数  :
 被调函数  :

 修改历史      :
  1.日    期   : 2015年4月28日
    作    者   : w00269675
    修改内容   : 新生成函数

*****************************************************************************/
oal_uint32  hmac_protection_obss_update_timer(void *p_arg)
{
    mac_device_stru     *pst_mac_device;
    oal_uint8            uc_vap_idx;
    mac_vap_stru        *pst_mac_vap;

    if (OAL_PTR_NULL == p_arg)
    {
        OAM_ERROR_LOG0(0, OAM_SF_ANY, "{hmac_protection_obss_update_timer::p_arg null.}");
        return OAL_ERR_CODE_PTR_NULL;
    }

    pst_mac_device = (mac_device_stru *)p_arg;

    /* 遍历device下对应VAP, 定时更新OBSS 保护模式 */
    /* 业务vap从1开始 */
    for (uc_vap_idx = 0; uc_vap_idx < pst_mac_device->uc_vap_num; uc_vap_idx++)
    {
        pst_mac_vap = mac_res_get_mac_vap(pst_mac_device->auc_vap_id[uc_vap_idx]);
        if (OAL_UNLIKELY(OAL_PTR_NULL == pst_mac_vap))
        {
            OAM_WARNING_LOG0(uc_vap_idx, OAM_SF_ANY, "{hmac_protection_obss_update_timer::pst_mac_vap null.}");
            return OAL_ERR_CODE_PTR_NULL;
        }

        /* OBSS老化只针对AP模式,非AP模式则跳出 */
        if (WLAN_VAP_MODE_BSS_AP != pst_mac_vap->en_vap_mode)
        {
            continue;
        }

        hmac_protection_obss_aging_ap(pst_mac_vap);
    }

    return OAL_SUCC;
}
示例#29
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;
    }
OAL_STATIC oal_uint32  hmac_frag_process(hmac_vap_stru *pst_hmac_vap,
                                   oal_netbuf_stru *pst_netbuf_original,
                                   mac_tx_ctl_stru *pst_tx_ctl,
                                   oal_uint32 ul_cip_hdrsize,
                                   oal_uint32 ul_max_tx_unit)
{
    mac_ieee80211_frame_stru *pst_mac_header;
    mac_ieee80211_frame_stru *pst_frag_header;
    oal_netbuf_stru          *pst_netbuf;
    oal_netbuf_stru          *pst_netbuf_prev;
    oal_uint32                ul_total_hdrsize;
    oal_uint32                ul_frag_num;
    oal_uint32                ul_frag_size;
    oal_int32                 l_remainder;
    oal_uint32                ul_payload  = 0;
    oal_uint32                ul_offset;
    mac_tx_ctl_stru          *pst_tx_ctl_copy;
    oal_uint32                ul_mac_hdr_size;

    ul_mac_hdr_size = MAC_80211_QOS_HTC_4ADDR_FRAME_LEN;

    pst_mac_header = pst_tx_ctl->pst_frame_header;
    pst_mac_header->st_frame_control.bit_more_frag = OAL_TRUE;
    ul_total_hdrsize = ul_mac_hdr_size + ul_cip_hdrsize;
    ul_frag_num = 1;
    /* 加密字节数包含在分片门限中,预留加密字节长度,由硬件填写加密头 */

    ul_offset       = ul_max_tx_unit - ul_cip_hdrsize - ul_mac_hdr_size;
    l_remainder    = (oal_int32)(OAL_NETBUF_LEN(pst_netbuf_original) - ul_offset - ul_mac_hdr_size);
    pst_netbuf_prev = pst_netbuf_original;

    do
    {
        ul_frag_size = ul_total_hdrsize + (oal_uint32)l_remainder;

        /* 判断是否还有更多的分片 */
        if (ul_frag_size > ul_max_tx_unit)
        {
            ul_frag_size = ul_max_tx_unit;
        }

        pst_netbuf = oal_netbuf_alloc(ul_frag_size + MAC_80211_QOS_HTC_4ADDR_FRAME_LEN, MAC_80211_QOS_HTC_4ADDR_FRAME_LEN, 4);
        if (OAL_PTR_NULL == pst_netbuf)
        {
            /* 在外部释放之前申请的报文 */
            OAM_ERROR_LOG0(pst_hmac_vap->st_vap_base_info.uc_vap_id, OAM_SF_ANY, "{hmac_frag_process::pst_netbuf null.}");
            return OAL_ERR_CODE_PTR_NULL;
        }

        pst_tx_ctl_copy = (mac_tx_ctl_stru *)OAL_NETBUF_CB(pst_netbuf);
        /* 拷贝cb字段 */
        oal_memcopy(pst_tx_ctl_copy, pst_tx_ctl, MAC_TX_CTL_SIZE);

        oal_netbuf_copy_queue_mapping(pst_netbuf, pst_netbuf_original);

        /*netbuf的headroom大于802.11 mac头长度*/
        pst_frag_header = (mac_ieee80211_frame_stru *)(OAL_NETBUF_PAYLOAD(pst_netbuf)- MAC_80211_QOS_HTC_4ADDR_FRAME_LEN);
        pst_tx_ctl_copy->bit_80211_mac_head_type = 1;  /*指示mac头部在skb中*/

        /* 拷贝帧头内容 */
        oal_memcopy(pst_frag_header, pst_mac_header, pst_tx_ctl->uc_frame_header_length);
        /* 赋值分片号 */
        pst_frag_header->bit_frag_num = ul_frag_num;
        ul_frag_num++;
        /* 计算分片报文帧体长度 */
        ul_payload = ul_frag_size - ul_total_hdrsize;

        oal_netbuf_copydata(pst_netbuf_original, (ul_offset+ul_mac_hdr_size), OAL_NETBUF_PAYLOAD(pst_netbuf), ul_payload);

        oal_netbuf_set_len(pst_netbuf, ul_payload);
        ((mac_tx_ctl_stru *)OAL_NETBUF_CB(pst_netbuf))->pst_frame_header = pst_frag_header;
        ((mac_tx_ctl_stru *)OAL_NETBUF_CB(pst_netbuf))->us_mpdu_len      = (oal_uint16)ul_payload;
        OAL_NETBUF_NEXT(pst_netbuf_prev)                                 = pst_netbuf;
        pst_netbuf_prev                                                  = pst_netbuf;

        if (pst_tx_ctl_copy->bit_80211_mac_head_type == 1)
        {
            oal_netbuf_push(pst_netbuf, MAC_80211_QOS_HTC_4ADDR_FRAME_LEN);
        }

        /* 计算下一个分片报文的长度和偏移 */
        l_remainder    -= (oal_int32)ul_payload;
        ul_offset       += ul_payload;
    }while(l_remainder > 0);

    pst_frag_header->st_frame_control.bit_more_frag = OAL_FALSE;
    OAL_NETBUF_NEXT(pst_netbuf) = OAL_PTR_NULL;

    /* 原始报文作为分片报文的第一个 */
    oal_netbuf_trim(pst_netbuf_original, OAL_NETBUF_LEN(pst_netbuf_original) - (ul_max_tx_unit - ul_cip_hdrsize));
    pst_tx_ctl->us_mpdu_len = (oal_uint16)(OAL_NETBUF_LEN(pst_netbuf_original) - ul_mac_hdr_size);


    return OAL_SUCC;
}