qcacmn: Featurize WMI APIs and TLVs that are specific to MCL

In the existing converged component, WMI TLV APIs are implemented in
a generic manner without proper featurization. All the APIs exposed
outside of WMI are implemented in wmi_unified_api.c and all the APIs
forming the CMD or extracting the EVT is implemented in wmi_unified_tlv.c.
Since WIN and MCL have a unified WMI layer in the converged component and
there are features within WIN and MCL that are not common, there exists a
good number of WMI APIs which are specific to WIN but compiled by MCL and
vice-versa. Due to this inadvertent problem, there is a chunk of code and
memory used up by WIN and MCL for features that are not used in their
products.
Featurize WMI APIs and TLVs that are specific to MCL -
- DSRC
- NAN
- P2P
- PMO
- roaming
- concurrency
- STA
- Generic MCL specific WMI (STA)

Change-Id: I03a68b0db30a3aa585b269ab0a1745b37bc7e0b7
CRs-Fixed: 2316935
This commit is contained in:
Qiwei Cai
2018-09-17 19:17:13 +08:00
committed by nshrivas
parent d47b3468d2
commit 3d26b2ee7d
16 changed files with 10669 additions and 10905 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,65 @@
/*
* Copyright (c) 2013-2018 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Implement API's specific to concurrency component.
*/
#include <wmi_unified_priv.h>
#include <wmi_unified_concurrency_api.h>
QDF_STATUS wmi_unified_set_enable_disable_mcc_adaptive_scheduler_cmd(
void *wmi_hdl, uint32_t mcc_adaptive_scheduler,
uint32_t pdev_id)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_set_enable_disable_mcc_adaptive_scheduler_cmd)
return wmi_handle->ops->send_set_enable_disable_mcc_adaptive_scheduler_cmd(wmi_handle,
mcc_adaptive_scheduler, pdev_id);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_set_mcc_channel_time_latency_cmd(void *wmi_hdl,
uint32_t mcc_channel_freq, uint32_t mcc_channel_time_latency)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_set_mcc_channel_time_latency_cmd)
return wmi_handle->ops->send_set_mcc_channel_time_latency_cmd(wmi_handle,
mcc_channel_freq,
mcc_channel_time_latency);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_set_mcc_channel_time_quota_cmd(void *wmi_hdl,
uint32_t adapter_1_chan_freq,
uint32_t adapter_1_quota, uint32_t adapter_2_chan_freq)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_set_mcc_channel_time_quota_cmd)
return wmi_handle->ops->send_set_mcc_channel_time_quota_cmd(wmi_handle,
adapter_1_chan_freq,
adapter_1_quota,
adapter_2_chan_freq);
return QDF_STATUS_E_FAILURE;
}

View File

@@ -0,0 +1,242 @@
/*
* Copyright (c) 2013-2018 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include <osdep.h>
#include <wmi.h>
#include <wmi_unified_priv.h>
#include <wmi_unified_concurrency_api.h>
/**
* send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv() -enable/disable
* mcc scheduler
* @wmi_handle: wmi handle
* @mcc_adaptive_scheduler: enable/disable
*
* This function enable/disable mcc adaptive scheduler in fw.
*
* Return: QDF_STATUS_SUCCESS for success or error code
*/
static QDF_STATUS send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv(
wmi_unified_t wmi_handle, uint32_t mcc_adaptive_scheduler,
uint32_t pdev_id)
{
QDF_STATUS ret;
wmi_buf_t buf = 0;
wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param *cmd = NULL;
uint16_t len =
sizeof(wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param);
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf) {
return QDF_STATUS_E_NOMEM;
}
cmd = (wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param *)
wmi_buf_data(buf);
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param,
WMITLV_GET_STRUCT_TLVLEN
(wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param));
cmd->enable = mcc_adaptive_scheduler;
cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(pdev_id);
wmi_mtrace(WMI_RESMGR_ADAPTIVE_OCS_ENABLE_DISABLE_CMDID, NO_SESSION, 0);
ret = wmi_unified_cmd_send(wmi_handle, buf, len,
WMI_RESMGR_ADAPTIVE_OCS_ENABLE_DISABLE_CMDID);
if (QDF_IS_STATUS_ERROR(ret)) {
WMI_LOGP("%s: Failed to send enable/disable MCC"
" adaptive scheduler command", __func__);
wmi_buf_free(buf);
}
return ret;
}
/**
* send_set_mcc_channel_time_latency_cmd_tlv() -set MCC channel time latency
* @wmi: wmi handle
* @mcc_channel: mcc channel
* @mcc_channel_time_latency: MCC channel time latency.
*
* Currently used to set time latency for an MCC vdev/adapter using operating
* channel of it and channel number. The info is provided run time using
* iwpriv command: iwpriv <wlan0 | p2p0> setMccLatency <latency in ms>.
*
* Return: CDF status
*/
static QDF_STATUS send_set_mcc_channel_time_latency_cmd_tlv(
wmi_unified_t wmi_handle,
uint32_t mcc_channel_freq,
uint32_t mcc_channel_time_latency)
{
QDF_STATUS ret;
wmi_buf_t buf = 0;
wmi_resmgr_set_chan_latency_cmd_fixed_param *cmdTL = NULL;
uint16_t len = 0;
uint8_t *buf_ptr = NULL;
wmi_resmgr_chan_latency chan_latency;
/* Note: we only support MCC time latency for a single channel */
uint32_t num_channels = 1;
uint32_t chan1_freq = mcc_channel_freq;
uint32_t latency_chan1 = mcc_channel_time_latency;
/* If 0ms latency is provided, then FW will set to a default.
* Otherwise, latency must be at least 30ms.
*/
if ((latency_chan1 > 0) &&
(latency_chan1 < WMI_MCC_MIN_NON_ZERO_CHANNEL_LATENCY)) {
WMI_LOGE("%s: Invalid time latency for Channel #1 = %dms "
"Minimum is 30ms (or 0 to use default value by "
"firmware)", __func__, latency_chan1);
return QDF_STATUS_E_INVAL;
}
/* Set WMI CMD for channel time latency here */
len = sizeof(wmi_resmgr_set_chan_latency_cmd_fixed_param) +
WMI_TLV_HDR_SIZE + /*Place holder for chan_time_latency array */
num_channels * sizeof(wmi_resmgr_chan_latency);
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf) {
return QDF_STATUS_E_NOMEM;
}
buf_ptr = (uint8_t *) wmi_buf_data(buf);
cmdTL = (wmi_resmgr_set_chan_latency_cmd_fixed_param *)
wmi_buf_data(buf);
WMITLV_SET_HDR(&cmdTL->tlv_header,
WMITLV_TAG_STRUC_wmi_resmgr_set_chan_latency_cmd_fixed_param,
WMITLV_GET_STRUCT_TLVLEN
(wmi_resmgr_set_chan_latency_cmd_fixed_param));
cmdTL->num_chans = num_channels;
/* Update channel time latency information for home channel(s) */
buf_ptr += sizeof(*cmdTL);
WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE,
num_channels * sizeof(wmi_resmgr_chan_latency));
buf_ptr += WMI_TLV_HDR_SIZE;
chan_latency.chan_mhz = chan1_freq;
chan_latency.latency = latency_chan1;
qdf_mem_copy(buf_ptr, &chan_latency, sizeof(chan_latency));
wmi_mtrace(WMI_RESMGR_SET_CHAN_LATENCY_CMDID, NO_SESSION, 0);
ret = wmi_unified_cmd_send(wmi_handle, buf, len,
WMI_RESMGR_SET_CHAN_LATENCY_CMDID);
if (QDF_IS_STATUS_ERROR(ret)) {
WMI_LOGE("%s: Failed to send MCC Channel Time Latency command",
__func__);
wmi_buf_free(buf);
QDF_ASSERT(0);
}
return ret;
}
/**
* send_set_mcc_channel_time_quota_cmd_tlv() -set MCC channel time quota
* @wmi: wmi handle
* @adapter_1_chan_number: adapter 1 channel number
* @adapter_1_quota: adapter 1 quota
* @adapter_2_chan_number: adapter 2 channel number
*
* Return: CDF status
*/
static QDF_STATUS send_set_mcc_channel_time_quota_cmd_tlv(
wmi_unified_t wmi_handle,
uint32_t adapter_1_chan_freq,
uint32_t adapter_1_quota,
uint32_t adapter_2_chan_freq)
{
QDF_STATUS ret;
wmi_buf_t buf = 0;
uint16_t len = 0;
uint8_t *buf_ptr = NULL;
wmi_resmgr_set_chan_time_quota_cmd_fixed_param *cmdTQ = NULL;
wmi_resmgr_chan_time_quota chan_quota;
uint32_t quota_chan1 = adapter_1_quota;
/* Knowing quota of 1st chan., derive quota for 2nd chan. */
uint32_t quota_chan2 = 100 - quota_chan1;
/* Note: setting time quota for MCC requires info for 2 channels */
uint32_t num_channels = 2;
uint32_t chan1_freq = adapter_1_chan_freq;
uint32_t chan2_freq = adapter_2_chan_freq;
WMI_LOGD("%s: freq1:%dMHz, Quota1:%dms, "
"freq2:%dMHz, Quota2:%dms", __func__,
chan1_freq, quota_chan1, chan2_freq,
quota_chan2);
/*
* Perform sanity check on time quota values provided.
*/
if (quota_chan1 < WMI_MCC_MIN_CHANNEL_QUOTA ||
quota_chan1 > WMI_MCC_MAX_CHANNEL_QUOTA) {
WMI_LOGE("%s: Invalid time quota for Channel #1=%dms. Minimum "
"is 20ms & maximum is 80ms", __func__, quota_chan1);
return QDF_STATUS_E_INVAL;
}
/* Set WMI CMD for channel time quota here */
len = sizeof(wmi_resmgr_set_chan_time_quota_cmd_fixed_param) +
WMI_TLV_HDR_SIZE + /* Place holder for chan_time_quota array */
num_channels * sizeof(wmi_resmgr_chan_time_quota);
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf) {
return QDF_STATUS_E_NOMEM;
}
buf_ptr = (uint8_t *) wmi_buf_data(buf);
cmdTQ = (wmi_resmgr_set_chan_time_quota_cmd_fixed_param *)
wmi_buf_data(buf);
WMITLV_SET_HDR(&cmdTQ->tlv_header,
WMITLV_TAG_STRUC_wmi_resmgr_set_chan_time_quota_cmd_fixed_param,
WMITLV_GET_STRUCT_TLVLEN
(wmi_resmgr_set_chan_time_quota_cmd_fixed_param));
cmdTQ->num_chans = num_channels;
/* Update channel time quota information for home channel(s) */
buf_ptr += sizeof(*cmdTQ);
WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE,
num_channels * sizeof(wmi_resmgr_chan_time_quota));
buf_ptr += WMI_TLV_HDR_SIZE;
chan_quota.chan_mhz = chan1_freq;
chan_quota.channel_time_quota = quota_chan1;
qdf_mem_copy(buf_ptr, &chan_quota, sizeof(chan_quota));
/* Construct channel and quota record for the 2nd MCC mode. */
buf_ptr += sizeof(chan_quota);
chan_quota.chan_mhz = chan2_freq;
chan_quota.channel_time_quota = quota_chan2;
qdf_mem_copy(buf_ptr, &chan_quota, sizeof(chan_quota));
wmi_mtrace(WMI_RESMGR_SET_CHAN_TIME_QUOTA_CMDID, NO_SESSION, 0);
ret = wmi_unified_cmd_send(wmi_handle, buf, len,
WMI_RESMGR_SET_CHAN_TIME_QUOTA_CMDID);
if (QDF_IS_STATUS_ERROR(ret)) {
WMI_LOGE("Failed to send MCC Channel Time Quota command");
wmi_buf_free(buf);
QDF_ASSERT(0);
}
return ret;
}
void wmi_concurrency_attach_tlv(wmi_unified_t wmi_handle)
{
struct wmi_ops *ops = wmi_handle->ops;
ops->send_set_enable_disable_mcc_adaptive_scheduler_cmd =
send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv;
ops->send_set_mcc_channel_time_latency_cmd =
send_set_mcc_channel_time_latency_cmd_tlv;
ops->send_set_mcc_channel_time_quota_cmd =
send_set_mcc_channel_time_quota_cmd_tlv;
}

131
wmi_unified_nan_api.c Normal file
View File

