net: wireless: bcmdhd: update bcm4358 FW (7.112.201.4) [DO NOT MERGE]
Insun Song [Tue, 6 Jun 2017 16:57:55 +0000 (16:57 +0000)]
am: d09c96966d  -s ours

Change-Id: Ib480fd21dade90678dcdc98fab8fc66308468722

bcmdhd/firmware/bcm4358/fw_bcm4358.bin
bcmdhd/firmware/bcm4358/fw_bcm4358_ap.bin
bcmdhd/wifi_hal/Android.mk
bcmdhd/wifi_hal/gscan.cpp
bcmdhd/wifi_hal/link_layer_stats.cpp
bcmdhd/wifi_hal/rtt.cpp
bcmdhd/wifi_hal/wifi_hal.cpp
bcmdhd/wifi_hal/wifi_logger.cpp
bcmdhd/wifi_hal/wifi_offload.cpp
bcmdhd/wpa_supplicant_8_lib/driver_cmd_nl80211.c

index fd4c428..e26e0df 100644 (file)
Binary files a/bcmdhd/firmware/bcm4358/fw_bcm4358.bin and b/bcmdhd/firmware/bcm4358/fw_bcm4358.bin differ
index 20a0bcc..a4f8322 100644 (file)
Binary files a/bcmdhd/firmware/bcm4358/fw_bcm4358_ap.bin and b/bcmdhd/firmware/bcm4358/fw_bcm4358_ap.bin differ
index ea19efd..9e4ed08 100644 (file)
@@ -36,6 +36,7 @@ LOCAL_SRC_FILES := \
        wifi_offload.cpp
 
 LOCAL_MODULE := libwifi-hal-bcm
+LOCAL_PROPRIETARY_MODULE := true
 
 include $(BUILD_STATIC_LIBRARY)
 
index 73bfe8c..d3dc0e7 100644 (file)
@@ -1655,82 +1655,6 @@ wifi_error wifi_set_epno_list(wifi_request_id id, wifi_interface_handle iface,
     return result;
 }
 
-class BssidBlacklistCommand : public WifiCommand
-{
-private:
-    wifi_bssid_params *mParams;
-public:
-    BssidBlacklistCommand(wifi_interface_handle handle, int id,
-            wifi_bssid_params *params)
-        : WifiCommand("BssidBlacklistCommand", handle, id), mParams(params)
-    { }
-     int createRequest(WifiRequest& request) {
-        int result = request.create(GOOGLE_OUI, WIFI_SUBCMD_SET_BSSID_BLACKLIST);
-        if (result < 0) {
-            return result;
-        }
-
-        nlattr *data = request.attr_start(NL80211_ATTR_VENDOR_DATA);
-        result = request.put_u32(GSCAN_ATTRIBUTE_NUM_BSSID, mParams->num_bssid);
-        if (result < 0) {
-            return result;
-        }
-        if (!mParams->num_bssid) {
-            result = request.put_u32(GSCAN_ATTRIBUTE_BSSID_BLACKLIST_FLUSH, 1);
-            if (result < 0) {
-                return result;
-            }
-        }
-        for (int i = 0; i < mParams->num_bssid; i++) {
-            result = request.put_addr(GSCAN_ATTRIBUTE_BLACKLIST_BSSID, mParams->bssids[i]);
-            if (result < 0) {
-                return result;
-            }
-        }
-        request.attr_end(data);
-        return result;
-    }
-
-    int start() {
-        ALOGV("Executing bssid blacklist request, num = %d", mParams->num_bssid);
-        WifiRequest request(familyId(), ifaceId());
-        int result = createRequest(request);
-        if (result < 0) {
-            return result;
-        }
-
-        result = requestResponse(request);
-        if (result < 0) {
-            ALOGE("Failed to execute bssid blacklist request, result = %d", result);
-            return result;
-        }
-
-        ALOGI("Successfully added %d blacklist bssids", mParams->num_bssid);
-        if (result < 0) {
-            return result;
-        }
-        return result;
-    }
-
-
-    virtual int handleResponse(WifiEvent& reply) {
-        /* Nothing to do on response! */
-        return NL_SKIP;
-    }
-};
-
-wifi_error wifi_set_bssid_blacklist(wifi_request_id id, wifi_interface_handle iface,
-        wifi_bssid_params params)
-{
-    wifi_handle handle = getWifiHandle(iface);
-
-    BssidBlacklistCommand *cmd = new BssidBlacklistCommand(iface, id, &params);
-    NULL_CHECK_RETURN(cmd, "memory allocation failure", WIFI_ERROR_OUT_OF_MEMORY);
-    wifi_error result = (wifi_error)cmd->start();
-    //release the reference of command as well
-    cmd->releaseRef();
-    return result;
-}
 
 ////////////////////////////////////////////////////////////////////////////////
 
