summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2016-12-15 03:26:24 -0700
committerLinux Build Service Account <lnxbuild@localhost>2016-12-15 03:26:24 -0700
commit24bb2ac22026240971e1a4ff3f413682d72315a9 (patch)
treef016d0fadad115cfce27936de1689e798d2de8f3
parent01dfd848a208116820f8c811aefee416fda5ad01 (diff)
parent52840fed8de512be2a8fe1ef8199896580f8ae72 (diff)
downloadandroid_hardware_qcom_wlan-24bb2ac22026240971e1a4ff3f413682d72315a9.tar.gz
android_hardware_qcom_wlan-24bb2ac22026240971e1a4ff3f413682d72315a9.tar.bz2
android_hardware_qcom_wlan-24bb2ac22026240971e1a4ff3f413682d72315a9.zip
Merge 52840fed8de512be2a8fe1ef8199896580f8ae72 on remote branch
Change-Id: Ied8cb421102e90bd414497ec75253188dec1bc11
-rw-r--r--qcwcn/wifi_hal/llstats.cpp83
-rw-r--r--qcwcn/wifi_hal/llstatscommand.h2
-rw-r--r--qcwcn/wifi_hal/nan.cpp13
-rw-r--r--qcwcn/wifi_hal/nan_cert.h64
-rw-r--r--qcwcn/wifi_hal/nan_i.h42
-rw-r--r--qcwcn/wifi_hal/nan_ind.cpp62
-rw-r--r--qcwcn/wifi_hal/nancommand.h2
7 files changed, 196 insertions, 72 deletions
diff --git a/qcwcn/wifi_hal/llstats.cpp b/qcwcn/wifi_hal/llstats.cpp
index 7183eb9..7b42771 100644
--- a/qcwcn/wifi_hal/llstats.cpp
+++ b/qcwcn/wifi_hal/llstats.cpp
@@ -857,6 +857,42 @@ int LLStatsCommand::requestResponse()
return WifiCommand::requestResponse(mMsg);
}
+wifi_error LLStatsCommand::notifyResponse()
+{
+ wifi_error ret = WIFI_SUCCESS;
+
+ /* Indicate stats to framework only if both radio and iface stats
+ * are present */
+ if (mResultsParams.radio_stat && mResultsParams.iface_stat) {
+ mHandler.on_link_stats_results(mRequestId,
+ mResultsParams.iface_stat, mNumRadios,
+ mResultsParams.radio_stat);
+ } else {
+ ret = WIFI_ERROR_INVALID_ARGS;
+ }
+
+ if(mResultsParams.radio_stat)
+ {
+ if (mResultsParams.radio_stat->tx_time_per_levels)
+ {
+ free(mResultsParams.radio_stat->tx_time_per_levels);
+ mResultsParams.radio_stat->tx_time_per_levels = NULL;
+ }
+ free(mResultsParams.radio_stat);
+ mResultsParams.radio_stat = NULL;
+ mRadioStatsSize = 0;
+ mNumRadios = 0;
+ }
+ if(mResultsParams.iface_stat)
+ {
+ free(mResultsParams.iface_stat);
+ mResultsParams.iface_stat = NULL;
+ }
+
+ return ret;
+}
+
+
int LLStatsCommand::handleResponse(WifiEvent &reply)
{
unsigned i=0;
@@ -1032,28 +1068,6 @@ int LLStatsCommand::handleResponse(WifiEvent &reply)
ALOGV("%s: numPeers is %u\n", __FUNCTION__,
mResultsParams.iface_stat->num_peers);
#endif
- if(mResultsParams.iface_stat->num_peers == 0)
- {
- // Number of Radios are 1 for now
- mHandler.on_link_stats_results(mRequestId,
- mResultsParams.iface_stat,
- mNumRadios,
- mResultsParams.radio_stat);
- if(mResultsParams.radio_stat)
- {
- if (mResultsParams.radio_stat->tx_time_per_levels)
- {
- free(mResultsParams.radio_stat->tx_time_per_levels);
- mResultsParams.radio_stat->tx_time_per_levels = NULL;
- }
- free(mResultsParams.radio_stat);
- mResultsParams.radio_stat = NULL;
- mRadioStatsSize = 0;
- mNumRadios = 0;
- }
- free(mResultsParams.iface_stat);
- mResultsParams.iface_stat = NULL;
- }
}
}
break;
@@ -1166,27 +1180,6 @@ int LLStatsCommand::handleResponse(WifiEvent &reply)
}
}
- // Number of Radios are 1 for now
- mHandler.on_link_stats_results(mRequestId,
- mResultsParams.iface_stat, mNumRadios,
- mResultsParams.radio_stat);
- if(mResultsParams.radio_stat)
- {
- if (mResultsParams.radio_stat->tx_time_per_levels)
- {
- free(mResultsParams.radio_stat->tx_time_per_levels);
- mResultsParams.radio_stat->tx_time_per_levels = NULL;
- }
- free(mResultsParams.radio_stat);
- mResultsParams.radio_stat = NULL;
- mRadioStatsSize = 0;
- mNumRadios = 0;
- }
- if(mResultsParams.iface_stat)
- {
- free(mResultsParams.iface_stat);
- mResultsParams.iface_stat = NULL;
- }
}
break;
@@ -1369,6 +1362,10 @@ wifi_error wifi_get_link_stats(wifi_request_id id,
if (ret < 0)
goto cleanup;
+ if (ret == 0) {
+ ret = LLCommand->notifyResponse();
+ }
+
cleanup:
return (wifi_error)ret;
}
diff --git a/qcwcn/wifi_hal/llstatscommand.h b/qcwcn/wifi_hal/llstatscommand.h
index 9202f3a..69f2c3a 100644
--- a/qcwcn/wifi_hal/llstatscommand.h
+++ b/qcwcn/wifi_hal/llstatscommand.h
@@ -103,6 +103,8 @@ public:
virtual int requestResponse();
+ virtual wifi_error notifyResponse();
+
virtual int handleResponse(WifiEvent &reply);
virtual void getClearRspParams(u32 *stats_clear_rsp_mask, u8 *stop_rsp);
diff --git a/qcwcn/wifi_hal/nan.cpp b/qcwcn/wifi_hal/nan.cpp
index 8498be4..740c392 100644
--- a/qcwcn/wifi_hal/nan.cpp
+++ b/qcwcn/wifi_hal/nan.cpp
@@ -23,6 +23,7 @@
#include <utils/Log.h>
#include "nancommand.h"
#include "vendor_definitions.h"
+
#ifdef __GNUC__
#define PRINTF_FORMAT(a,b) __attribute__ ((format (printf, (a), (b))))
#define STRUCT_PACKED __attribute__ ((packed))
@@ -51,8 +52,6 @@ wifi_error nan_register_handler(wifi_interface_handle iface,
ret = nanCommand->setCallbackHandler(handlers);
return (wifi_error)ret;
-
- return (wifi_error)ret;
}
wifi_error nan_get_version(wifi_handle handle,
@@ -1001,19 +1000,19 @@ int NanCommand::setCallbackHandler(NanCallbackHandler nHandler)
{
int res = WIFI_SUCCESS;
mHandler = nHandler;
- res = registerVendorHandler(mVendor_id, mSubcmd);
+ res = registerVendorHandler(mVendor_id, QCA_NL80211_VENDOR_SUBCMD_NAN);
if (res != 0) {
//error case should not happen print log
- ALOGE("%s: Unable to register Vendor Handler Vendor Id=0x%x subcmd=%u",
- __FUNCTION__, mVendor_id, mSubcmd);
+ ALOGE("%s: Unable to register Vendor Handler Vendor Id=0x%x"
+ " subcmd=QCA_NL80211_VENDOR_SUBCMD_NAN", __FUNCTION__, mVendor_id);
return res;
}
res = registerVendorHandler(mVendor_id, QCA_NL80211_VENDOR_SUBCMD_NDP);
if (res != 0) {
//error case should not happen print log
- ALOGE("%s: Unable to register Vendor Handler Vendor Id=0x%x subcmd=QCA_NL80211_VENDOR_SUBCMD_NDP",
- __FUNCTION__, mVendor_id);
+ ALOGE("%s: Unable to register Vendor Handler Vendor Id=0x%x"
+ " subcmd=QCA_NL80211_VENDOR_SUBCMD_NDP", __FUNCTION__, mVendor_id);
return res;
}
return res;
diff --git a/qcwcn/wifi_hal/nan_cert.h b/qcwcn/wifi_hal/nan_cert.h
new file mode 100644
index 0000000..5707fc3
--- /dev/null
+++ b/qcwcn/wifi_hal/nan_cert.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2016, The Linux Foundation. All rights reserved.
+
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __NAN_CERT_H__
+#define __NAN_CERT_H__
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+typedef struct {
+ /* NAN master rank being advertised by DE */
+ u64 master_rank;
+ /* NAN master preference being advertised by DE */
+ u8 master_pref;
+ /* random value being advertised by DE */
+ u8 random_factor;
+ /* hop_count from anchor master */
+ u8 hop_count;
+ u32 beacon_transmit_time;
+} NanStaParameter;
+
+
+/*
+ Function to get the sta_parameter expected by Sigma
+ as per CAPI spec.
+*/
+wifi_error nan_get_sta_parameter(transaction_id id,
+ wifi_interface_handle iface,
+ NanStaParameter* msg);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* __NAN_CERT_H__ */
+
diff --git a/qcwcn/wifi_hal/nan_i.h b/qcwcn/wifi_hal/nan_i.h
index 64089cb..e6a6721 100644
--- a/qcwcn/wifi_hal/nan_i.h
+++ b/qcwcn/wifi_hal/nan_i.h
@@ -350,6 +350,27 @@ typedef struct PACKED
u16 value;
} NanPublishServiceCancelRspMsg, *pNanPublishServiceCancelRspMsg;
+/* 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 Publish Terminated Ind */
typedef struct PACKED
{
@@ -916,6 +937,7 @@ typedef struct PACKED
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,
@@ -929,18 +951,6 @@ typedef enum {
NAN_INDICATION_UNKNOWN =0xFFFF
} NanIndicationType;
-typedef struct {
- /* NAN master rank being advertised by DE */
- u64 master_rank;
- /* NAN master preference being advertised by DE */
- u8 master_pref;
- /* random value being advertised by DE */
- u8 random_factor;
- /* hop_count from anchor master */
- u8 hop_count;
- u32 beacon_transmit_time;
-} NanStaParameter;
-
/* NAN Capabilities Req */
typedef struct PACKED
{
@@ -976,14 +986,6 @@ typedef struct PACKED
u32 reason;
} NanSelfTransmitFollowupIndMsg, *pNanSelfTransmitFollowupIndMsg;
-/*
- Function to get the sta_parameter expected by Sigma
- as per CAPI spec.
-*/
-wifi_error nan_get_sta_parameter(wifi_request_id id,
- wifi_interface_handle iface,
- NanStaParameter* msg);
-
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/qcwcn/wifi_hal/nan_ind.cpp b/qcwcn/wifi_hal/nan_ind.cpp
index c9bb00b..3508585 100644
--- a/qcwcn/wifi_hal/nan_ind.cpp
+++ b/qcwcn/wifi_hal/nan_ind.cpp
@@ -35,6 +35,15 @@ int NanCommand::handleNanIndication()
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));
@@ -147,7 +156,7 @@ NanIndicationType NanCommand::getIndicationType()
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:
@@ -173,6 +182,55 @@ NanIndicationType NanCommand::getIndicationType()
}
}
+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) {
@@ -743,7 +801,7 @@ int NanCommand::getNanStaParameter(wifi_interface_handle iface,
{
int ret = WIFI_ERROR_NONE;
int res = -1;
- int id = 1;
+ transaction_id id = 1;
NanCommand *nanCommand = NULL;
interface_info *ifaceInfo = getIfaceInfo(iface);
wifi_handle wifiHandle = getWifiHandle(iface);
diff --git a/qcwcn/wifi_hal/nancommand.h b/qcwcn/wifi_hal/nancommand.h
index b546dca..20fbc9d 100644
--- a/qcwcn/wifi_hal/nancommand.h
+++ b/qcwcn/wifi_hal/nancommand.h
@@ -22,6 +22,7 @@
#include "wifi_hal.h"
#include "qca-vendor.h"
#include "vendor_definitions.h"
+#include "nan_cert.h"
class NanCommand : public WifiVendorCommand
{
@@ -46,6 +47,7 @@ private:
//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);