@@ -0,0 +1,131 @@
/*
* Copyright (c) 2013-2018 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Implement API's specific to NAN component.
*/
#include <wmi_unified_priv.h>
#include <wmi_unified_nan_api.h>
QDF_STATUS wmi_unified_ndp_initiator_req_cmd_send(void *wmi_hdl,
struct nan_datapath_initiator_req *req)
{
wmi_unified_t wmi_handle = wmi_hdl;
if (wmi_handle->ops->send_ndp_initiator_req_cmd)
return wmi_handle->ops->send_ndp_initiator_req_cmd(wmi_handle,
req);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_ndp_responder_req_cmd_send(void *wmi_hdl,
struct nan_datapath_responder_req *req)
{
wmi_unified_t wmi_handle = wmi_hdl;
if (wmi_handle->ops->send_ndp_responder_req_cmd)
return wmi_handle->ops->send_ndp_responder_req_cmd(wmi_handle,
req);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_ndp_end_req_cmd_send(void *wmi_hdl,
struct nan_datapath_end_req *req)
{
wmi_unified_t wmi_handle = wmi_hdl;
if (wmi_handle->ops->send_ndp_end_req_cmd)
return wmi_handle->ops->send_ndp_end_req_cmd(wmi_handle,
req);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_extract_ndp_initiator_rsp(wmi_unified_t wmi_handle,
uint8_t *data, struct nan_datapath_initiator_rsp *rsp)
{
if (wmi_handle->ops->extract_ndp_initiator_rsp)
return wmi_handle->ops->extract_ndp_initiator_rsp(wmi_handle,
data, rsp);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_extract_ndp_ind(wmi_unified_t wmi_handle, uint8_t *data,
struct nan_datapath_indication_event *ind)
{
if (wmi_handle->ops->extract_ndp_ind)
return wmi_handle->ops->extract_ndp_ind(wmi_handle,
data, ind);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_extract_ndp_confirm(wmi_unified_t wmi_handle, uint8_t *data,
struct nan_datapath_confirm_event *ev)
{
if (wmi_handle->ops->extract_ndp_confirm)
return wmi_handle->ops->extract_ndp_confirm(wmi_handle,
data, ev);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_extract_ndp_responder_rsp(wmi_unified_t wmi_handle,
uint8_t *data,
struct nan_datapath_responder_rsp *rsp)
{
if (wmi_handle->ops->extract_ndp_responder_rsp)
return wmi_handle->ops->extract_ndp_responder_rsp(wmi_handle,
data, rsp);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_extract_ndp_end_rsp(wmi_unified_t wmi_handle, uint8_t *data,
struct nan_datapath_end_rsp_event *rsp)
{
if (wmi_handle->ops->extract_ndp_end_rsp)
return wmi_handle->ops->extract_ndp_end_rsp(wmi_handle,
data, rsp);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_extract_ndp_end_ind(wmi_unified_t wmi_handle, uint8_t *data,
struct nan_datapath_end_indication_event **ind)
{
if (wmi_handle->ops->extract_ndp_end_ind)
return wmi_handle->ops->extract_ndp_end_ind(wmi_handle,
data, ind);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_extract_ndp_sch_update(wmi_unified_t wmi_handle, uint8_t *data,
struct nan_datapath_sch_update_event *ind)
{
if (wmi_handle->ops->extract_ndp_sch_update)
return wmi_handle->ops->extract_ndp_sch_update(wmi_handle,
data, ind);
return QDF_STATUS_E_FAILURE;
}

859
wmi_unified_nan_tlv.c Normal file
View File

@@ -0,0 +1,859 @@
/*
* Copyright (c) 2013-2018 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include <osdep.h>
#include <wmi.h>
#include <wmi_unified_priv.h>
#include <nan_public_structs.h>
#include <wmi_unified_nan_api.h>
static QDF_STATUS nan_ndp_initiator_req_tlv(wmi_unified_t wmi_handle,
struct nan_datapath_initiator_req *ndp_req)
{
uint16_t len;
wmi_buf_t buf;
uint8_t *tlv_ptr;
QDF_STATUS status;
wmi_channel *ch_tlv;
wmi_ndp_initiator_req_fixed_param *cmd;
uint32_t passphrase_len, service_name_len;
uint32_t ndp_cfg_len, ndp_app_info_len, pmk_len;
wmi_ndp_transport_ip_param *tcp_ip_param;
/*
* WMI command expects 4 byte alligned len:
* round up ndp_cfg_len and ndp_app_info_len to 4 bytes
*/
ndp_cfg_len = qdf_roundup(ndp_req->ndp_config.ndp_cfg_len, 4);
ndp_app_info_len = qdf_roundup(ndp_req->ndp_info.ndp_app_info_len, 4);
pmk_len = qdf_roundup(ndp_req->pmk.pmk_len, 4);
passphrase_len = qdf_roundup(ndp_req->passphrase.passphrase_len, 4);
service_name_len =
qdf_roundup(ndp_req->service_name.service_name_len, 4);
/* allocated memory for fixed params as well as variable size data */
len = sizeof(*cmd) + sizeof(*ch_tlv) + (5 * WMI_TLV_HDR_SIZE)
+ ndp_cfg_len + ndp_app_info_len + pmk_len
+ passphrase_len + service_name_len;
if (ndp_req->is_ipv6_addr_present)
len += sizeof(*tcp_ip_param);
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf) {
return QDF_STATUS_E_NOMEM;
}
cmd = (wmi_ndp_initiator_req_fixed_param *) wmi_buf_data(buf);
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_ndp_initiator_req_fixed_param,
WMITLV_GET_STRUCT_TLVLEN(
wmi_ndp_initiator_req_fixed_param));
cmd->vdev_id = wlan_vdev_get_id(ndp_req->vdev);
cmd->transaction_id = ndp_req->transaction_id;
cmd->service_instance_id = ndp_req->service_instance_id;
WMI_CHAR_ARRAY_TO_MAC_ADDR(ndp_req->peer_discovery_mac_addr.bytes,
&cmd->peer_discovery_mac_addr);
cmd->ndp_cfg_len = ndp_req->ndp_config.ndp_cfg_len;
cmd->ndp_app_info_len = ndp_req->ndp_info.ndp_app_info_len;
cmd->ndp_channel_cfg = ndp_req->channel_cfg;
cmd->nan_pmk_len = ndp_req->pmk.pmk_len;
cmd->nan_csid = ndp_req->ncs_sk_type;
cmd->nan_passphrase_len = ndp_req->passphrase.passphrase_len;
cmd->nan_servicename_len = ndp_req->service_name.service_name_len;
ch_tlv = (wmi_channel *)&cmd[1];
WMITLV_SET_HDR(ch_tlv, WMITLV_TAG_STRUC_wmi_channel,
WMITLV_GET_STRUCT_TLVLEN(wmi_channel));
ch_tlv->mhz = ndp_req->channel;
tlv_ptr = (uint8_t *)&ch_tlv[1];
WMITLV_SET_HDR(tlv_ptr, WMITLV_TAG_ARRAY_BYTE, ndp_cfg_len);
qdf_mem_copy(&tlv_ptr[WMI_TLV_HDR_SIZE],
ndp_req->ndp_config.ndp_cfg, cmd->ndp_cfg_len);
tlv_ptr = tlv_ptr + WMI_TLV_HDR_SIZE + ndp_cfg_len;
WMITLV_SET_HDR(tlv_ptr, WMITLV_TAG_ARRAY_BYTE, ndp_app_info_len);
qdf_mem_copy(&tlv_ptr[WMI_TLV_HDR_SIZE],
ndp_req->ndp_info.ndp_app_info, cmd->ndp_app_info_len);
tlv_ptr = tlv_ptr + WMI_TLV_HDR_SIZE + ndp_app_info_len;
WMITLV_SET_HDR(tlv_ptr, WMITLV_TAG_ARRAY_BYTE, pmk_len);
qdf_mem_copy(&tlv_ptr[WMI_TLV_HDR_SIZE], ndp_req->pmk.pmk,
cmd->nan_pmk_len);
tlv_ptr = tlv_ptr + WMI_TLV_HDR_SIZE + pmk_len;
WMITLV_SET_HDR(tlv_ptr, WMITLV_TAG_ARRAY_BYTE, passphrase_len);
qdf_mem_copy(&tlv_ptr[WMI_TLV_HDR_SIZE], ndp_req->passphrase.passphrase,
cmd->nan_passphrase_len);
tlv_ptr = tlv_ptr + WMI_TLV_HDR_SIZE + passphrase_len;
WMITLV_SET_HDR(tlv_ptr, WMITLV_TAG_ARRAY_BYTE, service_name_len);
qdf_mem_copy(&tlv_ptr[WMI_TLV_HDR_SIZE],
ndp_req->service_name.service_name,
cmd->nan_servicename_len);
tlv_ptr = tlv_ptr + WMI_TLV_HDR_SIZE + service_name_len;
if (ndp_req->is_ipv6_addr_present) {
tcp_ip_param = (wmi_ndp_transport_ip_param *)tlv_ptr;
WMITLV_SET_HDR(tcp_ip_param,
WMITLV_TAG_STRUC_wmi_ndp_transport_ip_param,
WMITLV_GET_STRUCT_TLVLEN(
wmi_ndp_transport_ip_param));
tcp_ip_param->ipv6_addr_present = true;
qdf_mem_copy(tcp_ip_param->ipv6_intf_addr,
ndp_req->ipv6_addr, WMI_NDP_IPV6_INTF_ADDR_LEN);
}
WMI_LOGD(FL("IPv6 addr present: %d, addr: %pI6"),
ndp_req->is_ipv6_addr_present, ndp_req->ipv6_addr);
WMI_LOGD("vdev_id = %d, transaction_id: %d, service_instance_id: %d, ch: %d, ch_cfg: %d, csid: %d",
cmd->vdev_id, cmd->transaction_id, cmd->service_instance_id,
ch_tlv->mhz, cmd->ndp_channel_cfg, cmd->nan_csid);
WMI_LOGD("peer mac addr: mac_addr31to0: 0x%x, mac_addr47to32: 0x%x",
cmd->peer_discovery_mac_addr.mac_addr31to0,
cmd->peer_discovery_mac_addr.mac_addr47to32);
WMI_LOGD("ndp_config len: %d", cmd->ndp_cfg_len);
QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_DEBUG,
ndp_req->ndp_config.ndp_cfg,
ndp_req->ndp_config.ndp_cfg_len);
WMI_LOGD("ndp_app_info len: %d", cmd->ndp_app_info_len);
QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_DEBUG,
ndp_req->ndp_info.ndp_app_info,
ndp_req->ndp_info.ndp_app_info_len);
WMI_LOGD("pmk len: %d", cmd->nan_pmk_len);
QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_DEBUG,
ndp_req->pmk.pmk, cmd->nan_pmk_len);
WMI_LOGD("pass phrase len: %d", cmd->nan_passphrase_len);
QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_DEBUG,
ndp_req->passphrase.passphrase,
cmd->nan_passphrase_len);
WMI_LOGD("service name len: %d", cmd->nan_servicename_len);
QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_DEBUG,
ndp_req->service_name.service_name,
cmd->nan_servicename_len);
WMI_LOGD("sending WMI_NDP_INITIATOR_REQ_CMDID(0x%X)",
WMI_NDP_INITIATOR_REQ_CMDID);
wmi_mtrace(WMI_NDP_INITIATOR_REQ_CMDID, cmd->vdev_id, 0);
status = wmi_unified_cmd_send(wmi_handle, buf, len,
WMI_NDP_INITIATOR_REQ_CMDID);
if (QDF_IS_STATUS_ERROR(status)) {
WMI_LOGE("WMI_NDP_INITIATOR_REQ_CMDID failed, ret: %d", status);
wmi_buf_free(buf);
}
return status;
}
static QDF_STATUS nan_ndp_responder_req_tlv(wmi_unified_t wmi_handle,
struct nan_datapath_responder_req *req)
{
uint16_t len;
wmi_buf_t buf;
uint8_t *tlv_ptr;
QDF_STATUS status;
wmi_ndp_responder_req_fixed_param *cmd;
wmi_ndp_transport_ip_param *tcp_ip_param;
uint32_t passphrase_len, service_name_len;
uint32_t vdev_id = 0, ndp_cfg_len, ndp_app_info_len, pmk_len;
vdev_id = wlan_vdev_get_id(req->vdev);
WMI_LOGD("vdev_id: %d, transaction_id: %d, ndp_rsp %d, ndp_instance_id: %d, ndp_app_info_len: %d",
vdev_id, req->transaction_id,
req->ndp_rsp,
req->ndp_instance_id,
req->ndp_info.ndp_app_info_len);
/*
* WMI command expects 4 byte alligned len:
* round up ndp_cfg_len and ndp_app_info_len to 4 bytes
*/
ndp_cfg_len = qdf_roundup(req->ndp_config.ndp_cfg_len, 4);
ndp_app_info_len = qdf_roundup(req->ndp_info.ndp_app_info_len, 4);
pmk_len = qdf_roundup(req->pmk.pmk_len, 4);
passphrase_len = qdf_roundup(req->passphrase.passphrase_len, 4);
service_name_len =
qdf_roundup(req->service_name.service_name_len, 4);
/* allocated memory for fixed params as well as variable size data */
len = sizeof(*cmd) + 5*WMI_TLV_HDR_SIZE + ndp_cfg_len + ndp_app_info_len
+ pmk_len + passphrase_len + service_name_len;
if (req->is_ipv6_addr_present || req->is_port_present ||
req->is_protocol_present)
len += sizeof(*tcp_ip_param);
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf) {
return QDF_STATUS_E_NOMEM;
}
cmd = (wmi_ndp_responder_req_fixed_param *) wmi_buf_data(buf);
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_ndp_responder_req_fixed_param,
WMITLV_GET_STRUCT_TLVLEN(
wmi_ndp_responder_req_fixed_param));
cmd->vdev_id = vdev_id;
cmd->transaction_id = req->transaction_id;
cmd->ndp_instance_id = req->ndp_instance_id;
cmd->rsp_code = req->ndp_rsp;
cmd->ndp_cfg_len = req->ndp_config.ndp_cfg_len;
cmd->ndp_app_info_len = req->ndp_info.ndp_app_info_len;
cmd->nan_pmk_len = req->pmk.pmk_len;
cmd->nan_csid = req->ncs_sk_type;
cmd->nan_passphrase_len = req->passphrase.passphrase_len;
cmd->nan_servicename_len = req->service_name.service_name_len;
tlv_ptr = (uint8_t *)&cmd[1];
WMITLV_SET_HDR(tlv_ptr, WMITLV_TAG_ARRAY_BYTE, ndp_cfg_len);
qdf_mem_copy(&tlv_ptr[WMI_TLV_HDR_SIZE],
req->ndp_config.ndp_cfg, cmd->ndp_cfg_len);
tlv_ptr = tlv_ptr + WMI_TLV_HDR_SIZE + ndp_cfg_len;
WMITLV_SET_HDR(tlv_ptr, WMITLV_TAG_ARRAY_BYTE, ndp_app_info_len);
qdf_mem_copy(&tlv_ptr[WMI_TLV_HDR_SIZE],
req->ndp_info.ndp_app_info,
req->ndp_info.ndp_app_info_len);
tlv_ptr = tlv_ptr + WMI_TLV_HDR_SIZE + ndp_app_info_len;
WMITLV_SET_HDR(tlv_ptr, WMITLV_TAG_ARRAY_BYTE, pmk_len);
qdf_mem_copy(&tlv_ptr[WMI_TLV_HDR_SIZE], req->pmk.pmk,
cmd->nan_pmk_len);
tlv_ptr = tlv_ptr + WMI_TLV_HDR_SIZE + pmk_len;
WMITLV_SET_HDR(tlv_ptr, WMITLV_TAG_ARRAY_BYTE, passphrase_len);
qdf_mem_copy(&tlv_ptr[WMI_TLV_HDR_SIZE],
req->passphrase.passphrase,
cmd->nan_passphrase_len);
tlv_ptr = tlv_ptr + WMI_TLV_HDR_SIZE + passphrase_len;
WMITLV_SET_HDR(tlv_ptr, WMITLV_TAG_ARRAY_BYTE, service_name_len);
qdf_mem_copy(&tlv_ptr[WMI_TLV_HDR_SIZE],
req->service_name.service_name,
cmd->nan_servicename_len);
tlv_ptr = tlv_ptr + WMI_TLV_HDR_SIZE + service_name_len;
if (req->is_ipv6_addr_present || req->is_port_present ||
req->is_protocol_present) {
tcp_ip_param = (wmi_ndp_transport_ip_param *)tlv_ptr;
WMITLV_SET_HDR(tcp_ip_param,
WMITLV_TAG_STRUC_wmi_ndp_transport_ip_param,
WMITLV_GET_STRUCT_TLVLEN(
wmi_ndp_transport_ip_param));
tcp_ip_param->ipv6_addr_present = req->is_ipv6_addr_present;
qdf_mem_copy(tcp_ip_param->ipv6_intf_addr,
req->ipv6_addr, WMI_NDP_IPV6_INTF_ADDR_LEN);
tcp_ip_param->trans_port_present = req->is_port_present;
tcp_ip_param->transport_port = req->port;
tcp_ip_param->trans_proto_present = req->is_protocol_present;
tcp_ip_param->transport_protocol = req->protocol;
}
WMI_LOGD(FL("IPv6 addr present: %d, addr: %pI6"),
req->is_ipv6_addr_present, req->ipv6_addr);
WMI_LOGD(FL("port: %d present: %d"), req->is_port_present, req->port);
WMI_LOGD(FL("protocol: %d present: %d"),
req->is_protocol_present, req->protocol);
WMI_LOGD("vdev_id = %d, transaction_id: %d, csid: %d",
cmd->vdev_id, cmd->transaction_id, cmd->nan_csid);
WMI_LOGD("ndp_config len: %d",
req->ndp_config.ndp_cfg_len);
QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_DEBUG,
req->ndp_config.ndp_cfg,
req->ndp_config.ndp_cfg_len);
WMI_LOGD("ndp_app_info len: %d",
req->ndp_info.ndp_app_info_len);
QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_DEBUG,
req->ndp_info.ndp_app_info,
req->ndp_info.ndp_app_info_len);
WMI_LOGD("pmk len: %d", cmd->nan_pmk_len);
QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_DEBUG,
req->pmk.pmk, cmd->nan_pmk_len);
WMI_LOGD("pass phrase len: %d", cmd->nan_passphrase_len);
QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_DEBUG,
req->passphrase.passphrase,
cmd->nan_passphrase_len);
WMI_LOGD("service name len: %d", cmd->nan_servicename_len);
QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_DEBUG,
req->service_name.service_name,
cmd->nan_servicename_len);
WMI_LOGD("sending WMI_NDP_RESPONDER_REQ_CMDID(0x%X)",
WMI_NDP_RESPONDER_REQ_CMDID);
wmi_mtrace(WMI_NDP_RESPONDER_REQ_CMDID, cmd->vdev_id, 0);
status = wmi_unified_cmd_send(wmi_handle, buf, len,
WMI_NDP_RESPONDER_REQ_CMDID);
if (QDF_IS_STATUS_ERROR(status)) {
WMI_LOGE("WMI_NDP_RESPONDER_REQ_CMDID failed, ret: %d", status);
wmi_buf_free(buf);
}
return status;
}
static QDF_STATUS nan_ndp_end_req_tlv(wmi_unified_t wmi_handle,
struct nan_datapath_end_req *req)
{
uint16_t len;
wmi_buf_t buf;
QDF_STATUS status;
uint32_t ndp_end_req_len, i;
wmi_ndp_end_req *ndp_end_req_lst;
wmi_ndp_end_req_fixed_param *cmd;
/* len of tlv following fixed param */
ndp_end_req_len = sizeof(wmi_ndp_end_req) * req->num_ndp_instances;
/* above comes out to 4 byte alligned already, no need of padding */
len = sizeof(*cmd) + ndp_end_req_len + WMI_TLV_HDR_SIZE;
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf) {
return QDF_STATUS_E_NOMEM;
}
cmd = (wmi_ndp_end_req_fixed_param *) wmi_buf_data(buf);
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_ndp_end_req_fixed_param,
WMITLV_GET_STRUCT_TLVLEN(wmi_ndp_end_req_fixed_param));
cmd->transaction_id = req->transaction_id;
/* set tlv pointer to end of fixed param */
WMITLV_SET_HDR((uint8_t *)&cmd[1], WMITLV_TAG_ARRAY_STRUC,
ndp_end_req_len);
ndp_end_req_lst = (wmi_ndp_end_req *)((uint8_t *)&cmd[1] +
WMI_TLV_HDR_SIZE);
for (i = 0; i < req->num_ndp_instances; i++) {
WMITLV_SET_HDR(&ndp_end_req_lst[i],
WMITLV_TAG_ARRAY_FIXED_STRUC,
(sizeof(*ndp_end_req_lst) - WMI_TLV_HDR_SIZE));
ndp_end_req_lst[i].ndp_instance_id = req->ndp_ids[i];
}
WMI_LOGD("Sending WMI_NDP_END_REQ_CMDID to FW");
wmi_mtrace(WMI_NDP_END_REQ_CMDID, NO_SESSION, 0);
status = wmi_unified_cmd_send(wmi_handle, buf, len,
WMI_NDP_END_REQ_CMDID);
if (QDF_IS_STATUS_ERROR(status)) {
WMI_LOGE("WMI_NDP_END_REQ_CMDID failed, ret: %d", status);
wmi_buf_free(buf);
}
return status;
}
static QDF_STATUS extract_ndp_initiator_rsp_tlv(wmi_unified_t wmi_handle,
uint8_t *data, struct nan_datapath_initiator_rsp *rsp)
{
WMI_NDP_INITIATOR_RSP_EVENTID_param_tlvs *event;
wmi_ndp_initiator_rsp_event_fixed_param *fixed_params;
event = (WMI_NDP_INITIATOR_RSP_EVENTID_param_tlvs *)data;
fixed_params = event->fixed_param;
rsp->vdev =
wlan_objmgr_get_vdev_by_id_from_psoc(wmi_handle->soc->wmi_psoc,
fixed_params->vdev_id,
WLAN_NAN_ID);
if (!rsp->vdev) {
WMI_LOGE("vdev is null");
return QDF_STATUS_E_INVAL;
}
rsp->transaction_id = fixed_params->transaction_id;
rsp->ndp_instance_id = fixed_params->ndp_instance_id;
rsp->status = fixed_params->rsp_status;
rsp->reason = fixed_params->reason_code;
return QDF_STATUS_SUCCESS;
}
static QDF_STATUS extract_ndp_ind_tlv(wmi_unified_t wmi_handle,
uint8_t *data, struct nan_datapath_indication_event *rsp)
{
WMI_NDP_INDICATION_EVENTID_param_tlvs *event;
wmi_ndp_indication_event_fixed_param *fixed_params;
size_t total_array_len;
event = (WMI_NDP_INDICATION_EVENTID_param_tlvs *)data;
fixed_params =
(wmi_ndp_indication_event_fixed_param *)event->fixed_param;
if (fixed_params->ndp_cfg_len > event->num_ndp_cfg) {
WMI_LOGE("FW message ndp cfg length %d larger than TLV hdr %d",
fixed_params->ndp_cfg_len, event->num_ndp_cfg);
return QDF_STATUS_E_INVAL;
}
if (fixed_params->ndp_app_info_len > event->num_ndp_app_info) {
WMI_LOGE("FW message ndp app info length %d more than TLV hdr %d",
fixed_params->ndp_app_info_len,
event->num_ndp_app_info);
return QDF_STATUS_E_INVAL;
}
if (fixed_params->ndp_cfg_len >
(WMI_SVC_MSG_MAX_SIZE - sizeof(*fixed_params))) {
WMI_LOGE("%s: excess wmi buffer: ndp_cfg_len %d",
__func__, fixed_params->ndp_cfg_len);
return QDF_STATUS_E_INVAL;
}
total_array_len = fixed_params->ndp_cfg_len +
sizeof(*fixed_params);
if (fixed_params->ndp_app_info_len >
(WMI_SVC_MSG_MAX_SIZE - total_array_len)) {
WMI_LOGE("%s: excess wmi buffer: ndp_cfg_len %d",
__func__, fixed_params->ndp_app_info_len);
return QDF_STATUS_E_INVAL;
}
total_array_len += fixed_params->ndp_app_info_len;
if (fixed_params->nan_scid_len >
(WMI_SVC_MSG_MAX_SIZE - total_array_len)) {
WMI_LOGE("%s: excess wmi buffer: ndp_cfg_len %d",
__func__, fixed_params->nan_scid_len);
return QDF_STATUS_E_INVAL;
}
rsp->vdev =
wlan_objmgr_get_vdev_by_id_from_psoc(wmi_handle->soc->wmi_psoc,
fixed_params->vdev_id,
WLAN_NAN_ID);
if (!rsp->vdev) {
WMI_LOGE("vdev is null");
return QDF_STATUS_E_INVAL;
}
rsp->service_instance_id = fixed_params->service_instance_id;
rsp->ndp_instance_id = fixed_params->ndp_instance_id;
rsp->role = fixed_params->self_ndp_role;
rsp->policy = fixed_params->accept_policy;
WMI_MAC_ADDR_TO_CHAR_ARRAY(&fixed_params->peer_ndi_mac_addr,
rsp->peer_mac_addr.bytes);
WMI_MAC_ADDR_TO_CHAR_ARRAY(&fixed_params->peer_discovery_mac_addr,
rsp->peer_discovery_mac_addr.bytes);
WMI_LOGD("WMI_NDP_INDICATION_EVENTID(0x%X) received. vdev %d,\n"
"service_instance %d, ndp_instance %d, role %d, policy %d,\n"
"csid: %d, scid_len: %d, peer_addr: %pM, peer_disc_addr: %pM",
WMI_NDP_INDICATION_EVENTID, fixed_params->vdev_id,
fixed_params->service_instance_id,
fixed_params->ndp_instance_id, fixed_params->self_ndp_role,
fixed_params->accept_policy,
fixed_params->nan_csid, fixed_params->nan_scid_len,
rsp->peer_mac_addr.bytes,
rsp->peer_discovery_mac_addr.bytes);
WMI_LOGD("ndp_cfg - %d bytes", fixed_params->ndp_cfg_len);
QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_DEBUG,
&event->ndp_cfg, fixed_params->ndp_cfg_len);
WMI_LOGD("ndp_app_info - %d bytes",
fixed_params->ndp_app_info_len);
QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_DEBUG,
&event->ndp_app_info, fixed_params->ndp_app_info_len);
rsp->ndp_config.ndp_cfg_len = fixed_params->ndp_cfg_len;
rsp->ndp_info.ndp_app_info_len = fixed_params->ndp_app_info_len;
rsp->ncs_sk_type = fixed_params->nan_csid;
rsp->scid.scid_len = fixed_params->nan_scid_len;
if (rsp->ndp_config.ndp_cfg_len > NDP_QOS_INFO_LEN)
rsp->ndp_config.ndp_cfg_len = NDP_QOS_INFO_LEN;
qdf_mem_copy(rsp->ndp_config.ndp_cfg, event->ndp_cfg,
rsp->ndp_config.ndp_cfg_len);
if (rsp->ndp_info.ndp_app_info_len > NDP_APP_INFO_LEN)
rsp->ndp_info.ndp_app_info_len = NDP_APP_INFO_LEN;
qdf_mem_copy(rsp->ndp_info.ndp_app_info, event->ndp_app_info,
rsp->ndp_info.ndp_app_info_len);
if (rsp->scid.scid_len > NDP_SCID_BUF_LEN)
rsp->scid.scid_len = NDP_SCID_BUF_LEN;
qdf_mem_copy(rsp->scid.scid, event->ndp_scid, rsp->scid.scid_len);
if (event->ndp_transport_ip_param &&
event->num_ndp_transport_ip_param) {
if (event->ndp_transport_ip_param->ipv6_addr_present) {
rsp->is_ipv6_addr_present = true;
qdf_mem_copy(rsp->ipv6_addr,
event->ndp_transport_ip_param->ipv6_intf_addr,
WMI_NDP_IPV6_INTF_ADDR_LEN);
}
}
WMI_LOGD(FL("IPv6 addr present: %d, addr: %pI6"),
rsp->is_ipv6_addr_present, rsp->ipv6_addr);
WMI_LOGD("scid hex dump:");
QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_DEBUG,
rsp->scid.scid, rsp->scid.scid_len);
return QDF_STATUS_SUCCESS;
}
static QDF_STATUS extract_ndp_confirm_tlv(wmi_unified_t wmi_handle,
uint8_t *data, struct nan_datapath_confirm_event *rsp)
{
uint8_t i;
WMI_HOST_WLAN_PHY_MODE ch_mode;
WMI_NDP_CONFIRM_EVENTID_param_tlvs *event;
wmi_ndp_confirm_event_fixed_param *fixed_params;
size_t total_array_len;
event = (WMI_NDP_CONFIRM_EVENTID_param_tlvs *) data;
fixed_params = (wmi_ndp_confirm_event_fixed_param *)event->fixed_param;
WMI_LOGD("WMI_NDP_CONFIRM_EVENTID(0x%X) received. vdev %d, ndp_instance %d, rsp_code %d, reason_code: %d, num_active_ndps_on_peer: %d",
WMI_NDP_CONFIRM_EVENTID, fixed_params->vdev_id,
fixed_params->ndp_instance_id, fixed_params->rsp_code,
fixed_params->reason_code,
fixed_params->num_active_ndps_on_peer);
WMI_LOGE("num_ch: %d", fixed_params->num_ndp_channels);
if (fixed_params->ndp_cfg_len > event->num_ndp_cfg) {
WMI_LOGE("FW message ndp cfg length %d larger than TLV hdr %d",
fixed_params->ndp_cfg_len, event->num_ndp_cfg);
return QDF_STATUS_E_INVAL;
}
WMI_LOGD("ndp_cfg - %d bytes", fixed_params->ndp_cfg_len);
if (fixed_params->ndp_app_info_len > event->num_ndp_app_info) {
WMI_LOGE("FW message ndp app info length %d more than TLV hdr %d",
fixed_params->ndp_app_info_len,
event->num_ndp_app_info);
return QDF_STATUS_E_INVAL;
}
WMI_LOGD("ndp_app_info - %d bytes",
fixed_params->ndp_app_info_len);
if (fixed_params->ndp_cfg_len >
(WMI_SVC_MSG_MAX_SIZE - sizeof(*fixed_params))) {
WMI_LOGE("%s: excess wmi buffer: ndp_cfg_len %d",
__func__, fixed_params->ndp_cfg_len);
return QDF_STATUS_E_INVAL;
}
total_array_len = fixed_params->ndp_cfg_len +
sizeof(*fixed_params);
if (fixed_params->ndp_app_info_len >
(WMI_SVC_MSG_MAX_SIZE - total_array_len)) {
WMI_LOGE("%s: excess wmi buffer: ndp_cfg_len %d",
__func__, fixed_params->ndp_app_info_len);
return QDF_STATUS_E_INVAL;
}
if (fixed_params->num_ndp_channels > event->num_ndp_channel_list ||
fixed_params->num_ndp_channels > event->num_nss_list) {
WMI_LOGE(FL("NDP Ch count %d greater than NDP Ch TLV len (%d) or NSS TLV len (%d)"),
fixed_params->num_ndp_channels,
event->num_ndp_channel_list,
event->num_nss_list);
return QDF_STATUS_E_INVAL;
}
rsp->vdev =
wlan_objmgr_get_vdev_by_id_from_psoc(wmi_handle->soc->wmi_psoc,
fixed_params->vdev_id,
WLAN_NAN_ID);
if (!rsp->vdev) {
WMI_LOGE("vdev is null");
return QDF_STATUS_E_INVAL;
}
rsp->ndp_instance_id = fixed_params->ndp_instance_id;
rsp->rsp_code = fixed_params->rsp_code;
rsp->reason_code = fixed_params->reason_code;
rsp->num_active_ndps_on_peer = fixed_params->num_active_ndps_on_peer;
rsp->num_channels = fixed_params->num_ndp_channels;
WMI_MAC_ADDR_TO_CHAR_ARRAY(&fixed_params->peer_ndi_mac_addr,
rsp->peer_ndi_mac_addr.bytes);
rsp->ndp_info.ndp_app_info_len = fixed_params->ndp_app_info_len;
qdf_mem_copy(rsp->ndp_info.ndp_app_info, event->ndp_app_info,
rsp->ndp_info.ndp_app_info_len);
if (rsp->num_channels > NAN_CH_INFO_MAX_CHANNELS) {
WMI_LOGE(FL("too many channels"));
rsp->num_channels = NAN_CH_INFO_MAX_CHANNELS;
}
for (i = 0; i < rsp->num_channels; i++) {
rsp->ch[i].channel = event->ndp_channel_list[i].mhz;
rsp->ch[i].nss = event->nss_list[i];
ch_mode = WMI_GET_CHANNEL_MODE(&event->ndp_channel_list[i]);
rsp->ch[i].ch_width = wmi_get_ch_width_from_phy_mode(wmi_handle,
ch_mode);
WMI_LOGD(FL("ch: %d, ch_mode: %d, nss: %d"),
rsp->ch[i].channel,
rsp->ch[i].ch_width,
rsp->ch[i].nss);
}
if (event->ndp_transport_ip_param &&
event->num_ndp_transport_ip_param) {
if (event->ndp_transport_ip_param->ipv6_addr_present) {
rsp->is_ipv6_addr_present = true;
qdf_mem_copy(rsp->ipv6_addr,
event->ndp_transport_ip_param->ipv6_intf_addr,
WMI_NDP_IPV6_INTF_ADDR_LEN);
}
if (event->ndp_transport_ip_param->trans_port_present) {
rsp->is_port_present = true;
rsp->port =
event->ndp_transport_ip_param->transport_port;
}
if (event->ndp_transport_ip_param->trans_proto_present) {
rsp->is_protocol_present = true;
rsp->protocol =
event->ndp_transport_ip_param->transport_protocol;
}
}
WMI_LOGD(FL("IPv6 addr present: %d, addr: %pI6"),
rsp->is_ipv6_addr_present, rsp->ipv6_addr);
WMI_LOGD(FL("port: %d present: %d"), rsp->port, rsp->is_port_present);
WMI_LOGD(FL("protocol: %d present: %d"),
rsp->protocol, rsp->is_protocol_present);
return QDF_STATUS_SUCCESS;
}
static QDF_STATUS extract_ndp_responder_rsp_tlv(wmi_unified_t wmi_handle,
uint8_t *data, struct nan_datapath_responder_rsp *rsp)
{
WMI_NDP_RESPONDER_RSP_EVENTID_param_tlvs *event;
wmi_ndp_responder_rsp_event_fixed_param *fixed_params;
event = (WMI_NDP_RESPONDER_RSP_EVENTID_param_tlvs *)data;
fixed_params = event->fixed_param;
WMI_LOGD("WMI_NDP_RESPONDER_RSP_EVENTID(0x%X) received. vdev_id: %d, peer_mac_addr: %pM,transaction_id: %d, status_code %d, reason_code: %d, create_peer: %d",
WMI_NDP_RESPONDER_RSP_EVENTID, fixed_params->vdev_id,
rsp->peer_mac_addr.bytes, rsp->transaction_id,
rsp->status, rsp->reason, rsp->create_peer);
rsp->vdev =
wlan_objmgr_get_vdev_by_id_from_psoc(wmi_handle->soc->wmi_psoc,
fixed_params->vdev_id,
WLAN_NAN_ID);
if (!rsp->vdev) {
WMI_LOGE("vdev is null");
return QDF_STATUS_E_INVAL;
}
rsp->transaction_id = fixed_params->transaction_id;
rsp->reason = fixed_params->reason_code;
rsp->status = fixed_params->rsp_status;
rsp->create_peer = fixed_params->create_peer;
WMI_MAC_ADDR_TO_CHAR_ARRAY(&fixed_params->peer_ndi_mac_addr,
rsp->peer_mac_addr.bytes);
return QDF_STATUS_SUCCESS;
}
static QDF_STATUS extract_ndp_end_rsp_tlv(wmi_unified_t wmi_handle,
uint8_t *data, struct nan_datapath_end_rsp_event *rsp)
{
WMI_NDP_END_RSP_EVENTID_param_tlvs *event;
wmi_ndp_end_rsp_event_fixed_param *fixed_params = NULL;
event = (WMI_NDP_END_RSP_EVENTID_param_tlvs *) data;
fixed_params = (wmi_ndp_end_rsp_event_fixed_param *)event->fixed_param;
WMI_LOGD("WMI_NDP_END_RSP_EVENTID(0x%X) received. transaction_id: %d, rsp_status: %d, reason_code: %d",
WMI_NDP_END_RSP_EVENTID, fixed_params->transaction_id,
fixed_params->rsp_status, fixed_params->reason_code);
rsp->vdev = wlan_objmgr_get_vdev_by_opmode_from_psoc(
wmi_handle->soc->wmi_psoc, QDF_NDI_MODE, WLAN_NAN_ID);
if (!rsp->vdev) {
WMI_LOGE("vdev is null");
return QDF_STATUS_E_INVAL;
}
rsp->transaction_id = fixed_params->transaction_id;
rsp->reason = fixed_params->reason_code;
rsp->status = fixed_params->rsp_status;
return QDF_STATUS_SUCCESS;
}
static QDF_STATUS extract_ndp_end_ind_tlv(wmi_unified_t wmi_handle,
uint8_t *data, struct nan_datapath_end_indication_event **rsp)
{
uint32_t i, buf_size;
wmi_ndp_end_indication *ind;
struct qdf_mac_addr peer_addr;
WMI_NDP_END_INDICATION_EVENTID_param_tlvs *event;
event = (WMI_NDP_END_INDICATION_EVENTID_param_tlvs *) data;
ind = event->ndp_end_indication_list;
if (event->num_ndp_end_indication_list == 0) {
WMI_LOGE("Error: Event ignored, 0 ndp instances");
return QDF_STATUS_E_INVAL;
}
WMI_LOGD("number of ndp instances = %d",
event->num_ndp_end_indication_list);
if (event->num_ndp_end_indication_list > ((UINT_MAX - sizeof(**rsp))/
sizeof((*rsp)->ndp_map[0]))) {
WMI_LOGE("num_ndp_end_ind_list %d too large",
event->num_ndp_end_indication_list);
return QDF_STATUS_E_INVAL;
}
buf_size = sizeof(**rsp) + event->num_ndp_end_indication_list *
sizeof((*rsp)->ndp_map[0]);
*rsp = qdf_mem_malloc(buf_size);
if (!(*rsp)) {
WMI_LOGE("Failed to allocate memory");
return QDF_STATUS_E_NOMEM;
}
(*rsp)->num_ndp_ids = event->num_ndp_end_indication_list;
for (i = 0; i < (*rsp)->num_ndp_ids; i++) {
WMI_MAC_ADDR_TO_CHAR_ARRAY(&ind[i].peer_ndi_mac_addr,
peer_addr.bytes);
WMI_LOGD("ind[%d]: type %d, reason_code %d, instance_id %d num_active %d ",
i, ind[i].type, ind[i].reason_code,
ind[i].ndp_instance_id,
ind[i].num_active_ndps_on_peer);
/* Add each instance entry to the list */
(*rsp)->ndp_map[i].ndp_instance_id = ind[i].ndp_instance_id;
(*rsp)->ndp_map[i].vdev_id = ind[i].vdev_id;
WMI_MAC_ADDR_TO_CHAR_ARRAY(&ind[i].peer_ndi_mac_addr,
(*rsp)->ndp_map[i].peer_ndi_mac_addr.bytes);
(*rsp)->ndp_map[i].num_active_ndp_sessions =
ind[i].num_active_ndps_on_peer;
(*rsp)->ndp_map[i].type = ind[i].type;
(*rsp)->ndp_map[i].reason_code = ind[i].reason_code;
}
return QDF_STATUS_SUCCESS;
}
static QDF_STATUS extract_ndp_sch_update_tlv(wmi_unified_t wmi_handle,
uint8_t *data, struct nan_datapath_sch_update_event *ind)
{
uint8_t i;
WMI_HOST_WLAN_PHY_MODE ch_mode;
WMI_NDL_SCHEDULE_UPDATE_EVENTID_param_tlvs *event;
wmi_ndl_schedule_update_fixed_param *fixed_params;
event = (WMI_NDL_SCHEDULE_UPDATE_EVENTID_param_tlvs *)data;
fixed_params = event->fixed_param;
WMI_LOGD(FL("flags: %d, num_ch: %d, num_ndp_instances: %d"),
fixed_params->flags, fixed_params->num_channels,
fixed_params->num_ndp_instances);
if (fixed_params->num_channels > event->num_ndl_channel_list ||
fixed_params->num_channels > event->num_nss_list) {
WMI_LOGE(FL("Channel count %d greater than NDP Ch list TLV len (%d) or NSS list TLV len (%d)"),
fixed_params->num_channels,
event->num_ndl_channel_list,
event->num_nss_list);
return QDF_STATUS_E_INVAL;
}
if (fixed_params->num_ndp_instances > event->num_ndp_instance_list) {
WMI_LOGE(FL("NDP Instance count %d greater than NDP Instancei TLV len %d"),
fixed_params->num_ndp_instances,
event->num_ndp_instance_list);
return QDF_STATUS_E_INVAL;
}
ind->vdev =
wlan_objmgr_get_vdev_by_id_from_psoc(wmi_handle->soc->wmi_psoc,
fixed_params->vdev_id,
WLAN_NAN_ID);
if (!ind->vdev) {
WMI_LOGE("vdev is null");
return QDF_STATUS_E_INVAL;
}
ind->flags = fixed_params->flags;
ind->num_channels = fixed_params->num_channels;
ind->num_ndp_instances = fixed_params->num_ndp_instances;
WMI_MAC_ADDR_TO_CHAR_ARRAY(&fixed_params->peer_macaddr,
ind->peer_addr.bytes);
if (ind->num_ndp_instances > NDP_NUM_INSTANCE_ID) {
WMI_LOGE(FL("uint32 overflow"));
wlan_objmgr_vdev_release_ref(ind->vdev, WLAN_NAN_ID);
return QDF_STATUS_E_INVAL;
}
qdf_mem_copy(ind->ndp_instances, event->ndp_instance_list,
sizeof(uint32_t) * ind->num_ndp_instances);
if (ind->num_channels > NAN_CH_INFO_MAX_CHANNELS) {
WMI_LOGE(FL("too many channels"));
ind->num_channels = NAN_CH_INFO_MAX_CHANNELS;
}
for (i = 0; i < ind->num_channels; i++) {
ind->ch[i].channel = event->ndl_channel_list[i].mhz;
ind->ch[i].nss = event->nss_list[i];
ch_mode = WMI_GET_CHANNEL_MODE(&event->ndl_channel_list[i]);
ind->ch[i].ch_width = wmi_get_ch_width_from_phy_mode(wmi_handle,
ch_mode);
WMI_LOGD(FL("ch: %d, ch_mode: %d, nss: %d"),
ind->ch[i].channel,
ind->ch[i].ch_width,
ind->ch[i].nss);
}
for (i = 0; i < fixed_params->num_ndp_instances; i++)
WMI_LOGD(FL("instance_id[%d]: %d"),
i, event->ndp_instance_list[i]);
return QDF_STATUS_SUCCESS;
}
void wmi_nan_attach_tlv(wmi_unified_t wmi_handle)
{
struct wmi_ops *ops = wmi_handle->ops;
ops->send_ndp_initiator_req_cmd = nan_ndp_initiator_req_tlv;
ops->send_ndp_responder_req_cmd = nan_ndp_responder_req_tlv;
ops->send_ndp_end_req_cmd = nan_ndp_end_req_tlv;
ops->extract_ndp_initiator_rsp = extract_ndp_initiator_rsp_tlv;
ops->extract_ndp_ind = extract_ndp_ind_tlv;
ops->extract_ndp_confirm = extract_ndp_confirm_tlv;
ops->extract_ndp_responder_rsp = extract_ndp_responder_rsp_tlv;
ops->extract_ndp_end_rsp = extract_ndp_end_rsp_tlv;
ops->extract_ndp_end_ind = extract_ndp_end_ind_tlv;
ops->extract_ndp_sch_update = extract_ndp_sch_update_tlv;
}

