Merge commit 'd265cf49d6f43232550981f859a10e785da09650' into HEAD

* commit 'd265cf49d6f43232550981f859a10e785da09650':
  WifiHal: Always include the Service responder policy
  WifiHal: Add sdea info and subscribe addr to Capabilites
  WifiHal: Add Cipher Suite to capabilities
  WifiHal: Remove Range Auto enable/disable in Nan Enable/Config APIs
  Wifi-Hal: Add support for NAN Data Path security

Change-Id: I8b97e80e68ae9d91cd8dc1b126eb21cd8498f3f6
diff --git a/qcwcn/wifi_hal/nan.cpp b/qcwcn/wifi_hal/nan.cpp
index 4836705..f3a7457 100644
--- a/qcwcn/wifi_hal/nan.cpp
+++ b/qcwcn/wifi_hal/nan.cpp
@@ -845,6 +845,16 @@
         /* TBD Qos Info */
         nanCommand->attr_end(nlCfgQos);
     }
+    if (msg->cipher_type != NAN_CIPHER_SUITE_SHARED_KEY_NONE) {
+        if (nanCommand->put_u32(QCA_WLAN_VENDOR_ATTR_NDP_CSID,
+                msg->cipher_type))
+            goto cleanup;
+    }
+    if (msg->pmk_len == NAN_PMK_INFO_LEN) {
+        if (nanCommand->put_bytes(QCA_WLAN_VENDOR_ATTR_NDP_PMK,
+            (char *)msg->pmk, msg->pmk_len))
+            goto cleanup;
+    }
     nanCommand->attr_end(nlData);
 
     ret = nanCommand->requestEvent();
@@ -926,6 +936,16 @@
         /* TBD Qos Info */
         nanCommand->attr_end(nlCfgQos);
     }
+    if (msg->cipher_type != NAN_CIPHER_SUITE_SHARED_KEY_NONE) {
+        if (nanCommand->put_u32(QCA_WLAN_VENDOR_ATTR_NDP_CSID,
+                msg->cipher_type))
+            goto cleanup;
+    }
+    if (msg->pmk_len == NAN_PMK_INFO_LEN) {
+        if (nanCommand->put_bytes(QCA_WLAN_VENDOR_ATTR_NDP_PMK,
+            (char *)msg->pmk, msg->pmk_len))
+            goto cleanup;
+    }
     nanCommand->attr_end(nlData);
 
     ret = nanCommand->requestEvent();
diff --git a/qcwcn/wifi_hal/nan_i.h b/qcwcn/wifi_hal/nan_i.h
index de4d0ce..abc3069 100644
--- a/qcwcn/wifi_hal/nan_i.h
+++ b/qcwcn/wifi_hal/nan_i.h
@@ -988,6 +988,9 @@
     u32 max_ndp_sessions;
     u32 max_app_info_len;
     u32 max_queued_transmit_followup_msgs;
+    u32 cipher_suites_supported;
+    u32 max_subscribe_address;
+    u32 max_sdea_service_specific_info_len;
 } NanCapabilitiesRspMsg, *pNanCapabilitiesRspMsg;
 
 /* NAN Self Transmit Followup */
diff --git a/qcwcn/wifi_hal/nan_ind.cpp b/qcwcn/wifi_hal/nan_ind.cpp
index 39e8a9e..026928d 100644
--- a/qcwcn/wifi_hal/nan_ind.cpp
+++ b/qcwcn/wifi_hal/nan_ind.cpp
@@ -320,10 +320,10 @@
                                              &event->peer_sdea_params);
             break;
         case NAN_TLV_TYPE_NAN_RANGE_RESULT:
-            if (outputTlv.length > sizeof(event->range_result)) {
-                outputTlv.length = sizeof(event->range_result);
+            if (outputTlv.length > sizeof(event->range_info)) {
+                outputTlv.length = sizeof(event->range_info);
             }
-            memcpy(&event->range_result, outputTlv.value, outputTlv.length);
+            memcpy(&event->range_info, outputTlv.value, outputTlv.length);
             break;
         default:
             ALOGV("Unknown TLV type skipped");
diff --git a/qcwcn/wifi_hal/nan_req.cpp b/qcwcn/wifi_hal/nan_req.cpp
index 4853d68..dbf6411 100644
--- a/qcwcn/wifi_hal/nan_req.cpp
+++ b/qcwcn/wifi_hal/nan_req.cpp
@@ -136,10 +136,6 @@
            sizeof(u32)) : 0 \
         ) + \
         (
-           pReq->config_responder_auto_response ? (SIZEOF_TLV_HDR + \
-           sizeof(u32)) : 0 \
-        ) + \
-        (
            pReq->discovery_indication_cfg ? (SIZEOF_TLV_HDR + \
            sizeof(u32)) : 0 \
         );
@@ -291,11 +287,6 @@
                       sizeof(u32),
                       (const u8*)&pReq->disc_mac_addr_rand_interval_sec, tlvs);
     }
