mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-13 08:07:32 -04:00
qcacld-3.0: Add support for NDP vendor commands and NDI Create
Add support for NDP vendor commands and implement NAN Data Interface create. Propagation from qcacld-2.0 to qcacld-3.0 CRs-Fixed: 962367 Change-Id: I84e9ac5ccfe8faaa00dfc448defb81fb792263d5
This commit is contained in:
parent
e2dd5440bf
commit
5cdce8429e
10 changed files with 1090 additions and 23 deletions
|
|
@ -69,6 +69,10 @@
|
|||
#include "cdp_txrx_flow_ctrl_legacy.h"
|
||||
#include <cdp_txrx_peer_ops.h>
|
||||
|
||||
#ifdef WLAN_FEATURE_NAN_DATAPATH
|
||||
#include "wlan_hdd_nan_datapath.h"
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Preprocessor definitions and constants
|
||||
-------------------------------------------------------------------------*/
|
||||
|
|
@ -956,6 +960,9 @@ struct hdd_adapter_s {
|
|||
union {
|
||||
hdd_station_ctx_t station;
|
||||
hdd_ap_ctx_t ap;
|
||||
#ifdef WLAN_FEATURE_NAN_DATAPATH
|
||||
struct nan_datapath_ctx ndp_ctx;
|
||||
#endif
|
||||
} sessionCtx;
|
||||
|
||||
#ifdef WLAN_FEATURE_TSF
|
||||
|
|
@ -1074,6 +1081,15 @@ struct hdd_adapter_s {
|
|||
(tdlsCtx_t *)(pAdapter)->sessionCtx.station.pHddTdlsCtx : NULL)
|
||||
#endif
|
||||
|
||||
#ifdef WLAN_FEATURE_NAN_DATAPATH
|
||||
#define WLAN_HDD_GET_NDP_CTX_PTR(adapter) (&(adapter)->sessionCtx.ndp_ctx)
|
||||
#define WLAN_HDD_GET_NDP_WEXT_STATE_PTR(adapter) \
|
||||
(&(adapter)->sessionCtx.ndp_ctx.wext_state)
|
||||
#else
|
||||
#define WLAN_HDD_GET_NDP_CTX_PTR(adapter) (NULL)
|
||||
#define WLAN_HDD_GET_NDP_WEXT_STATE_PTR(adapter) (NULL)
|
||||
#endif
|
||||
|
||||
/* Set mac address locally administered bit */
|
||||
#define WLAN_HDD_RESET_LOCALLY_ADMINISTERED_BIT(macaddr) (macaddr[0] &= 0xFD)
|
||||
|
||||
|
|
@ -1718,4 +1734,6 @@ static inline int wlan_hdd_nl_init(hdd_context_t *hdd_ctx)
|
|||
return nl_srv_init(hdd_ctx->wiphy);
|
||||
}
|
||||
#endif
|
||||
QDF_STATUS hdd_sme_close_session_callback(void *pContext);
|
||||
|
||||
#endif /* end #if !defined(WLAN_HDD_MAIN_H) */
|
||||
|
|
|
|||
|
|
@ -149,6 +149,7 @@ struct wireless_dev *wlan_hdd_add_virtual_intf(struct wiphy *wiphy,
|
|||
#endif
|
||||
|
||||
int wlan_hdd_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev);
|
||||
int __wlan_hdd_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev);
|
||||
|
||||
|
||||
void wlan_hdd_cleanup_remain_on_channel_ctx(hdd_adapter_t *pAdapter);
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@
|
|||
#include "ol_rx_fwd.h"
|
||||
#include "cdp_txrx_flow_ctrl_legacy.h"
|
||||
#include "cdp_txrx_peer_ops.h"
|
||||
#include "wlan_hdd_nan_datapath.h"
|
||||
|
||||
/* These are needed to recognize WPA and RSN suite types */
|
||||
#define HDD_WPA_OUI_SIZE 4
|
||||
|
|
@ -4400,6 +4401,10 @@ hdd_sme_roam_callback(void *pContext, tCsrRoamInfo *pRoamInfo, uint32_t roamId,
|
|||
if (QDF_IS_STATUS_ERROR(status))
|
||||
hdd_info("set hw mode change not done");
|
||||
break;
|
||||
case eCSR_ROAM_NDP_STATUS_UPDATE:
|
||||
hdd_ndp_event_handler(pAdapter, pRoamInfo, roamId, roamStatus,
|
||||
roamResult);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@
|
|||
#include "wlan_hdd_subnet_detect.h"
|
||||
#include <wlan_hdd_regulatory.h>
|
||||
#include "wlan_hdd_lpass.h"
|
||||
#include "wlan_hdd_nan_datapath.h"
|
||||
|
||||
#define g_mode_rates_size (12)
|
||||
#define a_mode_rates_size (8)
|
||||
|
|
@ -1081,6 +1082,13 @@ static const struct nl80211_vendor_cmd_info wlan_hdd_cfg80211_vendor_events[] =
|
|||
.subcmd = QCA_NL80211_VENDOR_SUBCMD_GW_PARAM_CONFIG
|
||||
},
|
||||
#endif /*FEATURE_LFR_SUBNET_DETECTION */
|
||||
|
||||
#ifdef WLAN_FEATURE_NAN_DATAPATH
|
||||
[QCA_NL80211_VENDOR_SUBCMD_NDP_INDEX] = {
|
||||
.vendor_id = QCA_NL80211_VENDOR_ID,
|
||||
.subcmd = QCA_NL80211_VENDOR_SUBCMD_NDP
|
||||
},
|
||||
#endif /* WLAN_FEATURE_NAN_DATAPATH */
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -6006,6 +6014,16 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
|
|||
.doit = wlan_hdd_cfg80211_sap_configuration_set
|
||||
},
|
||||
|
||||
#ifdef WLAN_FEATURE_NAN_DATAPATH
|
||||
{
|
||||
.info.vendor_id = QCA_NL80211_VENDOR_ID,
|
||||
.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_NDP,
|
||||
.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
|
||||
WIPHY_VENDOR_CMD_NEED_NETDEV |
|
||||
WIPHY_VENDOR_CMD_NEED_RUNNING,
|
||||
.doit = wlan_hdd_cfg80211_process_ndp_cmd
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -348,6 +348,7 @@ enum qca_nl80211_vendor_subcmds {
|
|||
QCA_NL80211_VENDOR_SUBCMD_TDLS_GET_CAPABILITIES = 78,
|
||||
QCA_NL80211_VENDOR_SUBCMD_OFFLOADED_PACKETS = 79,
|
||||
QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI = 80,
|
||||
QCA_NL80211_VENDOR_SUBCMD_NDP = 81,
|
||||
|
||||
QCA_NL80211_VENDOR_SUBCMD_PACKET_FILTER = 83,
|
||||
/* OCB commands */
|
||||
|
|
@ -516,6 +517,9 @@ enum qca_nl80211_vendor_subcmds_index {
|
|||
#ifdef WLAN_FEATURE_TSF
|
||||
QCA_NL80211_VENDOR_SUBCMD_TSF_INDEX,
|
||||
#endif
|
||||
#ifdef WLAN_FEATURE_NAN_DATAPATH
|
||||
QCA_NL80211_VENDOR_SUBCMD_NDP_INDEX,
|
||||
#endif /* WLAN_FEATURE_NAN_DATAPATH */
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@
|
|||
#include "pld_common.h"
|
||||
#include "wlan_hdd_ocb.h"
|
||||
#include "wlan_hdd_nan.h"
|
||||
#include "wlan_hdd_nan_datapath.h"
|
||||
#include "wlan_hdd_debugfs.h"
|
||||
#include "wlan_hdd_driver_ops.h"
|
||||
#include "epping_main.h"
|
||||
|
|
@ -229,6 +230,7 @@ const char *hdd_device_mode_to_string(uint8_t device_mode)
|
|||
CASE_RETURN_STRING(QDF_IBSS_MODE);
|
||||
CASE_RETURN_STRING(QDF_P2P_DEVICE_MODE);
|
||||
CASE_RETURN_STRING(QDF_OCB_MODE);
|
||||
CASE_RETURN_STRING(QDF_NDI_MODE);
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
|
|
@ -2154,7 +2156,7 @@ QDF_STATUS hdd_register_interface(hdd_adapter_t *adapter,
|
|||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static QDF_STATUS hdd_sme_close_session_callback(void *pContext)
|
||||
QDF_STATUS hdd_sme_close_session_callback(void *pContext)
|
||||
{
|
||||
hdd_adapter_t *adapter = pContext;
|
||||
|
||||
|
|
@ -2549,6 +2551,7 @@ hdd_adapter_t *hdd_open_adapter(hdd_context_t *hdd_ctx, uint8_t session_type,
|
|||
case QDF_P2P_DEVICE_MODE:
|
||||
case QDF_OCB_MODE:
|
||||
case QDF_MONITOR_MODE:
|
||||
case QDF_NDI_MODE:
|
||||
{
|
||||
adapter = hdd_alloc_station_adapter(hdd_ctx, macAddr,
|
||||
name_assign_type,
|
||||
|
|
@ -2572,7 +2575,11 @@ hdd_adapter_t *hdd_open_adapter(hdd_context_t *hdd_ctx, uint8_t session_type,
|
|||
|
||||
adapter->device_mode = session_type;
|
||||
|
||||
status = hdd_init_station_mode(adapter);
|
||||
if (QDF_NDI_MODE == session_type)
|
||||
status = hdd_init_nan_data_mode(adapter);
|
||||
else
|
||||
status = hdd_init_station_mode(adapter);
|
||||
|
||||
if (QDF_STATUS_SUCCESS != status)
|
||||
goto err_free_netdev;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,8 +23,39 @@
|
|||
*
|
||||
* WLAN Host Device Driver nan datapath API implementation
|
||||
*/
|
||||
#include <wlan_hdd_includes.h>
|
||||
#include <linux/if.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include "wlan_hdd_includes.h"
|
||||
#include "wlan_hdd_nan_datapath.h"
|
||||
#include "wlan_hdd_p2p.h"
|
||||
#include "wma_api.h"
|
||||
|
||||
/* NLA policy */
|
||||
static const struct nla_policy
|
||||
qca_wlan_vendor_ndp_policy[QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX + 1] = {
|
||||
[QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD] = { .type = NLA_U32 },
|
||||
[QCA_WLAN_VENDOR_ATTR_NDP_TRANSACTION_ID] = { .type = NLA_U16 },
|
||||
[QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR] = { .type = NLA_STRING,
|
||||
.len = IFNAMSIZ },
|
||||
[QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_INSTANCE_ID] = { .type = NLA_U32 },
|
||||
[QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL_SPEC_CHANNEL] = { .type = NLA_U32 },
|
||||
[QCA_WLAN_VENDOR_ATTR_NDP_PEER_DISCOVERY_MAC_ADDR] = {
|
||||
.type = NLA_BINARY,
|
||||
.len = QDF_MAC_ADDR_SIZE },
|
||||
[QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_SECURITY] = { .type = NLA_U16 },
|
||||
[QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS] = { .type = NLA_BINARY,
|
||||
.len = NDP_QOS_INFO_LEN },
|
||||
[QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO_LEN] = { .type = NLA_U16 },
|
||||
[QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO] = { .type = NLA_BINARY,
|
||||
.len = NDP_APP_INFO_LEN },
|
||||
[QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID] = { .type = NLA_U32 },
|
||||
[QCA_WLAN_VENDOR_ATTR_NDP_SCHEDULE_RESPONSE_CODE] = { .type = NLA_U16 },
|
||||
[QCA_WLAN_VENDOR_ATTR_NDP_SCHEDULE_STATUS_CODE] = { .type = NLA_U16 },
|
||||
[QCA_WLAN_VENDOR_ATTR_NDP_NDI_MAC_ADDR] = { .type = NLA_BINARY,
|
||||
.len = QDF_MAC_ADDR_SIZE },
|
||||
};
|
||||
|
||||
/**
|
||||
* hdd_ndp_print_ini_config()- Print nan datapath specific INI configuration
|
||||
|
|
@ -47,12 +78,11 @@ void hdd_ndp_print_ini_config(hdd_context_t *hdd_ctx)
|
|||
* @hdd_ctx: Pointer to HDD context
|
||||
* @cfg: Pointer to target device capability information
|
||||
*
|
||||
* NaN datapath functionality is enabled if it is enabled in
|
||||
* .ini file and also supported in target device.
|
||||
* NAN datapath functinality is enabled if it is enabled in
|
||||
* .ini file and also supported in firmware.
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
|
||||
void hdd_nan_datapath_target_config(hdd_context_t *hdd_ctx,
|
||||
struct wma_tgt_cfg *cfg)
|
||||
{
|
||||
|
|
@ -60,3 +90,770 @@ void hdd_nan_datapath_target_config(hdd_context_t *hdd_ctx,
|
|||
hddLog(LOG1, FL("enable_nan_datapath: %d"),
|
||||
hdd_ctx->config->enable_nan_datapath);
|
||||
}
|
||||
|
||||
/**
|
||||
* hdd_ndi_start_bss() - Start BSS on NAN data interface
|
||||
* @adapter: adapter context
|
||||
* @operating_channel: channel on which the BSS to be started
|
||||
*
|
||||
* Return: 0 on success, error value on failure
|
||||
*/
|
||||
static int hdd_ndi_start_bss(hdd_adapter_t *adapter,
|
||||
uint8_t operating_channel)
|
||||
{
|
||||
int ret;
|
||||
uint32_t roam_id;
|
||||
hdd_wext_state_t *wext_state =
|
||||
WLAN_HDD_GET_NDP_WEXT_STATE_PTR(adapter);
|
||||
tCsrRoamProfile *roam_profile = &wext_state->roamProfile;
|
||||
|
||||
ENTER();
|
||||
|
||||
if (!roam_profile) {
|
||||
hddLog(LOGE, FL("No valid roam profile"));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (HDD_WMM_USER_MODE_NO_QOS ==
|
||||
(WLAN_HDD_GET_CTX(adapter))->config->WmmMode) {
|
||||
/* QoS not enabled in cfg file*/
|
||||
roam_profile->uapsd_mask = 0;
|
||||
} else {
|
||||
/* QoS enabled, update uapsd mask from cfg file*/
|
||||
roam_profile->uapsd_mask =
|
||||
(WLAN_HDD_GET_CTX(adapter))->config->UapsdMask;
|
||||
}
|
||||
|
||||
roam_profile->csrPersona = adapter->device_mode;
|
||||
|
||||
roam_profile->ChannelInfo.numOfChannels = 1;
|
||||
if (operating_channel) {
|
||||
roam_profile->ChannelInfo.ChannelList = &operating_channel;
|
||||
} else {
|
||||
roam_profile->ChannelInfo.ChannelList[0] =
|
||||
NAN_SOCIAL_CHANNEL_2_4GHZ;
|
||||
}
|
||||
hdd_select_cbmode(adapter, operating_channel);
|
||||
|
||||
roam_profile->SSIDs.numOfSSIDs = 1;
|
||||
roam_profile->SSIDs.SSIDList->SSID.length = 0;
|
||||
|
||||
roam_profile->phyMode = eCSR_DOT11_MODE_11ac;
|
||||
roam_profile->BSSType = eCSR_BSS_TYPE_NDI;
|
||||
roam_profile->BSSIDs.numOfBSSIDs = 1;
|
||||
qdf_mem_copy((void *)(roam_profile->BSSIDs.bssid),
|
||||
&adapter->macAddressCurrent.bytes[0],
|
||||
QDF_MAC_ADDR_SIZE);
|
||||
|
||||
roam_profile->AuthType.numEntries = 1;
|
||||
roam_profile->AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM;
|
||||
roam_profile->EncryptionType.numEntries = 1;
|
||||
roam_profile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE;
|
||||
|
||||
ret = sme_roam_connect(WLAN_HDD_GET_HAL_CTX(adapter),
|
||||
adapter->sessionId, roam_profile, &roam_id);
|
||||
if (QDF_STATUS_SUCCESS != ret) {
|
||||
hddLog(LOGE,
|
||||
FL("NDI sme_RoamConnect session %d failed with status %d -> NotConnected"),
|
||||
adapter->sessionId, ret);
|
||||
/* change back to NotConnected */
|
||||
hdd_conn_set_connection_state(adapter,
|
||||
eConnectionState_NotConnected);
|
||||
} else {
|
||||
hddLog(LOG2, FL("sme_RoamConnect issued successfully for NDI"));
|
||||
}
|
||||
|
||||
roam_profile->ChannelInfo.ChannelList = NULL;
|
||||
roam_profile->ChannelInfo.numOfChannels = 0;
|
||||
|
||||
EXIT();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* hdd_ndi_create_req_handler() - NDI create request handler
|
||||
* @hdd_ctx: hdd context
|
||||
* @tb: parsed NL attribute list
|
||||
*
|
||||
* Return: 0 on success or error code on failure
|
||||
*/
|
||||
static int hdd_ndi_create_req_handler(hdd_context_t *hdd_ctx,
|
||||
struct nlattr **tb)
|
||||
{
|
||||
hdd_adapter_t *adapter;
|
||||
char *iface_name;
|
||||
uint16_t transaction_id;
|
||||
int ret;
|
||||
struct nan_datapath_ctx *ndp_ctx;
|
||||
uint8_t op_channel =
|
||||
hdd_ctx->config->nan_datapath_ndi_channel;
|
||||
|
||||
ENTER();
|
||||
|
||||
if (!tb[QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR]) {
|
||||
hddLog(LOGE, FL("Interface name string is unavailable"));
|
||||
return -EINVAL;
|
||||
}
|
||||
iface_name = nla_data(tb[QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR]);
|
||||
|
||||
if (!tb[QCA_WLAN_VENDOR_ATTR_NDP_TRANSACTION_ID]) {
|
||||
hddLog(LOGE, FL("transaction id is unavailable"));
|
||||
return -EINVAL;
|
||||
}
|
||||
transaction_id =
|
||||
nla_get_u16(tb[QCA_WLAN_VENDOR_ATTR_NDP_TRANSACTION_ID]);
|
||||
|
||||
/* Check for an existing interface of NDI type */
|
||||
adapter = hdd_get_adapter(hdd_ctx, QDF_NDI_MODE);
|
||||
if (adapter) {
|
||||
hddLog(LOGE, FL("Cannot support more than one NDI"));
|
||||
return -EEXIST;
|
||||
}
|
||||
|
||||
adapter = hdd_open_adapter(hdd_ctx, QDF_NDI_MODE, iface_name,
|
||||
wlan_hdd_get_intf_addr(hdd_ctx), NET_NAME_UNKNOWN,
|
||||
true);
|
||||
if (!adapter) {
|
||||
hddLog(LOGE, FL("hdd_open_adapter failed"));
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create transaction id is required to be saved since the firmware
|
||||
* does not honor the transaction id for create request
|
||||
*/
|
||||
ndp_ctx = WLAN_HDD_GET_NDP_CTX_PTR(adapter);
|
||||
ndp_ctx->ndp_create_transaction_id = transaction_id;
|
||||
|
||||
/*
|
||||
* The NAN data interface has been created at this point.
|
||||
* Unlike traditional device modes, where the higher application
|
||||
* layer initiates connect / join / start, the NAN data interface
|
||||
* does not have any such formal requests. The NDI create request
|
||||
* is responsible for starting the BSS as well.
|
||||
*/
|
||||
if (op_channel != NAN_SOCIAL_CHANNEL_2_4GHZ ||
|
||||
op_channel != NAN_SOCIAL_CHANNEL_5GHZ_LOWER_BAND ||
|
||||
op_channel != NAN_SOCIAL_CHANNEL_5GHZ_UPPER_BAND) {
|
||||
/* start NDI on the default 2.4 GHz social channel */
|
||||
op_channel = NAN_SOCIAL_CHANNEL_2_4GHZ;
|
||||
}
|
||||
ret = hdd_ndi_start_bss(adapter, op_channel);
|
||||
if (0 > ret)
|
||||
hddLog(LOGE, FL("NDI start bss failed"));
|
||||
|
||||
EXIT();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* hdd_ndi_delete_req_handler() - NDI delete request handler
|
||||
* @hdd_ctx: hdd context
|
||||
* @tb: parsed NL attribute list
|
||||
*
|
||||
* Return: 0 on success or error code on failure
|
||||
*/
|
||||
static int hdd_ndi_delete_req_handler(hdd_context_t *hdd_ctx,
|
||||
struct nlattr **tb)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* hdd_ndp_initiator_req_handler() - NDP initiator request handler
|
||||
* @hdd_ctx: hdd context
|
||||
* @tb: parsed NL attribute list
|
||||
*
|
||||
* Return: 0 on success or error code on failure
|
||||
*/
|
||||
static int hdd_ndp_initiator_req_handler(hdd_context_t *hdd_ctx,
|
||||
struct nlattr **tb)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* hdd_ndp_responder_req_handler() - NDP responder request handler
|
||||
* @hdd_ctx: hdd context
|
||||
* @tb: parsed NL attribute list
|
||||
*
|
||||
* Return: 0 on success or error code on failure
|
||||
*/
|
||||
static int hdd_ndp_responder_req_handler(hdd_context_t *hdd_ctx,
|
||||
struct nlattr **tb)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* hdd_ndp_end_req_handler() - NDP end request handler
|
||||
* @hdd_ctx: hdd context
|
||||
* @tb: parsed NL attribute list
|
||||
*
|
||||
* Return: 0 on success or error code on failure
|
||||
*/
|
||||
static int hdd_ndp_end_req_handler(hdd_context_t *hdd_ctx,
|
||||
struct nlattr **tb)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* hdd_ndp_schedule_req_handler() - NDP schedule request handler
|
||||
* @hdd_ctx: hdd context
|
||||
* @tb: parsed NL attribute list
|
||||
*
|
||||
* Return: 0 on success or error code on failure
|
||||
*/
|
||||
static int hdd_ndp_schedule_req_handler(hdd_context_t *hdd_ctx,
|
||||
struct nlattr **tb)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* hdd_ndp_iface_create_rsp_handler() - NDP iface create response handler
|
||||
* @adapter: pointer to adapter context
|
||||
* @rsp_params: response parameters
|
||||
*
|
||||
* The function is expected to send a response back to the user space
|
||||
* even if the creation of BSS has failed
|
||||
*
|
||||
* Following vendor event is sent to cfg80211:
|
||||
* QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD =
|
||||
* QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_CREATE (4 bytes)
|
||||
* QCA_WLAN_VENDOR_ATTR_NDP_TRANSACTION_ID (2 bytes)
|
||||
* QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_TYPE (4 bytes)
|
||||
* QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
static void hdd_ndp_iface_create_rsp_handler(hdd_adapter_t *adapter,
|
||||
void *rsp_params)
|
||||
{
|
||||
struct sk_buff *vendor_event;
|
||||
hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
||||
struct ndi_create_rsp *ndi_rsp = (struct ndi_create_rsp *)rsp_params;
|
||||
uint32_t data_len = (3 * sizeof(uint32_t)) + sizeof(uint16_t) +
|
||||
NLMSG_HDRLEN + (4 * NLA_HDRLEN);
|
||||
struct nan_datapath_ctx *ndp_ctx = WLAN_HDD_GET_NDP_CTX_PTR(adapter);
|
||||
|
||||
ENTER();
|
||||
|
||||
if (wlan_hdd_validate_context(hdd_ctx))
|
||||
return;
|
||||
|
||||
if (!ndi_rsp) {
|
||||
hddLog(LOGE, FL("Invalid ndi create response"));
|
||||
return;
|
||||
}
|
||||
|
||||
/* notify response to the upper layer */
|
||||
vendor_event = cfg80211_vendor_event_alloc(hdd_ctx->wiphy,
|
||||
NULL,
|
||||
data_len,
|
||||
QCA_NL80211_VENDOR_SUBCMD_NDP_INDEX,
|
||||
cds_get_gfp_flags());
|
||||
|
||||
if (!vendor_event) {
|
||||
hddLog(LOGE, FL("cfg80211_vendor_event_alloc failed"));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Sub vendor command */
|
||||
if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_CREATE)) {
|
||||
hddLog(LOGE, FL("QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD put fail"));
|
||||
goto nla_put_failure;
|
||||
}
|
||||
|
||||
/* Transaction id */
|
||||
if (nla_put_u16(vendor_event, QCA_WLAN_VENDOR_ATTR_NDP_TRANSACTION_ID,
|
||||
ndp_ctx->ndp_create_transaction_id)) {
|
||||
hddLog(LOGE, FL("VENDOR_ATTR_NDP_TRANSACTION_ID put fail"));
|
||||
goto nla_put_failure;
|
||||
}
|
||||
|
||||
/* Status code */
|
||||
if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_TYPE,
|
||||
ndi_rsp->status)) {
|
||||
hddLog(LOGE, FL("VENDOR_ATTR_NDP_DRV_RETURN_TYPE put fail"));
|
||||
goto nla_put_failure;
|
||||
}
|
||||
|
||||
/* Status return value */
|
||||
if (nla_put_u32(vendor_event,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE, 0xA5)) {
|
||||
hddLog(LOGE, FL("VENDOR_ATTR_NDP_DRV_RETURN_VALUE put fail"));
|
||||
goto nla_put_failure;
|
||||
}
|
||||
|
||||
hddLog(LOG2, FL("sub command: %d, value: %d"),
|
||||
QCA_NL80211_VENDOR_SUBCMD_NDP_INDEX,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_CREATE);
|
||||
hddLog(LOG2, FL("create transaction id: %d, value: %d"),
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_TRANSACTION_ID,
|
||||
ndp_ctx->ndp_create_transaction_id);
|
||||
hddLog(LOG2, FL("status code: %d, value: %d"),
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_TYPE, ndi_rsp->status);
|
||||
hddLog(LOG2, FL("Return value: %d, value: %d"),
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE, 0xA5);
|
||||
|
||||
cfg80211_vendor_event(vendor_event, GFP_KERNEL);
|
||||
|
||||
ndp_ctx->ndp_create_transaction_id = 0;
|
||||
|
||||
if (ndi_rsp->status == QDF_STATUS_SUCCESS) {
|
||||
hddLog(LOGE, FL("NDI interface successfully created"));
|
||||
} else {
|
||||
hddLog(LOGE,
|
||||
FL("NDI interface creation failed with reason %d"),
|
||||
ndi_rsp->reason);
|
||||
}
|
||||
EXIT();
|
||||
return;
|
||||
|
||||
nla_put_failure:
|
||||
kfree_skb(vendor_event);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* hdd_ndp_iface_delete_rsp_handler() - NDP iface delete response handler
|
||||
* @adapter: pointer to adapter context
|
||||
* @rsp_params: response parameters
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
static void hdd_ndp_iface_delete_rsp_handler(hdd_adapter_t *adapter,
|
||||
void *rsp_params)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* hdd_ndp_initiator_rsp_handler() - NDP initiator response handler
|
||||
* @adapter: pointer to adapter context
|
||||
* @rsp_params: response parameters
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
static void hdd_ndp_initiator_rsp_handler(hdd_adapter_t *adapter,
|
||||
void *rsp_params)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* hdd_ndp_new_peer_ind_handler() - NDP new peer indication handler
|
||||
* @adapter: pointer to adapter context
|
||||
* @ind_params: indication parameters
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
static void hdd_ndp_new_peer_ind_handler(hdd_adapter_t *adapter,
|
||||
void *ind_params)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* hdd_ndp_peer_departed_ind_handler() - NDP peer departed indication handler
|
||||
* @adapter: pointer to adapter context
|
||||
* @ind_params: indication parameters
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
static void hdd_ndp_peer_departed_ind_handler(
|
||||
hdd_adapter_t *adapter, void *ind_params)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* hdd_ndp_confirm_ind_handler() - NDP confirm indication handler
|
||||
* @adapter: pointer to adapter context
|
||||
* @ind_params: indication parameters
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
static void hdd_ndp_confirm_ind_handler(hdd_adapter_t *adapter,
|
||||
void *ind_params)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* hdd_ndp_indication_handler() - NDP indication handler
|
||||
* @adapter: pointer to adapter context
|
||||
* @ind_params: indication parameters
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
static void hdd_ndp_indication_handler(hdd_adapter_t *adapter,
|
||||
void *ind_params)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* hdd_ndp_responder_rsp_handler() - NDP responder response handler
|
||||
* @adapter: pointer to adapter context
|
||||
* @rsp_params: response parameters
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
static void hdd_ndp_responder_rsp_handler(hdd_adapter_t *adapter,
|
||||
void *rsp_params)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* hdd_ndp_end_rsp_handler() - NDP end response handler
|
||||
* @adapter: pointer to adapter context
|
||||
* @rsp_params: response parameters
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
static void hdd_ndp_end_rsp_handler(hdd_adapter_t *adapter,
|
||||
void *rsp_params)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* hdd_ndp_end_ind_handler() - NDP end indication handler
|
||||
* @adapter: pointer to adapter context
|
||||
* @ind_params: indication parameters
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
static void hdd_ndp_end_ind_handler(hdd_adapter_t *adapter,
|
||||
void *ind_params)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* hdd_ndp_schedule_update_rsp_handler() - NDP schedule update response handler
|
||||
* @adapter: pointer to adapter context
|
||||
* @rsp_params: response parameters
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
static void hdd_ndp_schedule_update_rsp_handler(
|
||||
hdd_adapter_t *adapter, void *rsp_params)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* hdd_ndp_event_handler() - ndp response and indication handler
|
||||
* @adapter: adapter context
|
||||
* @roam_info: pointer to roam_info structure
|
||||
* @roam_id: roam id as indicated by SME
|
||||
* @roam_status: roam status
|
||||
* @roam_result: roam result
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void hdd_ndp_event_handler(hdd_adapter_t *adapter,
|
||||
tCsrRoamInfo *roam_info, uint32_t roam_id, eRoamCmdStatus roam_status,
|
||||
eCsrRoamResult roam_result)
|
||||
{
|
||||
if (roam_status == eCSR_ROAM_NDP_STATUS_UPDATE) {
|
||||
switch (roam_result) {
|
||||
case eCSR_ROAM_RESULT_NDP_CREATE_RSP:
|
||||
hdd_ndp_iface_create_rsp_handler(adapter,
|
||||
&roam_info->ndp.ndi_create_params);
|
||||
break;
|
||||
case eCSR_ROAM_RESULT_NDP_DELETE_RSP:
|
||||
hdd_ndp_iface_delete_rsp_handler(adapter,
|
||||
&roam_info->ndp.ndi_delete_params);
|
||||
break;
|
||||
case eCSR_ROAM_RESULT_NDP_INITIATOR_RSP:
|
||||
hdd_ndp_initiator_rsp_handler(adapter,
|
||||
&roam_info->ndp.ndp_init_rsp_params);
|
||||
break;
|
||||
case eCSR_ROAM_RESULT_NDP_NEW_PEER_IND:
|
||||
hdd_ndp_new_peer_ind_handler(adapter,
|
||||
&roam_info->ndp.ndp_peer_ind_params);
|
||||
break;
|
||||
case eCSR_ROAM_RESULT_NDP_CONFIRM_IND:
|
||||
hdd_ndp_confirm_ind_handler(adapter,
|
||||
&roam_info->ndp.ndp_confirm_params);
|
||||
break;
|
||||
case eCSR_ROAM_RESULT_NDP_INDICATION:
|
||||
hdd_ndp_indication_handler(adapter,
|
||||
&roam_info->ndp.ndp_indication_params);
|
||||
break;
|
||||
case eCSR_ROAM_RESULT_NDP_SCHED_UPDATE_RSP:
|
||||
hdd_ndp_schedule_update_rsp_handler(adapter,
|
||||
&roam_info->ndp.ndp_sched_upd_rsp_params);
|
||||
break;
|
||||
case eCSR_ROAM_RESULT_NDP_RESPONDER_RSP:
|
||||
hdd_ndp_responder_rsp_handler(adapter,
|
||||
&roam_info->ndp.ndp_responder_rsp_params);
|
||||
break;
|
||||
case eCSR_ROAM_RESULT_NDP_END_RSP:
|
||||
hdd_ndp_end_rsp_handler(adapter,
|
||||
&roam_info->ndp.ndp_end_rsp_params);
|
||||
break;
|
||||
case eCSR_ROAM_RESULT_NDP_PEER_DEPARTED_IND:
|
||||
hdd_ndp_peer_departed_ind_handler(adapter,
|
||||
&roam_info->ndp.ndp_peer_ind_params);
|
||||
break;
|
||||
case eCSR_ROAM_RESULT_NDP_END_IND:
|
||||
hdd_ndp_end_ind_handler(adapter,
|
||||
&roam_info->ndp.ndp_end_ind_params);
|
||||
break;
|
||||
default:
|
||||
hddLog(LOGE,
|
||||
FL("Unknown NDP response event from SME %d"),
|
||||
roam_result);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* __wlan_hdd_cfg80211_process_ndp_cmds() - handle NDP request
|
||||
* @wiphy: pointer to wireless wiphy structure.
|
||||
* @wdev: pointer to wireless_dev structure.
|
||||
* @data: Pointer to the data to be passed via vendor interface
|
||||
* @data_len:Length of the data to be passed
|
||||
*
|
||||
* This function is invoked to handle vendor command
|
||||
*
|
||||
* Return: 0 on success, negative errno on failure
|
||||
*/
|
||||
static int __wlan_hdd_cfg80211_process_ndp_cmd(struct wiphy *wiphy,
|
||||
struct wireless_dev *wdev, const void *data, int data_len)
|
||||
{
|
||||
uint32_t ndp_cmd_type;
|
||||
uint16_t transaction_id;
|
||||
int ret_val;
|
||||
hdd_context_t *hdd_ctx = wiphy_priv(wiphy);
|
||||
struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX + 1];
|
||||
char *iface_name;
|
||||
|
||||
ENTER();
|
||||
|
||||
ret_val = wlan_hdd_validate_context(hdd_ctx);
|
||||
if (ret_val)
|
||||
return ret_val;
|
||||
|
||||
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
|
||||
hddLog(LOGE, FL("Command not allowed in FTM mode"));
|
||||
return -EPERM;
|
||||
}
|
||||
if (!hdd_ctx->config->enable_nan_datapath) {
|
||||
hddLog(LOGE, FL("NAN datapath is not suported"));
|
||||
return -EPERM;
|
||||
}
|
||||
if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX,
|
||||
data, data_len,
|
||||
qca_wlan_vendor_ndp_policy)) {
|
||||
hddLog(LOGE, FL("Invalid NDP vendor command attributes"));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Parse and fetch NDP Command Type*/
|
||||
if (!tb[QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD]) {
|
||||
hddLog(LOGE, FL("NAN datapath cmd type failed"));
|
||||
return -EINVAL;
|
||||
}
|
||||
ndp_cmd_type = nla_get_u32(tb[QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD]);
|
||||
|
||||
if (!tb[QCA_WLAN_VENDOR_ATTR_NDP_TRANSACTION_ID]) {
|
||||
hddLog(LOGE, FL("attr transaction id failed"));
|
||||
return -EINVAL;
|
||||
}
|
||||
transaction_id = nla_get_u16(
|
||||
tb[QCA_WLAN_VENDOR_ATTR_NDP_TRANSACTION_ID]);
|
||||
|
||||
if (!tb[QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR]) {
|
||||
hddLog(LOGE, FL("Interface name string is unavailable"));
|
||||
return -EINVAL;
|
||||
}
|
||||
iface_name = nla_data(tb[QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR]);
|
||||
|
||||
hddLog(LOG2, FL("Transaction Id: %d NDP Cmd: %d iface_name: %s"),
|
||||
transaction_id, ndp_cmd_type, iface_name);
|
||||
|
||||
switch (ndp_cmd_type) {
|
||||
case QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_CREATE:
|
||||
ret_val = hdd_ndi_create_req_handler(hdd_ctx, tb);
|
||||
break;
|
||||
case QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_DELETE:
|
||||
ret_val = hdd_ndi_delete_req_handler(hdd_ctx, tb);
|
||||
break;
|
||||
case QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_REQUEST:
|
||||
ret_val = hdd_ndp_initiator_req_handler(hdd_ctx, tb);
|
||||
break;
|
||||
case QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_REQUEST:
|
||||
ret_val = hdd_ndp_responder_req_handler(hdd_ctx, tb);
|
||||
break;
|
||||
case QCA_WLAN_VENDOR_ATTR_NDP_END_REQUEST:
|
||||
ret_val = hdd_ndp_end_req_handler(hdd_ctx, tb);
|
||||
break;
|
||||
case QCA_WLAN_VENDOR_ATTR_NDP_SCHEDULE_UPDATE_REQUEST:
|
||||
ret_val = hdd_ndp_schedule_req_handler(hdd_ctx, tb);
|
||||
break;
|
||||
default:
|
||||
hddLog(LOGE, FL("Unrecognized NDP vendor cmd %d"),
|
||||
ndp_cmd_type);
|
||||
ret_val = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* wlan_hdd_cfg80211_process_ndp_cmd() - handle NDP request
|
||||
* @wiphy: pointer to wireless wiphy structure.
|
||||
* @wdev: pointer to wireless_dev structure.
|
||||
* @data: Pointer to the data to be passed via vendor interface
|
||||
* @data_len:Length of the data to be passed
|
||||
*
|
||||
* This function is called to send a NAN request to
|
||||
* firmware. This is an SSR-protected wrapper function.
|
||||
*
|
||||
* Return: 0 on success, negative errno on failure
|
||||
*/
|
||||
int wlan_hdd_cfg80211_process_ndp_cmd(struct wiphy *wiphy,
|
||||
struct wireless_dev *wdev, const void *data, int data_len)
|
||||
{
|
||||
int ret;
|
||||
|
||||
cds_ssr_protect(__func__);
|
||||
ret = __wlan_hdd_cfg80211_process_ndp_cmd(wiphy, wdev, data, data_len);
|
||||
cds_ssr_unprotect(__func__);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* hdd_init_nan_data_mode() - initialize nan data mode
|
||||
* @adapter: adapter context
|
||||
*
|
||||
* Returns: 0 on success negative error code on error
|
||||
*/
|
||||
int hdd_init_nan_data_mode(struct hdd_adapter_s *adapter)
|
||||
{
|
||||
struct net_device *wlan_dev = adapter->dev;
|
||||
struct nan_datapath_ctx *ndp_ctx = WLAN_HDD_GET_NDP_CTX_PTR(adapter);
|
||||
hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
||||
QDF_STATUS status;
|
||||
uint32_t type, sub_type;
|
||||
int32_t ret_val = 0;
|
||||
unsigned long rc;
|
||||
uint32_t timeout = WLAN_WAIT_TIME_SESSIONOPENCLOSE;
|
||||
|
||||
INIT_COMPLETION(adapter->session_open_comp_var);
|
||||
sme_set_curr_device_mode(hdd_ctx->hHal, adapter->device_mode);
|
||||
status = cds_get_vdev_types(adapter->device_mode, &type, &sub_type);
|
||||
if (QDF_STATUS_SUCCESS != status) {
|
||||
hddLog(LOGE, "failed to get vdev type");
|
||||
goto error_sme_open;
|
||||
}
|
||||
|
||||
/* open sme session for future use */
|
||||
status = sme_open_session(hdd_ctx->hHal, hdd_sme_roam_callback,
|
||||
adapter, (uint8_t *)&adapter->macAddressCurrent,
|
||||
&adapter->sessionId, type, sub_type);
|
||||
if (QDF_STATUS_SUCCESS == status) {
|
||||
hddLog(LOGE, "sme_open_session() failed with status code %d",
|
||||
status);
|
||||
ret_val = -EAGAIN;
|
||||
goto error_sme_open;
|
||||
}
|
||||
|
||||
/* Block on a completion variable. Can't wait forever though */
|
||||
rc = wait_for_completion_timeout(
|
||||
&adapter->session_open_comp_var,
|
||||
msecs_to_jiffies(timeout));
|
||||
if (!rc) {
|
||||
hddLog(LOGE,
|
||||
FL("Failed to open session, timeout code: %ld"), rc);
|
||||
ret_val = -ETIMEDOUT;
|
||||
goto error_sme_open;
|
||||
}
|
||||
|
||||
/* Register wireless extensions */
|
||||
ret_val = hdd_register_wext(wlan_dev);
|
||||
if (0 > ret_val) {
|
||||
hddLog(LOGE, FL("Wext registration failed with status code %d"),
|
||||
ret_val);
|
||||
ret_val = -EAGAIN;
|
||||
goto error_register_wext;
|
||||
}
|
||||
|
||||
status = hdd_init_tx_rx(adapter);
|
||||
if (QDF_STATUS_SUCCESS != status) {
|
||||
hddLog(LOGE, FL("hdd_init_tx_rx() init failed, status %d"),
|
||||
status);
|
||||
ret_val = -EAGAIN;
|
||||
goto error_init_txrx;
|
||||
}
|
||||
|
||||
set_bit(INIT_TX_RX_SUCCESS, &adapter->event_flags);
|
||||
|
||||
status = hdd_wmm_adapter_init(adapter);
|
||||
if (QDF_STATUS_SUCCESS != status) {
|
||||
hddLog(LOGE, FL("hdd_wmm_adapter_init() failed, status %d"),
|
||||
status);
|
||||
ret_val = -EAGAIN;
|
||||
goto error_wmm_init;
|
||||
}
|
||||
|
||||
set_bit(WMM_INIT_DONE, &adapter->event_flags);
|
||||
|
||||
ret_val = wma_cli_set_command((int)adapter->sessionId,
|
||||
(int)WMI_PDEV_PARAM_BURST_ENABLE,
|
||||
(int)hdd_ctx->config->enableSifsBurst,
|
||||
PDEV_CMD);
|
||||
if (0 != ret_val) {
|
||||
hddLog(LOGE, FL("WMI_PDEV_PARAM_BURST_ENABLE set failed %d"),
|
||||
ret_val);
|
||||
}
|
||||
|
||||
ndp_ctx->state = NAN_DATA_NDI_CREATING_STATE;
|
||||
return ret_val;
|
||||
|
||||
error_wmm_init:
|
||||
clear_bit(INIT_TX_RX_SUCCESS, &adapter->event_flags);
|
||||
hdd_deinit_tx_rx(adapter);
|
||||
|
||||
error_init_txrx:
|
||||
hdd_unregister_wext(wlan_dev);
|
||||
|
||||
error_register_wext:
|
||||
if (test_bit(SME_SESSION_OPENED, &adapter->event_flags)) {
|
||||
INIT_COMPLETION(adapter->session_close_comp_var);
|
||||
if (QDF_STATUS_SUCCESS ==
|
||||
sme_close_session(hdd_ctx->hHal,
|
||||
adapter->sessionId,
|
||||
hdd_sme_close_session_callback,
|
||||
adapter)) {
|
||||
rc = wait_for_completion_timeout(
|
||||
&adapter->session_close_comp_var,
|
||||
msecs_to_jiffies(timeout));
|
||||
if (rc <= 0) {
|
||||
hddLog(LOGE,
|
||||
FL("Session close failed status %ld"),
|
||||
rc);
|
||||
ret_val = -ETIMEDOUT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
error_sme_open:
|
||||
return ret_val;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,33 +23,220 @@
|
|||
*
|
||||
* WLAN Host Device Driver nan datapath API specification
|
||||
*/
|
||||
|
||||
#ifndef __WLAN_HDD_NAN_DATAPATH_H
|
||||
#define __WLAN_HDD_NAN_DATAPATH_H
|
||||
|
||||
struct hdd_context_s;
|
||||
struct wma_tgt_cfg;
|
||||
struct hdd_tgt_cfg;
|
||||
struct hdd_config;
|
||||
struct hdd_adapter_s;
|
||||
struct wireless_dev;
|
||||
|
||||
/* NAN Social channels */
|
||||
#define NAN_SOCIAL_CHANNEL_2_4GHZ 6
|
||||
#define NAN_SOCIAL_CHANNEL_5GHZ_LOWER_BAND 44
|
||||
#define NAN_SOCIAL_CHANNEL_5GHZ_UPPER_BAND 149
|
||||
|
||||
#define NDP_APP_INFO_LEN 255
|
||||
#define NDP_QOS_INFO_LEN 255
|
||||
|
||||
#ifdef WLAN_FEATURE_NAN_DATAPATH
|
||||
#define WLAN_HDD_NDP_GET_SSID(adapter) ( \
|
||||
&(adapter)->sessionCtx.ndp_ctx.conn_info.SSID)
|
||||
|
||||
#define WLAN_HDD_NDP_GET_BSSID(adapter) ( \
|
||||
&(adapter)->sessionCtx.ndp_ctx.conn_info.bssId)
|
||||
#else
|
||||
#define WLAN_HDD_NDP_GET_SSID(adapter) (NULL)
|
||||
#define WLAN_HDD_NDP_GET_BSSID(adapter) (NULL)
|
||||
#endif /* WLAN_FEATURE_NAN_DATAPATH */
|
||||
|
||||
/**
|
||||
* enum qca_wlan_vendor_attr_ndp_params - vendor attribute parameters
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD: NDP Sub command
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_TRANSACTION_ID: Transaction id reference
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_STATUS_ID: NDP status id
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_INSTANCE_ID: Service instance id
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL_SPEC_CHANNEL: Requested channel
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_PEER_DISCOVERY_MAC_ADDR: Peer discovery mac addr
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR: Iface name
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_SECURITY: Security configuration
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS: Qos configuration
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO_LEN: Application info length
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO: Application info
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID: NDP instance id
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_NUM_INSTANCE_ID: Number of NDP instance ids
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID_ARRAY: NDP instance id array
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_SCHEDULE_RESPONSE_CODE: Schedule response
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_SCHEDULE_STATUS_CODE: schedule status
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_NDI_MAC_ADDR: NDI mac address
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_TYPE: Driver return status
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE: Driver return value
|
||||
*/
|
||||
enum qca_wlan_vendor_attr_ndp_params {
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_PARAM_INVALID = 0,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_TRANSACTION_ID,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_INSTANCE_ID,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL_SPEC_CHANNEL,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_PEER_DISCOVERY_MAC_ADDR,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_SECURITY,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO_LEN,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_NUM_INSTANCE_ID,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID_ARRAY,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_SCHEDULE_RESPONSE_CODE,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_SCHEDULE_STATUS_CODE,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_NDI_MAC_ADDR,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_TYPE,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE,
|
||||
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_AFTER_LAST,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX =
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_AFTER_LAST - 1,
|
||||
};
|
||||
|
||||
/**
|
||||
* enum qca_wlan_vendor_attr_ndp_cfg_security - vendor security attribute
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_SECURITY_ENABLE: Security enabled
|
||||
*/
|
||||
enum qca_wlan_vendor_attr_ndp_cfg_security {
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_SECURITY_ENABLE = 1,
|
||||
};
|
||||
|
||||
/**
|
||||
* enum qca_wlan_vendor_attr_ndp_qos - vendor qos attribute
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_QOS_CONFIG: NDP QoS configuration
|
||||
*/
|
||||
enum qca_wlan_vendor_attr_ndp_qos {
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_QOS_CONFIG = 1,
|
||||
};
|
||||
|
||||
/**
|
||||
* enum qca_wlan_vendor_attr_ndp_sub_cmd_value - NDP subcmd value
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_INVALID: Unused subcmd value
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_CREATE: iface create
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_DELETE: iface delete
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_REQUEST: NDP initiator request
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_RESPONSE: NDP initiator response
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_REQUEST: NDP responder request
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_RESPONSE: NDP responder response
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_END_REQUEST: NDP end request
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_END_RESPONSE: NDP end response
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_SCHEDULE_UPDATE_REQUEST: NDP update request
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_SCHEDULE_UPDATE_RESPONSE: NDP update response
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_REQUEST_IND: NDP request indication
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_CONFIRM_IND: NDP confirm indication
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_SCHEDULE_UPDATE_IND: NDP sched update indication
|
||||
* @QCA_WLAN_VENDOR_ATTR_NDP_END_IND: NDP End indication
|
||||
*/
|
||||
enum qca_wlan_vendor_attr_ndp_sub_cmd_value {
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_INVALID = 0,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_CREATE = 1,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_DELETE = 2,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_REQUEST = 3,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_RESPONSE = 4,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_REQUEST = 5,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_RESPONSE = 6,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_END_REQUEST = 7,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_END_RESPONSE = 8,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_SCHEDULE_UPDATE_REQUEST = 9,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_SCHEDULE_UPDATE_RESPONSE = 10,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_REQUEST_IND = 11,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_CONFIRM_IND = 12,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_SCHEDULE_UPDATE_IND = 13,
|
||||
QCA_WLAN_VENDOR_ATTR_NDP_END_IND = 14
|
||||
};
|
||||
|
||||
/** enum nan_datapath_state - NAN datapath states
|
||||
* @NAN_DATA_NDI_CREATING_STATE: NDI create is in progress
|
||||
* @NAN_DATA_NDI_CREATED_STATE: NDI successfully crated
|
||||
* @NAN_DATA_NDI_DELETING_STATE: NDI delete is in progress
|
||||
* @NAN_DATA_NDI_DELETED_STATE: NDI delete is in progress
|
||||
* @NAN_DATA_PEER_CREATE_STATE: Peer create is in progress
|
||||
* @NAN_DATA_PEER_DELETE_STATE: Peer delete is in progrss
|
||||
* @NAN_DATA_CONNECTING_STATE: Data connection in progress
|
||||
* @NAN_DATA_CONNECTED_STATE: Data connection successful
|
||||
* @NAN_DATA_END_STATE: NDP end is in progress
|
||||
* @NAN_DATA_DISCONNECTED_STATE: NDP is in disconnected state
|
||||
*/
|
||||
enum nan_datapath_state {
|
||||
NAN_DATA_NDI_CREATING_STATE = 0,
|
||||
NAN_DATA_NDI_CREATED_STATE = 1,
|
||||
NAN_DATA_NDI_DELETING_STATE = 2,
|
||||
NAN_DATA_NDI_DELETED_STATE = 3,
|
||||
NAN_DATA_PEER_CREATE_STATE = 4,
|
||||
NAN_DATA_PEER_DELETE_STATE = 5,
|
||||
NAN_DATA_CONNECTING_STATE = 6,
|
||||
NAN_DATA_CONNECTED_STATE = 7,
|
||||
NAN_DATA_END_STATE = 8,
|
||||
NAN_DATA_DISCONNECTED_STATE = 9,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct nan_datapath_ctx - context for nan data path
|
||||
* @state: Current state of NDP
|
||||
* @active_ndp_sessions: active ndp sessions per adapter
|
||||
* @ndp_create_transaction_id: transaction id for create req
|
||||
* @ndp_delete_transaction_id: transaction id for delete req
|
||||
* @wext_state: Wext state variable
|
||||
* @conn_info: NDP connection info
|
||||
* @roam_info: NDP roam info
|
||||
* @gtk_offload_req_params: GTK offload request params
|
||||
* @ndp_key_installed: NDP security key installed
|
||||
* @ndp_enc_key: NDP encryption key info
|
||||
* @ndp_debug_state: debug state info
|
||||
*/
|
||||
struct nan_datapath_ctx {
|
||||
enum nan_datapath_state state;
|
||||
uint32_t active_ndp_sessions;
|
||||
uint16_t ndp_create_transaction_id;
|
||||
uint16_t ndp_delete_transaction_id;
|
||||
hdd_wext_state_t wext_state;
|
||||
connection_info_t conn_info;
|
||||
#ifdef WLAN_FEATURE_GTK_OFFLOAD
|
||||
tSirGtkOffloadParams gtk_offload_req_params;
|
||||
#endif
|
||||
bool ndp_key_installed;
|
||||
tCsrRoamSetKey ndp_enc_key;
|
||||
uint32_t ndp_debug_state;
|
||||
};
|
||||
|
||||
#ifdef WLAN_FEATURE_NAN_DATAPATH
|
||||
void hdd_ndp_print_ini_config(struct hdd_context_s *hdd_ctx);
|
||||
void hdd_nan_datapath_enable(struct hdd_config *cfg_ini, bool enable);
|
||||
void hdd_nan_datapath_target_config(struct hdd_context_s *hdd_ctx,
|
||||
struct wma_tgt_cfg *cfg);
|
||||
|
||||
void hdd_ndp_event_handler(struct hdd_adapter_s *adapter,
|
||||
tCsrRoamInfo *roam_info, uint32_t roam_id, eRoamCmdStatus roam_status,
|
||||
eCsrRoamResult roam_result);
|
||||
int wlan_hdd_cfg80211_process_ndp_cmd(struct wiphy *wiphy,
|
||||
struct wireless_dev *wdev, const void *data, int data_len);
|
||||
int hdd_init_nan_data_mode(struct hdd_adapter_s *adapter);
|
||||
#else
|
||||
static inline void hdd_ndp_print_ini_config(struct hdd_context_s *hdd_ctx)
|
||||
{
|
||||
}
|
||||
static inline void hdd_nan_datapath_enable(struct hdd_config *cfg_ini,
|
||||
bool enable)
|
||||
{
|
||||
}
|
||||
static inline void hdd_nan_datapath_target_config(struct hdd_context_s *hdd_ctx,
|
||||
struct wma_tgt_cfg *cfg)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void hdd_ndp_event_handler(struct hdd_adapter_s *adapter,
|
||||
tCsrRoamInfo *roam_info, uint32_t roam_id, eRoamCmdStatus roam_status,
|
||||
eCsrRoamResult roam_result)
|
||||
{
|
||||
}
|
||||
static inline int wlan_hdd_cfg80211_process_ndp_cmd(struct wiphy *wiphy,
|
||||
struct wireless_dev *wdev, const void *data, int data_len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline int hdd_init_nan_data_mode(struct hdd_adapter_s *adapter)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* WLAN_FEATURE_NAN_DATAPATH */
|
||||
|
||||
#endif /* __WLAN_HDD_NAN_DATAPATH_H */
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@
|
|||
#include "wlan_hdd_ocb.h"
|
||||
#include "wlan_hdd_napi.h"
|
||||
#include "cdp_txrx_flow_ctrl_legacy.h"
|
||||
#include "wlan_hdd_nan_datapath.h"
|
||||
|
||||
#define HDD_FINISH_ULA_TIME_OUT 800
|
||||
#define HDD_SET_MCBC_FILTERS_TO_FW 1
|
||||
|
|
@ -1598,7 +1599,12 @@ void hdd_statistics_cb(void *pStats, void *pContext)
|
|||
void hdd_clear_roam_profile_ie(hdd_adapter_t *pAdapter)
|
||||
{
|
||||
int i = 0;
|
||||
hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
|
||||
hdd_wext_state_t *pWextState;
|
||||
|
||||
if (QDF_NDI_MODE == pAdapter->device_mode)
|
||||
pWextState = WLAN_HDD_GET_NDP_WEXT_STATE_PTR(pAdapter);
|
||||
else
|
||||
pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
|
||||
|
||||
/* clear WPA/RSN/WSC IE information in the profile */
|
||||
pWextState->roamProfile.nWPAReqIELength = 0;
|
||||
|
|
@ -10865,16 +10871,27 @@ const struct iw_handler_def we_handler_def = {
|
|||
int hdd_set_wext(hdd_adapter_t *pAdapter)
|
||||
{
|
||||
hdd_wext_state_t *pwextBuf;
|
||||
hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
|
||||
hdd_station_ctx_t *pHddStaCtx;
|
||||
tCsrSSIDInfo *ssid_list;
|
||||
struct qdf_mac_addr *bssid;
|
||||
|
||||
pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
|
||||
if (QDF_NDI_MODE == pAdapter->device_mode) {
|
||||
pwextBuf = WLAN_HDD_GET_NDP_WEXT_STATE_PTR(pAdapter);
|
||||
ssid_list = WLAN_HDD_NDP_GET_SSID(pAdapter);
|
||||
bssid = WLAN_HDD_NDP_GET_BSSID(pAdapter);
|
||||
} else {
|
||||
pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
|
||||
pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
|
||||
ssid_list = &pHddStaCtx->conn_info.SSID;
|
||||
bssid = &pHddStaCtx->conn_info.bssId;
|
||||
}
|
||||
|
||||
/* Now configure the roaming profile links. To SSID and bssid. */
|
||||
pwextBuf->roamProfile.SSIDs.numOfSSIDs = 0;
|
||||
pwextBuf->roamProfile.SSIDs.SSIDList = &pHddStaCtx->conn_info.SSID;
|
||||
pwextBuf->roamProfile.SSIDs.SSIDList = ssid_list;
|
||||
|
||||
pwextBuf->roamProfile.BSSIDs.numOfBSSIDs = 0;
|
||||
pwextBuf->roamProfile.BSSIDs.bssid = &pHddStaCtx->conn_info.bssId;
|
||||
pwextBuf->roamProfile.BSSIDs.bssid = bssid;
|
||||
|
||||
/*Set the numOfChannels to zero to scan all the channels */
|
||||
pwextBuf->roamProfile.ChannelInfo.numOfChannels = 0;
|
||||
|
|
@ -10907,15 +10924,28 @@ int hdd_set_wext(hdd_adapter_t *pAdapter)
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* hdd_register_wext() - register wext context
|
||||
* @dev: net device handle
|
||||
*
|
||||
* Registers wext interface context for a given net device
|
||||
*
|
||||
* Returns: 0 on success, errno on failure
|
||||
*/
|
||||
int hdd_register_wext(struct net_device *dev)
|
||||
{
|
||||
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
|
||||
hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
|
||||
hdd_wext_state_t *pwextBuf;
|
||||
QDF_STATUS status;
|
||||
|
||||
ENTER();
|
||||
|
||||
/* Zero the memory. This zeros the profile structure. */
|
||||
if (QDF_NDI_MODE == pAdapter->device_mode)
|
||||
pwextBuf = WLAN_HDD_GET_NDP_WEXT_STATE_PTR(pAdapter);
|
||||
else
|
||||
pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
|
||||
|
||||
/* Zero the memory. This zeros the profile structure */
|
||||
memset(pwextBuf, 0, sizeof(hdd_wext_state_t));
|
||||
|
||||
init_completion(&(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->
|
||||
|
|
|
|||
|
|
@ -616,7 +616,7 @@ typedef enum {
|
|||
eCSR_ROAM_RESULT_NDP_NEW_PEER_IND,
|
||||
eCSR_ROAM_RESULT_NDP_CONFIRM_IND,
|
||||
eCSR_ROAM_RESULT_NDP_INDICATION,
|
||||
eCSR_ROAM_RESULT_NDP_RESPONDER_REQ,
|
||||
eCSR_ROAM_RESULT_NDP_SCHED_UPDATE_RSP,
|
||||
eCSR_ROAM_RESULT_NDP_RESPONDER_RSP,
|
||||
eCSR_ROAM_RESULT_NDP_END_RSP,
|
||||
eCSR_ROAM_RESULT_NDP_PEER_DEPARTED_IND,
|
||||
|
|
|
|||
Loading…
Reference in a new issue