153
wmi_unified_ocb_api.c Normal file
View File

@@ -0,0 +1,153 @@
/*
* Copyright (c) 2013-2018 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Implement API's specific to DSRC component.
*/
#include <wmi_unified_priv.h>
#include <wlan_ocb_public_structs.h>
#include <wmi_unified_ocb_api.h>
QDF_STATUS wmi_unified_ocb_start_timing_advert(struct wmi_unified *wmi_hdl,
struct ocb_timing_advert_param *timing_advert)
{
if (wmi_hdl->ops->send_ocb_start_timing_advert_cmd)
return wmi_hdl->ops->send_ocb_start_timing_advert_cmd(wmi_hdl,
timing_advert);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_ocb_stop_timing_advert(struct wmi_unified *wmi_hdl,
struct ocb_timing_advert_param *timing_advert)
{
if (wmi_hdl->ops->send_ocb_stop_timing_advert_cmd)
return wmi_hdl->ops->send_ocb_stop_timing_advert_cmd(wmi_hdl,
timing_advert);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_ocb_set_utc_time_cmd(struct wmi_unified *wmi_hdl,
struct ocb_utc_param *utc)
{
if (wmi_hdl->ops->send_ocb_set_utc_time_cmd)
return wmi_hdl->ops->send_ocb_set_utc_time_cmd(wmi_hdl, utc);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_ocb_get_tsf_timer(struct wmi_unified *wmi_hdl,
struct ocb_get_tsf_timer_param *req)
{
if (wmi_hdl->ops->send_ocb_get_tsf_timer_cmd)
return wmi_hdl->ops->send_ocb_get_tsf_timer_cmd(wmi_hdl,
req->vdev_id);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_dcc_get_stats_cmd(struct wmi_unified *wmi_hdl,
struct ocb_dcc_get_stats_param *get_stats_param)
{
if (wmi_hdl->ops->send_dcc_get_stats_cmd)
return wmi_hdl->ops->send_dcc_get_stats_cmd(wmi_hdl,
get_stats_param);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_dcc_clear_stats(struct wmi_unified *wmi_hdl,
struct ocb_dcc_clear_stats_param *clear_stats_param)
{
if (wmi_hdl->ops->send_dcc_clear_stats_cmd)
return wmi_hdl->ops->send_dcc_clear_stats_cmd(wmi_hdl,
clear_stats_param->vdev_id,
clear_stats_param->dcc_stats_bitmap);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_dcc_update_ndl(struct wmi_unified *wmi_hdl,
struct ocb_dcc_update_ndl_param *update_ndl_param)
{
if (wmi_hdl->ops->send_dcc_update_ndl_cmd)
return wmi_hdl->ops->send_dcc_update_ndl_cmd(wmi_hdl,
update_ndl_param);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_ocb_set_config(struct wmi_unified *wmi_hdl,
struct ocb_config *config)
{
if (wmi_hdl->ops->send_ocb_set_config_cmd)
return wmi_hdl->ops->send_ocb_set_config_cmd(wmi_hdl,
config);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS
wmi_extract_ocb_set_channel_config_resp(struct wmi_unified *wmi_hdl,
void *evt_buf,
uint32_t *status)
{
if (wmi_hdl->ops->extract_ocb_chan_config_resp)
return wmi_hdl->ops->extract_ocb_chan_config_resp(wmi_hdl,
evt_buf,
status);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_extract_ocb_tsf_timer(struct wmi_unified *wmi_hdl,
void *evt_buf,
struct ocb_get_tsf_timer_response *resp)
{
if (wmi_hdl->ops->extract_ocb_tsf_timer)
return wmi_hdl->ops->extract_ocb_tsf_timer(wmi_hdl,
evt_buf,
resp);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_extract_dcc_update_ndl_resp(struct wmi_unified *wmi_hdl,
void *evt_buf, struct ocb_dcc_update_ndl_response *resp)
{
if (wmi_hdl->ops->extract_dcc_update_ndl_resp)
return wmi_hdl->ops->extract_dcc_update_ndl_resp(wmi_hdl,
evt_buf,
resp);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_extract_dcc_stats(struct wmi_unified *wmi_hdl,
void *evt_buf,
struct ocb_dcc_get_stats_response **resp)
{
if (wmi_hdl->ops->extract_dcc_stats)
return wmi_hdl->ops->extract_dcc_stats(wmi_hdl,
evt_buf,
resp);
return QDF_STATUS_E_FAILURE;
}

791
wmi_unified_ocb_tlv.c Normal file
View File

@@ -0,0 +1,791 @@
/*
* Copyright (c) 2013-2018 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include <osdep.h>
#include <wmi.h>
#include <wmi_unified_priv.h>
#include <wlan_ocb_public_structs.h>
#include <wmi_unified_ocb_api.h>
/**
* send_ocb_set_utc_time_cmd() - send the UTC time to the firmware
* @wmi_handle: pointer to the wmi handle
* @utc: pointer to the UTC time struct
*
* Return: 0 on succes
*/
static QDF_STATUS send_ocb_set_utc_time_cmd_tlv(wmi_unified_t wmi_handle,
struct ocb_utc_param *utc)
{
QDF_STATUS ret;
wmi_ocb_set_utc_time_cmd_fixed_param *cmd;
uint8_t *buf_ptr;
uint32_t len, i;
wmi_buf_t buf;
len = sizeof(*cmd);
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf) {
return QDF_STATUS_E_NOMEM;
}
buf_ptr = (uint8_t *)wmi_buf_data(buf);
cmd = (wmi_ocb_set_utc_time_cmd_fixed_param *)buf_ptr;
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_ocb_set_utc_time_cmd_fixed_param,
WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_set_utc_time_cmd_fixed_param));
cmd->vdev_id = utc->vdev_id;
for (i = 0; i < SIZE_UTC_TIME; i++)
WMI_UTC_TIME_SET(cmd, i, utc->utc_time[i]);
for (i = 0; i < SIZE_UTC_TIME_ERROR; i++)
WMI_TIME_ERROR_SET(cmd, i, utc->time_error[i]);
wmi_mtrace(WMI_OCB_SET_UTC_TIME_CMDID, cmd->vdev_id, 0);
ret = wmi_unified_cmd_send(wmi_handle, buf, len,
WMI_OCB_SET_UTC_TIME_CMDID);
if (QDF_IS_STATUS_ERROR(ret)) {
WMI_LOGE(FL("Failed to set OCB UTC time"));
wmi_buf_free(buf);
}
return ret;
}
/**
* send_ocb_start_timing_advert_cmd_tlv() - start sending the timing advertisement
* frames on a channel
* @wmi_handle: pointer to the wmi handle
* @timing_advert: pointer to the timing advertisement struct
*
* Return: 0 on succes
*/
static QDF_STATUS send_ocb_start_timing_advert_cmd_tlv(wmi_unified_t wmi_handle,
struct ocb_timing_advert_param *timing_advert)
{
QDF_STATUS ret;
wmi_ocb_start_timing_advert_cmd_fixed_param *cmd;
uint8_t *buf_ptr;
uint32_t len, len_template;
wmi_buf_t buf;
len = sizeof(*cmd) +
WMI_TLV_HDR_SIZE;
len_template = timing_advert->template_length;
/* Add padding to the template if needed */
if (len_template % 4 != 0)
len_template += 4 - (len_template % 4);
len += len_template;
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf) {
return QDF_STATUS_E_NOMEM;
}
buf_ptr = (uint8_t *)wmi_buf_data(buf);
cmd = (wmi_ocb_start_timing_advert_cmd_fixed_param *)buf_ptr;
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_ocb_start_timing_advert_cmd_fixed_param,
WMITLV_GET_STRUCT_TLVLEN(
wmi_ocb_start_timing_advert_cmd_fixed_param));
cmd->vdev_id = timing_advert->vdev_id;
cmd->repeat_rate = timing_advert->repeat_rate;
cmd->channel_freq = timing_advert->chan_freq;
cmd->timestamp_offset = timing_advert->timestamp_offset;
cmd->time_value_offset = timing_advert->time_value_offset;
cmd->timing_advert_template_length = timing_advert->template_length;
buf_ptr += sizeof(*cmd);
/* Add the timing advert template */
WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE,
len_template);
qdf_mem_copy(buf_ptr + WMI_TLV_HDR_SIZE,
(uint8_t *)timing_advert->template_value,
timing_advert->template_length);
wmi_mtrace(WMI_OCB_START_TIMING_ADVERT_CMDID, cmd->vdev_id, 0);
ret = wmi_unified_cmd_send(wmi_handle, buf, len,
WMI_OCB_START_TIMING_ADVERT_CMDID);
if (QDF_IS_STATUS_ERROR(ret)) {
WMI_LOGE(FL("Failed to start OCB timing advert"));
wmi_buf_free(buf);
}
return ret;
}
/**
* send_ocb_stop_timing_advert_cmd_tlv() - stop sending the timing advertisement frames
* on a channel
* @wmi_handle: pointer to the wmi handle
* @timing_advert: pointer to the timing advertisement struct
*
* Return: 0 on succes
*/
static QDF_STATUS send_ocb_stop_timing_advert_cmd_tlv(wmi_unified_t wmi_handle,
struct ocb_timing_advert_param *timing_advert)
{
QDF_STATUS ret;
wmi_ocb_stop_timing_advert_cmd_fixed_param *cmd;
uint8_t *buf_ptr;
uint32_t len;
wmi_buf_t buf;
len = sizeof(*cmd);
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf) {
return QDF_STATUS_E_NOMEM;
}
buf_ptr = (uint8_t *)wmi_buf_data(buf);
cmd = (wmi_ocb_stop_timing_advert_cmd_fixed_param *)buf_ptr;
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_ocb_stop_timing_advert_cmd_fixed_param,
WMITLV_GET_STRUCT_TLVLEN(
wmi_ocb_stop_timing_advert_cmd_fixed_param));
cmd->vdev_id = timing_advert->vdev_id;
cmd->channel_freq = timing_advert->chan_freq;
wmi_mtrace(WMI_OCB_STOP_TIMING_ADVERT_CMDID, cmd->vdev_id, 0);
ret = wmi_unified_cmd_send(wmi_handle, buf, len,
WMI_OCB_STOP_TIMING_ADVERT_CMDID);
if (QDF_IS_STATUS_ERROR(ret)) {
WMI_LOGE(FL("Failed to stop OCB timing advert"));
wmi_buf_free(buf);
}
return ret;
}
/**
* send_ocb_get_tsf_timer_cmd_tlv() - get ocb tsf timer val
* @wmi_handle: pointer to the wmi handle
* @request: pointer to the request
*
* Return: 0 on succes
*/
static QDF_STATUS send_ocb_get_tsf_timer_cmd_tlv(wmi_unified_t wmi_handle,
uint8_t vdev_id)
{
QDF_STATUS ret;
wmi_ocb_get_tsf_timer_cmd_fixed_param *cmd;
uint8_t *buf_ptr;
wmi_buf_t buf;
int32_t len;
len = sizeof(*cmd);
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf) {
return QDF_STATUS_E_NOMEM;
}
buf_ptr = (uint8_t *)wmi_buf_data(buf);
cmd = (wmi_ocb_get_tsf_timer_cmd_fixed_param *)buf_ptr;
qdf_mem_zero(cmd, len);
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_ocb_get_tsf_timer_cmd_fixed_param,
WMITLV_GET_STRUCT_TLVLEN(
wmi_ocb_get_tsf_timer_cmd_fixed_param));
cmd->vdev_id = vdev_id;
/* Send the WMI command */
wmi_mtrace(WMI_OCB_GET_TSF_TIMER_CMDID, cmd->vdev_id, 0);
ret = wmi_unified_cmd_send(wmi_handle, buf, len,
WMI_OCB_GET_TSF_TIMER_CMDID);
/* If there is an error, set the completion event */
if (QDF_IS_STATUS_ERROR(ret)) {
WMI_LOGE(FL("Failed to send WMI message: %d"), ret);
wmi_buf_free(buf);
}
return ret;
}
/**
* send_dcc_get_stats_cmd_tlv() - get the DCC channel stats
* @wmi_handle: pointer to the wmi handle
* @get_stats_param: pointer to the dcc stats
*
* Return: 0 on succes
*/
static QDF_STATUS send_dcc_get_stats_cmd_tlv(wmi_unified_t wmi_handle,
struct ocb_dcc_get_stats_param *get_stats_param)
{
QDF_STATUS ret;
wmi_dcc_get_stats_cmd_fixed_param *cmd;
wmi_dcc_channel_stats_request *channel_stats_array;
wmi_buf_t buf;
uint8_t *buf_ptr;
uint32_t len;
uint32_t i;
/* Validate the input */
if (get_stats_param->request_array_len !=
get_stats_param->channel_count * sizeof(*channel_stats_array)) {
WMI_LOGE(FL("Invalid parameter"));
return QDF_STATUS_E_INVAL;
}
/* Allocate memory for the WMI command */
len = sizeof(*cmd) + WMI_TLV_HDR_SIZE +
get_stats_param->request_array_len;
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf) {
return QDF_STATUS_E_NOMEM;
}
buf_ptr = wmi_buf_data(buf);
qdf_mem_zero(buf_ptr, len);
/* Populate the WMI command */
cmd = (wmi_dcc_get_stats_cmd_fixed_param *)buf_ptr;
buf_ptr += sizeof(*cmd);
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_dcc_get_stats_cmd_fixed_param,
WMITLV_GET_STRUCT_TLVLEN(
wmi_dcc_get_stats_cmd_fixed_param));
cmd->vdev_id = get_stats_param->vdev_id;
cmd->num_channels = get_stats_param->channel_count;
WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
get_stats_param->request_array_len);
buf_ptr += WMI_TLV_HDR_SIZE;
channel_stats_array = (wmi_dcc_channel_stats_request *)buf_ptr;
qdf_mem_copy(channel_stats_array, get_stats_param->request_array,
get_stats_param->request_array_len);
for (i = 0; i < cmd->num_channels; i++)
WMITLV_SET_HDR(&channel_stats_array[i].tlv_header,
WMITLV_TAG_STRUC_wmi_dcc_channel_stats_request,
WMITLV_GET_STRUCT_TLVLEN(
wmi_dcc_channel_stats_request));
/* Send the WMI command */
wmi_mtrace(WMI_DCC_GET_STATS_CMDID, cmd->vdev_id, 0);
ret = wmi_unified_cmd_send(wmi_handle, buf, len,
WMI_DCC_GET_STATS_CMDID);
if (QDF_IS_STATUS_ERROR(ret)) {
WMI_LOGE(FL("Failed to send WMI message: %d"), ret);
wmi_buf_free(buf);
}
return ret;
}
/**
* send_dcc_clear_stats_cmd_tlv() - command to clear the DCC stats
* @wmi_handle: pointer to the wmi handle
* @vdev_id: vdev id
* @dcc_stats_bitmap: dcc status bitmap
*
* Return: 0 on succes
*/
static QDF_STATUS send_dcc_clear_stats_cmd_tlv(wmi_unified_t wmi_handle,
uint32_t vdev_id, uint32_t dcc_stats_bitmap)
{
QDF_STATUS ret;
wmi_dcc_clear_stats_cmd_fixed_param *cmd;
wmi_buf_t buf;
uint8_t *buf_ptr;
uint32_t len;
/* Allocate memory for the WMI command */
len = sizeof(*cmd);
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf) {
return QDF_STATUS_E_NOMEM;
}
buf_ptr = wmi_buf_data(buf);
qdf_mem_zero(buf_ptr, len);
/* Populate the WMI command */
cmd = (wmi_dcc_clear_stats_cmd_fixed_param *)buf_ptr;
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_dcc_clear_stats_cmd_fixed_param,
WMITLV_GET_STRUCT_TLVLEN(
wmi_dcc_clear_stats_cmd_fixed_param));
cmd->vdev_id = vdev_id;
cmd->dcc_stats_bitmap = dcc_stats_bitmap;
/* Send the WMI command */
wmi_mtrace(WMI_DCC_CLEAR_STATS_CMDID, cmd->vdev_id, 0);
ret = wmi_unified_cmd_send(wmi_handle, buf, len,
WMI_DCC_CLEAR_STATS_CMDID);
if (QDF_IS_STATUS_ERROR(ret)) {
WMI_LOGE(FL("Failed to send the WMI command"));
wmi_buf_free(buf);
}
return ret;
}
/**
* send_dcc_update_ndl_cmd_tlv() - command to update the NDL data
* @wmi_handle: pointer to the wmi handle
* @update_ndl_param: pointer to the request parameters
*
* Return: 0 on success
*/
static QDF_STATUS send_dcc_update_ndl_cmd_tlv(wmi_unified_t wmi_handle,
struct ocb_dcc_update_ndl_param *update_ndl_param)
{
QDF_STATUS qdf_status;
wmi_dcc_update_ndl_cmd_fixed_param *cmd;
wmi_dcc_ndl_chan *ndl_chan_array;
wmi_dcc_ndl_active_state_config *ndl_active_state_array;
uint32_t active_state_count;
wmi_buf_t buf;
uint8_t *buf_ptr;
uint32_t len;
uint32_t i;
/* validate the input */
if (update_ndl_param->dcc_ndl_chan_list_len !=
update_ndl_param->channel_count * sizeof(*ndl_chan_array)) {
WMI_LOGE(FL("Invalid parameter"));
return QDF_STATUS_E_INVAL;
}
active_state_count = 0;
ndl_chan_array = update_ndl_param->dcc_ndl_chan_list;
for (i = 0; i < update_ndl_param->channel_count; i++)
active_state_count +=
WMI_NDL_NUM_ACTIVE_STATE_GET(&ndl_chan_array[i]);
if (update_ndl_param->dcc_ndl_active_state_list_len !=
active_state_count * sizeof(*ndl_active_state_array)) {
WMI_LOGE(FL("Invalid parameter"));
return QDF_STATUS_E_INVAL;
}
/* Allocate memory for the WMI command */
len = sizeof(*cmd) +
WMI_TLV_HDR_SIZE + update_ndl_param->dcc_ndl_chan_list_len +
WMI_TLV_HDR_SIZE +
update_ndl_param->dcc_ndl_active_state_list_len;
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf) {
return QDF_STATUS_E_NOMEM;
}
buf_ptr = wmi_buf_data(buf);
qdf_mem_zero(buf_ptr, len);
/* Populate the WMI command */
cmd = (wmi_dcc_update_ndl_cmd_fixed_param *)buf_ptr;
buf_ptr += sizeof(*cmd);
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_dcc_update_ndl_cmd_fixed_param,
WMITLV_GET_STRUCT_TLVLEN(
wmi_dcc_update_ndl_cmd_fixed_param));
cmd->vdev_id = update_ndl_param->vdev_id;
cmd->num_channel = update_ndl_param->channel_count;
WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
update_ndl_param->dcc_ndl_chan_list_len);
buf_ptr += WMI_TLV_HDR_SIZE;
ndl_chan_array = (wmi_dcc_ndl_chan *)buf_ptr;
qdf_mem_copy(ndl_chan_array, update_ndl_param->dcc_ndl_chan_list,
update_ndl_param->dcc_ndl_chan_list_len);
for (i = 0; i < cmd->num_channel; i++)
WMITLV_SET_HDR(&ndl_chan_array[i].tlv_header,
WMITLV_TAG_STRUC_wmi_dcc_ndl_chan,
WMITLV_GET_STRUCT_TLVLEN(
wmi_dcc_ndl_chan));
buf_ptr += update_ndl_param->dcc_ndl_chan_list_len;
WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
update_ndl_param->dcc_ndl_active_state_list_len);
buf_ptr += WMI_TLV_HDR_SIZE;
ndl_active_state_array = (wmi_dcc_ndl_active_state_config *)buf_ptr;
qdf_mem_copy(ndl_active_state_array,
update_ndl_param->dcc_ndl_active_state_list,
update_ndl_param->dcc_ndl_active_state_list_len);
for (i = 0; i < active_state_count; i++) {
WMITLV_SET_HDR(&ndl_active_state_array[i].tlv_header,
WMITLV_TAG_STRUC_wmi_dcc_ndl_active_state_config,
WMITLV_GET_STRUCT_TLVLEN(
wmi_dcc_ndl_active_state_config));
}
buf_ptr += update_ndl_param->dcc_ndl_active_state_list_len;
/* Send the WMI command */
wmi_mtrace(WMI_DCC_UPDATE_NDL_CMDID, cmd->vdev_id, 0);
qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len,
WMI_DCC_UPDATE_NDL_CMDID);
/* If there is an error, set the completion event */
if (QDF_IS_STATUS_ERROR(qdf_status)) {
WMI_LOGE(FL("Failed to send WMI message: %d"), qdf_status);
wmi_buf_free(buf);
}
return qdf_status;
}
/**
* send_ocb_set_config_cmd_tlv() - send the OCB config to the FW
* @wmi_handle: pointer to the wmi handle
* @config: the OCB configuration
*
* Return: 0 on success
*/
static QDF_STATUS send_ocb_set_config_cmd_tlv(wmi_unified_t wmi_handle,
struct ocb_config *config)
{
QDF_STATUS ret;
wmi_ocb_set_config_cmd_fixed_param *cmd;
wmi_channel *chan;
wmi_ocb_channel *ocb_chan;
wmi_qos_parameter *qos_param;
wmi_dcc_ndl_chan *ndl_chan;
wmi_dcc_ndl_active_state_config *ndl_active_config;
wmi_ocb_schedule_element *sched_elem;
uint8_t *buf_ptr;
wmi_buf_t buf;
int32_t len;
int32_t i, j, active_state_count;
/*
* Validate the dcc_ndl_chan_list_len and count the number of active
* states. Validate dcc_ndl_active_state_list_len.
*/
active_state_count = 0;
if (config->dcc_ndl_chan_list_len) {
if (!config->dcc_ndl_chan_list ||
config->dcc_ndl_chan_list_len !=
config->channel_count * sizeof(wmi_dcc_ndl_chan)) {
WMI_LOGE(FL("NDL channel is invalid. List len: %d"),
config->dcc_ndl_chan_list_len);
return QDF_STATUS_E_INVAL;
}
for (i = 0, ndl_chan = config->dcc_ndl_chan_list;
i < config->channel_count; ++i, ++ndl_chan)
active_state_count +=
WMI_NDL_NUM_ACTIVE_STATE_GET(ndl_chan);
if (active_state_count) {
if (!config->dcc_ndl_active_state_list ||
config->dcc_ndl_active_state_list_len !=
active_state_count *
sizeof(wmi_dcc_ndl_active_state_config)) {
WMI_LOGE(FL("NDL active state is invalid."));
return QDF_STATUS_E_INVAL;
}
}
}
len = sizeof(*cmd) +
WMI_TLV_HDR_SIZE + config->channel_count *
sizeof(wmi_channel) +
WMI_TLV_HDR_SIZE + config->channel_count *
sizeof(wmi_ocb_channel) +
WMI_TLV_HDR_SIZE + config->channel_count *
sizeof(wmi_qos_parameter) * WMI_MAX_NUM_AC +
WMI_TLV_HDR_SIZE + config->dcc_ndl_chan_list_len +
WMI_TLV_HDR_SIZE + active_state_count *
sizeof(wmi_dcc_ndl_active_state_config) +
WMI_TLV_HDR_SIZE + config->schedule_size *
sizeof(wmi_ocb_schedule_element);
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf) {
return QDF_STATUS_E_NOMEM;
}
buf_ptr = (uint8_t *)wmi_buf_data(buf);
cmd = (wmi_ocb_set_config_cmd_fixed_param *)buf_ptr;
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_ocb_set_config_cmd_fixed_param,
WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_set_config_cmd_fixed_param));
cmd->vdev_id = config->vdev_id;
cmd->channel_count = config->channel_count;
cmd->schedule_size = config->schedule_size;
cmd->flags = config->flags;
buf_ptr += sizeof(*cmd);
/* Add the wmi_channel info */
WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
config->channel_count * sizeof(wmi_channel));
buf_ptr += WMI_TLV_HDR_SIZE;
for (i = 0; i < config->channel_count; i++) {
chan = (wmi_channel *)buf_ptr;
WMITLV_SET_HDR(&chan->tlv_header,
WMITLV_TAG_STRUC_wmi_channel,
WMITLV_GET_STRUCT_TLVLEN(wmi_channel));
chan->mhz = config->channels[i].chan_freq;
chan->band_center_freq1 = config->channels[i].chan_freq;
chan->band_center_freq2 = 0;
chan->info = 0;
WMI_SET_CHANNEL_MODE(chan, config->channels[i].ch_mode);
WMI_SET_CHANNEL_MAX_POWER(chan, config->channels[i].max_pwr);
WMI_SET_CHANNEL_MIN_POWER(chan, config->channels[i].min_pwr);
WMI_SET_CHANNEL_MAX_TX_POWER(chan, config->channels[i].max_pwr);
WMI_SET_CHANNEL_REG_POWER(chan, config->channels[i].reg_pwr);
WMI_SET_CHANNEL_ANTENNA_MAX(chan,
config->channels[i].antenna_max);
if (config->channels[i].bandwidth < 10)
WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_QUARTER_RATE);
else if (config->channels[i].bandwidth < 20)
WMI_SET_CHANNEL_FLAG(chan, WMI_CHAN_FLAG_HALF_RATE);
buf_ptr += sizeof(*chan);
}
/* Add the wmi_ocb_channel info */
WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
config->channel_count * sizeof(wmi_ocb_channel));
buf_ptr += WMI_TLV_HDR_SIZE;
for (i = 0; i < config->channel_count; i++) {
ocb_chan = (wmi_ocb_channel *)buf_ptr;
WMITLV_SET_HDR(&ocb_chan->tlv_header,
WMITLV_TAG_STRUC_wmi_ocb_channel,
WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_channel));
ocb_chan->bandwidth = config->channels[i].bandwidth;
WMI_CHAR_ARRAY_TO_MAC_ADDR(
config->channels[i].mac_address.bytes,
&ocb_chan->mac_address);
buf_ptr += sizeof(*ocb_chan);
}
/* Add the wmi_qos_parameter info */
WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
config->channel_count * sizeof(wmi_qos_parameter)*WMI_MAX_NUM_AC);
buf_ptr += WMI_TLV_HDR_SIZE;
/* WMI_MAX_NUM_AC parameters for each channel */
for (i = 0; i < config->channel_count; i++) {
for (j = 0; j < WMI_MAX_NUM_AC; j++) {
qos_param = (wmi_qos_parameter *)buf_ptr;
WMITLV_SET_HDR(&qos_param->tlv_header,
WMITLV_TAG_STRUC_wmi_qos_parameter,
WMITLV_GET_STRUCT_TLVLEN(wmi_qos_parameter));
qos_param->aifsn =
config->channels[i].qos_params[j].aifsn;
qos_param->cwmin =
config->channels[i].qos_params[j].cwmin;
qos_param->cwmax =
config->channels[i].qos_params[j].cwmax;
buf_ptr += sizeof(*qos_param);
}
}
/* Add the wmi_dcc_ndl_chan (per channel) */
WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
config->dcc_ndl_chan_list_len);
buf_ptr += WMI_TLV_HDR_SIZE;
if (config->dcc_ndl_chan_list_len) {
ndl_chan = (wmi_dcc_ndl_chan *)buf_ptr;
qdf_mem_copy(ndl_chan, config->dcc_ndl_chan_list,
config->dcc_ndl_chan_list_len);
for (i = 0; i < config->channel_count; i++)
WMITLV_SET_HDR(&(ndl_chan[i].tlv_header),
WMITLV_TAG_STRUC_wmi_dcc_ndl_chan,
WMITLV_GET_STRUCT_TLVLEN(wmi_dcc_ndl_chan));
buf_ptr += config->dcc_ndl_chan_list_len;
}
/* Add the wmi_dcc_ndl_active_state_config */
WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, active_state_count *
sizeof(wmi_dcc_ndl_active_state_config));
buf_ptr += WMI_TLV_HDR_SIZE;
if (active_state_count) {
ndl_active_config = (wmi_dcc_ndl_active_state_config *)buf_ptr;
qdf_mem_copy(ndl_active_config,
config->dcc_ndl_active_state_list,
active_state_count * sizeof(*ndl_active_config));
for (i = 0; i < active_state_count; ++i)
WMITLV_SET_HDR(&(ndl_active_config[i].tlv_header),
WMITLV_TAG_STRUC_wmi_dcc_ndl_active_state_config,
WMITLV_GET_STRUCT_TLVLEN(
wmi_dcc_ndl_active_state_config));
buf_ptr += active_state_count *
sizeof(*ndl_active_config);
}
/* Add the wmi_ocb_schedule_element info */
WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
config->schedule_size * sizeof(wmi_ocb_schedule_element));
buf_ptr += WMI_TLV_HDR_SIZE;
for (i = 0; i < config->schedule_size; i++) {
sched_elem = (wmi_ocb_schedule_element *)buf_ptr;
WMITLV_SET_HDR(&sched_elem->tlv_header,
WMITLV_TAG_STRUC_wmi_ocb_schedule_element,
WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_schedule_element));
sched_elem->channel_freq = config->schedule[i].chan_freq;
sched_elem->total_duration = config->schedule[i].total_duration;
sched_elem->guard_interval = config->schedule[i].guard_interval;
buf_ptr += sizeof(*sched_elem);
}
wmi_mtrace(WMI_OCB_SET_CONFIG_CMDID, cmd->vdev_id, 0);
ret = wmi_unified_cmd_send(wmi_handle, buf, len,
WMI_OCB_SET_CONFIG_CMDID);
if (QDF_IS_STATUS_ERROR(ret)) {
WMI_LOGE("Failed to set OCB config");
wmi_buf_free(buf);
}
return ret;
}
/**
* extract_ocb_channel_config_resp_tlv() - extract ocb channel config resp
* @wmi_handle: wmi handle
* @evt_buf: wmi event buffer
* @status: status buffer
*
* Return: QDF_STATUS_SUCCESS on success
*/
static QDF_STATUS extract_ocb_channel_config_resp_tlv(wmi_unified_t wmi_handle,
void *evt_buf,
uint32_t *status)
{
WMI_OCB_SET_CONFIG_RESP_EVENTID_param_tlvs *param_tlvs;
wmi_ocb_set_config_resp_event_fixed_param *fix_param;
param_tlvs = evt_buf;
fix_param = param_tlvs->fixed_param;
*status = fix_param->status;
return QDF_STATUS_SUCCESS;
}
/**
* extract_ocb_tsf_timer_tlv() - extract TSF timer from event buffer
* @wmi_handle: wmi handle
* @evt_buf: wmi event buffer
* @resp: response buffer
*
* Return: QDF_STATUS_SUCCESS on success
*/
static QDF_STATUS extract_ocb_tsf_timer_tlv(wmi_unified_t wmi_handle,
void *evt_buf, struct ocb_get_tsf_timer_response *resp)
{
WMI_OCB_GET_TSF_TIMER_RESP_EVENTID_param_tlvs *param_tlvs;
wmi_ocb_get_tsf_timer_resp_event_fixed_param *fix_param;
param_tlvs = evt_buf;
fix_param = param_tlvs->fixed_param;
resp->vdev_id = fix_param->vdev_id;
resp->timer_high = fix_param->tsf_timer_high;
resp->timer_low = fix_param->tsf_timer_low;
return QDF_STATUS_SUCCESS;
}
/**
* extract_ocb_ndl_resp_tlv() - extract TSF timer from event buffer
* @wmi_handle: wmi handle
* @evt_buf: wmi event buffer
* @resp: response buffer
*
* Return: QDF_STATUS_SUCCESS on success
*/
static QDF_STATUS extract_ocb_ndl_resp_tlv(wmi_unified_t wmi_handle,
void *evt_buf, struct ocb_dcc_update_ndl_response *resp)
{
WMI_DCC_UPDATE_NDL_RESP_EVENTID_param_tlvs *param_tlvs;
wmi_dcc_update_ndl_resp_event_fixed_param *fix_param;
param_tlvs = evt_buf;
fix_param = param_tlvs->fixed_param;
resp->vdev_id = fix_param->vdev_id;
resp->status = fix_param->status;
return QDF_STATUS_SUCCESS;
}
/**
* extract_ocb_dcc_stats_tlv() - extract DCC stats from event buffer
* @wmi_handle: wmi handle
* @evt_buf: wmi event buffer
* @resp: response buffer
*
* Since length of stats is variable, buffer for DCC stats will be allocated
* in this function. The caller must free the buffer.
*
* Return: QDF_STATUS_SUCCESS on success
*/
static QDF_STATUS extract_ocb_dcc_stats_tlv(wmi_unified_t wmi_handle,
void *evt_buf, struct ocb_dcc_get_stats_response **resp)
{
struct ocb_dcc_get_stats_response *response;
WMI_DCC_GET_STATS_RESP_EVENTID_param_tlvs *param_tlvs;
wmi_dcc_get_stats_resp_event_fixed_param *fix_param;
param_tlvs = (WMI_DCC_GET_STATS_RESP_EVENTID_param_tlvs *)evt_buf;
fix_param = param_tlvs->fixed_param;
/* Allocate and populate the response */
if (fix_param->num_channels > ((WMI_SVC_MSG_MAX_SIZE -
sizeof(*fix_param)) / sizeof(wmi_dcc_ndl_stats_per_channel))) {
WMI_LOGE("%s: too many channels:%d", __func__,
fix_param->num_channels);
QDF_ASSERT(0);
*resp = NULL;
return QDF_STATUS_E_INVAL;
}
response = qdf_mem_malloc(sizeof(*response) + fix_param->num_channels *
sizeof(wmi_dcc_ndl_stats_per_channel));
*resp = response;
if (!response)
return QDF_STATUS_E_NOMEM;
response->vdev_id = fix_param->vdev_id;
response->num_channels = fix_param->num_channels;
response->channel_stats_array_len =
fix_param->num_channels *
sizeof(wmi_dcc_ndl_stats_per_channel);
response->channel_stats_array = ((uint8_t *)response) +
sizeof(*response);
qdf_mem_copy(response->channel_stats_array,
param_tlvs->stats_per_channel_list,
response->channel_stats_array_len);
return QDF_STATUS_SUCCESS;
}
void wmi_ocb_attach_tlv(wmi_unified_t wmi_handle)
{
struct wmi_ops *ops = wmi_handle->ops;
ops->send_ocb_set_utc_time_cmd = send_ocb_set_utc_time_cmd_tlv;
ops->send_ocb_get_tsf_timer_cmd = send_ocb_get_tsf_timer_cmd_tlv;
ops->send_dcc_clear_stats_cmd = send_dcc_clear_stats_cmd_tlv;
ops->send_dcc_get_stats_cmd = send_dcc_get_stats_cmd_tlv;
ops->send_dcc_update_ndl_cmd = send_dcc_update_ndl_cmd_tlv;
ops->send_ocb_set_config_cmd = send_ocb_set_config_cmd_tlv;
ops->send_ocb_stop_timing_advert_cmd =
send_ocb_stop_timing_advert_cmd_tlv;
ops->send_ocb_start_timing_advert_cmd =
send_ocb_start_timing_advert_cmd_tlv;
ops->extract_ocb_chan_config_resp =
extract_ocb_channel_config_resp_tlv;
ops->extract_ocb_tsf_timer = extract_ocb_tsf_timer_tlv;
ops->extract_dcc_update_ndl_resp = extract_ocb_ndl_resp_tlv;
ops->extract_dcc_stats = extract_ocb_dcc_stats_tlv;
}

