/***************************************************************************** 函 数 名 : 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_STATIC oal_uint32 device_test_create_cfg_vap(oal_void) { oal_uint32 ul_return; frw_event_mem_stru *pst_event_mem; frw_event_stru *pst_event; pst_event_mem = FRW_EVENT_ALLOC(0); if (OAL_UNLIKELY(OAL_PTR_NULL == pst_event_mem)) { OAL_IO_PRINT("device_test_create_cfg_vap: hmac_init_event_process FRW_EVENT_ALLOC result = OAL_PTR_NULL.\n"); return OAL_FAIL; } ul_return = dmac_init_event_process(pst_event_mem); if (OAL_SUCC != ul_return) { OAL_IO_PRINT("device_test_create_cfg_vap: dmac_init_event_process result = fale.\n"); FRW_EVENT_FREE(pst_event_mem); return OAL_FAIL; } pst_event = (frw_event_stru *)pst_event_mem->puc_data; pst_event->st_event_hdr.uc_device_id = 0; ul_return = dmac_cfg_vap_init_event(pst_event_mem); if (OAL_SUCC != ul_return) { FRW_EVENT_FREE(pst_event_mem); return ul_return; } FRW_EVENT_FREE(pst_event_mem); return OAL_SUCC; }
/***************************************************************************** 函 数 名 : oam_upload_log_to_sdt 功能描述 : 打印信息到PC侧可维可测工具平台中 输入参数 : pc_string : 需要打印到可维可测工具平台中的字符串,以\0结束。 输出参数 : 无 返 回 值 : OAL_SUCC或其他错误码。 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2012年10月15日 作 者 : c59720 修改内容 : 新生成函数 *****************************************************************************/ oal_uint32 oam_upload_log_to_sdt(oal_int8 *pc_string) { oal_netbuf_stru *pst_skb; oal_uint32 ul_ret = OAL_SUCC; if (OAL_UNLIKELY(OAL_PTR_NULL == g_st_oam_sdt_func_hook.p_sdt_report_data_func)) { return OAL_ERR_CODE_PTR_NULL; } if (OAL_PTR_NULL == pc_string) { OAL_IO_PRINT("oam_upload_log_to_sdt::pc_string is null!\n"); return OAL_ERR_CODE_PTR_NULL; } pst_skb = oam_alloc_data2sdt(OAL_SIZEOF(oam_log_info_stru)); if (OAL_PTR_NULL == pst_skb) { return OAL_ERR_CODE_PTR_NULL; } /* COPY打印的内容 */ oal_memcopy(oal_netbuf_data(pst_skb), pc_string, OAL_SIZEOF(oam_log_info_stru)); /* 下发至sdt接收队列,若队列满则串口输出 */ ul_ret = oam_report_data2sdt(pst_skb, OAM_DATA_TYPE_LOG, OAM_PRIMID_TYPE_OUTPUT_CONTENT); return ul_ret; }
/***************************************************************************** 函 数 名 : 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; }
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); }
/***************************************************************************** 函 数 名 : 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; }
/***************************************************************************** 函 数 名 : 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; }
/***************************************************************************** 函 数 名 : oam_stats_report_irq_info_to_sdt 功能描述 : 中断统计信息上报SDT 输入参数 : 无 输出参数 : 无 返 回 值 : 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2014年2月21日 作 者 : z00237171 修改内容 : 新生成函数 *****************************************************************************/ oal_void oam_stats_report_irq_info_to_sdt( oal_uint8 *puc_irq_info_addr, oal_uint16 us_irq_info_len) { oal_uint32 ul_tick; oal_uint16 us_skb_len; /* skb总长度 */ oal_netbuf_stru *pst_netbuf; oam_ota_stru *pst_ota_data; if (OAL_UNLIKELY(OAL_PTR_NULL == g_st_oam_sdt_func_hook.p_sdt_report_data_func)) { return ; } if (OAL_PTR_NULL == puc_irq_info_addr) { OAL_IO_PRINT("oam_stats_report_irq_info_to_sdt::puc_irq_info_addr is null!\n"); return; } /* 为上报描述符申请空间,头部预留8字节,尾部预留1字节,给sdt_drv用 */ us_skb_len = us_irq_info_len + OAL_SIZEOF(oam_ota_hdr_stru); if (us_skb_len > WLAN_SDT_NETBUF_MAX_PAYLOAD) { us_skb_len = WLAN_SDT_NETBUF_MAX_PAYLOAD; us_irq_info_len = WLAN_SDT_NETBUF_MAX_PAYLOAD - OAL_SIZEOF(oam_ota_hdr_stru); } pst_netbuf = oam_alloc_data2sdt(us_skb_len); if (OAL_PTR_NULL == pst_netbuf) { return; } pst_ota_data = (oam_ota_stru *)oal_netbuf_data(pst_netbuf); /* 获取系统TICK值 */ ul_tick = (oal_uint32)OAL_TIME_GET_STAMP_MS(); /* 填写ota消息头结构体 */ pst_ota_data->st_ota_hdr.ul_tick = ul_tick; pst_ota_data->st_ota_hdr.en_ota_type = OAM_OTA_TYPE_IRQ; pst_ota_data->st_ota_hdr.uc_frame_hdr_len = 0; pst_ota_data->st_ota_hdr.us_ota_data_len = us_irq_info_len; #if (_PRE_PRODUCT_ID == _PRE_PRODUCT_ID_HI1102_HOST) pst_ota_data->st_ota_hdr.auc_resv[0] = 2; #else pst_ota_data->st_ota_hdr.auc_resv[0] = 3; #endif /* 复制数据,填写ota数据 */ oal_memcopy((oal_void *)pst_ota_data->auc_ota_data, (const oal_void *)puc_irq_info_addr, (oal_uint32)us_irq_info_len); /* 下发至sdt接收队列,若队列满则串口输出 */ oam_report_data2sdt(pst_netbuf, OAM_DATA_TYPE_OTA, OAM_PRIMID_TYPE_OUTPUT_CONTENT); }
/***************************************************************************** 函 数 名 : oam_print_to_file 功能描述 : 打印信息到文件中 输入参数 : pc_string : 需要打印到文件中的字符串,以\0结束。 输出参数 : 无 返 回 值 : OAL_SUCC或其他错误码。 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2012年10月15日 作 者 : c59720 修改内容 : 新生成函数 *****************************************************************************/ oal_uint32 oam_print_to_file(oal_int8 *pc_string) { #ifdef _PRE_WIFI_DMT oal_file_stru *f_file_ret; /* 用于保存写文件后的返回值 */ oal_file_stru *f_event_file; oal_int32 l_rslt; if (OAL_UNLIKELY(OAL_PTR_NULL == pc_string)) { OAM_IO_PRINTK("null param. \r\n"); return OAL_ERR_CODE_PTR_NULL; } f_event_file = oal_file_open_append(g_st_oam_mng_ctx.ac_file_path); if (OAL_UNLIKELY(OAL_FILE_FAIL == f_event_file)) { OAM_IO_PRINTK("open file failed. \r\n"); return OAL_ERR_CODE_OPEN_FILE_FAIL; } f_file_ret = oal_file_write(f_event_file, pc_string, (OAL_STRLEN(pc_string) + 1)); if (OAL_FILE_FAIL == f_file_ret) { l_rslt = oal_file_close(f_event_file); if (0 != l_rslt) { OAM_IO_PRINTK("close file failed. \r\n"); return OAL_ERR_CODE_CLOSE_FILE_FAIL; } OAM_IO_PRINTK("write file failed. \r\n"); return OAL_ERR_CODE_WRITE_FILE_FAIL; } l_rslt = oal_file_close(f_event_file); if (0 != l_rslt) { OAM_IO_PRINTK("close file failed. \r\n"); return OAL_ERR_CODE_CLOSE_FILE_FAIL; } #endif return OAL_SUCC; }
/***************************************************************************** 函 数 名 : oam_stats_report_usr_info 功能描述 : 把某个用户的统计信息上报sdt 输入参数 : 无 输出参数 : 无 返 回 值 : 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2014年3月24日 作 者 : z00237171 修改内容 : 新生成函数 *****************************************************************************/ oal_uint32 oam_stats_report_usr_info(oal_uint16 us_usr_id) { oal_uint32 ul_tick; oal_uint16 us_skb_len; /* skb总长度 */ oal_netbuf_stru *pst_netbuf; oam_ota_stru *pst_ota_data; oal_uint32 ul_ret = OAL_SUCC; oal_uint16 us_stat_info_len; if (OAL_UNLIKELY(OAL_PTR_NULL == g_st_oam_sdt_func_hook.p_sdt_report_data_func)) { return OAL_ERR_CODE_PTR_NULL; } if (us_usr_id >= WLAN_DEVICE_SUPPORT_MAX_NUM_SPEC * WLAN_ACTIVE_USER_MAX_NUM) { return OAL_ERR_CODE_INVALID_CONFIG; } us_stat_info_len = OAL_SIZEOF(oam_device_stat_info_stru); /* 为上报统计信息申请空间,头部预留8字节,尾部预留1字节,给sdt_drv用 */ us_skb_len = us_stat_info_len + OAL_SIZEOF(oam_ota_hdr_stru); if (us_skb_len > WLAN_SDT_NETBUF_MAX_PAYLOAD) { us_skb_len = WLAN_SDT_NETBUF_MAX_PAYLOAD; us_stat_info_len = WLAN_SDT_NETBUF_MAX_PAYLOAD - OAL_SIZEOF(oam_ota_hdr_stru); } pst_netbuf = oam_alloc_data2sdt(us_skb_len); if (OAL_PTR_NULL == pst_netbuf) { return OAL_ERR_CODE_PTR_NULL; } pst_ota_data = (oam_ota_stru *)oal_netbuf_data(pst_netbuf); /* 获取系统TICK值 */ ul_tick = (oal_uint32)OAL_TIME_GET_STAMP_MS(); /* 填写ota消息头结构体 */ pst_ota_data->st_ota_hdr.ul_tick = ul_tick; pst_ota_data->st_ota_hdr.en_ota_type = OAM_OTA_TYPE_USER_STAT_INFO; pst_ota_data->st_ota_hdr.uc_frame_hdr_len = 0; pst_ota_data->st_ota_hdr.us_ota_data_len = us_stat_info_len; oal_memcopy((oal_void *)pst_ota_data->auc_ota_data, (const oal_void *)&g_st_stat_info.ast_user_stat_info[us_usr_id], us_stat_info_len); /* 下发至sdt接收队列,若队列满则串口输出 */ ul_ret = oam_report_data2sdt(pst_netbuf, OAM_DATA_TYPE_OTA, OAM_PRIMID_TYPE_OUTPUT_CONTENT); return ul_ret; }
/***************************************************************************** 函 数 名 : oam_print_to_console 功能描述 : 打印信息到标准输出窗口中 输入参数 : pc_string : 需要打印到标准输出窗口中的字符串,以\0结束。 输出参数 : 无 返 回 值 : OAL_SUCC或其他错误码。 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2012年10月15日 作 者 : c59720 修改内容 : 新生成函数 *****************************************************************************/ oal_uint32 oam_print_to_console(oal_int8 *pc_string) { if (OAL_UNLIKELY(OAL_PTR_NULL == pc_string)) { return OAL_ERR_CODE_PTR_NULL; } OAL_IO_PRINT("%s\r\n", pc_string); return OAL_SUCC; }
/***************************************************************************** 函 数 名 : dmac_res_get_mac_dev 功能描述 : 获取对应HMAC DEV索引的内存 输入参数 : 对应HMAC DEV内存索引 输出参数 : 无 返 回 值 : 对应内存地址 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2015年1月31日 作 者 : l00279018 修改内容 : 新生成函数 *****************************************************************************/ dmac_device_stru *dmac_res_get_mac_dev(oal_uint32 ul_dev_idx) { if (OAL_UNLIKELY(ul_dev_idx >= MAC_RES_MAX_DEV_NUM)) { OAM_ERROR_LOG1(0, OAM_SF_ANY, "{dmac_res_get_dmac_dev::invalid ul_dev_idx[%d].}", ul_dev_idx); return OAL_PTR_NULL; } return &(g_st_dmac_res.st_dmac_dev_res.ast_dmac_dev_info[ul_dev_idx]); }
/***************************************************************************** 函 数 名 : oam_get_output_type 功能描述 : 获取可维可测输出方式 输入参数 : 无 输出参数 : 可维可测输出方式 返 回 值 : 1) OAL_ERR_CODE_PTR_NULL: 空指针 2) OAL_SUCC: 成功 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2012年9月28日 作 者 : huxiaotong 修改内容 : 新生成函数 *****************************************************************************/ oal_uint32 oam_get_output_type(oam_output_type_enum_uint8 *pen_output_type) { if (OAL_UNLIKELY(OAL_PTR_NULL == pen_output_type)) { OAM_IO_PRINTK("null param \r\n"); return OAL_ERR_CODE_PTR_NULL; } *pen_output_type = g_st_oam_mng_ctx.en_output_type; return OAL_SUCC; }
oal_int32 hi1102_device_main_init(oal_void) { oal_int32 l_return = OAL_FAIL; oal_uint16 us_bitmap; //frw_event_mem_stru *pst_event_mem; //WLAN_EDA_TRACE_TAG(0x4100UL); l_return = platform_module_init(); if (OAL_SUCC != l_return) { OAL_IO_PRINT("host_bottom_main_init: platform_module_init return error code: %d\r\n", l_return); return l_return; } //WLAN_EDA_TRACE_TAG(0x4200UL); l_return = device_module_init(); if (OAL_SUCC != l_return) { OAL_IO_PRINT("host_bottom_main_init: device_module_init return error code: %d\r\n", l_return); us_bitmap = BIT0 | BIT1 | BIT2 | BIT3; builder_module_exit(us_bitmap); return l_return; } #if 0 /* 1102 需要在device初始化成功后同步速率级 */ pst_event_mem = FRW_EVENT_ALLOC(0); if (OAL_UNLIKELY(OAL_PTR_NULL == pst_event_mem)) { OAL_IO_PRINT("hi1102_device_main_init: dmac_init_event_process FRW_EVENT_ALLOC result = OAL_PTR_NULL.\n"); return OAL_FAIL; } l_return = dmac_init_event_process(pst_event_mem); if (OAL_SUCC != l_return) { OAL_IO_PRINT("hi1102_device_main_init: dmac_init_event_process result = fale.\n"); FRW_EVENT_FREE(pst_event_mem); return OAL_FAIL; } FRW_EVENT_FREE(pst_event_mem); #endif #if (!defined(HI1102_EDA)) /*device_ready:调用HCC接口通知Hmac,Dmac已经完成初始化 TBD*/ //hcc_send_msg2host(D2H_MSG_WLAN_READY); SDIO_SendMsgSync(D2H_MSG_WLAN_READY); #endif /*启动完成后,输出打印*/ OAL_IO_PRINT("Hi1102_device_main_init:: Hi1102_device_main_init finish!\r\n"); return OAL_SUCC; }
/***************************************************************************** 函 数 名 : 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; }
/***************************************************************************** 函 数 名 : 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; }
/***************************************************************************** 函 数 名 : dmac_res_alloc_mac_dev 功能描述 : 获取一个HMAC DEV资源 输入参数 : 无 输出参数 : HMAC DEV内存索引值 返 回 值 : OAL_SUCC/OAL_FAIL 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2013年5月8日 作 者 : l00279018 修改内容 : 新生成函数 *****************************************************************************/ oal_uint32 dmac_res_alloc_mac_dev(oal_uint32 ul_dev_idx) { if (OAL_UNLIKELY(ul_dev_idx >= MAC_RES_MAX_DEV_NUM)) { OAM_ERROR_LOG1(0, OAM_SF_ANY, "{dmac_res_alloc_dmac_dev::invalid ul_dev_idx[%d].}", ul_dev_idx); return OAL_FAIL; } (g_st_dmac_res.st_dmac_dev_res.auc_user_cnt[ul_dev_idx])++; return OAL_SUCC; }
/***************************************************************************** 函 数 名 : 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; }
/***************************************************************************** 函 数 名 : oam_print_to_sdt 功能描述 : 打印信息到PC侧可维可测工具平台中 输入参数 : pc_string : 需要打印到可维可测工具平台中的字符串,以\0结束。 输出参数 : 无 返 回 值 : OAL_SUCC或其他错误码。 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2012年10月15日 作 者 : c59720 修改内容 : 新生成函数 *****************************************************************************/ oal_uint32 oam_print_to_sdt(oal_int8 *pc_string) { oal_netbuf_stru *pst_skb; oal_uint32 ul_ret = OAL_SUCC; oal_uint16 us_strlen; if (OAL_UNLIKELY(OAL_PTR_NULL == pc_string)) { return OAL_ERR_CODE_PTR_NULL; } if (OAL_UNLIKELY(OAL_PTR_NULL == g_st_oam_sdt_func_hook.p_sdt_report_data_func)) { return OAL_ERR_CODE_PTR_NULL; } /* 上报sdt字符串以'0'结束 */ us_strlen = (oal_uint16)OAL_STRLEN(pc_string); us_strlen = (us_strlen > OAM_REPORT_MAX_STRING_LEN) ? OAM_REPORT_MAX_STRING_LEN : us_strlen; pst_skb = oam_alloc_data2sdt(us_strlen); if (OAL_PTR_NULL == pst_skb) { return OAL_ERR_CODE_PTR_NULL; } /* COPY打印的内容 */ oal_memset(oal_netbuf_data(pst_skb), 0, us_strlen); oal_memcopy(oal_netbuf_data(pst_skb), pc_string, (oal_uint32)us_strlen); /* 下发至sdt接收队列,若队列满则串口输出 */ ul_ret = oam_report_data2sdt(pst_skb, OAM_DATA_TYPE_STRING, OAM_PRIMID_TYPE_OUTPUT_CONTENT); return ul_ret; }
/***************************************************************************** 函 数 名 : 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; } }
/***************************************************************************** 函 数 名 : oam_report_vap_pkt_stat_to_sdt 功能描述 : 将某一个vap下的收发包统计信息上报sdt 输入参数 : 无 输出参数 : 无 返 回 值 : 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2014年7月10日 作 者 : z00237171 修改内容 : 新生成函数 *****************************************************************************/ oal_uint32 oam_report_vap_pkt_stat_to_sdt(oal_uint8 uc_vap_id) { oal_uint32 ul_tick; oal_uint16 us_skb_len; /* skb总长度 */ oal_netbuf_stru *pst_netbuf; oam_ota_stru *pst_ota_data; oal_uint32 ul_ret = OAL_SUCC; oal_uint16 us_stat_info_len; if (OAL_UNLIKELY(OAL_PTR_NULL == g_st_oam_sdt_func_hook.p_sdt_report_data_func)) { return OAL_ERR_CODE_PTR_NULL; } us_stat_info_len = OAL_SIZEOF(oam_vap_stat_info_stru); /* 为上报统计信息申请空间,头部预留8字节,尾部预留1字节,给sdt_drv用 */ us_skb_len = us_stat_info_len + OAL_SIZEOF(oam_ota_hdr_stru); pst_netbuf = oam_alloc_data2sdt(us_skb_len); if (OAL_PTR_NULL == pst_netbuf) { return OAL_ERR_CODE_PTR_NULL; } pst_ota_data = (oam_ota_stru *)oal_netbuf_data(pst_netbuf); /* 获取系统TICK值 */ ul_tick = (oal_uint32)OAL_TIME_GET_STAMP_MS(); /* 填写ota消息头结构体 */ pst_ota_data->st_ota_hdr.ul_tick = ul_tick; pst_ota_data->st_ota_hdr.en_ota_type = OAM_OTA_TYPE_VAP_STAT_INFO; pst_ota_data->st_ota_hdr.us_ota_data_len = us_stat_info_len; pst_ota_data->st_ota_hdr.uc_frame_hdr_len = 0; oal_set_mac_addr(pst_ota_data->st_ota_hdr.auc_user_macaddr, BROADCAST_MACADDR); /* 复制数据,填写ota数据 */ oal_memcopy((oal_void *)pst_ota_data->auc_ota_data, (const oal_void *)&g_st_stat_info.ast_vap_stat_info[uc_vap_id], us_stat_info_len); /* 下发至sdt接收队列,若队列满则串口输出 */ ul_ret = oam_report_data2sdt(pst_netbuf, OAM_DATA_TYPE_OTA, OAM_PRIMID_TYPE_OUTPUT_CONTENT); return ul_ret; }
/***************************************************************************** 函 数 名 : dmac_res_free_mac_dev 功能描述 : 释放对应HMAC DEV的内存 输入参数 : 对应HMAC DEV内存索引 输出参数 : 无 返 回 值 : OAL_SUCC/OAL_FAIL 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2015年1月31日 作 者 : l00279018 修改内容 : 新生成函数 *****************************************************************************/ oal_uint32 dmac_res_free_mac_dev(oal_uint32 ul_dev_idx) { if (OAL_UNLIKELY(ul_dev_idx >= MAC_RES_MAX_DEV_NUM)) { OAM_ERROR_LOG1(0, OAM_SF_ANY, "{mac_res_free_dev::invalid ul_dev_idx[%d].}", ul_dev_idx); return OAL_FAIL; } (g_st_dmac_res.st_dmac_dev_res.auc_user_cnt[ul_dev_idx])--; if (0 != g_st_dmac_res.st_dmac_dev_res.auc_user_cnt[ul_dev_idx]) { return OAL_SUCC; } /* 入队索引值需要加1操作 */ oal_queue_enqueue(&(g_st_dmac_res.st_dmac_dev_res.st_queue), (oal_void *)((oal_uint)ul_dev_idx + 1)); 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; }
oal_void hmac_data_acq_down_vap(mac_vap_stru *pst_mac_vap) { oal_uint32 ul_ret; mac_device_stru *pst_device; oal_uint8 uc_vap_idx; mac_cfg_down_vap_param_stru st_down_vap; hmac_vap_stru *pst_hmac_vap; pst_device = mac_res_get_dev(pst_mac_vap->uc_device_id); if (OAL_PTR_NULL == pst_device) { OAM_WARNING_LOG0(pst_mac_vap->uc_vap_id, OAM_SF_ANY, "{hmac_data_acq_down_vap::pst_device null.}"); return; } /* 遍历device下所有vap,设置vap 下的信道号 */ for (uc_vap_idx = 0; uc_vap_idx < pst_device->uc_vap_num; uc_vap_idx++) { pst_hmac_vap = mac_res_get_hmac_vap(pst_device->auc_vap_id[uc_vap_idx]); if (OAL_PTR_NULL == pst_hmac_vap) { OAM_WARNING_LOG0(pst_mac_vap->uc_vap_id, OAM_SF_ANY, "{hmac_data_acq_down_vap::pst_hmac_vap null.}"); continue; } st_down_vap.pst_net_dev = pst_hmac_vap->pst_net_device; ul_ret = hmac_config_down_vap(&pst_hmac_vap->st_vap_base_info, OAL_SIZEOF(mac_cfg_down_vap_param_stru), (oal_uint8 *)&st_down_vap); if (OAL_UNLIKELY(OAL_SUCC != ul_ret)) { OAM_WARNING_LOG0(pst_mac_vap->uc_vap_id, OAM_SF_ANY, "{hmac_data_acq_down_vap::hmac_config_down_vap failed.}"); } } g_uc_data_acq_used = OAL_TRUE; OAM_INFO_LOG1(pst_mac_vap->uc_vap_id, OAM_SF_ANY, "{hmac_data_acq_down_vap::g_uc_data_acq_used=%d.}", g_uc_data_acq_used); }
/***************************************************************************** 函 数 名 : oam_netlink_ops_register 功能描述 : WAL模块向其它模块提供的注册netlink消息处理函数(接收方向) 输入参数 : 无 输出参数 : 无 返 回 值 : 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2013年10月17日 作 者 : mayuan 修改内容 : 新生成函数 *****************************************************************************/ oal_void oam_netlink_ops_register(oam_nl_cmd_enum_uint8 en_type, oal_uint32 (*p_func)(oal_uint8 *puc_data, oal_uint32 ul_len)) { if (OAL_UNLIKELY(OAL_PTR_NULL == p_func)) { OAL_IO_PRINT("oam_netlink_ops_register, p_func is null ptr."); return; } switch (en_type) { case OAM_NL_CMD_SDT: g_st_netlink_ops.p_oam_sdt_func = p_func; break; case OAM_NL_CMD_HUT: g_st_netlink_ops.p_oam_hut_func = p_func; break; case OAM_NL_CMD_ALG: g_st_netlink_ops.p_oam_alg_func = p_func; break; case OAM_NL_CMD_DAQ: g_st_netlink_ops.p_oam_daq_func = p_func; break; case OAM_NL_CMD_REG: g_st_netlink_ops.p_oam_reg_func = p_func; break; case OAM_NL_CMD_ACS: g_st_netlink_ops.p_oam_acs_func = p_func; break; default: OAL_IO_PRINT("oam_netlink_ops_register, err type = %d.", en_type); break; } }
/***************************************************************************** 函 数 名 : oam_report_data2sdt 功能描述 : oam将消息下发至sdt侧,由sdt侧统一上报至app侧 输入参数 : oal_netbuf_stru *pst_netbuf oam_data_type_enum_uint8 en_type oam_primid_type_enum_uint8 en_prim 输出参数 : 无 返 回 值 : oal_uint32 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2014年3月11日,星期二 作 者 : y00201072 修改内容 : 新生成函数 *****************************************************************************/ oal_uint32 oam_report_data2sdt(oal_netbuf_stru *pst_netbuf, oam_data_type_enum_uint8 en_type, oam_primid_type_enum_uint8 en_prim) { /* 判断sdt发送消息队列是否已满,若满输出至串口 */ if (OAL_LIKELY(OAL_PTR_NULL != g_st_oam_sdt_func_hook.p_sdt_get_wq_len_func)) { g_st_sdt_stat_info.ul_wq_len = (oal_uint32)g_st_oam_sdt_func_hook.p_sdt_get_wq_len_func(); } if (OAM_FLT_PASS != oam_filter_data2sdt(en_type)) { OAM_SDT_STAT_INCR(ul_filter_cnt); oal_mem_sdt_netbuf_free(pst_netbuf, OAL_TRUE); //oal_netbuf_free(pst_netbuf); /* DTS2015071003114, 在SDT处理太慢导致上报失败时候,减少SDT打印 0x778d WARNING的数量,每隔1000个打印一次*/ /* Note: 目前上层函数仅仅使用该返回值打印warning信息而已*/ #if (_PRE_PRODUCT_ID == _PRE_PRODUCT_ID_HI1151) if(0 != ((g_st_sdt_stat_info.ul_filter_cnt) % OAM_DATA2SDT_FAIL_COUNT)) { return OAL_SUCC; } #endif return OAL_FAIL; } if (OAL_UNLIKELY(OAL_PTR_NULL == g_st_oam_sdt_func_hook.p_sdt_report_data_func)) { OAL_IO_PRINT("oam_report_data2sdt p_sdt_report_data_func is NULL. \n"); return OAL_FAIL; } g_st_oam_sdt_func_hook.p_sdt_report_data_func(pst_netbuf, en_type, en_prim); return OAL_SUCC; }
/***************************************************************************** 函 数 名 : 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; }
/***************************************************************************** 函 数 名 : 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; }
/***************************************************************************** 函 数 名 : sdt_drv_netlink_send 功能描述 : SDT驱动侧通过netlink向SDT APP发送数据 记录待发送的数据与发送失败的数据;通过序列号记录 输入参数 : 无 输出参数 : 无 返 回 值 : 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2014年1月27日 作 者 : z00237171 修改内容 : 新生成函数 *****************************************************************************/ oal_uint32 sdt_drv_netlink_send(oal_netbuf_stru *pst_netbuf, oal_uint32 ul_len) { #if (_PRE_OS_VERSION_RAW != _PRE_OS_VERSION) #if((_PRE_TARGET_PRODUCT_TYPE_5610DMB == _PRE_CONFIG_TARGET_PRODUCT)\ ||(_PRE_TARGET_PRODUCT_TYPE_VSPM310DMB == _PRE_CONFIG_TARGET_PRODUCT)\ ||(_PRE_TARGET_PRODUCT_TYPE_WS835DMB == _PRE_CONFIG_TARGET_PRODUCT)) oal_int32 l_ret_len = 0; sdt_drv_pkt_hdr_stru *p_sdt_hdr; #endif oal_netbuf_stru *pst_copy_netbuf; oal_nlmsghdr_stru *pst_nlhdr; oal_uint32 ul_nlmsg_len; oal_int32 l_unicast_bytes = 0; /* 由上层保证参数非空 */ /* 如果没有与app建立连接,则直接返回,每500次打印一次提示信息 */ if (0 == g_st_sdt_drv_mng_entry.ul_usepid) { if (0 == (oal_atomic_read(&g_st_sdt_drv_mng_entry.ul_unconnect_cnt) % SDT_DRV_REPORT_NO_CONNECT_FREQUENCE)) { OAL_IO_PRINT("Info:waitting app_sdt start...\r\n"); oal_atomic_inc(&g_st_sdt_drv_mng_entry.ul_unconnect_cnt); } oal_mem_sdt_netbuf_free(pst_netbuf, OAL_TRUE); //oal_netbuf_free(pst_netbuf); return OAL_FAIL; } #if ((_PRE_TARGET_PRODUCT_TYPE_5610DMB == _PRE_CONFIG_TARGET_PRODUCT)\ ||(_PRE_TARGET_PRODUCT_TYPE_VSPM310DMB == _PRE_CONFIG_TARGET_PRODUCT)\ ||(_PRE_TARGET_PRODUCT_TYPE_WS835DMB == _PRE_CONFIG_TARGET_PRODUCT)) // 数据包分析 p_sdt_hdr = (sdt_drv_pkt_hdr_stru*)oal_netbuf_data(pst_netbuf); if (OAM_DATA_TYPE_LOG == p_sdt_hdr->en_msg_type || OAM_DATA_TYPE_OTA == p_sdt_hdr->en_msg_type) { if (0 == g_st_count) { ul_nlmsg_len = OAL_NLMSG_LENGTH(MAX_NLMSG_LEN); g_pst_copy_netbuf = oal_netbuf_alloc(ul_nlmsg_len, 0, WLAN_MEM_NETBUF_ALIGN); if (OAL_UNLIKELY(OAL_PTR_NULL == g_pst_copy_netbuf)) { oal_mem_sdt_netbuf_free(pst_netbuf, OAL_TRUE); //oal_netbuf_free(pst_netbuf); OAL_IO_PRINT("oal_netbuf_alloc failed. \r\n"); return OAL_FAIL; } g_pst_nlhdr = oal_nlmsg_put(g_pst_copy_netbuf, 0, 0, 0, (oal_int32)MAX_NLMSG_LEN, 0); } if (NULL != g_pst_nlhdr) { l_ret_len = MAX_NLMSG_LEN - g_buf_offset - ul_len; if (l_ret_len > 0) { oal_memcopy((oal_void *)OAL_NLMSG_DATA(g_pst_nlhdr) + g_buf_offset, (const oal_void *)oal_netbuf_data(pst_netbuf), ul_len); g_st_count++; g_buf_offset += ul_len; } } if (MAX_QUEUE_COUNT == g_st_count || g_buf_offset > MAX_CO_SIZE || l_ret_len < 0) { g_st_count = 0; g_buf_offset = 0; l_unicast_bytes = oal_netlink_unicast(g_st_sdt_drv_mng_entry.pst_nlsk, g_pst_copy_netbuf, g_st_sdt_drv_mng_entry.ul_usepid, 0); oal_msleep(300); OAM_SDT_STAT_INCR(ul_nlk_sd_cnt); if (l_unicast_bytes <= 0) { oal_mem_sdt_netbuf_free(pst_netbuf, OAL_TRUE); //oal_netbuf_free(pst_netbuf); oal_msleep(500); OAM_SDT_STAT_INCR(ul_nlk_sd_fail); return OAL_FAIL; } } oal_mem_sdt_netbuf_free(pst_netbuf, OAL_TRUE); return OAL_SUCC; } #endif /* 填写netlink消息头 */ ul_nlmsg_len = OAL_NLMSG_SPACE(ul_len); pst_copy_netbuf = oal_netbuf_alloc(ul_nlmsg_len, 0, WLAN_MEM_NETBUF_ALIGN); if (OAL_UNLIKELY(OAL_PTR_NULL == pst_copy_netbuf)) { oal_mem_sdt_netbuf_free(pst_netbuf, OAL_TRUE); //oal_netbuf_free(pst_netbuf); OAL_IO_PRINT("oal_netbuf_alloc failed. \r\n"); return OAL_FAIL; } pst_nlhdr = oal_nlmsg_put(pst_copy_netbuf, 0, 0, 0, (oal_int32)ul_len, 0); oal_memcopy((oal_void *)OAL_NLMSG_DATA(pst_nlhdr), (const oal_void *)oal_netbuf_data(pst_netbuf), ul_len); l_unicast_bytes = oal_netlink_unicast(g_st_sdt_drv_mng_entry.pst_nlsk, pst_copy_netbuf, g_st_sdt_drv_mng_entry.ul_usepid, OAL_MSG_DONTWAIT); oal_mem_sdt_netbuf_free(pst_netbuf, OAL_TRUE); //oal_netbuf_free(pst_netbuf); OAM_SDT_STAT_INCR(ul_nlk_sd_cnt); if (l_unicast_bytes <= 0) { OAM_SDT_STAT_INCR(ul_nlk_sd_fail); return OAL_FAIL; } #endif return OAL_SUCC; }
OAL_STATIC oal_uint32 host_test_get_chip_msg(oal_void) { oal_uint32 ul_return; mac_chip_stru *pst_chip; frw_event_mem_stru *pst_event_mem; frw_event_stru *pst_event; /* 事件结构体 */ oal_uint32 ul_dev_id; oal_netbuf_stru *pst_netbuf; dmac_tx_event_stru *pst_ctx_event; oal_uint8 *pst_mac_rates_11g; /** 待补充 ***/ pst_event_mem = FRW_EVENT_ALLOC(OAL_SIZEOF(dmac_tx_event_stru)); if (OAL_UNLIKELY(OAL_PTR_NULL == pst_event_mem)) { OAL_IO_PRINT("host_test_get_chip_msg: hmac_init_event_process FRW_EVENT_ALLOC result = OAL_PTR_NULL.\n"); return OAL_FAIL; } /* 申请netbuf内存 */ pst_netbuf = OAL_MEM_NETBUF_ALLOC(OAL_NORMAL_NETBUF, WLAN_MEM_NETBUF_SIZE2, OAL_NETBUF_PRIORITY_MID); if (OAL_UNLIKELY(OAL_PTR_NULL == pst_netbuf)) { OAL_IO_PRINT("host_test_get_chip_msg: hmac_init_event_process OAL_MEM_NETBUF_ALLOC result = OAL_PTR_NULL.\n"); return OAL_FAIL; } pst_event = (frw_event_stru *)pst_event_mem->puc_data; pst_ctx_event = (dmac_tx_event_stru *)pst_event->auc_event_data; pst_ctx_event->pst_netbuf = pst_netbuf; pst_mac_rates_11g = (oal_uint8*)oal_netbuf_data(pst_ctx_event->pst_netbuf); pst_chip = (mac_chip_stru *)(pst_mac_rates_11g + sizeof(mac_data_rate_stru) * MAC_DATARATES_PHY_80211G_NUM); ul_dev_id = (oal_uint32) oal_queue_dequeue(&(g_st_mac_res.st_dev_res.st_queue)); /* 0为无效值 */ if (0 == ul_dev_id) { OAL_IO_PRINT("host_test_get_chip_msg:oal_queue_dequeue return 0!"); FRW_EVENT_FREE(pst_event_mem); return OAL_FAIL; } pst_chip->auc_device_id[0] = (oal_uint8)(ul_dev_id - 1); /* 根据ul_chip_ver,通过hal_chip_init_by_version函数获得 */ pst_chip->uc_device_nums = 1; pst_chip->uc_chip_id = 0; pst_chip->en_chip_state = OAL_TRUE; /* 由hal_chip_get_version函数得到,1102 02需要SOC提供寄存器后实现 */ pst_chip->ul_chip_ver = WLAN_CHIP_VERSION_HI1151V100H; pst_chip->pst_chip_stru = OAL_PTR_NULL; ul_return = hmac_init_event_process(pst_event_mem); if(OAL_UNLIKELY(ul_return != OAL_SUCC)) { OAL_IO_PRINT("host_test_get_chip_msg: hmac_init_event_process ul_return != OAL_SUCC\n"); FRW_EVENT_FREE(pst_event_mem); oal_netbuf_free(pst_netbuf); return OAL_FAIL; } return OAL_SUCC; }