diff options
| author | Leela Venkata Kiran Kumar Reddy Chirala <kchirala@qca.qualcomm.com> | 2014-07-15 18:14:27 -0700 |
|---|---|---|
| committer | Akash Patel <c_akashp@qca.qualcomm.com> | 2014-08-14 19:53:10 -0700 |
| commit | 1c1dc38fd94454e90e47bafd98bc38df94201514 (patch) | |
| tree | 5a5d956be30ab103f8c4d53c09cafcb9b93bf030 | |
| parent | f5264a85df0714855bc0a42d0a6da83a6cab2148 (diff) | |
Unit test command to test the feature under development
This commit adds the support in the driver for unit test
command to test any module by passing some params using
iwpriv command
Change-Id: Icb2d52812517a10bffc70b1fec9991d6fabd8a5e
CRs-fixed: 658242
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_wext.c | 48 | ||||
| -rw-r--r-- | CORE/MAC/src/include/sirParams.h | 4 | ||||
| -rw-r--r-- | CORE/SERVICES/WMA/wma.c | 57 | ||||
| -rw-r--r-- | CORE/SERVICES/WMA/wma.h | 8 |
4 files changed, 115 insertions, 2 deletions
diff --git a/CORE/HDD/src/wlan_hdd_wext.c b/CORE/HDD/src/wlan_hdd_wext.c index ce33c26947f6..bce292283101 100644 --- a/CORE/HDD/src/wlan_hdd_wext.c +++ b/CORE/HDD/src/wlan_hdd_wext.c @@ -379,6 +379,8 @@ static const hdd_freq_chan_map_t freq_chan_map[] = { {2412, 1}, {2417, 2}, #define WE_TDLS_CONFIG_PARAMS 5 #endif +#define WE_UNIT_TEST_CMD 7 + #define WE_MTRACE_DUMP_CMD 8 #define WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD 9 @@ -7543,10 +7545,47 @@ static int __iw_set_var_ints_getnone(struct net_device *dev, } break; #endif + case WE_UNIT_TEST_CMD : + { + t_wma_unit_test_cmd *unitTestArgs; + vos_msg_t msg = {0}; + int i, j; + if ((apps_args[0] < WLAN_MODULE_ID_MIN) || + (apps_args[0] >= WLAN_MODULE_ID_MAX)) { + hddLog(LOGE, FL("Invalid MODULE ID %d"), apps_args[0]); + return -EINVAL; + } + if (apps_args[1] > (WMA_MAX_NUM_ARGS)) { + hddLog(LOGE, FL("Too Many args %d"), apps_args[1]); + return -EINVAL; + } + unitTestArgs = vos_mem_malloc(sizeof(*unitTestArgs)); + if (NULL == unitTestArgs) { + hddLog(LOGE, + FL("vos_mem_alloc failed for unitTestArgs")); + return -ENOMEM; + } + unitTestArgs->vdev_id = (int)pAdapter->sessionId; + unitTestArgs->module_id = apps_args[0]; + unitTestArgs->num_args = apps_args[1]; + for (i = 0, j = 2; i < unitTestArgs->num_args; i++, j++) { + unitTestArgs->args[i] = apps_args[j]; + } + msg.type = SIR_HAL_UNIT_TEST_CMD; + msg.reserved = 0; + msg.bodyptr = unitTestArgs; + if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, + &msg)) { + vos_mem_free(unitTestArgs); + VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + FL("Not able to post UNIT_TEST_CMD message to WDA")); + return -EINVAL; + } + } + break; default: { - hddLog(LOGE, "%s: Invalid IOCTL command %d", - __func__, sub_cmd ); + hddLog(LOGE, FL("Invalid IOCTL command %d"), sub_cmd ); } break; } @@ -10534,6 +10573,11 @@ static const struct iw_priv_args we_private_args[] = { 0, "setTdlsConfig" }, #endif + { + WE_UNIT_TEST_CMD, + IW_PRIV_TYPE_INT | MAX_VAR_ARGS, + 0, + "setUnitTestCmd" }, /* handlers for main ioctl */ { WLAN_PRIV_ADD_TSPEC, diff --git a/CORE/MAC/src/include/sirParams.h b/CORE/MAC/src/include/sirParams.h index 19f69267e10c..49cb89cf0533 100644 --- a/CORE/MAC/src/include/sirParams.h +++ b/CORE/MAC/src/include/sirParams.h @@ -637,10 +637,14 @@ typedef struct sSirMbMsgP2p #ifdef FEATURE_WLAN_AUTO_SHUTDOWN #define SIR_HAL_SET_AUTO_SHUTDOWN_TIMER_REQ (SIR_HAL_ITC_MSG_TYPES_BEGIN + 281) #endif + #ifdef WLAN_FEATURE_ROAM_OFFLOAD #define SIR_HAL_HO_FAIL_IND (SIR_HAL_ITC_MSG_TYPES_BEGIN + 282) #endif #define SIR_HAL_SET_BASE_MACADDR_IND (SIR_HAL_ITC_MSG_TYPES_BEGIN + 283) + +#define SIR_HAL_UNIT_TEST_CMD (SIR_HAL_ITC_MSG_TYPES_BEGIN + 284) + #define SIR_HAL_MSG_TYPES_END (SIR_HAL_MSG_TYPES_BEGIN + 0x1FF) // CFG message types diff --git a/CORE/SERVICES/WMA/wma.c b/CORE/SERVICES/WMA/wma.c index 425cdca98a79..06b54281e9e4 100644 --- a/CORE/SERVICES/WMA/wma.c +++ b/CORE/SERVICES/WMA/wma.c @@ -21084,6 +21084,58 @@ static VOS_STATUS wma_nan_req(void *wda_handle, tpNanRequest nan_req) } #endif +#ifdef WLAN_FEATURE_ROAM_OFFLOAD +static void wma_process_unit_test_cmd(WMA_HANDLE handle, + t_wma_unit_test_cmd *wma_utest) +{ + tp_wma_handle wma_handle = (tp_wma_handle) handle; + wmi_unit_test_cmd_fixed_param* cmd; + wmi_buf_t wmi_buf; + u_int8_t *buf_ptr; + int i; + u_int16_t len, args_tlv_len; + A_UINT32 *unit_test_cmd_args; + + args_tlv_len = WMI_TLV_HDR_SIZE + wma_utest->num_args * sizeof(A_UINT32); + len = sizeof(wmi_unit_test_cmd_fixed_param) + args_tlv_len; + if (!wma_handle || !wma_handle->wmi_handle) { + WMA_LOGE("%s: WMA is closed, can not issue fw unit test cmd", + __func__); + return; + } + wmi_buf = wmi_buf_alloc(wma_handle->wmi_handle, len); + if (!wmi_buf) { + WMA_LOGE("%s: wmai_buf_alloc failed", __func__); + return; + } + + cmd = (wmi_unit_test_cmd_fixed_param *)wmi_buf_data(wmi_buf); + buf_ptr = (u_int8_t *) cmd; + WMITLV_SET_HDR(&cmd->tlv_header, + WMITLV_TAG_STRUC_wmi_unit_test_cmd_fixed_param, + WMITLV_GET_STRUCT_TLVLEN(wmi_unit_test_cmd_fixed_param)); + cmd->vdev_id = wma_utest->vdev_id; + cmd->module_id = wma_utest->module_id; + cmd->num_args = wma_utest->num_args; + buf_ptr += sizeof(wmi_unit_test_cmd_fixed_param); + WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, + (wma_utest->num_args * sizeof(u_int32_t))); + unit_test_cmd_args = (A_UINT32 *)(buf_ptr + WMI_TLV_HDR_SIZE); + WMA_LOGI("%s: %d num of args = ", __func__, wma_utest->num_args); + for (i = 0; (i < wma_utest->num_args && i < WMA_MAX_NUM_ARGS); i++) { + unit_test_cmd_args[i] = wma_utest->args[i]; + WMA_LOGI("%d,", wma_utest->args[i]); + } + if (wmi_unified_cmd_send(wma_handle->wmi_handle, wmi_buf, len, + WMI_UNIT_TEST_CMDID)) { + WMA_LOGP("%s: failed to send unit test command", __func__); + adf_nbuf_free(wmi_buf); + return; + } + return; +} +#endif + /* * function : wma_mc_process_msg * Description : @@ -21602,6 +21654,11 @@ VOS_STATUS wma_mc_process_msg(v_VOID_t *vos_context, vos_msg_t *msg) (tSirSmeRoamOffloadSynchCnf *)msg->bodyptr); vos_mem_free(msg->bodyptr); break; + case SIR_HAL_UNIT_TEST_CMD: + wma_process_unit_test_cmd(wma_handle, + (t_wma_unit_test_cmd *)msg->bodyptr); + vos_mem_free(msg->bodyptr); + break; #endif #ifdef WLAN_FEATURE_NAN case WDA_NAN_REQUEST: diff --git a/CORE/SERVICES/WMA/wma.h b/CORE/SERVICES/WMA/wma.h index 9e6212d1c463..56e31f18944f 100644 --- a/CORE/SERVICES/WMA/wma.h +++ b/CORE/SERVICES/WMA/wma.h @@ -1668,4 +1668,12 @@ A_UINT32 eCsrEncryptionType_to_rsn_cipherset (eCsrEncryptionType encr); #define WMA_TX_Q_RECHECK_TIMER_WAIT 2 // 2 ms #define WMA_TX_Q_RECHECK_TIMER_MAX_WAIT 20 // 20 ms +#define WMA_MAX_NUM_ARGS 8 +typedef struct wma_unit_test_cmd +{ + v_UINT_t vdev_id; + WLAN_MODULE_ID module_id; + v_U32_t num_args; + v_U32_t args[WMA_MAX_NUM_ARGS]; +}t_wma_unit_test_cmd; #endif |
