qcacmn: Add modules to handle and extract NAN events

As part of supporting NAN DBS, new WMI TLVs are defined so
that Host can maintain the status of NAN Discovery in sync
with the Firmware. Move the older handlers into the NAN
related files. Also add modules to extract information from
the new TLV's and fill up the event parameters to pass
them to the NAN component. add support for explicitly
disabling NAN due to concurrencies.

Add modules to handle and extract the info from NAN events.

Change-Id: Ic03baaaef45106353c211a813e11e33a90cd41ca
CRs-Fixed: 2338059
This commit is contained in:
Nachiket Kukade
2018-11-08 18:19:51 +05:30
committed by nshrivas
parent 762c2fef95
commit 1d925bafba
4 changed files with 302 additions and 96 deletions

View File

@@ -502,87 +502,6 @@ static QDF_STATUS send_wlm_latency_level_cmd_tlv(wmi_unified_t wmi_handle,
return 0;
}
#ifdef WLAN_FEATURE_NAN
/**
* send_nan_req_cmd_tlv() - to send nan request to target
* @wmi_handle: wmi handle
* @nan_req: request data which will be non-null
*
* Return: CDF status
*/
static QDF_STATUS send_nan_req_cmd_tlv(wmi_unified_t wmi_handle,
struct nan_req_params *nan_req)
{
QDF_STATUS ret;
wmi_nan_cmd_param *cmd;
wmi_buf_t buf;
uint16_t len = sizeof(*cmd);
uint16_t nan_data_len, nan_data_len_aligned;
uint8_t *buf_ptr;
/*
* <----- cmd ------------><-- WMI_TLV_HDR_SIZE --><--- data ---->
* +------------+----------+-----------------------+--------------+
* | tlv_header | data_len | WMITLV_TAG_ARRAY_BYTE | nan_req_data |
* +------------+----------+-----------------------+--------------+
*/
if (!nan_req) {
WMI_LOGE("%s:nan req is not valid", __func__);
return QDF_STATUS_E_FAILURE;
}
nan_data_len = nan_req->request_data_len;
nan_data_len_aligned = roundup(nan_req->request_data_len,
sizeof(uint32_t));
if (nan_data_len_aligned < nan_req->request_data_len) {
WMI_LOGE("%s: integer overflow while rounding up data_len",
__func__);
return QDF_STATUS_E_FAILURE;
}
if (nan_data_len_aligned > WMI_SVC_MSG_MAX_SIZE - WMI_TLV_HDR_SIZE) {
WMI_LOGE("%s: wmi_max_msg_size overflow for given datalen",
__func__);
return QDF_STATUS_E_FAILURE;
}
len += WMI_TLV_HDR_SIZE + nan_data_len_aligned;
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf) {
return QDF_STATUS_E_NOMEM;
}
buf_ptr = (uint8_t *) wmi_buf_data(buf);
cmd = (wmi_nan_cmd_param *) buf_ptr;
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_nan_cmd_param,
WMITLV_GET_STRUCT_TLVLEN(wmi_nan_cmd_param));
cmd->data_len = nan_req->request_data_len;
WMI_LOGD("%s: The data len value is %u",
__func__, nan_req->request_data_len);
buf_ptr += sizeof(wmi_nan_cmd_param);
WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, nan_data_len_aligned);
buf_ptr += WMI_TLV_HDR_SIZE;
qdf_mem_copy(buf_ptr, nan_req->request_data, cmd->data_len);
wmi_mtrace(WMI_NAN_CMDID, NO_SESSION, 0);
ret = wmi_unified_cmd_send(wmi_handle, buf, len,
WMI_NAN_CMDID);
if (QDF_IS_STATUS_ERROR(ret)) {
WMI_LOGE("%s Failed to send set param command ret = %d",
__func__, ret);
wmi_buf_free(buf);
}
return ret;
}
void wmi_nan_feature_attach_tlv(struct wmi_unified *wmi_handle)
{
struct wmi_ops *ops = wmi_handle->ops;
ops->send_nan_req_cmd = send_nan_req_cmd_tlv;
}
#endif /* WLAN_FEATURE_NAN */
#ifdef CONVERGED_TDLS_ENABLE
/**
* tdls_get_wmi_offchannel_mode - Get WMI tdls off channel mode
@@ -2584,6 +2503,5 @@ void wmi_sta_attach_tlv(wmi_unified_t wmi_handle)
wmi_tdls_attach_tlv(wmi_handle);
wmi_disa_attach_tlv(wmi_handle);
wmi_policy_mgr_attach_tlv(wmi_handle);
wmi_nan_feature_attach_tlv(wmi_handle);
}