Ejemplo n.º 1
0
/*****************************************************************************
 函 数 名  : dmac_device_exception_report_timeout_fn
 功能描述  : 异常维测信息上报,定期读取寄存器,出现错误直接上报
 输入参数  : 无
 输出参数  : 无
 返 回 值  :
 调用函数  :
 被调函数  :

 修改历史      :
  1.日    期   : 2014年8月4日
    作    者   : huxiaotong
    修改内容   : 新生成函数
  2.日    期   : 2015年1月4日
    作    者   : daihu
    修改内容   : 增加双芯片时,pcie0和pcie1的读写

*****************************************************************************/
oal_uint32  dmac_device_exception_report_timeout_fn(oal_void *p_arg)
{
#if ((_PRE_OS_VERSION_LINUX == _PRE_OS_VERSION) && (_PRE_MULTI_CORE_MODE_OFFLOAD_DMAC != _PRE_MULTI_CORE_MODE))
    oal_uint8                   uc_pci_device_id = 0;
    oal_uint32                  ul_reg_pci_rpt_val  = 0;
    oal_uint32                  ul_pci_warn_clear_cfg_val = 0xFFFFFFFF;             /* 写1清 */
    oal_uint32                  ul_reg_pci_rpt_addr_offset = 0x110;                 /* PCIE 0x110寄存器 */
    oal_bus_chip_stru           *pst_bus_chip = OAL_PTR_NULL;
    hal_to_dmac_device_stru     *pst_hal_device = OAL_PTR_NULL;
    mac_device_stru             *pst_mac_device = OAL_PTR_NULL;

    pst_hal_device = (hal_to_dmac_device_stru *)p_arg;

    /* 获取chip id值 */
    uc_pci_device_id = pst_hal_device->uc_chip_id;

    oal_bus_get_chip_instance(&pst_bus_chip, uc_pci_device_id);

    /* 然后读取1151侧的 PCIE */
    ul_reg_pci_rpt_val   = 0;
    oal_pci_read_config_dword(pst_bus_chip->pst_pci_device, ul_reg_pci_rpt_addr_offset, &ul_reg_pci_rpt_val);

    pst_mac_device = mac_res_get_dev(pst_hal_device->uc_mac_device_id);
    if (OAL_UNLIKELY(OAL_PTR_NULL == pst_mac_device))
    {
        OAM_ERROR_LOG1(0, OAM_SF_ANY, "{dmac_device_exception_report_timeout_fn::pst_mac_device[%d] is NULL!}", pst_hal_device->uc_mac_device_id);
        return OAL_ERR_CODE_PTR_NULL;
    }

    pst_mac_device->ul_pcie_read_counter++;

    /* Bit[12]: Timer Timeout Status, 判断是否发生 timeout异常 */
    if(0 != (ul_reg_pci_rpt_val & 0x1000))
    {
        pst_mac_device->ul_pcie_reg110_timeout_counter++;

        OAM_WARNING_LOG4(0, OAM_SF_ANY,
         "{dmac_device_exception_report_timeout_fn:: read 1151 pcie reg0x110 timeout, chip id = %d, device id = %d, reg0x110 = [0x%08x]}, timeout counter: %d.",
            pst_hal_device->uc_chip_id, pst_hal_device->uc_mac_device_id, ul_reg_pci_rpt_val, pst_mac_device->ul_pcie_reg110_timeout_counter);

        oal_pci_write_config_dword(pst_bus_chip->pst_pci_device, ul_reg_pci_rpt_addr_offset, ul_pci_warn_clear_cfg_val);
    }
    /* 为防止出现 timeout异常后,长时间再未出现异常,每隔 10 * 64秒打印一次 timeout异常统计 */
    else if(0 == (pst_mac_device->ul_pcie_read_counter & 0x3F))
    {
        OAM_WARNING_LOG3(0, OAM_SF_ANY,
             "{dmac_device_exception_report_timeout_fn:: chip id = %d, device id = %d, reg0x110 read timeout counter: %d.",
                pst_hal_device->uc_chip_id, pst_hal_device->uc_mac_device_id, pst_mac_device->ul_pcie_reg110_timeout_counter);
    }
#endif

    return OAL_SUCC;
}
OAL_STATIC int32 hwifi_config_init_nvram(void)
{
    int32 l_ret = INI_FAILED;
    int32 l_cfg_id;
    int32 aul_nvram_params[NVRAM_PARAMS_INDEX_BUTT]={0};

    oal_memset(g_auc_nv_params, 0x00, sizeof(g_auc_nv_params));
    l_ret = get_cust_conf_string(CUST_MODU_NVRAM, OAL_PTR_NULL, g_auc_nv_params, sizeof(g_auc_nv_params));

    /* nv读取失败或者返回的参数值为零,尝试读取ini */
    if(INI_FAILED == l_ret || !g_auc_nv_params[0])
    {
        OAM_WARNING_LOG3(0, OAM_SF_ANY, "hwifi_config_init_nvram read nvram failed[ret:%d] or wrong values[first eight values:0x%x %x], read dts instead!", l_ret, *((oal_uint32*)g_auc_nv_params),*((oal_uint32*)(g_auc_nv_params+4)));
        /* 先尝试从ini文件中读取,读不到的话再从dts中读取 */
        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_config_init_nvram read %d from ini failed!", l_cfg_id);
                break;
            }
        }

        if (NVRAM_PARAMS_INDEX_BUTT == l_cfg_id)
        {
            OAM_INFO_LOG0(0, OAM_SF_ANY, "hwifi_config_init_nvram read from ini success!");
            oal_memcopy(g_auc_nv_params, aul_nvram_params, sizeof(g_auc_nv_params));
            return INI_SUCC;
        }

        l_ret = get_cust_conf_string(CUST_MODU_DTS, NVRAM_PARAMS_ARRAY, g_auc_nv_params, sizeof(g_auc_nv_params));
        if(INI_FAILED == l_ret)
        {
            OAM_WARNING_LOG0(0, OAM_SF_ANY, "hwifi_config_init_nvram read dts failed!");
            /* 读取dts也失败时将数组置零,防止下发至device */
            oal_memset(g_auc_nv_params, 0x00, sizeof(g_auc_nv_params));
            return INI_FAILED;
        }
    }

    return INI_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;
}
Ejemplo n.º 4
0
/*****************************************************************************
 函 数 名  : hmac_roam_alg_bss_check
 功能描述  :
 输入参数  :
 输出参数  : 无
 返 回 值  : OAL_SUCC 或 失败错误码
 调用函数  :
 被调函数  :

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

*****************************************************************************/
oal_uint32 hmac_roam_alg_bss_check(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_cap_info_stru          *pst_cap_info;
    oal_uint8                  *puc_pmkid;
    mac_cfg_ssid_param_stru     st_cfg_ssid;
    oal_uint32                  ul_ret;
    oal_uint32                  ul_avail_channel_capacity;
    oal_uint8                   uc_stru_len;
    oal_int8                    c_delta_rssi;
    oal_int8                    c_tmp_rssi;

    if ((OAL_PTR_NULL == pst_roam_info) || (OAL_PTR_NULL == pst_bss_dscr))
    {
        OAM_ERROR_LOG0(0, OAM_SF_ROAM, "{hmac_roam_alg_bss_check::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);

    /* 挑选HMAC_SCAN_MAX_VALID_SCANNED_BSS_EXPIRE时间以内的有效bss */
    if (oal_time_after((oal_uint32)OAL_TIME_GET_STAMP_MS(),(pst_bss_dscr->ul_timestamp + HMAC_SCAN_MAX_VALID_SCANNED_BSS_EXPIRE)))
    {
        return OAL_SUCC;
    }

    /* 检查黑名单 */
    ul_ret = hmac_roam_alg_find_in_blacklist(pst_roam_info, pst_bss_dscr->auc_bssid);
    if (OAL_TRUE == ul_ret)
    {
        OAM_WARNING_LOG3(0, OAM_SF_ROAM,"{hmac_roam_alg_bss_check:: [%02X:XX:XX:XX:%02X:%02X] in blacklist!}",
                         pst_bss_dscr->auc_bssid[0], pst_bss_dscr->auc_bssid[4], pst_bss_dscr->auc_bssid[5]);
        return OAL_SUCC;
    }

    /* 排除当前bss的rssi值计算,本地已经保存了dmac上报的rssi */
    if (0 == oal_compare_mac_addr(pst_mac_vap->auc_bssid, pst_bss_dscr->auc_bssid))
    {
        return OAL_SUCC;
    }

    /*  wep的bss直接过滤掉 */
    pst_cap_info = (mac_cap_info_stru *)&pst_bss_dscr->us_cap_info;
    if ((0 == pst_bss_dscr->st_bss_sec_info.uc_bss_80211i_mode) &&
        (0 != pst_cap_info->bit_privacy))
    {
        return OAL_SUCC;
    }

    /*  open加密方式到wpa/wpa2直接过滤掉 */
    /*lint -e731*/
    if ((0 == pst_cap_info->bit_privacy) != (OAL_TRUE != mac_mib_get_privacyinvoked(&pst_hmac_vap->st_vap_base_info)))
    {
        return OAL_SUCC;
    }
    /*lint +e731*/

    /* c_current_rssi为0时,表示linkloss上报的触发,不需要考虑rssi增益 */
    c_delta_rssi = hmac_roam_alg_adjust_rssi_increase(pst_roam_info, pst_bss_dscr);
    if (c_delta_rssi <= 0)
    {
        return OAL_SUCC;
    }


    ul_avail_channel_capacity = hmac_roam_alg_calc_avail_channel_capacity(pst_bss_dscr);
    if ((0 != ul_avail_channel_capacity) &&
        ((OAL_PTR_NULL == pst_roam_alg->pst_max_capacity_bss) ||
        (ul_avail_channel_capacity > pst_roam_alg->ul_max_capacity)))
    {
	    //暂时不考虑容量
        //pst_roam_alg->ul_max_capacity      = ul_avail_channel_capacity;
        //pst_roam_alg->pst_max_capacity_bss = pst_bss_dscr;
    }

    c_tmp_rssi = pst_bss_dscr->c_rssi;
    /* 对于已存在pmk缓存的bss进行加分处理 */
    puc_pmkid = hmac_vap_get_pmksa(pst_hmac_vap, pst_bss_dscr->auc_bssid);
    if (OAL_PTR_NULL != puc_pmkid)
    {
        c_tmp_rssi += ROAM_RSSI_DIFF_4_DB;
    }

    if ((OAL_PTR_NULL == pst_roam_alg->pst_max_rssi_bss) ||
        (c_tmp_rssi > pst_roam_alg->c_max_rssi))
    {
        pst_roam_alg->c_max_rssi        = c_tmp_rssi;
        pst_roam_alg->pst_max_rssi_bss  = pst_bss_dscr;
    }

    return OAL_SUCC;
}