117
wmi_unified_p2p_api.c Normal file
View File

@@ -0,0 +1,117 @@
/*
* Copyright (c) 2013-2018 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Implement API's specific to P2P component.
*/
#include <wmi_unified_priv.h>
#include <wmi_unified_p2p_api.h>
QDF_STATUS wmi_unified_set_p2pgo_oppps_req(void *wmi_hdl,
struct p2p_ps_params *oppps)
{
wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
if (wmi_handle->ops->send_set_p2pgo_oppps_req_cmd)
return wmi_handle->ops->send_set_p2pgo_oppps_req_cmd(wmi_handle,
oppps);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_set_p2pgo_noa_req_cmd(void *wmi_hdl,
struct p2p_ps_params *noa)
{
wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
if (wmi_handle->ops->send_set_p2pgo_noa_req_cmd)
return wmi_handle->ops->send_set_p2pgo_noa_req_cmd(wmi_handle,
noa);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_extract_p2p_noa_ev_param(void *wmi_hdl, void *evt_buf,
struct p2p_noa_info *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
if (!wmi_handle) {
WMI_LOGE("wmi handle is null");
return QDF_STATUS_E_INVAL;
}
if (wmi_handle->ops->extract_p2p_noa_ev_param)
return wmi_handle->ops->extract_p2p_noa_ev_param(
wmi_handle, evt_buf, param);
return QDF_STATUS_E_FAILURE;
}
#ifdef FEATURE_P2P_LISTEN_OFFLOAD
QDF_STATUS wmi_unified_p2p_lo_start_cmd(void *wmi_hdl,
struct p2p_lo_start *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
if (!wmi_handle) {
WMI_LOGE("wmi handle is null");
return QDF_STATUS_E_INVAL;
}
if (wmi_handle->ops->send_p2p_lo_start_cmd)
return wmi_handle->ops->send_p2p_lo_start_cmd(wmi_handle,
param);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_p2p_lo_stop_cmd(void *wmi_hdl, uint8_t vdev_id)
{
wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
if (!wmi_handle) {
WMI_LOGE("wmi handle is null");
return QDF_STATUS_E_INVAL;
}
if (wmi_handle->ops->send_p2p_lo_stop_cmd)
return wmi_handle->ops->send_p2p_lo_stop_cmd(wmi_handle,
vdev_id);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_extract_p2p_lo_stop_ev_param(void *wmi_hdl, void *evt_buf,
struct p2p_lo_event *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
if (!wmi_handle) {
WMI_LOGE("wmi handle is null");
return QDF_STATUS_E_INVAL;
}
if (wmi_handle->ops->extract_p2p_lo_stop_ev_param)
return wmi_handle->ops->extract_p2p_lo_stop_ev_param(
wmi_handle, evt_buf, param);
return QDF_STATUS_E_FAILURE;
}
#endif /* End of FEATURE_P2P_LISTEN_OFFLOAD*/

411
wmi_unified_p2p_tlv.c Normal file
View File

@@ -0,0 +1,411 @@
/*
* Copyright (c) 2013-2018 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include <osdep.h>
#include <wmi.h>
#include <wmi_unified_priv.h>
#include <wmi_unified_p2p_api.h>
/**
* send_set_p2pgo_noa_req_cmd_tlv() - send p2p go noa request to fw
* @wmi_handle: wmi handle
* @noa: p2p power save parameters
*
* Return: CDF status
*/
static QDF_STATUS send_set_p2pgo_noa_req_cmd_tlv(wmi_unified_t wmi_handle,
struct p2p_ps_params *noa)
{
wmi_p2p_set_noa_cmd_fixed_param *cmd;
wmi_p2p_noa_descriptor *noa_discriptor;
wmi_buf_t buf;
uint8_t *buf_ptr;
uint16_t len;
QDF_STATUS status;
uint32_t duration;
WMI_LOGD("%s: Enter", __func__);
len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + sizeof(*noa_discriptor);
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf) {
status = QDF_STATUS_E_FAILURE;
goto end;
}
buf_ptr = (uint8_t *)wmi_buf_data(buf);
cmd = (wmi_p2p_set_noa_cmd_fixed_param *)buf_ptr;
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_p2p_set_noa_cmd_fixed_param,
WMITLV_GET_STRUCT_TLVLEN
(wmi_p2p_set_noa_cmd_fixed_param));
duration = (noa->count == 1) ? noa->single_noa_duration : noa->duration;
cmd->vdev_id = noa->session_id;
cmd->enable = (duration) ? true : false;
cmd->num_noa = 1;
WMITLV_SET_HDR((buf_ptr + sizeof(wmi_p2p_set_noa_cmd_fixed_param)),
WMITLV_TAG_ARRAY_STRUC, sizeof(wmi_p2p_noa_descriptor));
noa_discriptor = (wmi_p2p_noa_descriptor *)(buf_ptr +
sizeof
(wmi_p2p_set_noa_cmd_fixed_param)
+ WMI_TLV_HDR_SIZE);
WMITLV_SET_HDR(&noa_discriptor->tlv_header,
WMITLV_TAG_STRUC_wmi_p2p_noa_descriptor,
WMITLV_GET_STRUCT_TLVLEN(wmi_p2p_noa_descriptor));
noa_discriptor->type_count = noa->count;
noa_discriptor->duration = duration;
noa_discriptor->interval = noa->interval;
noa_discriptor->start_time = 0;
WMI_LOGI("SET P2P GO NOA:vdev_id:%d count:%d duration:%d interval:%d",
cmd->vdev_id, noa->count, noa_discriptor->duration,
noa->interval);
wmi_mtrace(WMI_FWTEST_P2P_SET_NOA_PARAM_CMDID, cmd->vdev_id, 0);
status = wmi_unified_cmd_send(wmi_handle, buf, len,
WMI_FWTEST_P2P_SET_NOA_PARAM_CMDID);
if (QDF_IS_STATUS_ERROR(status)) {
WMI_LOGE("Failed to send WMI_FWTEST_P2P_SET_NOA_PARAM_CMDID");
wmi_buf_free(buf);
}
end:
WMI_LOGD("%s: Exit", __func__);
return status;
}
/**
* send_set_p2pgo_oppps_req_cmd_tlv() - send p2p go opp power save request to fw
* @wmi_handle: wmi handle
* @noa: p2p opp power save parameters
*
* Return: CDF status
*/
static QDF_STATUS send_set_p2pgo_oppps_req_cmd_tlv(wmi_unified_t wmi_handle,
struct p2p_ps_params *oppps)
{
wmi_p2p_set_oppps_cmd_fixed_param *cmd;
wmi_buf_t buf;
QDF_STATUS status;
WMI_LOGD("%s: Enter", __func__);
buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd));
if (!buf) {
status = QDF_STATUS_E_FAILURE;
goto end;
}
cmd = (wmi_p2p_set_oppps_cmd_fixed_param *) wmi_buf_data(buf);
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_p2p_set_oppps_cmd_fixed_param,
WMITLV_GET_STRUCT_TLVLEN(
wmi_p2p_set_oppps_cmd_fixed_param));
cmd->vdev_id = oppps->session_id;
if (oppps->ctwindow)
WMI_UNIFIED_OPPPS_ATTR_ENABLED_SET(cmd);
WMI_UNIFIED_OPPPS_ATTR_CTWIN_SET(cmd, oppps->ctwindow);
WMI_LOGI("SET P2P GO OPPPS:vdev_id:%d ctwindow:%d",
cmd->vdev_id, oppps->ctwindow);
wmi_mtrace(WMI_P2P_SET_OPPPS_PARAM_CMDID, cmd->vdev_id, 0);
status = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd),
WMI_P2P_SET_OPPPS_PARAM_CMDID);
if (QDF_IS_STATUS_ERROR(status)) {
WMI_LOGE("Failed to send WMI_P2P_SET_OPPPS_PARAM_CMDID");
wmi_buf_free(buf);
}
end:
WMI_LOGD("%s: Exit", __func__);
return status;
}
/**
* extract_p2p_noa_ev_param_tlv() - extract p2p noa information from event
* @wmi_handle: wmi handle
* @param evt_buf: pointer to event buffer
* @param param: Pointer to hold p2p noa info
*
* Return: QDF_STATUS_SUCCESS for success or error code
*/
static QDF_STATUS extract_p2p_noa_ev_param_tlv(
wmi_unified_t wmi_handle, void *evt_buf,
struct p2p_noa_info *param)
{
WMI_P2P_NOA_EVENTID_param_tlvs *param_tlvs;
wmi_p2p_noa_event_fixed_param *fixed_param;
uint8_t i;
wmi_p2p_noa_info *wmi_noa_info;
uint8_t *buf_ptr;
uint32_t descriptors;
param_tlvs = (WMI_P2P_NOA_EVENTID_param_tlvs *)evt_buf;
if (!param_tlvs) {
WMI_LOGE("%s: Invalid P2P NoA event buffer", __func__);
return QDF_STATUS_E_INVAL;
}
if (!param) {
WMI_LOGE("noa information param is null");
return QDF_STATUS_E_INVAL;
}
fixed_param = param_tlvs->fixed_param;
buf_ptr = (uint8_t *) fixed_param;
buf_ptr += sizeof(wmi_p2p_noa_event_fixed_param);
wmi_noa_info = (wmi_p2p_noa_info *) (buf_ptr);
if (!WMI_UNIFIED_NOA_ATTR_IS_MODIFIED(wmi_noa_info)) {
WMI_LOGE("%s: noa attr is not modified", __func__);
return QDF_STATUS_E_INVAL;
}
param->vdev_id = fixed_param->vdev_id;
param->index =
(uint8_t)WMI_UNIFIED_NOA_ATTR_INDEX_GET(wmi_noa_info);
param->opps_ps =
(uint8_t)WMI_UNIFIED_NOA_ATTR_OPP_PS_GET(wmi_noa_info);
param->ct_window =
(uint8_t)WMI_UNIFIED_NOA_ATTR_CTWIN_GET(wmi_noa_info);
descriptors = WMI_UNIFIED_NOA_ATTR_NUM_DESC_GET(wmi_noa_info);
param->num_desc = (uint8_t)descriptors;
if (param->num_desc > WMI_P2P_MAX_NOA_DESCRIPTORS) {
WMI_LOGE("%s: invalid num desc:%d", __func__,
param->num_desc);
return QDF_STATUS_E_INVAL;
}
WMI_LOGD("%s:index %u, opps_ps %u, ct_window %u, num_descriptors = %u",
__func__,
param->index, param->opps_ps, param->ct_window,
param->num_desc);
for (i = 0; i < param->num_desc; i++) {
param->noa_desc[i].type_count =
(uint8_t)wmi_noa_info->noa_descriptors[i].
type_count;
param->noa_desc[i].duration =
wmi_noa_info->noa_descriptors[i].duration;
param->noa_desc[i].interval =
wmi_noa_info->noa_descriptors[i].interval;
param->noa_desc[i].start_time =
wmi_noa_info->noa_descriptors[i].start_time;
WMI_LOGD("%s:NoA descriptor[%d] type_count %u, duration %u, interval %u, start_time = %u",
__func__, i, param->noa_desc[i].type_count,
param->noa_desc[i].duration,
param->noa_desc[i].interval,
param->noa_desc[i].start_time);
}
return QDF_STATUS_SUCCESS;
}
#ifdef FEATURE_P2P_LISTEN_OFFLOAD
/**
* send_p2p_lo_start_cmd_tlv() - send p2p lo start request to fw
* @wmi_handle: wmi handle
* @param: p2p listen offload start parameters
*
* Return: QDF status
*/
static QDF_STATUS send_p2p_lo_start_cmd_tlv(wmi_unified_t wmi_handle,
struct p2p_lo_start *param)
{
wmi_buf_t buf;
wmi_p2p_lo_start_cmd_fixed_param *cmd;
int32_t len = sizeof(*cmd);
uint8_t *buf_ptr;
QDF_STATUS status;
int device_types_len_aligned;
int probe_resp_len_aligned;
if (!param) {
WMI_LOGE("lo start param is null");
return QDF_STATUS_E_INVAL;
}
WMI_LOGD("%s: vdev_id:%d", __func__, param->vdev_id);
device_types_len_aligned =
qdf_roundup(param->dev_types_len,
sizeof(uint32_t));
probe_resp_len_aligned =
qdf_roundup(param->probe_resp_len,
sizeof(uint32_t));
len += 2 * WMI_TLV_HDR_SIZE + device_types_len_aligned +
probe_resp_len_aligned;
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf) {
return QDF_STATUS_E_NOMEM;
}
cmd = (wmi_p2p_lo_start_cmd_fixed_param *)wmi_buf_data(buf);
buf_ptr = (uint8_t *) wmi_buf_data(buf);
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_p2p_lo_start_cmd_fixed_param,
WMITLV_GET_STRUCT_TLVLEN(wmi_p2p_lo_start_cmd_fixed_param));
cmd->vdev_id = param->vdev_id;
cmd->ctl_flags = param->ctl_flags;
cmd->channel = param->freq;
cmd->period = param->period;
cmd->interval = param->interval;
cmd->count = param->count;
cmd->device_types_len = param->dev_types_len;
cmd->prob_resp_len = param->probe_resp_len;
buf_ptr += sizeof(wmi_p2p_lo_start_cmd_fixed_param);
WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE,
device_types_len_aligned);
buf_ptr += WMI_TLV_HDR_SIZE;
qdf_mem_copy(buf_ptr, param->device_types,
param->dev_types_len);
buf_ptr += device_types_len_aligned;
WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE,
probe_resp_len_aligned);
buf_ptr += WMI_TLV_HDR_SIZE;
qdf_mem_copy(buf_ptr, param->probe_resp_tmplt,
param->probe_resp_len);
WMI_LOGD("%s: Sending WMI_P2P_LO_START command, channel=%d, period=%d, interval=%d, count=%d", __func__,
cmd->channel, cmd->period, cmd->interval, cmd->count);
wmi_mtrace(WMI_P2P_LISTEN_OFFLOAD_START_CMDID, cmd->vdev_id, 0);
status = wmi_unified_cmd_send(wmi_handle,
buf, len,
WMI_P2P_LISTEN_OFFLOAD_START_CMDID);
if (status != QDF_STATUS_SUCCESS) {
WMI_LOGE("%s: Failed to send p2p lo start: %d",
__func__, status);
wmi_buf_free(buf);
return status;
}
WMI_LOGD("%s: Successfully sent WMI_P2P_LO_START", __func__);
return QDF_STATUS_SUCCESS;
}
/**
* send_p2p_lo_stop_cmd_tlv() - send p2p lo stop request to fw
* @wmi_handle: wmi handle
* @param: p2p listen offload stop parameters
*
* Return: QDF status
*/
static QDF_STATUS send_p2p_lo_stop_cmd_tlv(wmi_unified_t wmi_handle,
uint8_t vdev_id)
{
wmi_buf_t buf;
wmi_p2p_lo_stop_cmd_fixed_param *cmd;
int32_t len;
QDF_STATUS status;
WMI_LOGD("%s: vdev_id:%d", __func__, vdev_id);
len = sizeof(*cmd);
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf) {
return QDF_STATUS_E_NOMEM;
}
cmd = (wmi_p2p_lo_stop_cmd_fixed_param *)wmi_buf_data(buf);
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_p2p_lo_stop_cmd_fixed_param,
WMITLV_GET_STRUCT_TLVLEN(wmi_p2p_lo_stop_cmd_fixed_param));
cmd->vdev_id = vdev_id;
WMI_LOGD("%s: Sending WMI_P2P_LO_STOP command", __func__);
wmi_mtrace(WMI_P2P_LISTEN_OFFLOAD_STOP_CMDID, cmd->vdev_id, 0);
status = wmi_unified_cmd_send(wmi_handle,
buf, len,
WMI_P2P_LISTEN_OFFLOAD_STOP_CMDID);
if (status != QDF_STATUS_SUCCESS) {
WMI_LOGE("%s: Failed to send p2p lo stop: %d",
__func__, status);
wmi_buf_free(buf);
return status;
}
WMI_LOGD("%s: Successfully sent WMI_P2P_LO_STOP", __func__);
return QDF_STATUS_SUCCESS;
}
/**
* extract_p2p_lo_stop_ev_param_tlv() - extract p2p lo stop
* information from event
* @wmi_handle: wmi handle
* @param evt_buf: pointer to event buffer
* @param param: Pointer to hold p2p lo stop event information
*
* Return: QDF_STATUS_SUCCESS for success or error code
*/
static QDF_STATUS extract_p2p_lo_stop_ev_param_tlv(
wmi_unified_t wmi_handle, void *evt_buf,
struct p2p_lo_event *param)
{
WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID_param_tlvs *param_tlvs;
wmi_p2p_lo_stopped_event_fixed_param *lo_param;
param_tlvs = (WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID_param_tlvs *)
evt_buf;
if (!param_tlvs) {
WMI_LOGE("%s: Invalid P2P lo stop event buffer", __func__);
return QDF_STATUS_E_INVAL;
}
if (!param) {
WMI_LOGE("lo stop event param is null");
return QDF_STATUS_E_INVAL;
}
lo_param = param_tlvs->fixed_param;
param->vdev_id = lo_param->vdev_id;
param->reason_code = lo_param->reason;
WMI_LOGD("%s: vdev_id:%d, reason:%d", __func__,
param->vdev_id, param->reason_code);
return QDF_STATUS_SUCCESS;
}
void wmi_p2p_listen_offload_attach_tlv(wmi_unified_t wmi_handle)
{
struct wmi_ops *ops = wmi_handle->ops;
ops->send_p2p_lo_start_cmd = send_p2p_lo_start_cmd_tlv;
ops->send_p2p_lo_stop_cmd = send_p2p_lo_stop_cmd_tlv;
ops->extract_p2p_lo_stop_ev_param =
extract_p2p_lo_stop_ev_param_tlv;
}
#endif /* FEATURE_P2P_LISTEN_OFFLOAD */
void wmi_p2p_attach_tlv(wmi_unified_t wmi_handle)
{
struct wmi_ops *ops = wmi_handle->ops;
ops->send_set_p2pgo_oppps_req_cmd = send_set_p2pgo_oppps_req_cmd_tlv;
ops->send_set_p2pgo_noa_req_cmd = send_set_p2pgo_noa_req_cmd_tlv;
ops->extract_p2p_noa_ev_param = extract_p2p_noa_ev_param_tlv;
wmi_p2p_listen_offload_attach_tlv(wmi_handle);
}