index 1ef8516..f6d6ab5 100644 (file)
@@ -150,3 +150,17 @@ wifi_error wifi_get_link_stats(wifi_request_id id,
     return (wifi_error) command.requestResponse();
 }
 
+wifi_error wifi_set_link_stats(
+        wifi_interface_handle /* iface */, wifi_link_layer_params /* params */)
+{
+    /* Return success here since bcom HAL does not need set link stats. */
+    return WIFI_SUCCESS;
+}
+
+wifi_error wifi_clear_link_stats(
+        wifi_interface_handle /* iface */, u32 /* stats_clear_req_mask */,
+        u32 * /* stats_clear_rsp_mask */, u8 /* stop_req */, u8 * /* stop_rsp */)
+{
+    /* Return success here since bcom HAL does not support clear link stats. */
+    return WIFI_SUCCESS;
+}
index 410196b..cc46a8d 100644 (file)
@@ -13,7 +13,8 @@
 #include <netlink/object-api.h>
 #include <netlink/netlink.h>
 #include <netlink/socket.h>
-#include <netlink-types.h>
+#include <netlink-private/object-api.h>
+#include <netlink-private/types.h>
 
 #include "nl80211_copy.h"
 
index 251414b..db6f87c 100644 (file)
@@ -149,6 +149,8 @@ wifi_error init_wifi_vendor_hal_func_table(wifi_hal_fn *fn)
     fn->wifi_reset_significant_change_handler = wifi_reset_significant_change_handler;
     fn->wifi_get_gscan_capabilities = wifi_get_gscan_capabilities;
     fn->wifi_get_link_stats = wifi_get_link_stats;
+    fn->wifi_set_link_stats = wifi_set_link_stats;
+    fn->wifi_clear_link_stats = wifi_clear_link_stats;
     fn->wifi_get_valid_channels = wifi_get_valid_channels;
     fn->wifi_rtt_range_request = wifi_rtt_range_request;
     fn->wifi_rtt_range_cancel = wifi_rtt_range_cancel;
@@ -171,7 +173,6 @@ wifi_error init_wifi_vendor_hal_func_table(wifi_hal_fn *fn)
     fn->wifi_get_logger_supported_feature_set = wifi_get_logger_supported_feature_set;
     fn->wifi_get_ring_data = wifi_get_ring_data;
     fn->wifi_get_driver_version = wifi_get_driver_version;
-    fn->wifi_set_bssid_blacklist = wifi_set_bssid_blacklist;
     fn->wifi_start_rssi_monitoring = wifi_start_rssi_monitoring;
     fn->wifi_stop_rssi_monitoring = wifi_stop_rssi_monitoring;
     fn->wifi_configure_nd_offload = wifi_configure_nd_offload;
@@ -260,14 +261,28 @@ wifi_error wifi_initialize(wifi_handle *handle)
 
     *handle = (wifi_handle) info;
 
-    wifi_add_membership(*handle, "scan");
-    wifi_add_membership(*handle, "mlme");
-    wifi_add_membership(*handle, "regulatory");
-    wifi_add_membership(*handle, "vendor");
+    if (wifi_init_interfaces(*handle) != WIFI_SUCCESS) {
+        ALOGE("No wifi interface found");
+        nl_socket_free(cmd_sock);
+        nl_socket_free(event_sock);
+        pthread_mutex_destroy(&info->cb_lock);
+        free(info);
+        return WIFI_ERROR_NOT_AVAILABLE;
+    }
 
