qcacld-3.0: Route the legacy NAN commands through NAN component
NAN component has been moved to CLD. It includes implementation of the new NAN command QCA_NL80211_VENDOR_SUBCMD_NAN_EXT. Change the legacy NAN implementation of vendor cmd QCA_NL80211_VENDOR_SUBCMD_NAN so that the requests go through the NAN component. Clean up the legacy path. Functionality remains unchanged for legacy command. Route the legacy NAN commands through the NAN component. Change-Id: I542e5afe832619f8c088220cc4456aa7fe4416fd CRs-Fixed: 2356772
This commit is contained in:
parent
4f89e9e161
commit
6003bd2adf
4
Kbuild
4
Kbuild
@ -460,10 +460,6 @@ SME_CMN_OBJS := $(SME_SRC_DIR)/common/sme_api.o \
|
||||
|
||||
SME_RRM_OBJS := $(SME_SRC_DIR)/rrm/sme_rrm.o
|
||||
|
||||
ifeq ($(CONFIG_QCACLD_FEATURE_NAN), y)
|
||||
SME_NAN_OBJS = $(SME_SRC_DIR)/nan/nan_api.o
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_WLAN_FEATURE_NAN_DATAPATH), y)
|
||||
SME_NDP_OBJS += $(SME_SRC_DIR)/nan/nan_datapath_api.o
|
||||
endif
|
||||
|
@ -89,4 +89,13 @@ QDF_STATUS target_if_nan_register_events(struct wlan_objmgr_psoc *psoc);
|
||||
*/
|
||||
QDF_STATUS target_if_nan_deregister_events(struct wlan_objmgr_psoc *psoc);
|
||||
|
||||
/**
|
||||
* target_if_nan_rsp_handler() - Target IF handler for NAN Discovery events
|
||||
* @scn: target handle
|
||||
* @data: event buffer
|
||||
* @len: event buffer length
|
||||
*
|
||||
* Return: 0 for success or error code
|
||||
*/
|
||||
int target_if_nan_rsp_handler(ol_scn_t scn, uint8_t *data, uint32_t len);
|
||||
#endif /* _WIFI_POS_TGT_IF_H_ */
|
||||
|
@ -791,7 +791,7 @@ void target_if_nan_register_rx_ops(struct wlan_nan_rx_ops *rx_ops)
|
||||
rx_ops->nan_datapath_event_rx = nan_datapath_event_handler;
|
||||
}
|
||||
|
||||
static int target_if_nan_rsp_handler(ol_scn_t scn, uint8_t *data, uint32_t len)
|
||||
int target_if_nan_rsp_handler(ol_scn_t scn, uint8_t *data, uint32_t len)
|
||||
{
|
||||
struct nan_event_params *nan_rsp, temp_evt_params = {0};
|
||||
struct scheduler_msg msg = {0};
|
||||
@ -833,7 +833,7 @@ static int target_if_nan_rsp_handler(ol_scn_t scn, uint8_t *data, uint32_t len)
|
||||
}
|
||||
|
||||
nan_rsp->psoc = psoc;
|
||||
qdf_mem_copy(nan_rsp->buf_ptr, buf_ptr, nan_rsp->buf_len);
|
||||
qdf_mem_copy(nan_rsp->buf, buf_ptr, nan_rsp->buf_len);
|
||||
|
||||
msg.bodyptr = nan_rsp;
|
||||
msg.type = nan_rsp->evt_type;
|
||||
|
@ -109,7 +109,6 @@
|
||||
#include "bmi.h"
|
||||
#include <wlan_hdd_regulatory.h>
|
||||
#include "wlan_hdd_lpass.h"
|
||||
#include "nan_api.h"
|
||||
#include "wlan_nan_api.h"
|
||||
#include <wlan_hdd_napi.h>
|
||||
#include "wlan_hdd_disa.h"
|
||||
@ -12121,8 +12120,6 @@ int hdd_register_cb(struct hdd_context *hdd_ctx)
|
||||
sme_register_mgmt_frame_ind_callback(mac_handle,
|
||||
hdd_indicate_mgmt_frame);
|
||||
sme_set_tsfcb(mac_handle, hdd_get_tsf_cb, hdd_ctx);
|
||||
sme_nan_register_callback(mac_handle,
|
||||
wlan_hdd_cfg80211_nan_callback);
|
||||
sme_stats_ext_register_callback(mac_handle,
|
||||
wlan_hdd_cfg80211_stats_ext_callback);
|
||||
|
||||
@ -12213,7 +12210,6 @@ void hdd_deregister_cb(struct hdd_context *hdd_ctx)
|
||||
sme_stats_ext_register_callback(mac_handle,
|
||||
wlan_hdd_cfg80211_stats_ext_callback);
|
||||
|
||||
sme_nan_deregister_callback(mac_handle);
|
||||
status = sme_reset_tsfcb(mac_handle);
|
||||
if (!QDF_IS_STATUS_SUCCESS(status))
|
||||
hdd_err("Failed to de-register tsfcb the callback:%d",
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include <net/cfg80211.h>
|
||||
#include <ani_global.h>
|
||||
#include "sme_api.h"
|
||||
#include "nan_api.h"
|
||||
#include "wlan_hdd_main.h"
|
||||
#include "wlan_hdd_nan.h"
|
||||
#include <wlan_hdd_dsc.h>
|
||||
@ -67,11 +66,8 @@ bool wlan_hdd_nan_is_supported(struct hdd_context *hdd_ctx)
|
||||
*/
|
||||
static int __wlan_hdd_cfg80211_nan_request(struct wiphy *wiphy,
|
||||
struct wireless_dev *wdev,
|
||||
const void *data,
|
||||
int data_len)
|
||||
const void *data, int data_len)
|
||||
{
|
||||
tNanRequestReq nan_req;
|
||||
QDF_STATUS status;
|
||||
int ret_val;
|
||||
struct hdd_context *hdd_ctx = wiphy_priv(wiphy);
|
||||
|
||||
@ -91,19 +87,11 @@ static int __wlan_hdd_cfg80211_nan_request(struct wiphy *wiphy,
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
nan_req.request_data_len = data_len;
|
||||
nan_req.request_data = data;
|
||||
|
||||
status = sme_nan_request(&nan_req);
|
||||
if (QDF_STATUS_SUCCESS != status)
|
||||
ret_val = -EINVAL;
|
||||
|
||||
return ret_val;
|
||||
return os_if_nan_legacy_req(hdd_ctx->psoc, data, data_len);
|
||||
}
|
||||
|
||||
int wlan_hdd_cfg80211_nan_request(struct wiphy *wiphy,
|
||||
struct wireless_dev *wdev,
|
||||
const void *data,
|
||||
struct wireless_dev *wdev, const void *data,
|
||||
int data_len)
|
||||
|
||||
{
|
||||
@ -124,41 +112,6 @@ int wlan_hdd_cfg80211_nan_request(struct wiphy *wiphy,
|
||||
return ret;
|
||||
}
|
||||
|
||||
void wlan_hdd_cfg80211_nan_callback(hdd_handle_t hdd_handle, tSirNanEvent *msg)
|
||||
{
|
||||
struct hdd_context *hdd_ctx = hdd_handle_to_context(hdd_handle);
|
||||
struct sk_buff *vendor_event;
|
||||
int status;
|
||||
|
||||
if (!msg) {
|
||||
hdd_err("msg received here is null");
|
||||
return;
|
||||
}
|
||||
|
||||
status = wlan_hdd_validate_context(hdd_ctx);
|
||||
if (status)
|
||||
return;
|
||||
|
||||
vendor_event =
|
||||
cfg80211_vendor_event_alloc(hdd_ctx->wiphy,
|
||||
NULL,
|
||||
msg->event_data_len + NLMSG_HDRLEN,
|
||||
QCA_NL80211_VENDOR_SUBCMD_NAN_INDEX,
|
||||
GFP_KERNEL);
|
||||
|
||||
if (!vendor_event) {
|
||||
hdd_err("cfg80211_vendor_event_alloc failed");
|
||||
return;
|
||||
}
|
||||
if (nla_put(vendor_event, QCA_WLAN_VENDOR_ATTR_NAN,
|
||||
msg->event_data_len, msg->event_data)) {
|
||||
hdd_err("QCA_WLAN_VENDOR_ATTR_NAN put fail");
|
||||
kfree_skb(vendor_event);
|
||||
return;
|
||||
}
|
||||
cfg80211_vendor_event(vendor_event, GFP_KERNEL);
|
||||
}
|
||||
|
||||
/**
|
||||
* __wlan_hdd_cfg80211_nan_ext_request() - cfg80211 NAN extended request handler
|
||||
* @wiphy: driver's wiphy struct
|
||||
|
@ -328,7 +328,8 @@ void lim_process_ndi_del_sta_rsp(struct mac_context *mac_ctx,
|
||||
pe_err("Failed to get vdev from id");
|
||||
goto skip_event;
|
||||
}
|
||||
ucfg_nan_event_handler(psoc, vdev, NDP_PEER_DEPARTED, &peer_ind);
|
||||
ucfg_nan_datapath_event_handler(psoc, vdev, NDP_PEER_DEPARTED,
|
||||
&peer_ind);
|
||||
wlan_objmgr_vdev_release_ref(vdev, WLAN_NAN_ID);
|
||||
|
||||
skip_event:
|
||||
@ -477,7 +478,7 @@ static QDF_STATUS lim_send_sme_ndp_add_sta_rsp(struct mac_context *mac_ctx,
|
||||
sizeof(tSirMacAddr));
|
||||
new_peer_ind->sta_id = add_sta_rsp->staIdx;
|
||||
|
||||
ucfg_nan_event_handler(psoc, vdev, NDP_NEW_PEER, new_peer_ind);
|
||||
ucfg_nan_datapath_event_handler(psoc, vdev, NDP_NEW_PEER, new_peer_ind);
|
||||
qdf_mem_free(new_peer_ind);
|
||||
wlan_objmgr_vdev_release_ref(vdev, WLAN_NAN_ID);
|
||||
return QDF_STATUS_SUCCESS;
|
||||
|
@ -1,100 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014-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.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* Name: nan_api.h
|
||||
*
|
||||
* Description: NAN FSM defines.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __NAN_API_H__
|
||||
#define __NAN_API_H__
|
||||
|
||||
#include "qdf_types.h"
|
||||
#include "sir_types.h"
|
||||
|
||||
typedef void (*nan_callback)(hdd_handle_t hdd_handle, tSirNanEvent *event);
|
||||
|
||||
#ifdef WLAN_FEATURE_NAN
|
||||
typedef struct sNanRequestReq {
|
||||
uint16_t request_data_len;
|
||||
const uint8_t *request_data;
|
||||
} tNanRequestReq, *tpNanRequestReq;
|
||||
|
||||
/**
|
||||
* sme_nan_register_callback() - Register NAN Callback function
|
||||
* @mac_handle: Opaque handle to the MAC context
|
||||
* @callback: Callback function to be registered
|
||||
*
|
||||
* Function to be called by HDD to register the NAN Response callback
|
||||
* function with the sme layer.
|
||||
*
|
||||
* Return: void
|
||||
*/
|
||||
void sme_nan_register_callback(mac_handle_t mac_handle, nan_callback callback);
|
||||
|
||||
/**
|
||||
* sme_nan_deregister_callback() - NAN De-register cb function
|
||||
* @mac_handle: Opaque handle to the MAC context
|
||||
*
|
||||
* Function to be called by HDD to deregister the NAN Response
|
||||
* callback function with the sme layer.
|
||||
*
|
||||
* Return: void
|
||||
*/
|
||||
void sme_nan_deregister_callback(mac_handle_t mac_handle);
|
||||
|
||||
/**
|
||||
* sme_nan_request() - Process a NAN request
|
||||
* @input: Nan Request structure ptr
|
||||
*
|
||||
* This function gets called when HDD receives NAN vendor command
|
||||
* from userspace
|
||||
*
|
||||
* Return: QDF_STATUS
|
||||
*/
|
||||
QDF_STATUS sme_nan_request(tpNanRequestReq input);
|
||||
|
||||
/**
|
||||
* sme_nan_event() - Process a NAN event
|
||||
* @mac_handle: Opaque handle to the MAC context
|
||||
* @event: NAN event received from firmware
|
||||
*
|
||||
* This callback function will be called when SME received eWNI_SME_NAN_EVENT
|
||||
* event from WMA
|
||||
*
|
||||
* Return: void
|
||||
*/
|
||||
void sme_nan_event(mac_handle_t mac_handle, tSirNanEvent *event);
|
||||
|
||||
#else /* WLAN_FEATURE_NAN */
|
||||
|
||||
static inline void sme_nan_register_callback(mac_handle_t mac_handle,
|
||||
nan_callback callback)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void sme_nan_deregister_callback(mac_handle_t mac_handle)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* WLAN_FEATURE_NAN */
|
||||
|
||||
#endif /* __NAN_API_H__ */
|
@ -36,7 +36,6 @@
|
||||
#include "host_diag_core_event.h"
|
||||
#include "csr_link_list.h"
|
||||
#include "sme_power_save.h"
|
||||
#include "nan_api.h"
|
||||
|
||||
struct wmi_twt_enable_complete_event_param;
|
||||
/*--------------------------------------------------------------------------
|
||||
@ -289,9 +288,6 @@ typedef struct tagSmeStruct {
|
||||
#ifdef FEATURE_WLAN_EXTSCAN
|
||||
ext_scan_ind_cb ext_scan_ind_cb;
|
||||
#endif /* FEATURE_WLAN_EXTSCAN */
|
||||
#ifdef WLAN_FEATURE_NAN
|
||||
nan_callback nan_callback;
|
||||
#endif
|
||||
csr_link_status_callback link_status_callback;
|
||||
void *link_status_context;
|
||||
int (*get_tsf_cb)(void *pcb_cxt, struct stsf *ptsf);
|
||||
|
@ -41,9 +41,6 @@
|
||||
#include "cds_utils.h"
|
||||
#include "sap_api.h"
|
||||
#include "mac_trace.h"
|
||||
#ifdef WLAN_FEATURE_NAN
|
||||
#include "nan_api.h"
|
||||
#endif
|
||||
#include "cds_regdomain.h"
|
||||
#include "cfg_api.h"
|
||||
#include "sme_power_save_api.h"
|
||||
@ -2171,16 +2168,6 @@ QDF_STATUS sme_process_msg(struct mac_context *mac, struct scheduler_msg *pMsg)
|
||||
if (pMsg->bodyptr)
|
||||
qdf_mem_free(pMsg->bodyptr);
|
||||
break;
|
||||
#ifdef WLAN_FEATURE_NAN
|
||||
case eWNI_SME_NAN_EVENT:
|
||||
MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_RX_WMA_MSG,
|
||||
NO_SESSION, pMsg->type));
|
||||
if (pMsg->bodyptr) {
|
||||
sme_nan_event(MAC_HANDLE(mac), pMsg->bodyptr);
|
||||
qdf_mem_free(pMsg->bodyptr);
|
||||
}
|
||||
break;
|
||||
#endif /* WLAN_FEATURE_NAN */
|
||||
case eWNI_SME_LINK_STATUS_IND:
|
||||
{
|
||||
tAniGetLinkStatus *pLinkStatus =
|
||||
|
@ -1,101 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014-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 <sir_common.h>
|
||||
#include <ani_global.h>
|
||||
#include "sme_api.h"
|
||||
#include "csr_inside_api.h"
|
||||
#include "sme_inside.h"
|
||||
#include "nan_api.h"
|
||||
#include "cfg_api.h"
|
||||
#include "wma_types.h"
|
||||
|
||||
void sme_nan_register_callback(mac_handle_t mac_handle, nan_callback callback)
|
||||
{
|
||||
struct mac_context *mac = MAC_CONTEXT(mac_handle);
|
||||
|
||||
if (!mac) {
|
||||
sme_err("Invalid MAC handle");
|
||||
return;
|
||||
}
|
||||
mac->sme.nan_callback = callback;
|
||||
}
|
||||
|
||||
void sme_nan_deregister_callback(mac_handle_t mac_handle)
|
||||
{
|
||||
struct mac_context *mac = MAC_CONTEXT(mac_handle);
|
||||
|
||||
if (!mac) {
|
||||
sme_err("Invalid MAC handle");
|
||||
return;
|
||||
}
|
||||
mac->sme.nan_callback = NULL;
|
||||
}
|
||||
|
||||
QDF_STATUS sme_nan_request(tpNanRequestReq input)
|
||||
{
|
||||
struct scheduler_msg msg = {0};
|
||||
QDF_STATUS status;
|
||||
tpNanRequest data;
|
||||
size_t data_len;
|
||||
|
||||
data_len = sizeof(tNanRequest) + input->request_data_len;
|
||||
data = qdf_mem_malloc(data_len);
|
||||
if (!data)
|
||||
return QDF_STATUS_E_NOMEM;
|
||||
|
||||
data->request_data_len = input->request_data_len;
|
||||
if (input->request_data_len) {
|
||||
qdf_mem_copy(data->request_data,
|
||||
input->request_data, input->request_data_len);
|
||||
}
|
||||
|
||||
msg.type = WMA_NAN_REQUEST;
|
||||
msg.reserved = 0;
|
||||
msg.bodyptr = data;
|
||||
|
||||
status = scheduler_post_message(QDF_MODULE_ID_SME, QDF_MODULE_ID_WMA,
|
||||
QDF_MODULE_ID_WMA, &msg);
|
||||
|
||||
if (QDF_IS_STATUS_ERROR(status)) {
|
||||
sme_err("Not able to post WMA_NAN_REQUEST message to WMA");
|
||||
qdf_mem_free(data);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
void sme_nan_event(mac_handle_t mac_handle, tSirNanEvent *event)
|
||||
{
|
||||
struct mac_context *mac = MAC_CONTEXT(mac_handle);
|
||||
|
||||
sme_debug("Received eWNI_SME_NAN_EVENT");
|
||||
|
||||
if (!mac) {
|
||||
sme_err("Invalid MAC handle");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!event) {
|
||||
sme_err("NULL event");
|
||||
return;
|
||||
}
|
||||
|
||||
if (mac->sme.nan_callback)
|
||||
mac->sme.nan_callback(mac->hdd_handle, event);
|
||||
}
|
@ -1050,10 +1050,6 @@ void wma_wow_tx_complete(void *wma);
|
||||
|
||||
int wma_unified_csa_offload_enable(tp_wma_handle wma, uint8_t vdev_id);
|
||||
|
||||
#ifdef WLAN_FEATURE_NAN
|
||||
int wma_nan_rsp_event_handler(void *handle, uint8_t *event_buf, uint32_t len);
|
||||
#endif
|
||||
|
||||
#ifdef FEATURE_WLAN_TDLS
|
||||
int wma_tdls_event_handler(void *handle, uint8_t *event, uint32_t len);
|
||||
#endif
|
||||
@ -1190,10 +1186,6 @@ static inline QDF_STATUS wma_set_tsf_gpio_pin(WMA_HANDLE handle, uint32_t pin)
|
||||
#endif
|
||||
QDF_STATUS wma_set_wisa_params(tp_wma_handle wma, struct sir_wisa_params *wisa);
|
||||
|
||||
#ifdef WLAN_FEATURE_NAN
|
||||
QDF_STATUS wma_nan_req(void *wma_ptr, tpNanRequest nan_req);
|
||||
#endif
|
||||
|
||||
#ifdef DHCP_SERVER_OFFLOAD
|
||||
int wma_process_dhcpserver_offload(tp_wma_handle wma_handle,
|
||||
tSirDhcpSrvOffloadInfo *
|
||||
|
@ -65,6 +65,9 @@
|
||||
#include "wlan_reg_services_api.h"
|
||||
#include "wlan_roam_debug.h"
|
||||
#include <wlan_cp_stats_mc_ucfg_api.h>
|
||||
#ifdef WLAN_FEATURE_NAN
|
||||
#include "target_if_nan.h"
|
||||
#endif
|
||||
|
||||
#ifndef ARRAY_LENGTH
|
||||
#define ARRAY_LENGTH(a) (sizeof(a) / sizeof((a)[0]))
|
||||
@ -230,6 +233,28 @@ static inline int wma_wake_reason_nlod(uint8_t vdev_id)
|
||||
}
|
||||
#endif /* FEATURE_WLAN_SCAN_PNO */
|
||||
|
||||
#ifdef WLAN_FEATURE_NAN
|
||||
/**
|
||||
* wma_nan_rsp_handler_callback() - call NAN Discovery event handler
|
||||
* @handle: wma handle
|
||||
* @event: event buffer
|
||||
* @len: buffer length
|
||||
*
|
||||
* Return: 0 for success or error code
|
||||
*/
|
||||
static int wma_nan_rsp_handler_callback(void *handle, uint8_t *event,
|
||||
uint32_t len)
|
||||
{
|
||||
return target_if_nan_rsp_handler(handle, event, len);
|
||||
}
|
||||
#else
|
||||
static inline int wma_nan_rsp_handler_callback(void *handle, uint8_t *event,
|
||||
uint32_t len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* wma_send_snr_request() - send request to fw to get RSSI stats
|
||||
* @wma_handle: wma handle
|
||||
@ -1190,87 +1215,6 @@ int wma_unified_csa_offload_enable(tp_wma_handle wma, uint8_t vdev_id)
|
||||
}
|
||||
#endif /* WLAN_POWER_MANAGEMENT_OFFLOAD */
|
||||
|
||||
#ifdef WLAN_FEATURE_NAN
|
||||
/**
|
||||
* wma_nan_rsp_event_handler() - Function is used to handle nan response
|
||||
* @handle: wma handle
|
||||
* @event_buf: event buffer
|
||||
* @len: length of buffer
|
||||
*
|
||||
* Return: 0 for success or error code
|
||||
*/
|
||||
int wma_nan_rsp_event_handler(void *handle, uint8_t *event_buf,
|
||||
uint32_t len)
|
||||
{
|
||||
WMI_NAN_EVENTID_param_tlvs *param_buf;
|
||||
tSirNanEvent *nan_rsp_event;
|
||||
wmi_nan_event_hdr *nan_rsp_event_hdr;
|
||||
QDF_STATUS status;
|
||||
struct scheduler_msg message = {0};
|
||||
uint8_t *buf_ptr;
|
||||
uint32_t alloc_len;
|
||||
|
||||
/*
|
||||
* This is how received event_buf looks like
|
||||
*
|
||||
* <-------------------- event_buf ----------------------------------->
|
||||
*
|
||||
* <--wmi_nan_event_hdr--><---WMI_TLV_HDR_SIZE---><----- data -------->
|
||||
*
|
||||
* +-----------+---------+-----------------------+--------------------+
|
||||
* | tlv_header| data_len| WMITLV_TAG_ARRAY_BYTE | nan_rsp_event_data |
|
||||
* +-----------+---------+-----------------------+--------------------+
|
||||
*/
|
||||
|
||||
WMA_LOGD("%s: Posting NaN response event to SME", __func__);
|
||||
param_buf = (WMI_NAN_EVENTID_param_tlvs *) event_buf;
|
||||
if (!param_buf) {
|
||||
WMA_LOGE("%s: Invalid nan response event buf", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
nan_rsp_event_hdr = param_buf->fixed_param;
|
||||
buf_ptr = (uint8_t *) nan_rsp_event_hdr;
|
||||
alloc_len = sizeof(tSirNanEvent);
|
||||
alloc_len += nan_rsp_event_hdr->data_len;
|
||||
if (nan_rsp_event_hdr->data_len > ((WMI_SVC_MSG_MAX_SIZE -
|
||||
WMI_TLV_HDR_SIZE - sizeof(*nan_rsp_event_hdr)) / sizeof(uint8_t)) ||
|
||||
nan_rsp_event_hdr->data_len > param_buf->num_data) {
|
||||
WMA_LOGE("excess data length:%d, num_data:%d",
|
||||
nan_rsp_event_hdr->data_len, param_buf->num_data);
|
||||
return -EINVAL;
|
||||
}
|
||||
nan_rsp_event = qdf_mem_malloc(alloc_len);
|
||||
if (!nan_rsp_event)
|
||||
return -ENOMEM;
|
||||
|
||||
nan_rsp_event->event_data_len = nan_rsp_event_hdr->data_len;
|
||||
qdf_mem_copy(nan_rsp_event->event_data, buf_ptr +
|
||||
sizeof(wmi_nan_event_hdr) + WMI_TLV_HDR_SIZE,
|
||||
nan_rsp_event->event_data_len);
|
||||
message.type = eWNI_SME_NAN_EVENT;
|
||||
message.bodyptr = (void *)nan_rsp_event;
|
||||
message.bodyval = 0;
|
||||
|
||||
status = scheduler_post_message(QDF_MODULE_ID_WMA,
|
||||
QDF_MODULE_ID_SME,
|
||||
QDF_MODULE_ID_SME, &message);
|
||||
if (status != QDF_STATUS_SUCCESS) {
|
||||
WMA_LOGE("%s: Failed to post NaN response event to SME",
|
||||
__func__);
|
||||
qdf_mem_free(nan_rsp_event);
|
||||
return -EFAULT;
|
||||
}
|
||||
WMA_LOGD("%s: NaN response event Posted to SME", __func__);
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
static int wma_nan_rsp_event_handler(void *handle, uint8_t *event_buf,
|
||||
uint32_t len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* WLAN_FEATURE_NAN */
|
||||
|
||||
/**
|
||||
* wma_csa_offload_handler() - CSA event handler
|
||||
* @handle: wma handle
|
||||
@ -2860,7 +2804,8 @@ static int wma_wake_event_piggybacked(
|
||||
break;
|
||||
|
||||
case WOW_REASON_NAN_EVENT:
|
||||
errno = wma_nan_rsp_event_handler(wma, pb_event, pb_event_len);
|
||||
errno = wma_nan_rsp_handler_callback(wma, pb_event,
|
||||
pb_event_len);
|
||||
break;
|
||||
|
||||
case WOW_REASON_NAN_DATA:
|
||||
@ -3895,43 +3840,6 @@ QDF_STATUS wma_set_auto_shutdown_timer_req(tp_wma_handle wma_handle,
|
||||
}
|
||||
#endif /* FEATURE_WLAN_AUTO_SHUTDOWN */
|
||||
|
||||
#ifdef WLAN_FEATURE_NAN
|
||||
/**
|
||||
* wma_nan_req() - to send nan request to target
|
||||
* @wma: wma_handle
|
||||
* @nan_req: request data which will be non-null
|
||||
*
|
||||
* Return: QDF status
|
||||
*/
|
||||
QDF_STATUS wma_nan_req(void *wma_ptr, tpNanRequest nan_req)
|
||||
{
|
||||
tp_wma_handle wma_handle = (tp_wma_handle) wma_ptr;
|
||||
struct nan_req_params *params;
|
||||
size_t params_len;
|
||||
QDF_STATUS status;
|
||||
|
||||
if (!wma_handle) {
|
||||
WMA_LOGE("%s: wma handle is NULL", __func__);
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
params_len = sizeof(*params) + nan_req->request_data_len;
|
||||
params = qdf_mem_malloc(params_len);
|
||||
if (!params)
|
||||
return QDF_STATUS_E_NOMEM;
|
||||
|
||||
params->request_data_len = nan_req->request_data_len;
|
||||
if (params->request_data_len > 0)
|
||||
qdf_mem_copy(params->request_data, nan_req->request_data,
|
||||
params->request_data_len);
|
||||
|
||||
status = wmi_unified_nan_req_cmd(wma_handle->wmi_handle, params);
|
||||
qdf_mem_free(params);
|
||||
|
||||
return status;
|
||||
}
|
||||
#endif /* WLAN_FEATURE_NAN */
|
||||
|
||||
#ifdef DHCP_SERVER_OFFLOAD
|
||||
/**
|
||||
* wma_process_dhcpserver_offload() - enable DHCP server offload
|
||||
|
@ -3559,13 +3559,6 @@ QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc,
|
||||
wmi_vdev_install_key_complete_event_id,
|
||||
wma_vdev_install_key_complete_event_handler,
|
||||
WMA_RX_SERIALIZER_CTX);
|
||||
#ifdef WLAN_FEATURE_NAN
|
||||
/* register for nan response event */
|
||||
wmi_unified_register_event_handler(wma_handle->wmi_handle,
|
||||
wmi_nan_event_id,
|
||||
wma_nan_rsp_event_handler,
|
||||
WMA_RX_SERIALIZER_CTX);
|
||||
#endif /* WLAN_FEATURE_NAN */
|
||||
|
||||
#ifdef WLAN_FEATURE_STATS_EXT
|
||||
/* register for extended stats event */
|
||||
@ -8461,12 +8454,6 @@ static QDF_STATUS wma_mc_process_msg(struct scheduler_msg *msg)
|
||||
qdf_mem_free(msg->bodyptr);
|
||||
break;
|
||||
#endif /* WLAN_FEATURE_ROAM_OFFLOAD */
|
||||
#ifdef WLAN_FEATURE_NAN
|
||||
case WMA_NAN_REQUEST:
|
||||
wma_nan_req(wma_handle, (tNanRequest *) msg->bodyptr);
|
||||
qdf_mem_free(msg->bodyptr);
|
||||
break;
|
||||
#endif /* WLAN_FEATURE_NAN */
|
||||
case SIR_HAL_SET_BASE_MACADDR_IND:
|
||||
wma_set_base_macaddr_indicate(wma_handle,
|
||||
(tSirMacAddr *) msg->bodyptr);
|
||||
|
@ -133,6 +133,18 @@ static inline QDF_STATUS os_if_nan_set_ndp_delete_transaction_id(
|
||||
return ucfg_nan_set_ndp_delete_transaction_id(vdev, val);
|
||||
}
|
||||
|
||||
/**
|
||||
* os_if_nan_legacy_req: os_if api to handle NAN requests attached to the vendor
|
||||
* command QCA_NL80211_VENDOR_SUBCMD_NAN
|
||||
* @psoc: pointer to psoc object
|
||||
* @data: request data. contains vendor cmd tlvs
|
||||
* @data_len: length of data
|
||||
*
|
||||
* Return: status of operation
|
||||
*/
|
||||
int os_if_nan_legacy_req(struct wlan_objmgr_psoc *psoc, const void *data,
|
||||
int data_len);
|
||||
|
||||
/**
|
||||
* os_if_process_nan_req: os_if api to handle NAN requests attached to the
|
||||
* vendor command QCA_NL80211_VENDOR_SUBCMD_NAN_EXT
|
||||
|
@ -2276,6 +2276,37 @@ static int os_if_nan_generic_req(struct wlan_objmgr_psoc *psoc,
|
||||
return qdf_status_to_os_return(status);
|
||||
}
|
||||
|
||||
int os_if_nan_legacy_req(struct wlan_objmgr_psoc *psoc, const void *data,
|
||||
int data_len)
|
||||
{
|
||||
struct nan_generic_req *nan_req;
|
||||
QDF_STATUS status;
|
||||
|
||||
if (data_len > NAN_CMD_MAX_SIZE) {
|
||||
cfg80211_err("NAN request exceeding max allowed size");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
nan_req = qdf_mem_malloc(sizeof(*nan_req) + data_len);
|
||||
nan_req->psoc = psoc;
|
||||
nan_req->params.request_data_len = data_len;
|
||||
qdf_mem_copy(nan_req->params.request_data, data, data_len);
|
||||
|
||||
/*
|
||||
* Send legacy NAN requests with type GENERIC, these will be treated as
|
||||
* passthrough by the driver. These will not affect the NAN state
|
||||
* machine or policy manager.
|
||||
*/
|
||||
status = ucfg_nan_discovery_req(nan_req, NAN_GENERIC_REQ);
|
||||
|
||||
if (QDF_IS_STATUS_ERROR(status))
|
||||
cfg80211_err("Failed to post NAN request");
|
||||
|
||||
qdf_mem_free(nan_req);
|
||||
|
||||
return qdf_status_to_os_return(status);
|
||||
}
|
||||
|
||||
static int os_if_process_nan_disable_req(struct wlan_objmgr_psoc *psoc,
|
||||
struct nlattr **tb)
|
||||
{
|
||||
@ -2379,9 +2410,19 @@ int os_if_process_nan_req(struct wlan_objmgr_psoc *psoc,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* If target does not support NAN DBS, send request with type GENERIC.
|
||||
* These will be treated as passthrough by the driver. This is to make
|
||||
* sure that HW mode is not set to DBS by NAN Enable request. NAN state
|
||||
* machine will remain unaffected in this case.
|
||||
*/
|
||||
if (!ucfg_is_nan_dbs_supported(psoc))
|
||||
return os_if_nan_generic_req(psoc, tb);
|
||||
|
||||
/*
|
||||
* Send all requests other than Enable/Disable as type GENERIC.
|
||||
* These will be treated as passthrough by the driver.
|
||||
*/
|
||||
if (!tb[QCA_WLAN_VENDOR_ATTR_NAN_SUBCMD_TYPE])
|
||||
return os_if_nan_generic_req(psoc, tb);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user