View File

@@ -25,6 +25,32 @@
#include "wmi_unified_pmo_api.h"
#include "wlan_pmo_hw_filter_public_struct.h"
#ifdef FEATURE_WLAN_D0WOW
QDF_STATUS wmi_unified_d0wow_enable_send(void *wmi_hdl,
uint8_t mac_id)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_d0wow_enable_cmd)
return wmi_handle->ops->send_d0wow_enable_cmd(wmi_handle,
mac_id);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_d0wow_disable_send(void *wmi_hdl,
uint8_t mac_id)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_d0wow_disable_cmd)
return wmi_handle->ops->send_d0wow_disable_cmd(wmi_handle,
mac_id);
return QDF_STATUS_E_FAILURE;
}
#endif /* FEATURE_WLAN_D0WOW */
QDF_STATUS wmi_unified_add_wow_wakeup_event_cmd(void *wmi_hdl,
uint32_t vdev_id,
uint32_t *bitmap,
@@ -57,6 +83,21 @@ QDF_STATUS wmi_unified_wow_patterns_to_fw_cmd(void *wmi_hdl,
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_enable_arp_ns_offload_cmd(void *wmi_hdl,
struct pmo_arp_offload_params *arp_offload_req,
struct pmo_ns_offload_params *ns_offload_req,
uint8_t vdev_id)
{
struct wmi_unified *wmi_handle = (struct wmi_unified *)wmi_hdl;
if (wmi_handle->ops->send_enable_arp_ns_offload_cmd)
return wmi_handle->ops->send_enable_arp_ns_offload_cmd(
wmi_handle,
arp_offload_req, ns_offload_req, vdev_id);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_add_clear_mcbc_filter_cmd(void *wmi_hdl,
uint8_t vdev_id,
struct qdf_mac_addr multicast_addr,
@@ -84,22 +125,44 @@ QDF_STATUS wmi_unified_multiple_add_clear_mcbc_filter_cmd(void *wmi_hdl,
return QDF_STATUS_E_FAILURE;
}
#ifdef FEATURE_WLAN_RA_FILTERING
QDF_STATUS wmi_unified_wow_sta_ra_filter_cmd(void *wmi_hdl,
uint8_t vdev_id, uint8_t default_pattern,
uint16_t rate_limit_interval)
QDF_STATUS wmi_unified_conf_hw_filter_cmd(void *opaque_wmi,
struct pmo_hw_filter_params *req)
{
struct wmi_unified *wmi = opaque_wmi;
if (!wmi->ops->send_conf_hw_filter_cmd)
return QDF_STATUS_E_NOSUPPORT;
return wmi->ops->send_conf_hw_filter_cmd(wmi, req);
}
QDF_STATUS wmi_unified_send_gtk_offload_cmd(void *wmi_hdl, uint8_t vdev_id,
struct pmo_gtk_req *params,
bool enable_offload,
uint32_t gtk_offload_opcode)
{
struct wmi_unified *wmi_handle = (struct wmi_unified *)wmi_hdl;
if (wmi_handle->ops->send_wow_sta_ra_filter_cmd)
return wmi_handle->ops->send_wow_sta_ra_filter_cmd(wmi_handle,
vdev_id, default_pattern, rate_limit_interval);
if (wmi_handle->ops->send_gtk_offload_cmd)
return wmi_handle->ops->send_gtk_offload_cmd(wmi_handle,
vdev_id, params, enable_offload,
gtk_offload_opcode);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_process_gtk_offload_getinfo_cmd(void *wmi_hdl,
uint8_t vdev_id,
uint64_t offload_req_opcode)
{
struct wmi_unified *wmi_handle = (struct wmi_unified *)wmi_hdl;
if (wmi_handle->ops->send_process_gtk_offload_getinfo_cmd)
return wmi_handle->ops->send_process_gtk_offload_getinfo_cmd(
wmi_handle, vdev_id, offload_req_opcode);
return QDF_STATUS_E_FAILURE;
}
#endif /* FEATURE_WLAN_RA_FILTERING */
QDF_STATUS wmi_unified_enable_enhance_multicast_offload_cmd(
void *wmi_hdl, uint8_t vdev_id, bool action)
@@ -127,19 +190,22 @@ QDF_STATUS wmi_extract_gtk_rsp_event(void *wmi_hdl, void *evt_buf,
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_process_gtk_offload_getinfo_cmd(void *wmi_hdl,
uint8_t vdev_id,
uint64_t offload_req_opcode)
#ifdef FEATURE_WLAN_RA_FILTERING
QDF_STATUS wmi_unified_wow_sta_ra_filter_cmd(void *wmi_hdl,
uint8_t vdev_id, uint8_t default_pattern,
uint16_t rate_limit_interval)
{
struct wmi_unified *wmi_handle = (struct wmi_unified *)wmi_hdl;
if (wmi_handle->ops->send_process_gtk_offload_getinfo_cmd)
return wmi_handle->ops->send_process_gtk_offload_getinfo_cmd(
wmi_handle, vdev_id, offload_req_opcode);
if (wmi_handle->ops->send_wow_sta_ra_filter_cmd)
return wmi_handle->ops->send_wow_sta_ra_filter_cmd(wmi_handle,
vdev_id, default_pattern, rate_limit_interval);
return QDF_STATUS_E_FAILURE;
}
#endif /* FEATURE_WLAN_RA_FILTERING */
QDF_STATUS wmi_unified_action_frame_patterns_cmd(void *wmi_hdl,
struct pmo_action_wakeup_set_params *action_params)
@@ -153,74 +219,6 @@ QDF_STATUS wmi_unified_action_frame_patterns_cmd(void *wmi_hdl,
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_send_gtk_offload_cmd(void *wmi_hdl, uint8_t vdev_id,
struct pmo_gtk_req *params,
bool enable_offload,
uint32_t gtk_offload_opcode)
{
struct wmi_unified *wmi_handle = (struct wmi_unified *)wmi_hdl;
if (wmi_handle->ops->send_gtk_offload_cmd)
return wmi_handle->ops->send_gtk_offload_cmd(wmi_handle,
vdev_id, params, enable_offload,
gtk_offload_opcode);
return QDF_STATUS_E_FAILURE;
}
#ifdef WLAN_FEATURE_PACKET_FILTERING
QDF_STATUS wmi_unified_enable_disable_packet_filter_cmd(void *wmi_hdl,
uint8_t vdev_id, bool enable)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_enable_disable_packet_filter_cmd)
return wmi_handle->ops->send_enable_disable_packet_filter_cmd(
wmi_handle, vdev_id, enable);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_config_packet_filter_cmd(void *wmi_hdl,
uint8_t vdev_id, struct pmo_rcv_pkt_fltr_cfg *rcv_filter_param,
uint8_t filter_id, bool enable)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_config_packet_filter_cmd)
return wmi_handle->ops->send_config_packet_filter_cmd(
wmi_handle, vdev_id, rcv_filter_param, filter_id, enable);
return QDF_STATUS_E_FAILURE;
}
#endif
QDF_STATUS wmi_unified_enable_arp_ns_offload_cmd(void *wmi_hdl,
struct pmo_arp_offload_params *arp_offload_req,
struct pmo_ns_offload_params *ns_offload_req,
uint8_t vdev_id)
{
struct wmi_unified *wmi_handle = (struct wmi_unified *)wmi_hdl;
if (wmi_handle->ops->send_enable_arp_ns_offload_cmd)
return wmi_handle->ops->send_enable_arp_ns_offload_cmd(
wmi_handle,
arp_offload_req, ns_offload_req, vdev_id);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_conf_hw_filter_cmd(void *opaque_wmi,
struct pmo_hw_filter_params *req)
{
struct wmi_unified *wmi = opaque_wmi;
if (!wmi->ops->send_conf_hw_filter_cmd)
return QDF_STATUS_E_NOSUPPORT;
return wmi->ops->send_conf_hw_filter_cmd(wmi, req);
}
#ifdef FEATURE_WLAN_LPHB
QDF_STATUS wmi_unified_lphb_config_hbenable_cmd(void *wmi_hdl,
wmi_hb_set_enable_cmd_fixed_param *params)
@@ -282,3 +280,104 @@ QDF_STATUS wmi_unified_lphb_config_udp_pkt_filter_cmd(void *wmi_hdl,
return QDF_STATUS_E_FAILURE;
}
#endif /* FEATURE_WLAN_LPHB */
#ifdef WLAN_FEATURE_PACKET_FILTERING
QDF_STATUS wmi_unified_enable_disable_packet_filter_cmd(void *wmi_hdl,
uint8_t vdev_id, bool enable)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_enable_disable_packet_filter_cmd)
return wmi_handle->ops->send_enable_disable_packet_filter_cmd(
wmi_handle, vdev_id, enable);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_config_packet_filter_cmd(void *wmi_hdl,
uint8_t vdev_id, struct pmo_rcv_pkt_fltr_cfg *rcv_filter_param,
uint8_t filter_id, bool enable)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_config_packet_filter_cmd)
return wmi_handle->ops->send_config_packet_filter_cmd(
wmi_handle, vdev_id, rcv_filter_param, filter_id, enable);
return QDF_STATUS_E_FAILURE;
}
#endif /* WLAN_FEATURE_PACKET_FILTERING */
QDF_STATUS wmi_unified_wow_delete_pattern_cmd(void *wmi_hdl, uint8_t ptrn_id,
uint8_t vdev_id)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_wow_delete_pattern_cmd)
return wmi_handle->ops->send_wow_delete_pattern_cmd(wmi_handle,
ptrn_id,
vdev_id);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_host_wakeup_ind_to_fw_cmd(void *wmi_hdl)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_host_wakeup_ind_to_fw_cmd)
return wmi_handle->ops->send_host_wakeup_ind_to_fw_cmd(wmi_handle);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_wow_timer_pattern_cmd(void *wmi_hdl, uint8_t vdev_id,
uint32_t cookie, uint32_t time)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_wow_timer_pattern_cmd)
return wmi_handle->ops->send_wow_timer_pattern_cmd(wmi_handle,
vdev_id, cookie, time);
return QDF_STATUS_E_FAILURE;
}
#ifdef WLAN_FEATURE_EXTWOW_SUPPORT
QDF_STATUS wmi_unified_enable_ext_wow_cmd(void *wmi_hdl,
struct ext_wow_params *params)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_enable_ext_wow_cmd)
return wmi_handle->ops->send_enable_ext_wow_cmd(wmi_handle,
params);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_set_app_type2_params_in_fw_cmd(void *wmi_hdl,
struct app_type2_params *appType2Params)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_set_app_type2_params_in_fw_cmd)
return wmi_handle->ops->send_set_app_type2_params_in_fw_cmd(
wmi_handle, appType2Params);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_app_type1_params_in_fw_cmd(void *wmi_hdl,
struct app_type1_params *app_type1_params)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_app_type1_params_in_fw_cmd)
return wmi_handle->ops->send_app_type1_params_in_fw_cmd(
wmi_handle, app_type1_params);
return QDF_STATUS_E_FAILURE;
}
#endif /* WLAN_FEATURE_EXTWOW_SUPPORT */