-    wifi_init_interfaces(*handle);
-    // ALOGI("Found %d interfaces", info->num_interfaces);
+    if ((wifi_add_membership(*handle, "scan") < 0) ||
+        (wifi_add_membership(*handle, "mlme")  < 0) ||
+        (wifi_add_membership(*handle, "regulatory") < 0) ||
+        (wifi_add_membership(*handle, "vendor") < 0)) {
+        ALOGE("Add membership failed");
+        nl_socket_free(cmd_sock);
+        nl_socket_free(event_sock);
+        pthread_mutex_destroy(&info->cb_lock);
+        free(info);
+        return WIFI_ERROR_NOT_AVAILABLE;
+    }
 
+    // ALOGI("Found %d interfaces", info->num_interfaces);
 
     ALOGI("Initialized Wifi HAL Successfully; vendor cmd = %d", NL80211_CMD_VENDOR);
     return WIFI_SUCCESS;
@@ -319,7 +334,7 @@ void wifi_cleanup(wifi_handle handle, wifi_cleaned_up_handler handler)
     char buf[64];
 
     info->cleaned_up_handler = handler;
-    if (write(info->cleanup_socks[0], "Exit", 4) < 1) {
+    if (TEMP_FAILURE_RETRY(write(info->cleanup_socks[0], "Exit", 4)) < 1) {
         // As a fallback set the cleanup flag to TRUE
         ALOGE("could not write to the cleanup socket");
     } else {
@@ -329,8 +344,9 @@ void wifi_cleanup(wifi_handle handle, wifi_cleaned_up_handler handler)
         // it has rx'ed the Exit message to exit the thread.
         // As a fallback set the cleanup flag to TRUE
         memset(buf, 0, sizeof(buf));
-        int result = read(info->cleanup_socks[0], buf, sizeof(buf));
-        ALOGE("%s: Read after POLL returned %d, error no = %d", __FUNCTION__, result, errno);
+        ssize_t result = TEMP_FAILURE_RETRY(read(info->cleanup_socks[0], buf, sizeof(buf)));
+        ALOGE("%s: Read after POLL returned %zd, error no = %d (%s)", __FUNCTION__,
+               result, errno, strerror(errno));
         if (strncmp(buf, "Done", 4) == 0) {
             ALOGE("Event processing terminated");
         } else {
@@ -411,13 +427,14 @@ void wifi_event_loop(wifi_handle handle)
         pfd[0].revents = 0;
         pfd[1].revents = 0;
         // ALOGI("Polling socket");
-        int result = poll(pfd, 2, timeout);
+        int result = TEMP_FAILURE_RETRY(poll(pfd, 2, timeout));
         if (result < 0) {
             // ALOGE("Error polling socket");
         } else if (pfd[0].revents & POLLERR) {
-            ALOGE("POLL Error; error no = %d", errno);
-            int result2 = read(pfd[0].fd, buf, sizeof(buf));
-            ALOGE("Read after POLL returned %d, error no = %d", result2, errno);
+            ALOGE("POLL Error; error no = %d (%s)", errno, strerror(errno));
+            ssize_t result2 = TEMP_FAILURE_RETRY(read(pfd[0].fd, buf, sizeof(buf)));
+            ALOGE("Read after POLL returned %zd, error no = %d (%s)", result2,
+                  errno, strerror(errno));
         } else if (pfd[0].revents & POLLHUP) {
             ALOGE("Remote side hung up");
             break;
@@ -426,11 +443,12 @@ void wifi_event_loop(wifi_handle handle)
             internal_pollin_handler(handle);
         } else if (pfd[1].revents & POLLIN) {
             memset(buf, 0, sizeof(buf));
-            int result2 = read(pfd[1].fd, buf, sizeof(buf));
-            ALOGE("%s: Read after POLL returned %d, error no = %d", __FUNCTION__, result2, errno);
+            ssize_t result2 = TEMP_FAILURE_RETRY(read(pfd[1].fd, buf, sizeof(buf)));
+            ALOGE("%s: Read after POLL returned %zd, error no = %d (%s)", __FUNCTION__,
+                   result2, errno, strerror(errno));
             if (strncmp(buf, "Exit", 4) == 0) {
                 ALOGD("Got a signal to exit!!!");
-                if (write(pfd[1].fd, "Done", 4) < 1) {
+                if (TEMP_FAILURE_RETRY(write(pfd[1].fd, "Done", 4)) < 1) {
                     ALOGE("could not write to the cleanup socket");
                 }
                 break;
@@ -1139,6 +1157,9 @@ wifi_error wifi_init_interfaces(wifi_handle handle)
 
     closedir(d);
 
+    if (n == 0)
+        return WIFI_ERROR_NOT_AVAILABLE;
+
     d = opendir("/sys/class/net");
     if (d == 0)
         return WIFI_ERROR_UNKNOWN;
index f0dc326..e5b40c4 100644 (file)
@@ -13,7 +13,8 @@
 #include <netlink/object-api.h>
 #include <netlink/netlink.h>
 #include <netlink/socket.h>
-#include <netlink-types.h>
+#include <netlink-private/object-api.h>
+#include <netlink-private/types.h>
 
 #include "nl80211_copy.h"
 #include "sync.h"
index 2dc9228..e1013f5 100644 (file)
@@ -13,7 +13,9 @@
 #include <netlink/object-api.h>
 #include <netlink/netlink.h>
 #include <netlink/socket.h>
-#include <netlink-types.h>
+#include <netlink-private/object-api.h>
+#include <netlink-private/types.h>
+
 
 #include "nl80211_copy.h"
 #include "sync.h"
index 5d24799..f9dbb95 100644 (file)
@@ -168,5 +168,48 @@ int wpa_driver_set_ap_wps_p2p_ie(void *priv, const struct wpabuf *beacon,
                                 const struct wpabuf *proberesp,
                                 const struct wpabuf *assocresp)
 {
-        return 0;
+       char *buf;
+       const struct wpabuf *ap_wps_p2p_ie = NULL;
+
+       char *_cmd = "SET_AP_WPS_P2P_IE";
+       char *pbuf;
+       int ret = 0;
+       int i, buf_len;
+       struct cmd_desc {
+               int cmd;
+               const struct wpabuf *src;
+       } cmd_arr[] = {
+               {0x1, beacon},
+               {0x2, proberesp},
+               {0x4, assocresp},
+               {-1, NULL}
+       };
+
+       wpa_printf(MSG_DEBUG, "%s: Entry", __func__);
+       for (i = 0; cmd_arr[i].cmd != -1; i++) {
+               ap_wps_p2p_ie = cmd_arr[i].src;
+               if (ap_wps_p2p_ie) {
+                       buf_len = strlen(_cmd) + 3 + wpabuf_len(ap_wps_p2p_ie);
+                       buf = os_zalloc(buf_len);
+                       if (NULL == buf) {
+                               wpa_printf(MSG_ERROR, "%s: Out of memory",
+                                          __func__);
+                               ret = -1;
+                               break;
+                       }
+               } else {
+                       continue;
+               }
+               pbuf = buf;
+               pbuf += snprintf(pbuf, buf_len - wpabuf_len(ap_wps_p2p_ie),
+                                "%s %d",_cmd, cmd_arr[i].cmd);
+               *pbuf++ = '\0';
+               os_memcpy(pbuf, wpabuf_head(ap_wps_p2p_ie), wpabuf_len(ap_wps_p2p_ie));
+               ret = wpa_driver_nl80211_driver_cmd(priv, buf, buf, buf_len);
+               os_free(buf);
+               if (ret < 0)
+                       break;
+       }
+
+       return ret;
 }