Merge tag 'android-8.0.0_r34' of https://android.googlesource.com/platform//hardware/qcom/wlan into HEAD
Android 8.0.0 release 34
Change-Id: Iee615c89dd36ea8e926311bfae0b97e051aeb3ed
diff --git a/Android.mk b/Android.mk
index 0b9c8ba..2c73630 100644
--- a/Android.mk
+++ b/Android.mk
@@ -2,9 +2,9 @@
ifeq ($(WLAN_PATH),$(call project-path-for,wlan))
-# TODO: Fix this properly when b/37901207 is fixed
-#ifneq ($(BOARD_IS_AUTOMOTIVE),true)
-ifeq ($(filter bat,$(TARGET_DEVICE)),)
+# TODO: Find a better way to separate build configs for ADP vs non-ADP devices
+ifneq ($(BOARD_IS_AUTOMOTIVE),true)
include $(call all-subdir-makefiles)
endif
+
endif
diff --git a/cld80211-lib/cld80211_lib.c b/cld80211-lib/cld80211_lib.c
index 491fb3e..5c8255b 100644
--- a/cld80211-lib/cld80211_lib.c
+++ b/cld80211-lib/cld80211_lib.c
@@ -225,7 +225,7 @@
}
-static int get_multicast_id(struct cld80211_ctx *ctx, const char *group)
+static int get_multicast_id(struct cld80211_ctx *ctx, const char *group, bool sync_driver)
{
struct family_data res = { group, -ENOENT };
struct nl_msg *nlmsg = nlmsg_alloc();
@@ -238,9 +238,11 @@
CTRL_CMD_GETFAMILY, 0);
nla_put_string(nlmsg, CTRL_ATTR_FAMILY_NAME, "cld80211");
- cld80211_send_recv_msg(ctx, nlmsg, family_handler, &res);
- ALOGI("%s: nlctrl family id: %d group: %s mcast_id: %d", getprogname(),
- ctx->nlctrl_familyid, group, res.id);
+ if (sync_driver == true) {
+ cld80211_send_recv_msg(ctx, nlmsg, family_handler, &res);
+ ALOGI("%s: nlctrl family id: %d group: %s mcast_id: %d", getprogname(),
+ ctx->nlctrl_familyid, group, res.id);
+ }
nlmsg_free(nlmsg);
return res.id;
}
@@ -252,7 +254,7 @@
ALOGE("%s: ctx/mcgroup is NULL: %s", getprogname(), __func__);
return 0;
}
- int id = get_multicast_id(ctx, mcgroup);
+ int id = get_multicast_id(ctx, mcgroup, true);
if (id < 0) {
ALOGE("%s: Could not find group %s, errno: %d id: %d",
getprogname(), mcgroup, errno, id);
@@ -275,7 +277,7 @@
ALOGE("%s: ctx/mcgroup is NULL: %s", getprogname(), __func__);
return 0;
}
- int id = get_multicast_id(ctx, mcgroup);
+ int id = get_multicast_id(ctx, mcgroup, false);
if (id < 0) {
ALOGE("%s: Could not find group %s, errno: %d id: %d",
getprogname(), mcgroup, errno, id);
diff --git a/qcwcn/wifi_hal/common.cpp b/qcwcn/wifi_hal/common.cpp
index 2dd8395..2541b65 100644
--- a/qcwcn/wifi_hal/common.cpp
+++ b/qcwcn/wifi_hal/common.cpp
@@ -23,6 +23,7 @@
#include "wifi_hal.h"
#include "common.h"
+#include <errno.h>
interface_info *getIfaceInfo(wifi_interface_handle handle)
{
@@ -447,3 +448,26 @@
return LowiWifiHalApi;
}
+wifi_error mapErrorKernelToWifiHAL(int error)
+{
+ if (error >= 0)
+ return WIFI_ERROR_NONE;
+
+ switch (error) {
+ case -EOPNOTSUPP:
+ return WIFI_ERROR_NOT_SUPPORTED;
+ case -EAGAIN:
+ return WIFI_ERROR_NOT_AVAILABLE;
+ case -EINVAL:
+ return WIFI_ERROR_INVALID_ARGS;
+ case -ETIMEDOUT:
+ return WIFI_ERROR_TIMED_OUT;
+ case -ENOMEM:
+ return WIFI_ERROR_OUT_OF_MEMORY;
+ case -EBUSY:
+ return WIFI_ERROR_BUSY;
+ default:
+ return WIFI_ERROR_UNKNOWN;
+ }
+ return WIFI_ERROR_UNKNOWN;
+}
diff --git a/qcwcn/wifi_hal/common.h b/qcwcn/wifi_hal/common.h
index 649bf6a..c3ac14e 100644
--- a/qcwcn/wifi_hal/common.h
+++ b/qcwcn/wifi_hal/common.h
@@ -182,6 +182,7 @@
wifi_error wifi_start_rssi_monitoring(wifi_request_id id, wifi_interface_handle
iface, s8 max_rssi, s8 min_rssi, wifi_rssi_event_handler eh);
wifi_error wifi_stop_rssi_monitoring(wifi_request_id id, wifi_interface_handle iface);
+wifi_error mapErrorKernelToWifiHAL(int error);
// some common macros
#define min(x, y) ((x) < (y) ? (x) : (y))
diff --git a/qcwcn/wifi_hal/cpp_bindings.cpp b/qcwcn/wifi_hal/cpp_bindings.cpp
index f67b411..36befed 100644
--- a/qcwcn/wifi_hal/cpp_bindings.cpp
+++ b/qcwcn/wifi_hal/cpp_bindings.cpp
@@ -1003,5 +1003,5 @@
cleanup:
delete *vCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
diff --git a/qcwcn/wifi_hal/gscan.cpp b/qcwcn/wifi_hal/gscan.cpp
index e6d71a0..db5f140 100644
--- a/qcwcn/wifi_hal/gscan.cpp
+++ b/qcwcn/wifi_hal/gscan.cpp
@@ -97,20 +97,6 @@
struct nlattr *nlData;
interface_info *ifaceInfo = getIfaceInfo(handle);
wifi_handle wifiHandle = getWifiHandle(handle);
- lowi_cb_table_t *lowiWifiHalApi = NULL;
-
- /* Route GSCAN request through LOWI if supported */
- lowiWifiHalApi = getLowiCallbackTable(GSCAN_SUPPORTED);
- if (lowiWifiHalApi == NULL ||
- lowiWifiHalApi->get_valid_channels == NULL) {
- ALOGV("%s: Sending cmd directly to host", __FUNCTION__);
- } else {
- ret = lowiWifiHalApi->get_valid_channels(handle, band, max_channels,
- channels, num_channels);
- ALOGV("%s: lowi get_valid_channels "
- "returned: %d. Exit.", __FUNCTION__, ret);
- return (wifi_error)ret;
- }
/* No request id from caller, so generate one and pass it on to the driver.
* Generate one randomly.
@@ -175,7 +161,7 @@
cleanup:
delete gScanCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
wifi_error wifi_get_gscan_capabilities(wifi_interface_handle handle,
@@ -184,32 +170,20 @@
wifi_error ret = WIFI_SUCCESS;
wifi_handle wifiHandle = getWifiHandle(handle);
hal_info *info = getHalInfo(wifiHandle);
- lowi_cb_table_t *lowiWifiHalApi = NULL;
if (!(info->supported_feature_set & WIFI_FEATURE_GSCAN)) {
ALOGE("%s: GSCAN is not supported by driver", __FUNCTION__);
return WIFI_ERROR_NOT_SUPPORTED;
- }
+ }
if (capabilities == NULL) {
ALOGE("%s: NULL capabilities pointer provided. Exit.", __FUNCTION__);
return WIFI_ERROR_INVALID_ARGS;
}
- /* Route GSCAN request through LOWI if supported */
- lowiWifiHalApi = getLowiCallbackTable(GSCAN_SUPPORTED);
- if (lowiWifiHalApi == NULL ||
- lowiWifiHalApi->get_gscan_capabilities == NULL) {
- ALOGV("%s: Sending cmd directly to host", __FUNCTION__);
- } else {
- ret = lowiWifiHalApi->get_gscan_capabilities(handle, capabilities);
- ALOGV("%s: lowi get_gscan_capabilities returned: %d. Exit.", __FUNCTION__, ret);
- return ret;
- }
-
memcpy(capabilities, &info->capa.gscan_capa, sizeof(wifi_gscan_capabilities));
- return ret;
+ return mapErrorKernelToWifiHAL(ret);
}
wifi_error wifi_start_gscan(wifi_request_id id,
@@ -227,7 +201,6 @@
wifi_scan_bucket_spec bucketSpec;
struct nlattr *nlBuckectSpecList;
hal_info *info = getHalInfo(wifiHandle);
- lowi_cb_table_t *lowiWifiHalApi = NULL;
gscan_event_handlers* event_handlers;
GScanCommandEventHandler *gScanStartCmdEventHandler;
@@ -240,18 +213,6 @@
return WIFI_ERROR_NOT_SUPPORTED;
}
- /* Route GSCAN request through LOWI if supported */
- lowiWifiHalApi = getLowiCallbackTable(GSCAN_SUPPORTED);
- if (lowiWifiHalApi == NULL ||
- lowiWifiHalApi->start_gscan == NULL) {
- ALOGV("%s: Sending cmd directly to host", __FUNCTION__);
- } else {
- ret = lowiWifiHalApi->start_gscan(id, iface, params, handler);
- ALOGV("%s: lowi start_gscan "
- "returned: %d. Exit.", __FUNCTION__, ret);
- return (wifi_error)ret;
- }
-
ALOGV("%s: RequestId:%d ", __FUNCTION__, id);
/* Wi-Fi HAL doesn't need to check if a similar request to start gscan was
* made earlier. If start_gscan() is called while another gscan is already
@@ -435,7 +396,7 @@
__FUNCTION__, ret);
gScanStartCmdEventHandler->disableEventHandling();
}
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
@@ -445,7 +406,6 @@
int ret = 0;
GScanCommand *gScanCommand;
struct nlattr *nlData;
- lowi_cb_table_t *lowiWifiHalApi = NULL;
interface_info *ifaceInfo = getIfaceInfo(iface);
wifi_handle wifiHandle = getWifiHandle(iface);
@@ -462,18 +422,6 @@
return WIFI_ERROR_NOT_SUPPORTED;
}
- /* Route GSCAN request through LOWI if supported */
- lowiWifiHalApi = getLowiCallbackTable(GSCAN_SUPPORTED);
- if (lowiWifiHalApi == NULL ||
- lowiWifiHalApi->stop_gscan == NULL) {
- ALOGV("%s: Sending cmd directly to host", __FUNCTION__);
- } else {
- ret = lowiWifiHalApi->stop_gscan(id, iface);
- ALOGV("%s: lowi stop_gscan "
- "returned: %d. Exit.", __FUNCTION__, ret);
- return (wifi_error)ret;
- }
-
if (gScanStartCmdEventHandler == NULL ||
gScanStartCmdEventHandler->isEventHandlingEnabled() == false) {
ALOGE("%s: GSCAN isn't running or already stopped. "
@@ -526,7 +474,7 @@
cleanup:
delete gScanCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* Set the GSCAN BSSID Hotlist. */
@@ -541,7 +489,6 @@
interface_info *ifaceInfo = getIfaceInfo(iface);
wifi_handle wifiHandle = getWifiHandle(iface);
hal_info *info = getHalInfo(wifiHandle);
- lowi_cb_table_t *lowiWifiHalApi = NULL;
gscan_event_handlers* event_handlers;
GScanCommandEventHandler *gScanSetBssidHotlistCmdEventHandler;
@@ -555,18 +502,6 @@
return WIFI_ERROR_NOT_SUPPORTED;
}
- /* Route request through LOWI if supported*/
- lowiWifiHalApi = getLowiCallbackTable(GSCAN_SUPPORTED);
- if (lowiWifiHalApi == NULL ||
- lowiWifiHalApi->set_bssid_hotlist == NULL) {
- ALOGV("%s: Sending cmd directly to host", __FUNCTION__);
- } else {
- ret = lowiWifiHalApi->set_bssid_hotlist(id, iface, params,handler);
- ALOGV("%s: lowi set_bssid_hotlist "
- "returned: %d. Exit.", __FUNCTION__, ret);
- return (wifi_error)ret;
- }
-
/* Wi-Fi HAL doesn't need to check if a similar request to set bssid
* hotlist was made earlier. If set_bssid_hotlist() is called while
* another one is running, the request will be sent down to driver and
@@ -702,7 +637,7 @@
__FUNCTION__, ret);
gScanSetBssidHotlistCmdEventHandler->disableEventHandling();
}
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
wifi_error wifi_reset_bssid_hotlist(wifi_request_id id,
@@ -714,7 +649,6 @@
interface_info *ifaceInfo = getIfaceInfo(iface);
wifi_handle wifiHandle = getWifiHandle(iface);
hal_info *info = getHalInfo(wifiHandle);
- lowi_cb_table_t *lowiWifiHalApi = NULL;
gscan_event_handlers* event_handlers;
GScanCommandEventHandler *gScanSetBssidHotlistCmdEventHandler;
@@ -728,19 +662,6 @@
return WIFI_ERROR_NOT_SUPPORTED;
}
- /* Route request through LOWI if supported*/
- lowiWifiHalApi = getLowiCallbackTable(GSCAN_SUPPORTED);
- if (lowiWifiHalApi == NULL ||
- lowiWifiHalApi->reset_bssid_hotlist == NULL) {
- ALOGV("%s: Sending cmd directly to host", __FUNCTION__);
- } else {
- ret = lowiWifiHalApi->reset_bssid_hotlist(id, iface);
- ALOGV("%s: lowi reset_bssid_hotlist "
- "returned: %d. Exit.", __FUNCTION__, ret);
- return (wifi_error)ret;
- }
-
-
if (gScanSetBssidHotlistCmdEventHandler == NULL ||
(gScanSetBssidHotlistCmdEventHandler->isEventHandlingEnabled() ==
false)) {
@@ -794,7 +715,7 @@
cleanup:
delete gScanCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* Set the GSCAN Significant AP Change list. */
@@ -809,7 +730,6 @@
interface_info *ifaceInfo = getIfaceInfo(iface);
wifi_handle wifiHandle = getWifiHandle(iface);
hal_info *info = getHalInfo(wifiHandle);
- lowi_cb_table_t *lowiWifiHalApi = NULL;
gscan_event_handlers* event_handlers;
GScanCommandEventHandler *gScanSetSignificantChangeCmdEventHandler;
@@ -823,21 +743,6 @@
return WIFI_ERROR_NOT_SUPPORTED;
}
- /* Route request through LOWI if supported*/
- lowiWifiHalApi = getLowiCallbackTable(GSCAN_SUPPORTED);
- if (lowiWifiHalApi == NULL ||
- lowiWifiHalApi->set_significant_change_handler == NULL) {
- ALOGV("%s: Sending cmd directly to host", __FUNCTION__);
- } else {
- ret = lowiWifiHalApi->set_significant_change_handler(id,
- iface,
- params,
- handler);
- ALOGV("%s: lowi set_significant_change_handler "
- "returned: %d. Exit.", __FUNCTION__, ret);
- return (wifi_error)ret;
- }
-
/* Wi-Fi HAL doesn't need to check if a similar request to set significant
* change list was made earlier. If set_significant_change() is called while
* another one is running, the request will be sent down to driver and
@@ -984,7 +889,7 @@
gScanSetSignificantChangeCmdEventHandler->disableEventHandling();
}
delete gScanCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* Clear the GSCAN Significant AP change list. */
@@ -997,7 +902,6 @@
interface_info *ifaceInfo = getIfaceInfo(iface);
wifi_handle wifiHandle = getWifiHandle(iface);
hal_info *info = getHalInfo(wifiHandle);
- lowi_cb_table_t *lowiWifiHalApi = NULL;
gscan_event_handlers* event_handlers;
GScanCommandEventHandler *gScanSetSignificantChangeCmdEventHandler;
@@ -1011,18 +915,6 @@
return WIFI_ERROR_NOT_SUPPORTED;
}
- /* Route request through LOWI if supported*/
- lowiWifiHalApi = getLowiCallbackTable(GSCAN_SUPPORTED);
- if (lowiWifiHalApi == NULL ||
- lowiWifiHalApi->reset_significant_change_handler == NULL) {
- ALOGV("%s: Sending cmd directly to host", __FUNCTION__);
- } else {
- ret = lowiWifiHalApi->reset_significant_change_handler(id, iface);
- ALOGV("%s: lowi reset_significant_change_handler "
- "returned: %d. Exit.", __FUNCTION__, ret);
- return (wifi_error)ret;
- }
-
if (gScanSetSignificantChangeCmdEventHandler == NULL ||
(gScanSetSignificantChangeCmdEventHandler->isEventHandlingEnabled() ==
false)) {
@@ -1078,7 +970,7 @@
cleanup:
delete gScanCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* Get the GSCAN cached scan results. */
@@ -1090,7 +982,6 @@
int requestId, ret = 0, retRequestRsp = 0;
GScanCommand *gScanCommand;
struct nlattr *nlData;
- lowi_cb_table_t *lowiWifiHalApi = NULL;
interface_info *ifaceInfo = getIfaceInfo(iface);
wifi_handle wifiHandle = getWifiHandle(iface);
@@ -1102,22 +993,6 @@
return WIFI_ERROR_NOT_SUPPORTED;
}
- /* Route GSCAN request through LOWI if supported */
- lowiWifiHalApi = getLowiCallbackTable(GSCAN_SUPPORTED);
- if (lowiWifiHalApi == NULL ||
- lowiWifiHalApi->get_cached_gscan_results == NULL) {
- ALOGV("%s: Sending cmd directly to host", __FUNCTION__);
- } else {
- ret = lowiWifiHalApi->get_cached_gscan_results(iface,
- flush,
- max,
- results,
- num);
- ALOGV("%s: lowi get_cached_gscan_results"
- "returned: %d. Exit.", __FUNCTION__, ret);
- return (wifi_error)ret;
- }
-
/* No request id from caller, so generate one and pass it on to the driver. */
/* Generate it randomly */
requestId = get_requestid();
@@ -1219,7 +1094,7 @@
cleanup:
gScanCommand->freeRspParams(eGScanGetCachedResultsRspParams);
delete gScanCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* Random MAC OUI for PNO */
@@ -1274,7 +1149,7 @@
cleanup:
delete vCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
@@ -1958,7 +1833,7 @@
__FUNCTION__, ret);
gScanSetPnoListCmdEventHandler->disableEventHandling();
}
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* Reset the ePNO list - no ePNO networks should be matched after this */
@@ -2028,7 +1903,7 @@
cleanup:
delete gScanCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* Set the ePNO Passpoint List. */
@@ -2197,7 +2072,7 @@
__FUNCTION__, ret);
gScanPnoSetPasspointListCmdEventHandler->disableEventHandling();
}
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
wifi_error wifi_reset_passpoint_list(wifi_request_id id,
@@ -2285,7 +2160,7 @@
cleanup:
delete gScanCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
int GScanCommand::allocCachedResultsTemp(int max,
diff --git a/qcwcn/wifi_hal/ifaceeventhandler.cpp b/qcwcn/wifi_hal/ifaceeventhandler.cpp
index fd959ac..9e11ce1 100644
--- a/qcwcn/wifi_hal/ifaceeventhandler.cpp
+++ b/qcwcn/wifi_hal/ifaceeventhandler.cpp
@@ -72,7 +72,7 @@
}
mwifiEventHandler->setCallbackHandler(eh);
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* Reset monitoring for the NL event*/
@@ -96,7 +96,7 @@
ALOGV("Object mwifiEventHandler for id = %d already Deleted", id);
}
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* This function will be the main handler for the registered incoming
diff --git a/qcwcn/wifi_hal/llstats.cpp b/qcwcn/wifi_hal/llstats.cpp
index 88bf79f..9a0365e 100644
--- a/qcwcn/wifi_hal/llstats.cpp
+++ b/qcwcn/wifi_hal/llstats.cpp
@@ -1293,7 +1293,7 @@
}
cleanup:
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
//Implementation of the functions exposed in LLStats.h
@@ -1356,7 +1356,7 @@
}
cleanup:
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
@@ -1413,5 +1413,5 @@
cleanup:
delete LLCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
diff --git a/qcwcn/wifi_hal/nan.cpp b/qcwcn/wifi_hal/nan.cpp
index 524bacb..894873a 100644
--- a/qcwcn/wifi_hal/nan.cpp
+++ b/qcwcn/wifi_hal/nan.cpp
@@ -54,7 +54,7 @@
}
ret = nanCommand->setCallbackHandler(handlers);
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
wifi_error nan_get_version(wifi_handle handle,
@@ -103,7 +103,7 @@
}
cleanup:
delete nanCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* Function to send disable request to the wifi driver.*/
@@ -144,7 +144,7 @@
}
cleanup:
delete nanCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* Function to send publish request to the wifi driver.*/
@@ -186,7 +186,7 @@
}
cleanup:
delete nanCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* Function to send publish cancel to the wifi driver.*/
@@ -228,7 +228,7 @@
}
cleanup:
delete nanCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* Function to send Subscribe request to the wifi driver.*/
@@ -270,7 +270,7 @@
}
cleanup:
delete nanCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* Function to cancel subscribe to the wifi driver.*/
@@ -312,7 +312,7 @@
}
cleanup:
delete nanCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* Function to send NAN follow up request to the wifi driver.*/
@@ -354,7 +354,7 @@
}
cleanup:
delete nanCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* Function to send NAN statistics request to the wifi driver.*/
@@ -396,7 +396,7 @@
}
cleanup:
delete nanCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* Function to send NAN configuration request to the wifi driver.*/
@@ -438,7 +438,7 @@
}
cleanup:
delete nanCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* Function to send NAN request to the wifi driver.*/
@@ -480,7 +480,7 @@
}
cleanup:
delete nanCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* Function to send NAN Beacon sdf payload to the wifi driver.
@@ -526,7 +526,7 @@
cleanup:
delete nanCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
wifi_error nan_get_sta_parameter(transaction_id id,
@@ -550,7 +550,7 @@
}
cleanup:
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* Function to get NAN capabilities */
@@ -591,7 +591,7 @@
}
cleanup:
delete nanCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* Function to get NAN capabilities */
@@ -677,7 +677,7 @@
return WIFI_SUCCESS;
cleanup:
delete *nanCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
wifi_error nan_data_interface_create(transaction_id id,
@@ -698,7 +698,7 @@
&nanCommand);
if (ret != WIFI_SUCCESS) {
ALOGE("%s: Initialization failed", __FUNCTION__);
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* Add the vendor specific attributes for the NL command. */
@@ -725,7 +725,7 @@
}
cleanup:
delete nanCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
wifi_error nan_data_interface_delete(transaction_id id,
@@ -745,7 +745,7 @@
&nanCommand);
if (ret != WIFI_SUCCESS) {
ALOGE("%s: Initialization failed", __FUNCTION__);
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* Add the vendor specific attributes for the NL command. */
@@ -773,7 +773,7 @@
}
cleanup:
delete nanCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
wifi_error nan_data_request_initiator(transaction_id id,
@@ -792,7 +792,7 @@
&nanCommand);
if (ret != WIFI_SUCCESS) {
ALOGE("%s: Initialization failed", __FUNCTION__);
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
if ((msg->cipher_type != NAN_CIPHER_SUITE_SHARED_KEY_NONE) &&
@@ -878,30 +878,27 @@
if (nanCommand->put_u32(QCA_WLAN_VENDOR_ATTR_NDP_CSID,
msg->cipher_type))
goto cleanup;
-
- if ( msg->key_info.key_type == NAN_SECURITY_KEY_INPUT_PMK &&
- msg->key_info.body.pmk_info.pmk_len == NAN_PMK_INFO_LEN) {
- if (nanCommand->put_bytes(QCA_WLAN_VENDOR_ATTR_NDP_PMK,
- (char *)msg->key_info.body.pmk_info.pmk,
- msg->key_info.body.pmk_info.pmk_len))
- goto cleanup;
- } else if (msg->key_info.key_type ==
- NAN_SECURITY_KEY_INPUT_PASSPHRASE &&
- msg->key_info.body.passphrase_info.passphrase_len >=
- NAN_SECURITY_MIN_PASSPHRASE_LEN &&
- msg->key_info.body.passphrase_info.passphrase_len <=
- NAN_SECURITY_MAX_PASSPHRASE_LEN) {
- if (nanCommand->put_bytes(QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE,
- (char *)msg->key_info.body.passphrase_info.passphrase,
- msg->key_info.body.passphrase_info.passphrase_len))
- goto cleanup;
- }
-
- if (msg->service_name_len) {
- if (nanCommand->put_bytes(QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME,
- (char *)msg->service_name, msg->service_name_len))
- goto cleanup;
- }
+ }
+ if ( msg->key_info.key_type == NAN_SECURITY_KEY_INPUT_PMK &&
+ msg->key_info.body.pmk_info.pmk_len == NAN_PMK_INFO_LEN) {
+ if (nanCommand->put_bytes(QCA_WLAN_VENDOR_ATTR_NDP_PMK,
+ (char *)msg->key_info.body.pmk_info.pmk,
+ msg->key_info.body.pmk_info.pmk_len))
+ goto cleanup;
+ } else if (msg->key_info.key_type == NAN_SECURITY_KEY_INPUT_PASSPHRASE &&
+ msg->key_info.body.passphrase_info.passphrase_len >=
+ NAN_SECURITY_MIN_PASSPHRASE_LEN &&
+ msg->key_info.body.passphrase_info.passphrase_len <=
+ NAN_SECURITY_MAX_PASSPHRASE_LEN) {
+ if (nanCommand->put_bytes(QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE,
+ (char *)msg->key_info.body.passphrase_info.passphrase,
+ msg->key_info.body.passphrase_info.passphrase_len))
+ goto cleanup;
+ }
+ if (msg->service_name_len) {
+ if (nanCommand->put_bytes(QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME,
+ (char *)msg->service_name, msg->service_name_len))
+ goto cleanup;
}
nanCommand->attr_end(nlData);
@@ -911,7 +908,7 @@
}
cleanup:
delete nanCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
wifi_error nan_data_indication_response(transaction_id id,
@@ -930,7 +927,7 @@
&nanCommand);
if (ret != WIFI_SUCCESS) {
ALOGE("%s: Initialization failed", __FUNCTION__);
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
if ((msg->cipher_type != NAN_CIPHER_SUITE_SHARED_KEY_NONE) &&
@@ -997,29 +994,28 @@
if (nanCommand->put_u32(QCA_WLAN_VENDOR_ATTR_NDP_CSID,
msg->cipher_type))
goto cleanup;
+ }
+ if ( msg->key_info.key_type == NAN_SECURITY_KEY_INPUT_PMK &&
+ msg->key_info.body.pmk_info.pmk_len == NAN_PMK_INFO_LEN) {
+ if (nanCommand->put_bytes(QCA_WLAN_VENDOR_ATTR_NDP_PMK,
+ (char *)msg->key_info.body.pmk_info.pmk,
+ msg->key_info.body.pmk_info.pmk_len))
+ goto cleanup;
+ } else if (msg->key_info.key_type == NAN_SECURITY_KEY_INPUT_PASSPHRASE &&
+ msg->key_info.body.passphrase_info.passphrase_len >=
+ NAN_SECURITY_MIN_PASSPHRASE_LEN &&
+ msg->key_info.body.passphrase_info.passphrase_len <=
+ NAN_SECURITY_MAX_PASSPHRASE_LEN) {
+ if (nanCommand->put_bytes(QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE,
+ (char *)msg->key_info.body.passphrase_info.passphrase,
+ msg->key_info.body.passphrase_info.passphrase_len))
+ goto cleanup;
+ }
- if ( msg->key_info.key_type == NAN_SECURITY_KEY_INPUT_PMK &&
- msg->key_info.body.pmk_info.pmk_len == NAN_PMK_INFO_LEN) {
- if (nanCommand->put_bytes(QCA_WLAN_VENDOR_ATTR_NDP_PMK,
- (char *)msg->key_info.body.pmk_info.pmk,
- msg->key_info.body.pmk_info.pmk_len))
- goto cleanup;
- } else if (msg->key_info.key_type == NAN_SECURITY_KEY_INPUT_PASSPHRASE &&
- msg->key_info.body.passphrase_info.passphrase_len >=
- NAN_SECURITY_MIN_PASSPHRASE_LEN &&
- msg->key_info.body.passphrase_info.passphrase_len <=
- NAN_SECURITY_MAX_PASSPHRASE_LEN) {
- if (nanCommand->put_bytes(QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE,
- (char *)msg->key_info.body.passphrase_info.passphrase,
- msg->key_info.body.passphrase_info.passphrase_len))
- goto cleanup;
- }
-
- if (msg->service_name_len) {
- if (nanCommand->put_bytes(QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME,
- (char *)msg->service_name, msg->service_name_len))
- goto cleanup;
- }
+ if (msg->service_name_len) {
+ if (nanCommand->put_bytes(QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME,
+ (char *)msg->service_name, msg->service_name_len))
+ goto cleanup;
}
nanCommand->attr_end(nlData);
@@ -1029,7 +1025,7 @@
}
cleanup:
delete nanCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
wifi_error nan_data_end(transaction_id id,
@@ -1048,7 +1044,7 @@
&nanCommand);
if (ret != WIFI_SUCCESS) {
ALOGE("%s: Initialization failed", __FUNCTION__);
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* Add the vendor specific attributes for the NL command. */
@@ -1076,7 +1072,7 @@
}
cleanup:
delete nanCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
// Implementation related to nan class common functions
diff --git a/qcwcn/wifi_hal/nan_i.h b/qcwcn/wifi_hal/nan_i.h
index 7202751..5938919 100644
--- a/qcwcn/wifi_hal/nan_i.h
+++ b/qcwcn/wifi_hal/nan_i.h
@@ -211,6 +211,7 @@
NAN_TLV_TYPE_5G_CHANNEL,
NAN_TLV_TYPE_DISC_MAC_ADDR_RANDOM_INTERVAL,
NAN_TLV_TYPE_RANGING_AUTO_RESPONSE_CFG = 4134,
+ NAN_TLV_TYPE_SUBSCRIBE_SID_BEACON = 4135,
NAN_TLV_TYPE_CONFIG_LAST = 8191,
/* Attributes types */
@@ -347,7 +348,7 @@
{
u16 ttl;
u16 period;
- u32 reserved:1;
+ u32 replyIndFlag:1;
u32 publishType:2;
u32 txType:1;
u32 rssiThresholdFlag:1;
@@ -407,6 +408,27 @@
u16 reserved;
} NanPublishTerminatedIndMsg, *pNanPublishTerminatedIndMsg;
+/* Params for NAN Publish Replied Ind */
+typedef struct PACKED
+{
+ u32 matchHandle;
+} NanPublishRepliedIndParams;
+
+/* NAN Publish Replied Ind */
+typedef struct PACKED
+{
+ NanMsgHeader fwHeader;
+ NanPublishRepliedIndParams publishRepliedIndParams;
+ /*
+ * Excludes TLVs
+ *
+ * Required: MAC Address
+ * Optional: Received RSSI Value
+ *
+ */
+ u8 ptlv[];
+} NanPublishRepliedIndMsg, *pNanPublishRepliedIndMsg;
+
/* NAN Subscribe Service Req */
typedef struct PACKED
{
@@ -940,6 +962,7 @@
u32 discBeaconTxFailures;
u32 amHopCountExpireCount;
u32 ndpChannelFreq;
+ u32 ndpChannelFreq2;
} FwNanSyncStats, *pFwNanSyncStats;
/* NAN Misc DE Statistics */
@@ -974,6 +997,7 @@
Definition of various NanIndication(events)
*/
typedef enum {
+ NAN_INDICATION_PUBLISH_REPLIED =0,
NAN_INDICATION_PUBLISH_TERMINATED =1,
NAN_INDICATION_MATCH =2,
NAN_INDICATION_MATCH_EXPIRED =3,
@@ -1166,6 +1190,7 @@
NDP_I_MGMT_FRAME_CONFIRM_FAILED = 9011,
NDP_I_END_FAILED = 9012,
NDP_I_MGMT_FRAME_END_REQUEST_FAILED = 9013,
+ NDP_I_MGMT_FRAME_SECURITY_INSTALL_FAILED = 9014,
/* 9500 onwards vendor specific error codes */
NDP_I_VENDOR_SPECIFIC_ERROR = 9500
diff --git a/qcwcn/wifi_hal/nan_ind.cpp b/qcwcn/wifi_hal/nan_ind.cpp
index f2adf61..2f3d0e6 100644
--- a/qcwcn/wifi_hal/nan_ind.cpp
+++ b/qcwcn/wifi_hal/nan_ind.cpp
@@ -35,6 +35,15 @@
ALOGV("handleNanIndication msg_id:%u", msg_id);
switch (msg_id) {
+ case NAN_INDICATION_PUBLISH_REPLIED:
+ NanPublishRepliedInd publishRepliedInd;
+ memset(&publishRepliedInd, 0, sizeof(publishRepliedInd));
+ res = getNanPublishReplied(&publishRepliedInd);
+ if (!res && mHandler.EventPublishReplied) {
+ (*mHandler.EventPublishReplied)(&publishRepliedInd);
+ }
+ break;
+
case NAN_INDICATION_PUBLISH_TERMINATED:
NanPublishTerminatedInd publishTerminatedInd;
memset(&publishTerminatedInd, 0, sizeof(publishTerminatedInd));
@@ -165,7 +174,7 @@
switch (pHeader->msgId) {
case NAN_MSG_ID_PUBLISH_REPLIED_IND:
- return NAN_INDICATION_UNKNOWN;
+ return NAN_INDICATION_PUBLISH_REPLIED;
case NAN_MSG_ID_PUBLISH_TERMINATED_IND:
return NAN_INDICATION_PUBLISH_TERMINATED;
case NAN_MSG_ID_MATCH_IND:
@@ -195,6 +204,55 @@
}
}
+int NanCommand::getNanPublishReplied(NanPublishRepliedInd *event)
+{
+ if (event == NULL || mNanVendorEvent == NULL) {
+ ALOGE("%s: Invalid input argument event:%p mNanVendorEvent:%p",
+ __func__, event, mNanVendorEvent);
+ return WIFI_ERROR_INVALID_ARGS;
+ }
+
+ pNanPublishRepliedIndMsg pRsp = (pNanPublishRepliedIndMsg)mNanVendorEvent;
+ event->requestor_instance_id = pRsp->publishRepliedIndParams.matchHandle;
+
+ event->rssi_value = 0;
+ u8 *pInputTlv = pRsp->ptlv;
+ NanTlv outputTlv;
+ u16 readLen = 0;
+ int remainingLen = (mNanDataLen - \
+ (sizeof(NanMsgHeader)));
+
+ if (remainingLen <= 0) {
+ ALOGI("%s: No TLV's present",__func__);
+ return WIFI_SUCCESS;
+ }
+ while ((remainingLen > 0) &&
+ (0 != (readLen = NANTLV_ReadTlv(pInputTlv, &outputTlv)))) {
+ switch (outputTlv.type) {
+ case NAN_TLV_TYPE_MAC_ADDRESS:
+ if (outputTlv.length > sizeof(event->addr)) {
+ outputTlv.length = sizeof(event->addr);
+ }
+ memcpy(event->addr, outputTlv.value, outputTlv.length);
+ break;
+ case NAN_TLV_TYPE_RECEIVED_RSSI_VALUE:
+ if (outputTlv.length > sizeof(event->rssi_value)) {
+ outputTlv.length = sizeof(event->rssi_value);
+ }
+ memcpy(&event->rssi_value, outputTlv.value,
+ outputTlv.length);
+ break;
+ default:
+ ALOGI("Unknown TLV type skipped");
+ break;
+ }
+ remainingLen -= readLen;
+ pInputTlv += readLen;
+ memset(&outputTlv, 0, sizeof(outputTlv));
+ }
+ return WIFI_SUCCESS;
+}
+
int NanCommand::getNanPublishTerminated(NanPublishTerminatedInd *event)
{
if (event == NULL || mNanVendorEvent == NULL) {
@@ -1012,6 +1070,7 @@
NanDataPathConfirmInd *event)
{
u32 len = 0;
+ NanInternalStatusType drv_reason_code;
if (event == NULL || tb_vendor == NULL) {
ALOGE("%s: Invalid input argument event:%p tb_vendor:%p",
@@ -1043,6 +1102,20 @@
} else {
ALOGD("%s: NDP App Info not present", __FUNCTION__);
}
+ drv_reason_code = (NanInternalStatusType)nla_get_u32(tb_vendor[QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE]);
+ ALOGD("%s: Drv reason code %d", __FUNCTION__, drv_reason_code);
+ switch (drv_reason_code) {
+ case NDP_I_MGMT_FRAME_REQUEST_FAILED:
+ case NDP_I_MGMT_FRAME_RESPONSE_FAILED:
+ case NDP_I_MGMT_FRAME_CONFIRM_FAILED:
+ case NDP_I_MGMT_FRAME_SECURITY_INSTALL_FAILED:
+ event->reason_code = NAN_STATUS_PROTOCOL_FAILURE;
+ break;
+ default:
+ event->reason_code = (NanStatusType)drv_reason_code;
+ break;
+ }
+ ALOGD("%s: Reason code %d", __FUNCTION__, event->reason_code);
return WIFI_SUCCESS;
}
diff --git a/qcwcn/wifi_hal/nan_req.cpp b/qcwcn/wifi_hal/nan_req.cpp
index 2868ffb..ab94bfd 100644
--- a/qcwcn/wifi_hal/nan_req.cpp
+++ b/qcwcn/wifi_hal/nan_req.cpp
@@ -104,8 +104,8 @@
sizeof(pReq->config_cluster_attribute_val)) : 0 \
) + \
(
- pReq->config_scan_params ? (SIZEOF_TLV_HDR + \
- NAN_MAX_SOCIAL_CHANNELS * sizeof(u32)) : 0 \
+ pReq->config_scan_params ? NAN_MAX_SOCIAL_CHANNELS *
+ (SIZEOF_TLV_HDR + sizeof(u32)) : 0 \
) + \
(
pReq->config_random_factor_force ? (SIZEOF_TLV_HDR + \
@@ -136,9 +136,13 @@
sizeof(u32)) : 0 \
) + \
(
- pReq->discovery_indication_cfg ? (SIZEOF_TLV_HDR + \
- sizeof(u32)) : 0 \
- );
+ /* Always include cfg discovery indication TLV */
+ SIZEOF_TLV_HDR + sizeof(u32) \
+ ) + \
+ (
+ pReq->config_subscribe_sid_beacon ? (SIZEOF_TLV_HDR + \
+ sizeof(pReq->subscribe_sid_beacon_val)) : 0 \
+ ) ;
pNanEnableReqMsg pFwReq = (pNanEnableReqMsg)malloc(message_len);
if (pFwReq == NULL) {
cleanup();
@@ -287,18 +291,17 @@
sizeof(u32),
(const u8*)&pReq->disc_mac_addr_rand_interval_sec, tlvs);
}
- if (pReq->discovery_indication_cfg) {
- NanConfigDiscoveryIndications discovery_indications;
- discovery_indications.disableDiscoveryMacAddressEvent =
- (pReq->discovery_indication_cfg & BIT_0) ? 1 : 0;
- discovery_indications.disableDiscoveryStartedClusterEvent =
- (pReq->discovery_indication_cfg & BIT_1) ? 1 : 0;
- discovery_indications.disableDiscoveryJoinedClusterEvent =
- (pReq->discovery_indication_cfg & BIT_2) ? 1 : 0;
- tlvs = addTlv(NAN_TLV_TYPE_CONFIG_DISCOVERY_INDICATIONS,
- sizeof(u32),
- (const u8*)&discovery_indications, tlvs);
+ u32 config_discovery_indications;
+ config_discovery_indications = (u32)pReq->discovery_indication_cfg;
+ tlvs = addTlv(NAN_TLV_TYPE_CONFIG_DISCOVERY_INDICATIONS,
+ sizeof(u32),
+ (const u8*)&config_discovery_indications, tlvs);
+
+ if (pReq->config_subscribe_sid_beacon) {
+ tlvs = addTlv(NAN_TLV_TYPE_SUBSCRIBE_SID_BEACON,
+ sizeof(pReq->subscribe_sid_beacon_val),
+ (const u8*)&pReq->subscribe_sid_beacon_val, tlvs);
}
mVendorData = (char*)pFwReq;
@@ -349,7 +352,7 @@
int NanCommand::putNanConfig(transaction_id id, const NanConfigRequest *pReq)
{
ALOGV("NAN_CONFIG");
- size_t message_len = NAN_MAX_CONFIGURATION_REQ_SIZE;
+ size_t message_len = 0;
int idx = 0;
if (pReq == NULL ||
@@ -386,8 +389,8 @@
sizeof(pReq->config_cluster_attribute_val)) : 0 \
) + \
(
- pReq->config_scan_params ? (SIZEOF_TLV_HDR + \
- NAN_MAX_SOCIAL_CHANNELS * sizeof(u32)) : 0 \
+ pReq->config_scan_params ? NAN_MAX_SOCIAL_CHANNELS *
+ (SIZEOF_TLV_HDR + sizeof(u32)) : 0 \
) + \
(
pReq->config_random_factor_force ? (SIZEOF_TLV_HDR + \
@@ -414,8 +417,12 @@
sizeof(u32)) : 0 \
) + \
(
- pReq->discovery_indication_cfg ? (SIZEOF_TLV_HDR + \
- sizeof(u32)) : 0 \
+ pReq->config_subscribe_sid_beacon ? (SIZEOF_TLV_HDR + \
+ sizeof(pReq->subscribe_sid_beacon_val)) : 0 \
+ ) + \
+ (
+ /* Always include cfg discovery indication TLV */
+ SIZEOF_TLV_HDR + sizeof(u32) \
);
if (pReq->num_config_discovery_attr) {
@@ -453,7 +460,6 @@
tlvs = addTlv(NAN_TLV_TYPE_MASTER_PREFERENCE, sizeof(pReq->master_pref),
(const u8*)&pReq->master_pref, tlvs);
}
-
if (pReq->config_rssi_window_size) {
tlvs = addTlv(NAN_TLV_TYPE_RSSI_AVERAGING_WINDOW_SIZE, sizeof(pReq->rssi_window_size_val),
(const u8*)&pReq->rssi_window_size_val, tlvs);
@@ -462,6 +468,15 @@
tlvs = addTlv(NAN_TLV_TYPE_24G_RSSI_CLOSE_PROXIMITY, sizeof(pReq->rssi_proximity),
(const u8*)&pReq->rssi_proximity, tlvs);
}
+ if (pReq->config_5g_rssi_close_proximity) {
+ tlvs = addTlv(NAN_TLV_TYPE_5G_RSSI_CLOSE_PROXIMITY,
+ sizeof(pReq->rssi_close_proximity_5g_val),
+ (const u8*)&pReq->rssi_close_proximity_5g_val, tlvs);
+ }
+ if (pReq->config_cluster_attribute_val) {
+ tlvs = addTlv(NAN_TLV_TYPE_CLUSTER_ATTRIBUTE_IN_SDF, sizeof(pReq->config_cluster_attribute_val),
+ (const u8*)&pReq->config_cluster_attribute_val, tlvs);
+ }
if (pReq->config_scan_params) {
u32 socialChannelParamVal[NAN_MAX_SOCIAL_CHANNELS];
/* Fill the social channel param */
@@ -508,7 +523,6 @@
calcNanFurtherAvailabilityMapSize(&pReq->fam_val),
(const u8*)(tlvs + SIZEOF_TLV_HDR), tlvs);
}
-
if (pReq->config_dw.config_2dot4g_dw_band) {
tlvs = addTlv(NAN_TLV_TYPE_2G_COMMITTED_DW,
sizeof(pReq->config_dw.dw_2dot4g_interval_val),
@@ -524,21 +538,19 @@
sizeof(u32),
(const u8*)&pReq->disc_mac_addr_rand_interval_sec, tlvs);
}
-
- if (pReq->discovery_indication_cfg) {
- NanConfigDiscoveryIndications discovery_indications;
- discovery_indications.disableDiscoveryMacAddressEvent =
- (pReq->discovery_indication_cfg & BIT_0) ? 1 : 0;
- discovery_indications.disableDiscoveryStartedClusterEvent =
- (pReq->discovery_indication_cfg & BIT_1) ? 1 : 0;
- discovery_indications.disableDiscoveryJoinedClusterEvent =
- (pReq->discovery_indication_cfg & BIT_2) ? 1 : 0;
-
- tlvs = addTlv(NAN_TLV_TYPE_CONFIG_DISCOVERY_INDICATIONS,
- sizeof(u32),
- (const u8*)&discovery_indications, tlvs);
+ if (pReq->config_subscribe_sid_beacon) {
+ tlvs = addTlv(NAN_TLV_TYPE_SUBSCRIBE_SID_BEACON,
+ sizeof(pReq->subscribe_sid_beacon_val),
+ (const u8*)&pReq->subscribe_sid_beacon_val, tlvs);
}
+ u32 config_discovery_indications;
+ config_discovery_indications = (u32)(pReq->discovery_indication_cfg);
+ /* Always include the discovery cfg TLV as there is no cfg flag */
+ tlvs = addTlv(NAN_TLV_TYPE_CONFIG_DISCOVERY_INDICATIONS,
+ sizeof(u32),
+ (const u8*)&config_discovery_indications, tlvs);
+
mVendorData = (char*)pFwReq;
mDataLen = message_len;
@@ -610,7 +622,8 @@
pFwReq->publishServiceReqParams.ttl = pReq->ttl;
pFwReq->publishServiceReqParams.period = pReq->period;
- pFwReq->publishServiceReqParams.reserved = 0;
+ pFwReq->publishServiceReqParams.replyIndFlag =
+ (pReq->recv_indication_cfg & BIT_3) ? 0 : 1;
pFwReq->publishServiceReqParams.publishType = pReq->publish_type;
pFwReq->publishServiceReqParams.txType = pReq->tx_type;
@@ -1342,6 +1355,12 @@
goto out;
}
+ if (!mInfo->cmd_sock) {
+ ALOGE("%s: Command socket is null",__func__);
+ res = -1;
+ goto out;
+ }
+
/* send message */
ALOGV("%s:Handle:%p Socket Value:%p", __func__, mInfo, mInfo->cmd_sock);
res = nl_send_auto_complete(mInfo->cmd_sock, mMsg.getMessage());
diff --git a/qcwcn/wifi_hal/nan_rsp.cpp b/qcwcn/wifi_hal/nan_rsp.cpp
index 5e614e4..360134e 100644
--- a/qcwcn/wifi_hal/nan_rsp.cpp
+++ b/qcwcn/wifi_hal/nan_rsp.cpp
@@ -347,6 +347,7 @@
NanPublishTerminatedInd* pRspInd;
NanDisabledInd* pRspdInd;
char tlvInfo[NAN_ERROR_STR_LEN];
+ tlvInfo[0] = '\0';
if (isNanResponse()) {
pRsp = (NanResponseMsg*)pResponse;
@@ -867,6 +868,7 @@
sync_stats.discBeaconTxFailures = pSyncStats->discBeaconTxFailures;
sync_stats.amHopCountExpireCount = pSyncStats->amHopCountExpireCount;
sync_stats.ndpChannelFreq = pSyncStats->ndpChannelFreq;
+ sync_stats.ndpChannelFreq2 = pSyncStats->ndpChannelFreq2;
memcpy(&pRsp->data, &sync_stats, sizeof(NanSyncStats));
} else if (stats_type == NAN_STATS_ID_DE) {
NanDeStats de_stats;
diff --git a/qcwcn/wifi_hal/nancommand.h b/qcwcn/wifi_hal/nancommand.h
index 6b2624f..763544f 100644
--- a/qcwcn/wifi_hal/nancommand.h
+++ b/qcwcn/wifi_hal/nancommand.h
@@ -46,6 +46,7 @@
//based on the indication type
int handleNanIndication();
//Various Functions to get the appropriate indications
+ int getNanPublishReplied(NanPublishRepliedInd *event);
int getNanPublishTerminated(NanPublishTerminatedInd *event);
int getNanMatch(NanMatchInd *event);
int getNanMatchExpired(NanMatchExpiredInd *event);
diff --git a/qcwcn/wifi_hal/rssi_monitor.cpp b/qcwcn/wifi_hal/rssi_monitor.cpp
index 8cffe98..b4df331 100644
--- a/qcwcn/wifi_hal/rssi_monitor.cpp
+++ b/qcwcn/wifi_hal/rssi_monitor.cpp
@@ -264,7 +264,7 @@
&vCommand);
if (ret != WIFI_SUCCESS) {
ALOGE("%s: Initialization failed", __FUNCTION__);
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
ALOGV("%s: Max RSSI:%d Min RSSI:%d", __FUNCTION__,
@@ -308,7 +308,7 @@
cleanup:
delete vCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
wifi_error wifi_stop_rssi_monitoring(wifi_request_id id,
@@ -337,7 +337,7 @@
&vCommand);
if (ret != WIFI_SUCCESS) {
ALOGE("%s: Initialization failed", __FUNCTION__);
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* Add the vendor specific attributes for the NL command. */
@@ -366,5 +366,5 @@
cleanup:
delete vCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
diff --git a/qcwcn/wifi_hal/rtt.cpp b/qcwcn/wifi_hal/rtt.cpp
index f3ca8e4..c3d9e69 100644
--- a/qcwcn/wifi_hal/rtt.cpp
+++ b/qcwcn/wifi_hal/rtt.cpp
@@ -80,7 +80,7 @@
}
cleanup:
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* API to request RTT measurement */
@@ -143,7 +143,7 @@
}
cleanup:
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* API to cancel RTT measurements */
@@ -195,7 +195,7 @@
}
cleanup:
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
// API to configure the LCI. Used in RTT Responder mode only
@@ -239,7 +239,7 @@
}
cleanup:
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
// API to configure the LCR. Used in RTT Responder mode only.
@@ -283,7 +283,7 @@
}
cleanup:
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/*
@@ -320,7 +320,7 @@
}
cleanup:
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/**
@@ -366,7 +366,7 @@
}
cleanup:
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
@@ -404,5 +404,5 @@
}
cleanup:
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
diff --git a/qcwcn/wifi_hal/tdls.cpp b/qcwcn/wifi_hal/tdls.cpp
index a1b0936..64d5a63 100644
--- a/qcwcn/wifi_hal/tdls.cpp
+++ b/qcwcn/wifi_hal/tdls.cpp
@@ -415,7 +415,7 @@
}
cleanup:
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* wifi_disable_tdls - disables TDLS-auto mode for a specific route
@@ -469,7 +469,7 @@
cleanup:
delete pTdlsCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* wifi_get_tdls_status - allows getting the status of TDLS for a specific
@@ -518,7 +518,7 @@
pTdlsCommand->getStatusRspParams(status);
cleanup:
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* return the current HW + Firmware combination's TDLS capabilities */
@@ -563,5 +563,5 @@
if (ret < 0)
memset(capabilities, 0, sizeof(wifi_tdls_capabilities));
delete pTdlsCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
diff --git a/qcwcn/wifi_hal/wifi_hal.cpp b/qcwcn/wifi_hal/wifi_hal.cpp
index 822d6bc..d8bf9c2 100644
--- a/qcwcn/wifi_hal/wifi_hal.cpp
+++ b/qcwcn/wifi_hal/wifi_hal.cpp
@@ -181,7 +181,7 @@
supportedFeatures.getResponseparams(set);
cleanup:
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
static wifi_error wifi_get_capabilities(wifi_interface_handle handle)
@@ -247,7 +247,7 @@
info->firmware_bus_max_size = busSizeSupported.getBusSize();
cleanup:
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
static wifi_error wifi_init_user_sock(hal_info *info)
@@ -408,6 +408,8 @@
fn->wifi_get_roaming_capabilities = wifi_get_roaming_capabilities;
fn->wifi_configure_roaming = wifi_configure_roaming;
fn->wifi_enable_firmware_roaming = wifi_enable_firmware_roaming;
+ fn->wifi_select_tx_power_scenario = wifi_select_tx_power_scenario;
+ fn->wifi_reset_tx_power_scenario = wifi_reset_tx_power_scenario;
return WIFI_SUCCESS;
}
@@ -1200,7 +1202,7 @@
if (ret) {
*set_size = 0;
}
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
@@ -1246,7 +1248,7 @@
cleanup:
delete vCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
wifi_error wifi_start_sending_offloaded_packet(wifi_request_id id,
@@ -1266,7 +1268,7 @@
&vCommand);
if (ret != WIFI_SUCCESS) {
ALOGE("%s: Initialization failed", __func__);
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
ALOGV("ip packet length : %u\nIP Packet:", ip_packet_len);
@@ -1310,7 +1312,7 @@
cleanup:
delete vCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
wifi_error wifi_stop_sending_offloaded_packet(wifi_request_id id,
@@ -1325,7 +1327,7 @@
&vCommand);
if (ret != WIFI_SUCCESS) {
ALOGE("%s: Initialization failed", __func__);
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* Add the vendor specific attributes for the NL command. */
@@ -1352,7 +1354,7 @@
cleanup:
delete vCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
static wifi_error wifi_set_packet_filter(wifi_interface_handle iface,
@@ -1378,7 +1380,7 @@
&vCommand);
if (ret != WIFI_SUCCESS) {
ALOGE("%s: Initialization failed", __FUNCTION__);
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* Add the vendor specific attributes for the NL command. */
@@ -1430,7 +1432,7 @@
cleanup:
if (vCommand)
delete vCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
static wifi_error wifi_get_packet_filter_capabilities(
@@ -1497,7 +1499,7 @@
*max_len = vCommand->getFilterLength();
cleanup:
delete vCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
@@ -1513,7 +1515,7 @@
&vCommand);
if (ret != WIFI_SUCCESS) {
ALOGE("%s: Initialization failed", __func__);
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
ALOGV("ND offload : %s", enable?"Enable":"Disable");
@@ -1536,5 +1538,5 @@
cleanup:
delete vCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
diff --git a/qcwcn/wifi_hal/wificonfig.cpp b/qcwcn/wifi_hal/wificonfig.cpp
index 8a09488..acfe92f 100644
--- a/qcwcn/wifi_hal/wificonfig.cpp
+++ b/qcwcn/wifi_hal/wificonfig.cpp
@@ -100,7 +100,7 @@
cleanup:
delete wifiConfigCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* Set the country code to driver. */
@@ -151,7 +151,7 @@
cleanup:
delete wifiConfigCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
wifi_error wifi_set_beacon_wifi_iface_stats_averaging_factor(
@@ -219,7 +219,7 @@
cleanup:
delete wifiConfigCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
wifi_error wifi_set_guard_time(wifi_request_id id,
@@ -283,7 +283,135 @@
cleanup:
delete wifiConfigCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
+}
+
+wifi_error wifi_select_tx_power_scenario(wifi_interface_handle handle,
+ wifi_power_scenario scenario)
+{
+ int ret = 0;
+ WiFiConfigCommand *wifiConfigCommand;
+ struct nlattr *nlData;
+ interface_info *ifaceInfo = getIfaceInfo(handle);
+ wifi_handle wifiHandle = getWifiHandle(handle);
+ u32 bdf_file = 0;
+
+ ALOGV("%s : power scenario:%d", __FUNCTION__, scenario);
+
+ wifiConfigCommand = new WiFiConfigCommand(
+ wifiHandle,
+ 1,
+ OUI_QCA,
+ QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITS);
+ if (wifiConfigCommand == NULL) {
+ ALOGE("%s: Error wifiConfigCommand NULL", __FUNCTION__);
+ return WIFI_ERROR_UNKNOWN;
+ }
+
+ /* Create the NL message. */
+ ret = wifiConfigCommand->create();
+ if (ret < 0) {
+ ALOGE("wifi_select_tx_power_scenario: failed to create NL msg. Error:%d", ret);
+ goto cleanup;
+ }
+
+ /* Set the interface Id of the message. */
+ ret = wifiConfigCommand->set_iface_id(ifaceInfo->name);
+ if (ret < 0) {
+ ALOGE("wifi_select_tx_power_scenario: failed to set iface id. Error:%d", ret);
+ goto cleanup;
+ }
+
+ /* Add the vendor specific attributes for the NL command. */
+ nlData = wifiConfigCommand->attr_start(NL80211_ATTR_VENDOR_DATA);
+ if (!nlData) {
+ ALOGE("wifi_select_tx_power_scenario: failed attr_start for VENDOR_DATA. "
+ "Error:%d", ret);
+ goto cleanup;
+ }
+
+ if (scenario == WIFI_POWER_SCENARIO_VOICE_CALL) {
+ bdf_file = QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_BDF0;
+ } else {
+ ALOGE("wifi_select_tx_power_scenario: invalid scenario %d", scenario);
+ ret = WIFI_ERROR_INVALID_ARGS;
+ goto cleanup;
+ }
+ if (wifiConfigCommand->put_u32(
+ QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SAR_ENABLE,
+ bdf_file)) {
+ ALOGE("failed to put SAR_ENABLE");
+ goto cleanup;
+ }
+ wifiConfigCommand->attr_end(nlData);
+
+ ret = wifiConfigCommand->requestEvent();
+ if (ret != 0) {
+ ALOGE("wifi_select_tx_power_scenario(): requestEvent Error:%d", ret);
+ goto cleanup;
+ }
+
+cleanup:
+ delete wifiConfigCommand;
+ return mapErrorKernelToWifiHAL(ret);
+}
+
+wifi_error wifi_reset_tx_power_scenario(wifi_interface_handle handle)
+{
+ int ret = 0;
+ WiFiConfigCommand *wifiConfigCommand;
+ struct nlattr *nlData;
+ interface_info *ifaceInfo = getIfaceInfo(handle);
+ wifi_handle wifiHandle = getWifiHandle(handle);
+
+ wifiConfigCommand = new WiFiConfigCommand(
+ wifiHandle,
+ 1,
+ OUI_QCA,
+ QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITS);
+ if (wifiConfigCommand == NULL) {
+ ALOGE("%s: Error wifiConfigCommand NULL", __FUNCTION__);
+ return WIFI_ERROR_UNKNOWN;
+ }
+
+ /* Create the NL message. */
+ ret = wifiConfigCommand->create();
+ if (ret < 0) {
+ ALOGE("wifi_reset_tx_power_scenario: failed to create NL msg. Error:%d", ret);
+ goto cleanup;
+ }
+
+ /* Set the interface Id of the message. */
+ ret = wifiConfigCommand->set_iface_id(ifaceInfo->name);
+ if (ret < 0) {
+ ALOGE("wifi_reset_tx_power_scenario: failed to set iface id. Error:%d", ret);
+ goto cleanup;
+ }
+
+ /* Add the vendor specific attributes for the NL command. */
+ nlData = wifiConfigCommand->attr_start(NL80211_ATTR_VENDOR_DATA);
+ if (!nlData) {
+ ALOGE("wifi_reset_tx_power_scenario: failed attr_start for VENDOR_DATA. "
+ "Error:%d", ret);
+ goto cleanup;
+ }
+
+ if (wifiConfigCommand->put_u32(QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SAR_ENABLE,
+ QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_NONE)) {
+ ALOGE("failed to put SAR_ENABLE or NUM_SPECS");
+ goto cleanup;
+ }
+ wifiConfigCommand->attr_end(nlData);
+
+ ret = wifiConfigCommand->requestEvent();
+ if (ret != 0) {
+ ALOGE("wifi_reset_tx_power_scenario(): requestEvent Error:%d", ret);
+ goto cleanup;
+ }
+
+cleanup:
+ delete wifiConfigCommand;
+ return mapErrorKernelToWifiHAL(ret);
}
WiFiConfigCommand::WiFiConfigCommand(wifi_handle handle,
diff --git a/qcwcn/wifi_hal/wifilogger.cpp b/qcwcn/wifi_hal/wifilogger.cpp
index 6c77650..a8423cf 100644
--- a/qcwcn/wifi_hal/wifilogger.cpp
+++ b/qcwcn/wifi_hal/wifilogger.cpp
@@ -153,7 +153,7 @@
cleanup:
if (wifiLoggerCommand)
delete wifiLoggerCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
@@ -183,7 +183,7 @@
get_rb_status(rb_info, rbs);
}
*num_buffers = NUM_RING_BUFS;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
void push_out_all_ring_buffers(hal_info *info)
@@ -273,7 +273,7 @@
cleanup:
delete wifiLoggerCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
/* Function to get the data in each ring for the given ring ID.*/
@@ -339,7 +339,7 @@
cleanup:
delete wifiLoggerCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
void WifiLoggerCommand::setVersionInfo(char *buffer, int buffer_size) {
@@ -405,7 +405,7 @@
}
cleanup:
delete wifiLoggerCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
@@ -468,7 +468,7 @@
}
cleanup:
delete wifiLoggerCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
@@ -534,7 +534,7 @@
cleanup:
delete wifiLoggerCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
wifi_error wifi_set_log_handler(wifi_request_id id,
@@ -1501,7 +1501,7 @@
cleanup:
delete wifiLoggerCommand;
- return (wifi_error)ret;
+ return mapErrorKernelToWifiHAL(ret);
}
void WifiLoggerCommand::getWakeStatsRspParams(
diff --git a/qcwcn/wifi_hal/wifiloggercmd.h b/qcwcn/wifi_hal/wifiloggercmd.h
index bdeaec2..ba0d284 100644
--- a/qcwcn/wifi_hal/wifiloggercmd.h
+++ b/qcwcn/wifi_hal/wifiloggercmd.h
@@ -52,8 +52,8 @@
#define DRIVER_PRINTS_RB_BUF_SIZE 4096
#define DRIVER_PRINTS_NUM_BUFS 128
-#define FIRMWARE_PRINTS_RB_BUF_SIZE 4096
-#define FIRMWARE_PRINTS_NUM_BUFS 128
+#define FIRMWARE_PRINTS_RB_BUF_SIZE 32768
+#define FIRMWARE_PRINTS_NUM_BUFS 16
enum rb_info_indices {
POWER_EVENTS_RB_ID = 0,