1958
wmi_unified_pmo_tlv.c Normal file

File diff suppressed because it is too large Load Diff

314
wmi_unified_roam_api.c Normal file
View File

@@ -0,0 +1,314 @@
/*
* Copyright (c) 2013-2018 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include <osdep.h>
#include <wmi.h>
#include <wmi_unified_priv.h>
#include <wmi_unified_roam_param.h>
#include <wmi_unified_roam_api.h>
#ifdef FEATURE_LFR_SUBNET_DETECTION
QDF_STATUS wmi_unified_set_gateway_params_cmd(void *wmi_hdl,
struct gateway_update_req_param *req)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_set_gateway_params_cmd)
return wmi_handle->ops->send_set_gateway_params_cmd(wmi_handle,
req);
return QDF_STATUS_E_FAILURE;
}
#endif /* FEATURE_LFR_SUBNET_DETECTION */
#ifdef FEATURE_RSSI_MONITOR
QDF_STATUS wmi_unified_set_rssi_monitoring_cmd(void *wmi_hdl,
struct rssi_monitor_param *req)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_set_rssi_monitoring_cmd)
return wmi_handle->ops->send_set_rssi_monitoring_cmd(wmi_handle,
req);
return QDF_STATUS_E_FAILURE;
}
#endif /* FEATURE_RSSI_MONITOR */
QDF_STATUS wmi_unified_roam_scan_offload_rssi_thresh_cmd(void *wmi_hdl,
struct roam_offload_scan_rssi_params
*roam_req)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_roam_scan_offload_rssi_thresh_cmd)
return wmi_handle->ops->send_roam_scan_offload_rssi_thresh_cmd(
wmi_handle, roam_req);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_roam_mawc_params_cmd(
void *wmi_hdl, struct wmi_mawc_roam_params *params)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_roam_mawc_params_cmd)
return wmi_handle->ops->send_roam_mawc_params_cmd(wmi_handle,
params);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_roam_scan_filter_cmd(void *wmi_hdl,
struct roam_scan_filter_params *roam_req)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_roam_scan_filter_cmd)
return wmi_handle->ops->send_roam_scan_filter_cmd(wmi_handle,
roam_req);
return QDF_STATUS_E_FAILURE;
}
#ifdef FEATURE_WLAN_ESE
QDF_STATUS wmi_unified_plm_stop_cmd(void *wmi_hdl,
const struct plm_req_params *plm)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_plm_stop_cmd)
return wmi_handle->ops->send_plm_stop_cmd(wmi_handle, plm);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_plm_start_cmd(void *wmi_hdl,
const struct plm_req_params *plm,
uint32_t *gchannel_list)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_plm_start_cmd)
return wmi_handle->ops->send_plm_start_cmd(wmi_handle,
plm,
gchannel_list);
return QDF_STATUS_E_FAILURE;
}
#endif /* FEATURE_WLAN_ESE */
#ifdef WLAN_FEATURE_ROAM_OFFLOAD
QDF_STATUS wmi_unified_set_ric_req_cmd(void *wmi_hdl, void *msg,
uint8_t is_add_ts)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_set_ric_req_cmd)
return wmi_handle->ops->send_set_ric_req_cmd(wmi_handle, msg,
is_add_ts);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_roam_synch_complete_cmd(void *wmi_hdl,
uint8_t vdev_id)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_process_roam_synch_complete_cmd)
return wmi_handle->ops->send_process_roam_synch_complete_cmd(
wmi_handle, vdev_id);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_roam_invoke_cmd(void *wmi_hdl,
struct wmi_roam_invoke_cmd *roaminvoke,
uint32_t ch_hz)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_roam_invoke_cmd)
return wmi_handle->ops->send_roam_invoke_cmd(wmi_handle,
roaminvoke,
ch_hz);
return QDF_STATUS_E_FAILURE;
}
#endif /* WLAN_FEATURE_ROAM_OFFLOAD */
QDF_STATUS wmi_unified_roam_scan_offload_mode_cmd(void *wmi_hdl,
wmi_start_scan_cmd_fixed_param *scan_cmd_fp,
struct roam_offload_scan_params *roam_req)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_roam_scan_offload_mode_cmd)
return wmi_handle->ops->send_roam_scan_offload_mode_cmd(
wmi_handle, scan_cmd_fp, roam_req);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_send_roam_scan_offload_ap_cmd(void *wmi_hdl,
struct ap_profile_params *ap_profile)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_roam_scan_offload_ap_profile_cmd)
return wmi_handle->ops->send_roam_scan_offload_ap_profile_cmd(
wmi_handle, ap_profile);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_roam_scan_offload_cmd(void *wmi_hdl,
uint32_t command, uint32_t vdev_id)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_roam_scan_offload_cmd)
return wmi_handle->ops->send_roam_scan_offload_cmd(wmi_handle,
command,
vdev_id);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_roam_scan_offload_scan_period(void *wmi_hdl,
uint32_t scan_period,
uint32_t scan_age,
uint32_t vdev_id)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_roam_scan_offload_scan_period_cmd)
return wmi_handle->ops->send_roam_scan_offload_scan_period_cmd(wmi_handle,
scan_period, scan_age, vdev_id);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_roam_scan_offload_chan_list_cmd(void *wmi_hdl,
uint8_t chan_count,
uint32_t *chan_list,
uint8_t list_type, uint32_t vdev_id)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_roam_scan_offload_chan_list_cmd)
return wmi_handle->ops->send_roam_scan_offload_chan_list_cmd(wmi_handle,
chan_count, chan_list,
list_type, vdev_id);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_roam_scan_offload_rssi_change_cmd(void *wmi_hdl,
uint32_t vdev_id,
int32_t rssi_change_thresh,
uint32_t bcn_rssi_weight,
uint32_t hirssi_delay_btw_scans)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_roam_scan_offload_rssi_change_cmd)
return wmi_handle->ops->send_roam_scan_offload_rssi_change_cmd(wmi_handle,
vdev_id, rssi_change_thresh,
bcn_rssi_weight, hirssi_delay_btw_scans);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_set_per_roam_config(void *wmi_hdl,
struct wmi_per_roam_config_req *req_buf)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_per_roam_config_cmd)
return wmi_handle->ops->send_per_roam_config_cmd(wmi_handle,
req_buf);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_send_limit_off_chan_cmd(void *wmi_hdl,
struct wmi_limit_off_chan_param *limit_off_chan_param)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_limit_off_chan_cmd)
return wmi_handle->ops->send_limit_off_chan_cmd(wmi_handle,
limit_off_chan_param);
return QDF_STATUS_E_FAILURE;
}
#ifdef WLAN_FEATURE_FILS_SK
QDF_STATUS wmi_unified_roam_send_hlp_cmd(void *wmi_hdl,
struct hlp_params *req_buf)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_roam_scan_hlp_cmd)
return wmi_handle->ops->send_roam_scan_hlp_cmd(wmi_handle,
req_buf);
return QDF_STATUS_E_FAILURE;
}
#endif /* WLAN_FEATURE_FILS_SK */
QDF_STATUS wmi_unified_send_btm_config(void *wmi_hdl,
struct wmi_btm_config *params)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_btm_config)
return wmi_handle->ops->send_btm_config(wmi_handle,
params);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_offload_11k_cmd(void *wmi_hdl,
struct wmi_11k_offload_params *params)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_offload_11k_cmd)
return wmi_handle->ops->send_offload_11k_cmd(wmi_handle,
params);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_invoke_neighbor_report_cmd(void *wmi_hdl,
struct wmi_invoke_neighbor_report_params *params)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_invoke_neighbor_report_cmd)
return wmi_handle->ops->send_invoke_neighbor_report_cmd(
wmi_handle, params);
return QDF_STATUS_E_FAILURE;
}