-    if (pReq->config_responder_auto_response) {
-        tlvs = addTlv(NAN_TLV_TYPE_RANGING_AUTO_RESPONSE_CFG,
-                      sizeof(u32),
-                      (const u8*)&pReq->ranging_auto_response_cfg, tlvs);
-    }
     if (pReq->discovery_indication_cfg) {
         NanConfigDiscoveryIndications discovery_indications;
         discovery_indications.disableDiscoveryMacAddressEvent =
@@ -423,10 +414,6 @@
            sizeof(u32)) : 0 \
         ) + \
         (
-           pReq->config_responder_auto_response ? (SIZEOF_TLV_HDR + \
-           sizeof(u32)) : 0 \
-        )  + \
-        (
            pReq->discovery_indication_cfg ? (SIZEOF_TLV_HDR + \
            sizeof(u32)) : 0 \
         );
@@ -537,11 +524,6 @@
                       sizeof(u32),
                       (const u8*)&pReq->disc_mac_addr_rand_interval_sec, tlvs);
     }
-    if (pReq->config_responder_auto_response) {
-        tlvs = addTlv(NAN_TLV_TYPE_RANGING_AUTO_RESPONSE_CFG,
-                      sizeof(u32),
-                      (const u8*)&pReq->ranging_auto_response_cfg, tlvs);
-    }
 
     if (pReq->discovery_indication_cfg) {
         NanConfigDiscoveryIndications discovery_indications;
@@ -584,7 +566,7 @@
         (pReq->service_specific_info_len ? SIZEOF_TLV_HDR + pReq->service_specific_info_len : 0) +
         (pReq->rx_match_filter_len ? SIZEOF_TLV_HDR + pReq->rx_match_filter_len : 0) +
         (pReq->tx_match_filter_len ? SIZEOF_TLV_HDR + pReq->tx_match_filter_len : 0) +
-        (pReq->service_responder_policy ? SIZEOF_TLV_HDR + sizeof(NanServiceAcceptPolicy) : 0) +
+        (SIZEOF_TLV_HDR + sizeof(NanServiceAcceptPolicy)) +
         (pReq->cipher_type ? SIZEOF_TLV_HDR + sizeof(NanCsidType) : 0) +
         (pReq->pmk_len ? SIZEOF_TLV_HDR + NAN_PMK_INFO_LEN : 0) +
         ((pReq->sdea_params.config_nan_data_path || pReq->sdea_params.security_cfg ||
@@ -648,10 +630,11 @@
         tlvs = addTlv(NAN_TLV_TYPE_TX_MATCH_FILTER, pReq->tx_match_filter_len,
                       (const u8*)&pReq->tx_match_filter[0], tlvs);
     }
-    if (pReq->service_responder_policy) {
-        tlvs = addTlv(NAN_TLV_TYPE_NAN_SERVICE_ACCEPT_POLICY, sizeof(NanServiceAcceptPolicy),
-                      (const u8*)&pReq->service_responder_policy, tlvs);
-    }
+
+    /* Pass the Accept policy always */
+    tlvs = addTlv(NAN_TLV_TYPE_NAN_SERVICE_ACCEPT_POLICY, sizeof(NanServiceAcceptPolicy),
+                  (const u8*)&pReq->service_responder_policy, tlvs);
+
     if (pReq->cipher_type) {
         NanCsidType pNanCsidType;
         pNanCsidType.csid_type = pReq->cipher_type;
diff --git a/qcwcn/wifi_hal/nan_rsp.cpp b/qcwcn/wifi_hal/nan_rsp.cpp
index c625838..f7d786d 100644
--- a/qcwcn/wifi_hal/nan_rsp.cpp
+++ b/qcwcn/wifi_hal/nan_rsp.cpp
@@ -587,6 +587,12 @@
                        pFwRsp->max_app_info_len;
             pRsp->body.nan_capabilities.max_queued_transmit_followup_msgs = \
                        pFwRsp->max_queued_transmit_followup_msgs;
+            pRsp->body.nan_capabilities.cipher_suites_supported = \
+                       pFwRsp->cipher_suites_supported;
+            pRsp->body.nan_capabilities.max_subscribe_address = \
+                       pFwRsp->max_subscribe_address;
+            pRsp->body.nan_capabilities.max_sdea_service_specific_info_len = \
+                       pFwRsp->max_sdea_service_specific_info_len;
             break;
         }
         default:
diff --git a/qcwcn/wifi_hal/vendor_definitions.h b/qcwcn/wifi_hal/vendor_definitions.h
index e4b228a..ac8afcd 100644
--- a/qcwcn/wifi_hal/vendor_definitions.h
+++ b/qcwcn/wifi_hal/vendor_definitions.h
@@ -360,6 +360,10 @@
     QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE,
     /* Unsigned 32-bit value for Channel setup configuration */
     QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL_CONFIG,
+    /* Unsigned 32-bit value for Cipher Suite Shared Key Type */
+    QCA_WLAN_VENDOR_ATTR_NDP_CSID,
+    /* Array of u8: len = NAN_PMK_INFO_LEN */
+    QCA_WLAN_VENDOR_ATTR_NDP_PMK,
 
     /* KEEP LAST */
     QCA_WLAN_VENDOR_ATTR_NDP_AFTER_LAST,