Files
android_kernel_samsung_sm86…/wmi_unified_api.c
Govind Singh 5eb515326f qcacmn: Add tlv implementation of common unified API
Add common unified API and tlv/non-tlv callback wrappers.
Add tlv implementation of common MCL/WIN API.

CRs-Fixed: 978603
Change-Id: I7e70b48ef5e1df0c0f81c639579e6eb1a6685dc3
2016-03-16 16:23:00 +05:30

599 lines
16 KiB
C

/*
* Copyright (c) 2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* 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.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
#include "athdefs.h"
#include "osapi_linux.h"
#include "a_types.h"
#include "a_debug.h"
#include "ol_if_athvar.h"
#include "ol_defines.h"
#include "wmi.h"
#include "wmi_unified_priv.h"
#include "wma_api.h"
#include "wmi_unified_param.h"
/**
* wmi_unified_vdev_create_send() - send VDEV create command to fw
* @wmi_handle: wmi handle
* @param: pointer to hold vdev create parameter
* @macaddr: vdev mac address
*
* Return: 0 for success or error code
*/
int32_t wmi_unified_vdev_create_send(void *wmi_hdl,
uint8_t macaddr[IEEE80211_ADDR_LEN],
struct vdev_create_params *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_vdev_create_cmd)
return wmi_handle->ops->send_vdev_create_cmd(wmi_handle,
macaddr, param);
return CDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_vdev_delete_send() - send VDEV delete command to fw
* @wmi_handle: wmi handle
* @if_id: vdev id
*
* Return: 0 for success or error code
*/
int32_t wmi_unified_vdev_delete_send(void *wmi_hdl,
uint8_t if_id)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_vdev_delete_cmd)
return wmi_handle->ops->send_vdev_delete_cmd(wmi_handle,
if_id);
return CDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_vdev_stop_send() - send vdev stop command to fw
* @wmi: wmi handle
* @vdev_id: vdev id
*
* Return: 0 for success or erro code
*/
int32_t wmi_unified_vdev_stop_send(void *wmi_hdl,
uint8_t vdev_id)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_vdev_stop_cmd)
return wmi_handle->ops->send_vdev_stop_cmd(wmi_handle,
vdev_id);
return CDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_vdev_down_send() - send vdev down command to fw
* @wmi: wmi handle
* @vdev_id: vdev id
*
* Return: 0 for success or error code
*/
int32_t wmi_unified_vdev_down_send(void *wmi_hdl, uint8_t vdev_id)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_vdev_down_cmd)
return wmi_handle->ops->send_vdev_down_cmd(wmi_handle, vdev_id);
return CDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_peer_flush_tids_send() - flush peer tids packets in fw
* @wmi: wmi handle
* @peer_addr: peer mac address
* @param: pointer to hold peer flush tid parameter
*
* Return: 0 for sucess or error code
*/
int32_t wmi_unified_peer_flush_tids_send(void *wmi_hdl,
uint8_t peer_addr[IEEE80211_ADDR_LEN],
struct peer_flush_params *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_peer_flush_tids_cmd)
return wmi_handle->ops->send_peer_flush_tids_cmd(wmi_handle,
peer_addr, param);
return CDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_peer_delete_send() - send PEER delete command to fw
* @wmi: wmi handle
* @peer_addr: peer mac addr
* @vdev_id: vdev id
*
* Return: 0 for success or error code
*/
int32_t wmi_unified_peer_delete_send(void *wmi_hdl,
uint8_t
peer_addr[IEEE80211_ADDR_LEN],
uint8_t vdev_id)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_peer_delete_cmd)
return wmi_handle->ops->send_peer_delete_cmd(wmi_handle,
peer_addr, vdev_id);
return CDF_STATUS_E_FAILURE;
}
/**
* wmi_set_peer_param() - set peer parameter in fw
* @wmi_ctx: wmi handle
* @peer_addr: peer mac address
* @param : pointer to hold peer set parameter
*
* Return: 0 for success or error code
*/
int32_t wmi_set_peer_param_send(void *wmi_hdl,
uint8_t peer_addr[IEEE80211_ADDR_LEN],
struct peer_set_params *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_peer_param_cmd)
return wmi_handle->ops->send_peer_param_cmd(wmi_handle,
peer_addr, param);
return CDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_vdev_up_send() - send vdev up command in fw
* @wmi: wmi handle
* @bssid: bssid
* @vdev_up_params: pointer to hold vdev up parameter
*
* Return: 0 for success or error code
*/
int32_t wmi_unified_vdev_up_send(void *wmi_hdl,
uint8_t bssid[IEEE80211_ADDR_LEN],
struct vdev_up_params *params)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_vdev_up_cmd)
return wmi_handle->ops->send_vdev_up_cmd(wmi_handle, bssid,
params);
return CDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_peer_create_send() - send peer create command to fw
* @wmi: wmi handle
* @peer_addr: peer mac address
* @peer_type: peer type
* @vdev_id: vdev id
*
* Return: 0 for success or error code
*/
int32_t wmi_unified_peer_create_send(void *wmi_hdl,
struct peer_create_params *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_peer_create_cmd)
return wmi_handle->ops->send_peer_create_cmd(wmi_handle, param);
return CDF_STATUS_E_FAILURE;
}
#ifdef FEATURE_GREEN_AP
/**
* wmi_unified_green_ap_ps_send() - enable green ap powersave command
* @wmi_handle: wmi handle
* @value: value
* @mac_id: mac id to have radio context
*
* Return: 0 for success or error code
*/
int32_t wmi_unified_green_ap_ps_send(void *wmi_hdl,
uint32_t value, uint8_t mac_id)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_green_ap_ps_cmd)
return wmi_handle->ops->send_green_ap_ps_cmd(wmi_handle, value,
mac_id);
return CDF_STATUS_E_FAILURE;
}
#else
int32_t wmi_unified_green_ap_ps_send(void *wmi_hdl,
uint32_t value, uint8_t mac_id)
{
return 0;
}
#endif /* FEATURE_GREEN_AP */
/**
* wmi_unified_pdev_utf_cmd() - send utf command to fw
* @wmi_handle: wmi handle
* @param: pointer to pdev_utf_params
* @mac_id: mac id to have radio context
*
* Return: 0 for success or error code
*/
int32_t
wmi_unified_pdev_utf_cmd_send(void *wmi_hdl,
struct pdev_utf_params *param,
uint8_t mac_id)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_pdev_utf_cmd)
return wmi_handle->ops->send_pdev_utf_cmd(wmi_handle, param,
mac_id);
return CDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_pdev_set_param() - set pdev parameters
* @wmi_handle: wmi handle
* @param: pointer to pdev parameter
* @mac_id: radio context
*
* Return: 0 on success, errno on failure
*/
int32_t
wmi_unified_pdev_param_send(void *wmi_hdl,
struct pdev_params *param,
uint8_t mac_id)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_pdev_param_cmd)
return wmi_handle->ops->send_pdev_param_cmd(wmi_handle, param,
mac_id);
return CDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_suspend_send() - WMI suspend function
* @param wmi_handle : handle to WMI.
* @param param : pointer to hold suspend parameter
* @mac_id: radio context
*
* Return: 0 on success and -ve on failure.
*/
int32_t wmi_unified_suspend_send(void *wmi_hdl,
struct suspend_params *param,
uint8_t mac_id)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_suspend_cmd)
return wmi_handle->ops->send_suspend_cmd(wmi_handle, param,
mac_id);
return CDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_resume_send - WMI resume function
* @param wmi_handle : handle to WMI.
* @mac_id: radio context
*
* Return: 0 on success and -ve on failure.
*/
int32_t wmi_unified_resume_send(void *wmi_hdl,
uint8_t mac_id)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_resume_cmd)
return wmi_handle->ops->send_resume_cmd(wmi_handle,
mac_id);
return CDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_wow_enable_send() - WMI wow enable function
* @param wmi_handle : handle to WMI.
* @param param : pointer to hold wow enable parameter
* @mac_id: radio context
*
* Return: 0 on success and -ve on failure.
*/
int32_t wmi_unified_wow_enable_send(void *wmi_hdl,
struct wow_cmd_params *param,
uint8_t mac_id)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_wow_enable_cmd)
return wmi_handle->ops->send_wow_enable_cmd(wmi_handle, param,
mac_id);
return CDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_ap_ps_cmd_send() - set ap powersave parameters
* @wma_ctx: wma context
* @peer_addr: peer mac address
* @param: pointer to ap_ps parameter structure
*
* Return: 0 for success or error code
*/
int32_t wmi_unified_ap_ps_cmd_send(void *wmi_hdl,
uint8_t *peer_addr,
struct ap_ps_params *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_set_ap_ps_param_cmd)
return wmi_handle->ops->send_set_ap_ps_param_cmd(wmi_handle,
peer_addr,
param);
return CDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_sta_ps_cmd_send() - set sta powersave parameters
* @wma_ctx: wma context
* @peer_addr: peer mac address
* @param: pointer to sta_ps parameter structure
*
* Return: 0 for success or error code
*/
int32_t wmi_unified_sta_ps_cmd_send(void *wmi_hdl,
struct sta_ps_params *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_set_sta_ps_param_cmd)
return wmi_handle->ops->send_set_sta_ps_param_cmd(wmi_handle,
param);
return CDF_STATUS_E_FAILURE;
}
/**
* wmi_crash_inject() - inject fw crash
* @wma_handle: wma handle
* @param: ponirt to crash inject paramter structure
*
* Return: 0 for success or return error
*/
int32_t wmi_crash_inject(void *wmi_hdl,
struct crash_inject *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_crash_inject_cmd)
return wmi_handle->ops->send_crash_inject_cmd(wmi_handle,
param);
return CDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_dbglog_cmd_send() - set debug log level
* @param wmi_handle : handle to WMI.
* @param param : pointer to hold dbglog level parameter
*
* Return: 0 on success and -ve on failure.
*/
int32_t
wmi_unified_dbglog_cmd_send(void *wmi_hdl,
struct dbglog_params *dbglog_param)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_dbglog_cmd)
return wmi_handle->ops->send_dbglog_cmd(wmi_handle,
dbglog_param);
return CDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_vdev_set_param_send() - WMI vdev set parameter function
* @param wmi_handle : handle to WMI.
* @param macaddr : MAC address
* @param param : pointer to hold vdev set parameter
*
* Return: 0 on success and -ve on failure.
*/
int32_t wmi_unified_vdev_set_param_send(void *wmi_hdl,
struct vdev_set_params *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_vdev_set_param_cmd)
return wmi_handle->ops->send_vdev_set_param_cmd(wmi_handle,
param);
return CDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_stats_request_send() - WMI request stats function
* @param wmi_handle : handle to WMI.
* @param macaddr : MAC address
* @param param : pointer to hold stats request parameter
*
* Return: 0 on success and -ve on failure.
*/
int32_t wmi_unified_stats_request_send(void *wmi_hdl,
uint8_t macaddr[IEEE80211_ADDR_LEN],
struct stats_request_params *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_stats_request_cmd)
return wmi_handle->ops->send_stats_request_cmd(wmi_handle,
macaddr, param);
return CDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_stats_request_send() - WMI request stats function
* @param wmi_handle : handle to WMI.
* @param macaddr : MAC address
* @param param : pointer to hold stats request parameter
*
* Return: 0 on success and -ve on failure.
*/
int32_t wmi_unified_packet_log_enable_send(void *wmi_hdl,
uint8_t macaddr[IEEE80211_ADDR_LEN],
struct packet_enable_params *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_packet_log_enable_cmd)
return wmi_handle->ops->send_packet_log_enable_cmd(wmi_handle,
macaddr, param);
return CDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_beacon_send_cmd() - WMI beacon send function
* @param wmi_handle : handle to WMI.
* @param macaddr : MAC address
* @param param : pointer to hold beacon send cmd parameter
*
* Return: 0 on success and -ve on failure.
*/
int32_t wmi_unified_beacon_send_cmd(void *wmi_hdl,
uint8_t macaddr[IEEE80211_ADDR_LEN],
struct beacon_params *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_beacon_send_cmd)
return wmi_handle->ops->send_beacon_send_cmd(wmi_handle,
macaddr, param);
return CDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_peer_assoc_send() - WMI peer assoc function
* @param wmi_handle : handle to WMI.
* @param macaddr : MAC address
* @param param : pointer to peer assoc parameter
*
* Return: 0 on success and -ve on failure.
*/
int32_t wmi_unified_peer_assoc_send(void *wmi_hdl,
uint8_t macaddr[IEEE80211_ADDR_LEN],
struct peer_assoc_params *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_peer_assoc_cmd)
return wmi_handle->ops->send_peer_assoc_cmd(wmi_handle,
macaddr, param);
return CDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_scan_start_cmd_send() - WMI scan start function
* @param wmi_handle : handle to WMI.
* @param macaddr : MAC address
* @param param : pointer to hold scan start cmd parameter
*
* Return: 0 on success and -ve on failure.
*/
int32_t wmi_unified_scan_start_cmd_send(void *wmi_hdl,
uint8_t macaddr[IEEE80211_ADDR_LEN],
struct scan_start_params *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_scan_start_cmd)
return wmi_handle->ops->send_scan_start_cmd(wmi_handle,
macaddr, param);
return CDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_scan_stop_cmd_send() - WMI scan start function
* @param wmi_handle : handle to WMI.
* @param macaddr : MAC address
* @param param : pointer to hold scan start cmd parameter
*
* Return: 0 on success and -ve on failure.
*/
int32_t wmi_unified_scan_stop_cmd_send(void *wmi_hdl,
uint8_t macaddr[IEEE80211_ADDR_LEN],
struct scan_stop_params *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_scan_stop_cmd)
return wmi_handle->ops->send_scan_stop_cmd(wmi_handle,
macaddr, param);
return CDF_STATUS_E_FAILURE;
}
/**
* wmi_unified_scan_chan_list_cmd_send() - WMI scan channel list function
* @param wmi_handle : handle to WMI.
* @param macaddr : MAC address
* @param param : pointer to hold scan channel list parameter
*
* Return: 0 on success and -ve on failure.
*/
int32_t wmi_unified_scan_chan_list_cmd_send(void *wmi_hdl,
uint8_t macaddr[IEEE80211_ADDR_LEN],
struct scan_chan_list_params *param)
{
wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
if (wmi_handle->ops->send_scan_chan_list_cmd)
return wmi_handle->ops->send_scan_chan_list_cmd(wmi_handle,
macaddr, param);
return CDF_STATUS_E_FAILURE;
}