2224
wmi_unified_roam_tlv.c Normal file

File diff suppressed because it is too large Load Diff

491
wmi_unified_sta_api.c Normal file
View File

@@ -0,0 +1,491 @@
/*
* Copyright (c) 2013-2018 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: Implement API's specific to STA component.
*/
#include <wmi.h>
#include "wmi_unified_priv.h"
#include "wmi_unified_sta_api.h"
QDF_STATUS wmi_unified_set_sta_sa_query_param_cmd(void *wmi_hdl,
uint8_t vdev_id,
uint32_t max_retries,
uint32_t retry_interval)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_set_sta_sa_query_param_cmd)
return wmi_handle->ops->send_set_sta_sa_query_param_cmd(wmi_handle,
vdev_id, max_retries,
retry_interval);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_set_sta_keep_alive_cmd(void *wmi_hdl,
struct sta_params *params)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_set_sta_keep_alive_cmd)
return wmi_handle->ops->send_set_sta_keep_alive_cmd(wmi_handle,
params);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_vdev_set_gtx_cfg_cmd(void *wmi_hdl, uint32_t if_id,
struct wmi_gtx_config *gtx_info)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_vdev_set_gtx_cfg_cmd)
return wmi_handle->ops->send_vdev_set_gtx_cfg_cmd(wmi_handle,
if_id,
gtx_info);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_process_dhcp_ind(void *wmi_hdl,
wmi_peer_set_param_cmd_fixed_param *ta_dhcp_ind)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_process_dhcp_ind_cmd)
return wmi_handle->ops->send_process_dhcp_ind_cmd(wmi_handle,
ta_dhcp_ind);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_get_link_speed_cmd(void *wmi_hdl,
wmi_mac_addr peer_macaddr)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_get_link_speed_cmd)
return wmi_handle->ops->send_get_link_speed_cmd(wmi_handle,
peer_macaddr);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_fw_profiling_data_cmd(void *wmi_hdl,
uint32_t cmd, uint32_t value1, uint32_t value2)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_fw_profiling_cmd)
return wmi_handle->ops->send_fw_profiling_cmd(wmi_handle,
cmd,
value1,
value2);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_nat_keepalive_en_cmd(void *wmi_hdl, uint8_t vdev_id)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_nat_keepalive_en_cmd)
return wmi_handle->ops->send_nat_keepalive_en_cmd(wmi_handle,
vdev_id);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_wlm_latency_level_cmd(void *wmi_hdl,
struct wlm_latency_level_param *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_wlm_latency_level_cmd)
return wmi_handle->ops->send_wlm_latency_level_cmd(wmi_handle,
param);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_nan_req_cmd(void *wmi_hdl,
struct nan_req_params *nan_req)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_nan_req_cmd)
return wmi_handle->ops->send_nan_req_cmd(wmi_handle,
nan_req);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_process_set_ie_info_cmd(void *wmi_hdl,
struct vdev_ie_info_param *ie_info)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_process_set_ie_info_cmd)
return wmi_handle->ops->send_process_set_ie_info_cmd(wmi_handle,
ie_info);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_set_base_macaddr_indicate_cmd(void *wmi_hdl,
uint8_t *custom_addr)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_set_base_macaddr_indicate_cmd)
return wmi_handle->ops->send_set_base_macaddr_indicate_cmd(wmi_handle,
custom_addr);
return QDF_STATUS_E_FAILURE;
}
#ifdef CONVERGED_TDLS_ENABLE
QDF_STATUS wmi_unified_set_tdls_offchan_mode_cmd(void *wmi_hdl,
struct tdls_channel_switch_params *chan_switch_params)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_set_tdls_offchan_mode_cmd)
return wmi_handle->ops->send_set_tdls_offchan_mode_cmd(wmi_handle,
chan_switch_params);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_update_fw_tdls_state_cmd(void *wmi_hdl,
void *tdls_param, uint8_t tdls_state)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_update_fw_tdls_state_cmd)
return wmi_handle->ops->send_update_fw_tdls_state_cmd(wmi_handle,
tdls_param, tdls_state);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_update_tdls_peer_state_cmd(void *wmi_hdl,
struct tdls_peer_state_params *peerStateParams,
uint32_t *ch_mhz)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_update_tdls_peer_state_cmd)
return wmi_handle->ops->send_update_tdls_peer_state_cmd(wmi_handle,
peerStateParams, ch_mhz);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_extract_vdev_tdls_ev_param(void *wmi_hdl, void *evt_buf,
struct tdls_event_info *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
if (wmi_handle->ops->extract_vdev_tdls_ev_param)
return wmi_handle->ops->extract_vdev_tdls_ev_param(wmi_handle,
evt_buf, param);
return QDF_STATUS_E_FAILURE;
}
#endif /* CONVERGED_TDLS_ENABLE */
#ifdef WLAN_FEATURE_DISA
QDF_STATUS wmi_unified_encrypt_decrypt_send_cmd(void *wmi_hdl,
struct disa_encrypt_decrypt_req_params *params)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_encrypt_decrypt_send_cmd)
return wmi_handle->ops->send_encrypt_decrypt_send_cmd(
wmi_handle,
params);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_extract_encrypt_decrypt_resp_params(void *wmi_hdl,
uint8_t *evt_buf,
struct disa_encrypt_decrypt_resp_params *resp)
{
struct wmi_unified *wmi_handle = (struct wmi_unified *)wmi_hdl;
if (wmi_handle->ops->extract_encrypt_decrypt_resp_event)
return wmi_handle->ops->extract_encrypt_decrypt_resp_event(
wmi_handle, evt_buf, resp);
return QDF_STATUS_E_FAILURE;
}
#endif /* WLAN_FEATURE_DISA */
QDF_STATUS wmi_unified_send_sar_limit_cmd(void *wmi_hdl,
struct sar_limit_cmd_params *params)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_sar_limit_cmd)
return wmi_handle->ops->send_sar_limit_cmd(
wmi_handle,
params);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_get_sar_limit_cmd(void *wmi_hdl)
{
wmi_unified_t wmi_handle = wmi_hdl;
if (wmi_handle->ops->get_sar_limit_cmd)
return wmi_handle->ops->get_sar_limit_cmd(wmi_handle);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_extract_sar_limit_event(void *wmi_hdl,
uint8_t *evt_buf,
struct sar_limit_event *event)
{
wmi_unified_t wmi_handle = wmi_hdl;
if (wmi_handle->ops->extract_sar_limit_event)
return wmi_handle->ops->extract_sar_limit_event(wmi_handle,
evt_buf,
event);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_extract_sar2_result_event(void *handle,
uint8_t *event, uint32_t len)
{
wmi_unified_t wmi_handle = handle;
if (wmi_handle->ops->extract_sar2_result_event)
return wmi_handle->ops->extract_sar2_result_event(wmi_handle,
event,
len);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_set_del_pmkid_cache(void *wmi_hdl,
struct wmi_unified_pmk_cache *req_buf)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_set_del_pmkid_cache_cmd)
return wmi_handle->ops->send_set_del_pmkid_cache_cmd(wmi_handle,
req_buf);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_del_ts_cmd(void *wmi_hdl, uint8_t vdev_id,
uint8_t ac)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_del_ts_cmd)
return wmi_handle->ops->send_del_ts_cmd(wmi_handle,
vdev_id, ac);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_aggr_qos_cmd(void *wmi_hdl,
struct aggr_add_ts_param *aggr_qos_rsp_msg)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_aggr_qos_cmd)
return wmi_handle->ops->send_aggr_qos_cmd(wmi_handle,
aggr_qos_rsp_msg);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_add_ts_cmd(void *wmi_hdl,
struct add_ts_param *msg)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_add_ts_cmd)
return wmi_handle->ops->send_add_ts_cmd(wmi_handle,
msg);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_process_add_periodic_tx_ptrn_cmd(void *wmi_hdl,
struct periodic_tx_pattern *
pAddPeriodicTxPtrnParams,
uint8_t vdev_id)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_process_add_periodic_tx_ptrn_cmd)
return wmi_handle->ops->send_process_add_periodic_tx_ptrn_cmd(
wmi_handle,
pAddPeriodicTxPtrnParams,
vdev_id);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_process_del_periodic_tx_ptrn_cmd(void *wmi_hdl,
uint8_t vdev_id,
uint8_t pattern_id)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_process_del_periodic_tx_ptrn_cmd)
return wmi_handle->ops->send_process_del_periodic_tx_ptrn_cmd(
wmi_handle,
vdev_id,
pattern_id);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_set_auto_shutdown_timer_cmd(void *wmi_hdl,
uint32_t timer_val)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_set_auto_shutdown_timer_cmd)
return wmi_handle->ops->send_set_auto_shutdown_timer_cmd(
wmi_handle,
timer_val);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_set_led_flashing_cmd(void *wmi_hdl,
struct flashing_req_params *flashing)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_set_led_flashing_cmd)
return wmi_handle->ops->send_set_led_flashing_cmd(wmi_handle,
flashing);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_process_ch_avoid_update_cmd(void *wmi_hdl)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_process_ch_avoid_update_cmd)
return wmi_handle->ops->send_process_ch_avoid_update_cmd(
wmi_handle);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_pdev_set_pcl_cmd(void *wmi_hdl,
struct wmi_pcl_chan_weights *msg)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_pdev_set_pcl_cmd)
return wmi_handle->ops->send_pdev_set_pcl_cmd(wmi_handle, msg);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_soc_set_hw_mode_cmd(void *wmi_hdl,
uint32_t hw_mode_index)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_pdev_set_hw_mode_cmd)
return wmi_handle->ops->send_pdev_set_hw_mode_cmd(wmi_handle,
hw_mode_index);
return QDF_STATUS_E_FAILURE;
}
#ifdef WLAN_POLICY_MGR_ENABLE
QDF_STATUS wmi_unified_pdev_set_dual_mac_config_cmd(void *wmi_hdl,
struct policy_mgr_dual_mac_config *msg)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_pdev_set_dual_mac_config_cmd)
return wmi_handle->ops->send_pdev_set_dual_mac_config_cmd(
wmi_handle,
msg);
return QDF_STATUS_E_FAILURE;
}
#endif /* WLAN_POLICY_MGR_ENABLE */
QDF_STATUS wmi_unified_send_adapt_dwelltime_params_cmd(void *wmi_hdl,
struct wmi_adaptive_dwelltime_params *dwelltime_params)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_adapt_dwelltime_params_cmd)
return wmi_handle->ops->
send_adapt_dwelltime_params_cmd(wmi_handle,
dwelltime_params);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_send_dbs_scan_sel_params_cmd(void *wmi_hdl,
struct wmi_dbs_scan_sel_params *dbs_scan_params)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_dbs_scan_sel_params_cmd)
return wmi_handle->ops->
send_dbs_scan_sel_params_cmd(wmi_handle,
dbs_scan_params);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_set_arp_stats_req(void *wmi_hdl,
struct set_arp_stats *req_buf)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_set_arp_stats_req_cmd)
return wmi_handle->ops->send_set_arp_stats_req_cmd(wmi_handle,
req_buf);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_unified_get_arp_stats_req(void *wmi_hdl,
struct get_arp_stats *req_buf)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_get_arp_stats_req_cmd)
return wmi_handle->ops->send_get_arp_stats_req_cmd(wmi_handle,
req_buf);
return QDF_STATUS_E_FAILURE;
}

2498
wmi_unified_sta_tlv.c Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff