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

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 WIN
- Air Time Fareness (ATF)
- Direct Buffer Rx (DBR)
- Smart Antenna (SMART_ANT)
- Generic WIN specific WMI (AP)

Change-Id: I7b27c8993da04c9e9651a9682de370daaa40d187
CRs-Fixed: 2320273
This commit is contained in:
Sathish Kumar
2018-10-02 11:03:59 +05:30
committed by nshrivas
parent cb7616fb07
commit efb25bf9db
10 changed files with 4954 additions and 4731 deletions

1063
wmi_unified_ap_api.c Normal file

File diff suppressed because it is too large Load Diff

2544
wmi_unified_ap_tlv.c Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

164
wmi_unified_atf_api.c Normal file
View File

@@ -0,0 +1,164 @@
/*
* Copyright (c) 2016-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 "wmi_unified_priv.h"
#include "wmi_unified_atf_param.h"
#include "qdf_module.h"
/**
* wmi_unified_set_bwf_cmd_send() - WMI set bwf function
* @param wmi_handle : handle to WMI.
* @param param : pointer to set bwf param
*
* @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
*/
QDF_STATUS wmi_unified_set_bwf_cmd_send(void *wmi_hdl,
struct set_bwf_params *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_set_bwf_cmd)
return wmi_handle->ops->send_set_bwf_cmd(wmi_handle, param);
return QDF_STATUS_E_FAILURE;
}
#ifdef WLAN_ATF_ENABLE
/**
* wmi_unified_set_atf_cmd_send() - WMI set atf function
* @param wmi_handle : handle to WMI.
* @param param : pointer to set atf param
*
* @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
*/
QDF_STATUS
wmi_unified_set_atf_cmd_send(void *wmi_hdl,
struct set_atf_params *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
if (wmi_handle->ops->send_set_atf_cmd)
return wmi_handle->ops->send_set_atf_cmd(wmi_handle, param);
return QDF_STATUS_E_FAILURE;
}
/**
* wmi_send_atf_peer_request_cmd() - send atf peer request command to fw
* @wmi_handle: wmi handle
* @param: pointer to atf peer request param
*
* Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
*/
QDF_STATUS
wmi_send_atf_peer_request_cmd(void *wmi_hdl,
struct atf_peer_request_params *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
if (wmi_handle->ops->send_atf_peer_request_cmd)
return wmi_handle->ops->send_atf_peer_request_cmd(wmi_handle,
param);
return QDF_STATUS_E_FAILURE;
}
/**
* wmi_send_set_atf_grouping_cmd() - send set atf grouping command to fw
* @wmi_handle: wmi handle
* @param: pointer to set atf grouping param
*
* Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
*/
QDF_STATUS
wmi_send_set_atf_grouping_cmd(void *wmi_hdl,
struct atf_grouping_params *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
if (wmi_handle->ops->send_set_atf_grouping_cmd)
return wmi_handle->ops->send_set_atf_grouping_cmd(wmi_handle,
param);
return QDF_STATUS_E_FAILURE;
}
/**
* wmi_send_set_atf_group_ac_cmd() - send set atf AC command to fw
* @wmi_handle: wmi handle
* @param: pointer to set atf AC group param
*
* Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
*/
QDF_STATUS
wmi_send_set_atf_group_ac_cmd(void *wmi_hdl,
struct atf_group_ac_params *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
if (wmi_handle->ops->send_set_atf_group_ac_cmd)
return wmi_handle->ops->send_set_atf_group_ac_cmd(wmi_handle,
param);
return QDF_STATUS_E_FAILURE;
}
/**
* wmi_extract_atf_peer_stats_ev() - extract atf peer stats
* from event
* @wmi_handle: wmi handle
* @param evt_buf: pointer to event buffer
* @param ev: Pointer to hold atf peer stats
*
* Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
*/
QDF_STATUS
wmi_extract_atf_peer_stats_ev(void *wmi_hdl, void *evt_buf,
wmi_host_atf_peer_stats_event *ev)
{
wmi_unified_t wmi = (wmi_unified_t)wmi_hdl;
if (wmi->ops->extract_atf_peer_stats_ev)
return wmi->ops->extract_atf_peer_stats_ev(wmi, evt_buf, ev);
return QDF_STATUS_E_FAILURE;
}
/**
* wmi_extract_atf_token_info_ev() - extract atf token info
* from event
* @wmi_handle: wmi handle
* @param evt_buf: pointer to event buffer
* @param idx: Index indicating the peer number
* @param ev: Pointer to hold atf token info
*
* Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
*/
QDF_STATUS
wmi_extract_atf_token_info_ev(void *wmi_hdl, void *evt_buf, uint8_t idx,
wmi_host_atf_peer_stats_info *ev)
{
wmi_unified_t wmi = (wmi_unified_t)wmi_hdl;
if (wmi->ops->extract_atf_token_info_ev)
return wmi->ops->extract_atf_token_info_ev(wmi, evt_buf,
idx, ev);
return QDF_STATUS_E_FAILURE;
}
#endif /* WLAN_ATF_ENABLE */

190
wmi_unified_atf_tlv.c Normal file
View File

@@ -0,0 +1,190 @@
/*
* Copyright (c) 2016-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_atf_param.h"
#include "wmi_unified_atf_api.h"
#ifdef WLAN_ATF_ENABLE
/**
* send_set_atf_cmd_tlv() - send set atf command to fw
* @wmi_handle: wmi handle
* @param: pointer to set atf param
*
* @return QDF_STATUS_SUCCESS on success and -ve on failure.
*/
static QDF_STATUS
send_set_atf_cmd_tlv(wmi_unified_t wmi_handle,
struct set_atf_params *param)
{
wmi_atf_peer_info *peer_info;
wmi_peer_atf_request_fixed_param *cmd;
wmi_buf_t buf;
uint8_t *buf_ptr;
int i;
int32_t len = 0;
QDF_STATUS retval;
len = sizeof(*cmd) + WMI_TLV_HDR_SIZE;
len += param->num_peers * sizeof(wmi_atf_peer_info);
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf) {
WMI_LOGE("%s:wmi_buf_alloc failed", __func__);
return QDF_STATUS_E_FAILURE;
}
buf_ptr = (uint8_t *)wmi_buf_data(buf);
cmd = (wmi_peer_atf_request_fixed_param *)buf_ptr;
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_peer_atf_request_fixed_param,
WMITLV_GET_STRUCT_TLVLEN(
wmi_peer_atf_request_fixed_param));
cmd->num_peers = param->num_peers;
buf_ptr += sizeof(*cmd);
WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
sizeof(wmi_atf_peer_info) *
cmd->num_peers);
buf_ptr += WMI_TLV_HDR_SIZE;
peer_info = (wmi_atf_peer_info *)buf_ptr;
for (i = 0; i < cmd->num_peers; i++) {
WMITLV_SET_HDR(&peer_info->tlv_header,
WMITLV_TAG_STRUC_wmi_atf_peer_info,
WMITLV_GET_STRUCT_TLVLEN(
wmi_atf_peer_info));
qdf_mem_copy(&(peer_info->peer_macaddr),
&(param->peer_info[i].peer_macaddr),
sizeof(wmi_mac_addr));
peer_info->atf_units = param->peer_info[i].percentage_peer;
peer_info->vdev_id = param->peer_info[i].vdev_id;
peer_info->pdev_id =
wmi_handle->ops->convert_pdev_id_host_to_target(
param->peer_info[i].pdev_id);
/*
* TLV definition for peer atf request fixed param combines
* extension stats. Legacy FW for WIN (Non-TLV) has peer atf
* stats and atf extension stats as two different
* implementations.
* Need to discuss with FW on this.
*
* peer_info->atf_groupid = param->peer_ext_info[i].group_index;
* peer_info->atf_units_reserved =
* param->peer_ext_info[i].atf_index_reserved;
*/
peer_info++;
}
wmi_mtrace(WMI_PEER_ATF_REQUEST_CMDID, NO_SESSION, 0);
retval = wmi_unified_cmd_send(wmi_handle, buf, len,
WMI_PEER_ATF_REQUEST_CMDID);
if (retval != QDF_STATUS_SUCCESS) {
WMI_LOGE("%s : WMI Failed", __func__);
wmi_buf_free(buf);
}
return retval;
}
#endif
/**
* send_set_bwf_cmd_tlv() - send set bwf command to fw
* @wmi_handle: wmi handle
* @param: pointer to set bwf param
*
* Return: 0 for success or error code
*/
static QDF_STATUS
send_set_bwf_cmd_tlv(wmi_unified_t wmi_handle,
struct set_bwf_params *param)
{
wmi_bwf_peer_info *peer_info;
wmi_peer_bwf_request_fixed_param *cmd;
wmi_buf_t buf;
QDF_STATUS retval;
int32_t len;
uint8_t *buf_ptr;
int i;
len = sizeof(*cmd) + WMI_TLV_HDR_SIZE;
len += param->num_peers * sizeof(wmi_bwf_peer_info);
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf) {
WMI_LOGE("%s:wmi_buf_alloc failed", __func__);
return QDF_STATUS_E_FAILURE;
}
buf_ptr = (uint8_t *)wmi_buf_data(buf);
cmd = (wmi_peer_bwf_request_fixed_param *)buf_ptr;
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_peer_bwf_request_fixed_param,
WMITLV_GET_STRUCT_TLVLEN(
wmi_peer_bwf_request_fixed_param));
cmd->num_peers = param->num_peers;
buf_ptr += sizeof(*cmd);
WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
sizeof(wmi_bwf_peer_info) *
cmd->num_peers);
buf_ptr += WMI_TLV_HDR_SIZE;
peer_info = (wmi_bwf_peer_info *)buf_ptr;
for (i = 0; i < cmd->num_peers; i++) {
WMITLV_SET_HDR(&peer_info->tlv_header,
WMITLV_TAG_STRUC_wmi_bwf_peer_info,
WMITLV_GET_STRUCT_TLVLEN(wmi_bwf_peer_info));
peer_info->bwf_guaranteed_bandwidth =
param->peer_info[i].throughput;
peer_info->bwf_max_airtime =
param->peer_info[i].max_airtime;
peer_info->bwf_peer_priority =
param->peer_info[i].priority;
qdf_mem_copy(&peer_info->peer_macaddr,
&param->peer_info[i].peer_macaddr,
sizeof(param->peer_info[i].peer_macaddr));
peer_info->vdev_id =
param->peer_info[i].vdev_id;
peer_info->pdev_id =
wmi_handle->ops->convert_pdev_id_host_to_target(
param->peer_info[i].pdev_id);
peer_info++;
}
wmi_mtrace(WMI_PEER_BWF_REQUEST_CMDID, NO_SESSION, 0);
retval = wmi_unified_cmd_send(wmi_handle, buf, len,
WMI_PEER_BWF_REQUEST_CMDID);
if (retval != QDF_STATUS_SUCCESS) {
WMI_LOGE("%s : WMI Failed", __func__);
wmi_buf_free(buf);
}
return retval;
}
void wmi_atf_attach_tlv(wmi_unified_t wmi_handle)
{
struct wmi_ops *ops = wmi_handle->ops;
#ifdef WLAN_ATF_ENABLE
ops->send_set_atf_cmd = send_set_atf_cmd_tlv;
#endif
ops->send_set_bwf_cmd = send_set_bwf_cmd_tlv;
}

76
wmi_unified_dbr_api.c Normal file
View File

@@ -0,0 +1,76 @@
/*
* Copyright (c) 2016-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 "wmi_unified_priv.h"
#include "qdf_module.h"
QDF_STATUS wmi_unified_dbr_ring_cfg(void *wmi_hdl,
struct direct_buf_rx_cfg_req *cfg)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_dbr_cfg_cmd)
return wmi_handle->ops->send_dbr_cfg_cmd(wmi_handle, cfg);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_extract_dbr_buf_release_fixed(
void *wmi_hdl,
uint8_t *evt_buf,
struct direct_buf_rx_rsp *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->extract_dbr_buf_release_fixed)
return wmi_handle->ops->extract_dbr_buf_release_fixed(
wmi_handle,
evt_buf, param);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_extract_dbr_buf_release_entry(
void *wmi_hdl,
uint8_t *evt_buf, uint8_t idx,
struct direct_buf_rx_entry *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->extract_dbr_buf_release_entry)
return wmi_handle->ops->extract_dbr_buf_release_entry(
wmi_handle,
evt_buf, idx, param);
return QDF_STATUS_E_FAILURE;
}
QDF_STATUS wmi_extract_dbr_buf_metadata(
void *wmi_hdl,
uint8_t *evt_buf, uint8_t idx,
struct direct_buf_rx_metadata *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
if (wmi_handle->ops->extract_dbr_buf_metadata)
return wmi_handle->ops->extract_dbr_buf_metadata(
wmi_handle,
evt_buf, idx, param);
return QDF_STATUS_E_FAILURE;
}

169
wmi_unified_dbr_tlv.c Normal file
View File

@@ -0,0 +1,169 @@
/*
* Copyright (c) 2016-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_dbr_param.h"
#include "wmi_unified_dbr_api.h"
/**
* send_dbr_cfg_cmd_tlv() - configure DMA rings for Direct Buf RX
* @wmi_handle: wmi handle
* @data_len: len of dma cfg req
* @data: dma cfg req
*
* Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
*/
static QDF_STATUS send_dbr_cfg_cmd_tlv(wmi_unified_t wmi_handle,
struct direct_buf_rx_cfg_req *cfg)
{
wmi_buf_t buf;
wmi_dma_ring_cfg_req_fixed_param *cmd;
QDF_STATUS ret;
int32_t len = sizeof(*cmd);
buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd));
if (!buf) {
WMI_LOGE(FL("wmi_buf_alloc failed"));
return QDF_STATUS_E_FAILURE;
}
cmd = (wmi_dma_ring_cfg_req_fixed_param *)wmi_buf_data(buf);
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_dma_ring_cfg_req_fixed_param,
WMITLV_GET_STRUCT_TLVLEN(wmi_dma_ring_cfg_req_fixed_param));
cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(
cfg->pdev_id);
cmd->mod_id = cfg->mod_id;
cmd->base_paddr_lo = cfg->base_paddr_lo;
cmd->base_paddr_hi = cfg->base_paddr_hi;
cmd->head_idx_paddr_lo = cfg->head_idx_paddr_lo;
cmd->head_idx_paddr_hi = cfg->head_idx_paddr_hi;
cmd->tail_idx_paddr_lo = cfg->tail_idx_paddr_lo;
cmd->tail_idx_paddr_hi = cfg->tail_idx_paddr_hi;
cmd->num_elems = cfg->num_elems;
cmd->buf_size = cfg->buf_size;
cmd->num_resp_per_event = cfg->num_resp_per_event;
cmd->event_timeout_ms = cfg->event_timeout_ms;
WMI_LOGD("%s: wmi_dma_ring_cfg_req_fixed_param pdev id %d mod id %d"
"base paddr lo %x base paddr hi %x head idx paddr lo %x"
"head idx paddr hi %x tail idx paddr lo %x"
"tail idx addr hi %x num elems %d buf size %d num resp %d"
"event timeout %d", __func__, cmd->pdev_id,
cmd->mod_id, cmd->base_paddr_lo, cmd->base_paddr_hi,
cmd->head_idx_paddr_lo, cmd->head_idx_paddr_hi,
cmd->tail_idx_paddr_lo, cmd->tail_idx_paddr_hi,
cmd->num_elems, cmd->buf_size, cmd->num_resp_per_event,
cmd->event_timeout_ms);
wmi_mtrace(WMI_PDEV_DMA_RING_CFG_REQ_CMDID, NO_SESSION, 0);
ret = wmi_unified_cmd_send(wmi_handle, buf, len,
WMI_PDEV_DMA_RING_CFG_REQ_CMDID);
if (QDF_IS_STATUS_ERROR(ret)) {
WMI_LOGE(FL(":wmi cmd send failed"));
wmi_buf_free(buf);
}
return ret;
}
static QDF_STATUS extract_dbr_buf_release_fixed_tlv(wmi_unified_t wmi_handle,
uint8_t *event, struct direct_buf_rx_rsp *param)
{
WMI_PDEV_DMA_RING_BUF_RELEASE_EVENTID_param_tlvs *param_buf;
wmi_dma_buf_release_fixed_param *ev;
param_buf = (WMI_PDEV_DMA_RING_BUF_RELEASE_EVENTID_param_tlvs *)event;
if (!param_buf)
return QDF_STATUS_E_INVAL;
ev = param_buf->fixed_param;
if (!ev)
return QDF_STATUS_E_INVAL;
param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host(
ev->pdev_id);
param->mod_id = ev->mod_id;
param->num_buf_release_entry = ev->num_buf_release_entry;
param->num_meta_data_entry = ev->num_meta_data_entry;
WMI_LOGD("%s:pdev id %d mod id %d num buf release entry %d", __func__,
param->pdev_id, param->mod_id, param->num_buf_release_entry);
return QDF_STATUS_SUCCESS;
}
static QDF_STATUS extract_dbr_buf_release_entry_tlv(wmi_unified_t wmi_handle,
uint8_t *event, uint8_t idx, struct direct_buf_rx_entry *param)
{
WMI_PDEV_DMA_RING_BUF_RELEASE_EVENTID_param_tlvs *param_buf;
wmi_dma_buf_release_entry *entry;
param_buf = (WMI_PDEV_DMA_RING_BUF_RELEASE_EVENTID_param_tlvs *)event;
if (!param_buf)
return QDF_STATUS_E_INVAL;
entry = &param_buf->entries[idx];
if (!entry) {
WMI_LOGE("%s: Entry is NULL", __func__);
return QDF_STATUS_E_FAILURE;
}
WMI_LOGD("%s: paddr_lo[%d] = %x", __func__, idx, entry->paddr_lo);
param->paddr_lo = entry->paddr_lo;
param->paddr_hi = entry->paddr_hi;
return QDF_STATUS_SUCCESS;
}
static QDF_STATUS extract_dbr_buf_metadata_tlv(
wmi_unified_t wmi_handle, uint8_t *event,
uint8_t idx, struct direct_buf_rx_metadata *param)
{
WMI_PDEV_DMA_RING_BUF_RELEASE_EVENTID_param_tlvs *param_buf;
wmi_dma_buf_release_spectral_meta_data *entry;
param_buf = (WMI_PDEV_DMA_RING_BUF_RELEASE_EVENTID_param_tlvs *)event;
if (!param_buf)
return QDF_STATUS_E_INVAL;
entry = &param_buf->meta_data[idx];
if (!entry) {
WMI_LOGE("%s: Entry is NULL", __func__);
return QDF_STATUS_E_FAILURE;
}
qdf_mem_copy(param->noisefloor, entry->noise_floor,
sizeof(entry->noise_floor));
return QDF_STATUS_SUCCESS;
}
void wmi_dbr_attach_tlv(wmi_unified_t wmi_handle)
{
struct wmi_ops *ops = wmi_handle->ops;
ops->send_dbr_cfg_cmd = send_dbr_cfg_cmd_tlv;
ops->extract_dbr_buf_release_entry = extract_dbr_buf_release_entry_tlv;
ops->extract_dbr_buf_metadata = extract_dbr_buf_metadata_tlv;
ops->extract_dbr_buf_release_fixed = extract_dbr_buf_release_fixed_tlv;
}

138
wmi_unified_smart_ant_api.c Normal file
View File

@@ -0,0 +1,138 @@
/*
* Copyright (c) 2016-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 "wmi_unified_priv.h"
#include "wmi_unified_param.h"
#include "qdf_module.h"
/**
* wmi_unified_set_ant_switch_tbl_cmd_send() - WMI ant switch tbl cmd function
* @param wmi_handle : handle to WMI.
* @param param : pointer to hold ant switch tbl param
*
* @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
*/
QDF_STATUS wmi_unified_set_ant_switch_tbl_cmd_send(void *wmi_hdl,
struct ant_switch_tbl_params *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_set_ant_switch_tbl_cmd)
return wmi_handle->ops->send_set_ant_switch_tbl_cmd(wmi_handle,
param);
return QDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_smart_ant_enable_cmd_send() - WMI smart ant enable function
* @param wmi_handle : handle to WMI.
* @param param : pointer to hold antenna param
*
* @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
*/
QDF_STATUS wmi_unified_smart_ant_enable_cmd_send(void *wmi_hdl,
struct smart_ant_enable_params *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_smart_ant_enable_cmd)
return wmi_handle->ops->send_smart_ant_enable_cmd(wmi_handle,
param);
return QDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_smart_ant_set_rx_ant_cmd_send() - WMI set rx antenna function
* @param wmi_handle : handle to WMI.
* @param param : pointer to hold antenna param
*
* @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
*/
QDF_STATUS wmi_unified_smart_ant_set_rx_ant_cmd_send(void *wmi_hdl,
struct smart_ant_rx_ant_params *param)
{
wmi_unified_t wmi = (wmi_unified_t) wmi_hdl;
if (wmi->ops->send_smart_ant_set_rx_ant_cmd)
return wmi->ops->send_smart_ant_set_rx_ant_cmd(wmi, param);
return QDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_smart_ant_set_tx_ant_cmd_send() - WMI set tx antenna function
* @param wmi_handle : handle to WMI.
* @param param : pointer to hold antenna param
*
* @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
*/
QDF_STATUS wmi_unified_smart_ant_set_tx_ant_cmd_send(void *wmi_hdl,
uint8_t macaddr[IEEE80211_ADDR_LEN],
struct smart_ant_tx_ant_params *param)
{
wmi_unified_t wmi = (wmi_unified_t) wmi_hdl;
if (wmi->ops->send_smart_ant_set_tx_ant_cmd)
return wmi->ops->send_smart_ant_set_tx_ant_cmd(wmi, macaddr,
param);
return QDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_smart_ant_set_training_info_cmd_send() - WMI set tx antenna function
* @param wmi_handle : handle to WMI.
* @param param : pointer to hold antenna param
*
* @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
*/
QDF_STATUS wmi_unified_smart_ant_set_training_info_cmd_send(void *wmi_hdl,
uint8_t macaddr[IEEE80211_ADDR_LEN],
struct smart_ant_training_info_params *param)
{
wmi_unified_t wmi = (wmi_unified_t) wmi_hdl;
if (wmi->ops->send_smart_ant_set_training_info_cmd)
return wmi->ops->send_smart_ant_set_training_info_cmd(wmi,
macaddr, param);
return QDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_smart_ant_node_config_cmd_send() - WMI set node config function
* @param wmi_handle : handle to WMI.
* @param macaddr : MAC address
* @param param : pointer to hold node parameter
*
* @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
*/
QDF_STATUS wmi_unified_smart_ant_node_config_cmd_send(void *wmi_hdl,
uint8_t macaddr[IEEE80211_ADDR_LEN],
struct smart_ant_node_config_params *param)
{
wmi_unified_t wmi = (wmi_unified_t) wmi_hdl;
if (wmi->ops->send_smart_ant_set_node_config_cmd)
return wmi->ops->send_smart_ant_set_node_config_cmd(wmi,
macaddr, param);
return QDF_STATUS_E_FAILURE;
}

484
wmi_unified_smart_ant_tlv.c Normal file
View File

@@ -0,0 +1,484 @@
/*
* Copyright (c) 2016-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_smart_ant_param.h"
#include "wmi_unified_smart_ant_api.h"
/**
* send_smart_ant_enable_cmd_tlv() - WMI smart ant enable function
*
* @param wmi_handle : handle to WMI.
* @param param : pointer to antenna param
*
* This function sends smart antenna enable command to FW
*
* @return QDF_STATUS_SUCCESS on success and -ve on failure.
*/
static QDF_STATUS send_smart_ant_enable_cmd_tlv(wmi_unified_t wmi_handle,
struct smart_ant_enable_params *param)
{
/* Send WMI COMMAND to Enable */
wmi_pdev_smart_ant_enable_cmd_fixed_param *cmd;
wmi_pdev_smart_ant_gpio_handle *gpio_param;
wmi_buf_t buf;
uint8_t *buf_ptr;
int len = 0;
QDF_STATUS ret;
int loop = 0;
len = sizeof(*cmd) + WMI_TLV_HDR_SIZE;
len += WMI_HAL_MAX_SANTENNA * sizeof(wmi_pdev_smart_ant_gpio_handle);
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf) {
WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__);
return QDF_STATUS_E_NOMEM;
}
buf_ptr = wmi_buf_data(buf);
qdf_mem_zero(buf_ptr, len);
cmd = (wmi_pdev_smart_ant_enable_cmd_fixed_param *)buf_ptr;
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_pdev_smart_ant_enable_cmd_fixed_param,
WMITLV_GET_STRUCT_TLVLEN(
wmi_pdev_smart_ant_enable_cmd_fixed_param));
cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(
param->pdev_id);
cmd->enable = param->enable;
cmd->mode = param->mode;
cmd->rx_antenna = param->rx_antenna;
cmd->tx_default_antenna = param->rx_antenna;
/* TLV indicating array of structures to follow */
buf_ptr += sizeof(wmi_pdev_smart_ant_enable_cmd_fixed_param);
WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
WMI_HAL_MAX_SANTENNA *
sizeof(wmi_pdev_smart_ant_gpio_handle));
buf_ptr += WMI_TLV_HDR_SIZE;
gpio_param = (wmi_pdev_smart_ant_gpio_handle *)buf_ptr;
for (loop = 0; loop < WMI_HAL_MAX_SANTENNA; loop++) {
WMITLV_SET_HDR(&gpio_param->tlv_header,
WMITLV_TAG_STRUC_wmi_pdev_smart_ant_gpio_handle,
WMITLV_GET_STRUCT_TLVLEN(
wmi_pdev_smart_ant_gpio_handle));
if (param->mode == SMART_ANT_MODE_SERIAL) {
if (loop < WMI_HOST_MAX_SERIAL_ANTENNA) {
gpio_param->gpio_pin = param->gpio_pin[loop];
gpio_param->gpio_func = param->gpio_func[loop];
} else {
gpio_param->gpio_pin = 0;
gpio_param->gpio_func = 0;
}
} else if (param->mode == SMART_ANT_MODE_PARALLEL) {
gpio_param->gpio_pin = param->gpio_pin[loop];
gpio_param->gpio_func = param->gpio_func[loop];
}
/* Setting it to 0 for now */
gpio_param->pdev_id =
wmi_handle->ops->convert_pdev_id_host_to_target(
param->pdev_id);
gpio_param++;
}
wmi_mtrace(WMI_PDEV_SMART_ANT_ENABLE_CMDID, NO_SESSION, 0);
ret = wmi_unified_cmd_send(wmi_handle,
buf,
len,
WMI_PDEV_SMART_ANT_ENABLE_CMDID);
if (ret != 0) {
WMI_LOGE(" %s :WMI Failed\n", __func__);
WMI_LOGE("enable:%d mode:%d rx_antenna: 0x%08x PINS: [%d %d %d %d] Func[%d %d %d %d] cmdstatus=%d\n",
cmd->enable,
cmd->mode,
cmd->rx_antenna,
param->gpio_pin[0], param->gpio_pin[1],
param->gpio_pin[2], param->gpio_pin[3],
param->gpio_func[0], param->gpio_func[1],
param->gpio_func[2], param->gpio_func[3],
ret);
wmi_buf_free(buf);
}
return ret;
}
/**
* send_smart_ant_set_rx_ant_cmd_tlv() - WMI set rx antenna function
*
* @param wmi_handle : handle to WMI.
* @param param : pointer to rx antenna param
* @return QDF_STATUS_SUCCESS on success and -ve on failure.
*/
static QDF_STATUS send_smart_ant_set_rx_ant_cmd_tlv(wmi_unified_t wmi_handle,
struct smart_ant_rx_ant_params *param)
{
wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param *cmd;
wmi_buf_t buf;
uint8_t *buf_ptr;
uint32_t len;
QDF_STATUS ret;
len = sizeof(*cmd);
buf = wmi_buf_alloc(wmi_handle, len);
WMI_LOGD("%s:\n", __func__);
if (!buf) {
WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__);
return QDF_STATUS_E_NOMEM;
}
buf_ptr = wmi_buf_data(buf);
cmd = (wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param *)buf_ptr;
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param,
WMITLV_GET_STRUCT_TLVLEN(
wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param));
cmd->rx_antenna = param->antenna;
cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(
param->pdev_id);
wmi_mtrace(WMI_PDEV_SMART_ANT_SET_RX_ANTENNA_CMDID, NO_SESSION, 0);
ret = wmi_unified_cmd_send(wmi_handle,
buf,
len,
WMI_PDEV_SMART_ANT_SET_RX_ANTENNA_CMDID);
if (ret != 0) {
WMI_LOGE(" %s :WMI Failed\n", __func__);
WMI_LOGE("%s: rx_antenna: 0x%08x cmdstatus=%d\n",
__func__,
cmd->rx_antenna,
ret);
wmi_buf_free(buf);
}
return ret;
}
/**
* send_smart_ant_set_tx_ant_cmd_tlv() - WMI set tx antenna function
* @param wmi_handle : handle to WMI.
* @param macaddr : vdev mac address
* @param param : pointer to tx antenna param
*
* @return QDF_STATUS_SUCCESS on success and -ve on failure.
*/
static QDF_STATUS send_smart_ant_set_tx_ant_cmd_tlv(wmi_unified_t wmi_handle,
uint8_t macaddr[IEEE80211_ADDR_LEN],
struct smart_ant_tx_ant_params *param)
{
wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param *cmd;
wmi_peer_smart_ant_set_tx_antenna_series *ant_tx_series;
wmi_buf_t buf;
int32_t len = 0;
int i;
uint8_t *buf_ptr;
QDF_STATUS ret;
len = sizeof(*cmd) + WMI_TLV_HDR_SIZE;
len += (WMI_SMART_ANT_MAX_RATE_SERIES) *
sizeof(wmi_peer_smart_ant_set_tx_antenna_series);
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf) {
WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__);
return QDF_STATUS_E_NOMEM;
}
buf_ptr = (uint8_t *)wmi_buf_data(buf);
qdf_mem_zero(buf_ptr, len);
cmd = (wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param *)buf_ptr;
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param,
WMITLV_GET_STRUCT_TLVLEN(
wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param));
cmd->vdev_id = param->vdev_id;
WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr);
buf_ptr += sizeof(wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param);
WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
sizeof(wmi_peer_smart_ant_set_tx_antenna_series));
buf_ptr += WMI_TLV_HDR_SIZE;
ant_tx_series = (wmi_peer_smart_ant_set_tx_antenna_series *)buf_ptr;
for (i = 0; i < WMI_SMART_ANT_MAX_RATE_SERIES; i++) {
WMITLV_SET_HDR(&ant_tx_series->tlv_header,
WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_tx_antenna_series,
WMITLV_GET_STRUCT_TLVLEN(
wmi_peer_smart_ant_set_tx_antenna_series));
ant_tx_series->antenna_series = param->antenna_array[i];
ant_tx_series++;
}
wmi_mtrace(WMI_PEER_SMART_ANT_SET_TX_ANTENNA_CMDID, cmd->vdev_id, 0);
ret = wmi_unified_cmd_send(wmi_handle,
buf,
len,
WMI_PEER_SMART_ANT_SET_TX_ANTENNA_CMDID);
if (ret != 0) {
WMI_LOGE(" %s :WMI Failed\n", __func__);
wmi_buf_free(buf);
}
return ret;
}
/**
* send_set_ant_switch_tbl_cmd_tlv() - send ant switch tbl cmd to fw
* @wmi_handle: wmi handle
* @param: pointer to hold ant switch tbl param
*
* @return QDF_STATUS_SUCCESS on success and -ve on failure.
*/
static QDF_STATUS
send_set_ant_switch_tbl_cmd_tlv(wmi_unified_t wmi_handle,
struct ant_switch_tbl_params *param)
{
uint8_t len;
wmi_buf_t buf;
wmi_pdev_set_ant_switch_tbl_cmd_fixed_param *cmd;
wmi_pdev_set_ant_ctrl_chain *ctrl_chain;
uint8_t *buf_ptr;
len = sizeof(*cmd) + WMI_TLV_HDR_SIZE;
len += sizeof(wmi_pdev_set_ant_ctrl_chain);
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf) {
WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__);
return QDF_STATUS_E_NOMEM;
}
buf_ptr = (uint8_t *)wmi_buf_data(buf);
qdf_mem_zero(buf_ptr, len);
cmd = (wmi_pdev_set_ant_switch_tbl_cmd_fixed_param *)buf_ptr;
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_pdev_set_ant_switch_tbl_cmd_fixed_param,
WMITLV_GET_STRUCT_TLVLEN(
wmi_pdev_set_ant_switch_tbl_cmd_fixed_param));
cmd->antCtrlCommon1 = param->ant_ctrl_common1;
cmd->antCtrlCommon2 = param->ant_ctrl_common2;
cmd->mac_id =
wmi_handle->ops->convert_pdev_id_host_to_target(param->pdev_id);
/* TLV indicating array of structures to follow */
buf_ptr += sizeof(wmi_pdev_set_ant_switch_tbl_cmd_fixed_param);
WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
sizeof(wmi_pdev_set_ant_ctrl_chain));
buf_ptr += WMI_TLV_HDR_SIZE;
ctrl_chain = (wmi_pdev_set_ant_ctrl_chain *)buf_ptr;
ctrl_chain->pdev_id =
wmi_handle->ops->convert_pdev_id_host_to_target(param->pdev_id);
ctrl_chain->antCtrlChain = param->antCtrlChain;
wmi_mtrace(WMI_PDEV_SET_ANTENNA_SWITCH_TABLE_CMDID, NO_SESSION, 0);
if (wmi_unified_cmd_send(wmi_handle, buf, len,
WMI_PDEV_SET_ANTENNA_SWITCH_TABLE_CMDID)) {
wmi_buf_free(buf);
return QDF_STATUS_E_FAILURE;
}
return QDF_STATUS_SUCCESS;
}
/**
* send_smart_ant_set_training_info_cmd_tlv() - WMI set smart antenna
* training information function
* @param wmi_handle : handle to WMI.
* @macaddr : vdev mac address
* @param param : pointer to tx antenna param
* @return QDF_STATUS_SUCCESS on success and -ve on failure.
*/
static QDF_STATUS send_smart_ant_set_training_info_cmd_tlv(
wmi_unified_t wmi_handle,
uint8_t macaddr[IEEE80211_ADDR_LEN],
struct smart_ant_training_info_params *param)
{
wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param *cmd;
wmi_peer_smart_ant_set_train_antenna_param *train_param;
wmi_buf_t buf;
uint8_t *buf_ptr;
int32_t len = 0;
QDF_STATUS ret;
int loop;
len = sizeof(*cmd) + WMI_TLV_HDR_SIZE;
len += (WMI_SMART_ANT_MAX_RATE_SERIES) *
sizeof(wmi_peer_smart_ant_set_train_antenna_param);
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf) {
WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__);
return QDF_STATUS_E_NOMEM;
}
buf_ptr = (uint8_t *)wmi_buf_data(buf);
qdf_mem_zero(buf_ptr, len);
cmd = (wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param *)buf_ptr;
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param,
WMITLV_GET_STRUCT_TLVLEN(
wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param));
cmd->vdev_id = param->vdev_id;
WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr);
cmd->num_pkts = param->numpkts;
buf_ptr += sizeof(wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param);
WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
sizeof(wmi_peer_smart_ant_set_train_antenna_param) *
WMI_SMART_ANT_MAX_RATE_SERIES);
buf_ptr += WMI_TLV_HDR_SIZE;
train_param = (wmi_peer_smart_ant_set_train_antenna_param *)buf_ptr;
for (loop = 0; loop < WMI_SMART_ANT_MAX_RATE_SERIES; loop++) {
WMITLV_SET_HDR(&train_param->tlv_header,
WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_train_antenna_param,
WMITLV_GET_STRUCT_TLVLEN(
wmi_peer_smart_ant_set_train_antenna_param));
train_param->train_rate_series = param->rate_array[loop];
train_param->train_antenna_series = param->antenna_array[loop];
train_param->rc_flags = 0;
WMI_LOGI(FL("Series number:%d\n"), loop);
WMI_LOGI(FL("Rate [0x%02x] Tx_Antenna [0x%08x]\n"),
train_param->train_rate_series,
train_param->train_antenna_series);
train_param++;
}
wmi_mtrace(WMI_PEER_SMART_ANT_SET_TRAIN_INFO_CMDID, cmd->vdev_id, 0);
ret = wmi_unified_cmd_send(wmi_handle,
buf,
len,
WMI_PEER_SMART_ANT_SET_TRAIN_INFO_CMDID);
if (ret != 0) {
WMI_LOGE(" %s :WMI Failed\n", __func__);
wmi_buf_free(buf);
return QDF_STATUS_E_FAILURE;
}
return ret;
}
/**
* send_smart_ant_set_node_config_cmd_tlv() - WMI set node
* configuration function
* @param wmi_handle : handle to WMI.
* @macaddr : vdev mad address
* @param param : pointer to tx antenna param
*
* @return QDF_STATUS_SUCCESS on success and -ve on failure.
*/
static QDF_STATUS send_smart_ant_set_node_config_cmd_tlv(
wmi_unified_t wmi_handle,
uint8_t macaddr[IEEE80211_ADDR_LEN],
struct smart_ant_node_config_params *param)
{
wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param *cmd;
wmi_buf_t buf;
uint8_t *buf_ptr;
int32_t len = 0, args_tlv_len;
int ret;
int i = 0;
uint32_t *node_config_args;
args_tlv_len = WMI_TLV_HDR_SIZE + param->args_count * sizeof(uint32_t);
len = sizeof(*cmd) + args_tlv_len;
if (param->args_count == 0) {
WMI_LOGE("%s: Can't send a command with %d arguments\n",
__func__, param->args_count);
return QDF_STATUS_E_FAILURE;
}
buf = wmi_buf_alloc(wmi_handle, len);
if (!buf) {
WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__);
return QDF_STATUS_E_NOMEM;
}
cmd = (wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param *)
wmi_buf_data(buf);
buf_ptr = (uint8_t *)cmd;
WMITLV_SET_HDR(&cmd->tlv_header,
WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param,
WMITLV_GET_STRUCT_TLVLEN(
wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param));
cmd->vdev_id = param->vdev_id;
WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr);
cmd->cmd_id = param->cmd_id;
cmd->args_count = param->args_count;
buf_ptr += sizeof(
wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param);
WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32,
(cmd->args_count * sizeof(uint32_t)));
buf_ptr += WMI_TLV_HDR_SIZE;
node_config_args = (uint32_t *)buf_ptr;
for (i = 0; i < param->args_count; i++) {
node_config_args[i] = param->args_arr[i];
WMI_LOGI("%d", param->args_arr[i]);
}
wmi_mtrace(WMI_PEER_SMART_ANT_SET_NODE_CONFIG_OPS_CMDID,
cmd->vdev_id, 0);
ret = wmi_unified_cmd_send(wmi_handle,
buf,
len,
WMI_PEER_SMART_ANT_SET_NODE_CONFIG_OPS_CMDID);
if (ret != 0) {
WMI_LOGE("%s: WMI FAILED:Sent cmd_id: 0x%x\n Node: %02x:%02x:%02x:%02x:%02x:%02x cmdstatus=%d\n",
__func__, param->cmd_id, macaddr[0],
macaddr[1], macaddr[2], macaddr[3],
macaddr[4], macaddr[5], ret);
wmi_buf_free(buf);
}
return ret;
}
void wmi_smart_ant_attach_tlv(wmi_unified_t wmi_handle)
{
struct wmi_ops *ops = wmi_handle->ops;
ops->send_smart_ant_enable_cmd = send_smart_ant_enable_cmd_tlv;
ops->send_smart_ant_set_rx_ant_cmd = send_smart_ant_set_rx_ant_cmd_tlv;
ops->send_smart_ant_set_tx_ant_cmd = send_smart_ant_set_tx_ant_cmd_tlv;
ops->send_smart_ant_set_training_info_cmd =
send_smart_ant_set_training_info_cmd_tlv;
ops->send_smart_ant_set_node_config_cmd =
send_smart_ant_set_node_config_cmd_tlv;
ops->send_set_ant_switch_tbl_cmd = send_set_ant_switch_tbl_cmd_tlv;
}

File diff suppressed because it is too large Load Diff