summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-06-24 01:12:49 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-06-24 01:12:49 +0000
commit957fe1936da4dd3f0e7d7b9dc2e726733dd3dc5e (patch)
tree669fe7e7e8201ed855227dfc21d603f2a58bd33e
parent1a4ca3390a6495177416826d68b37af6a16596a5 (diff)
parentc7c58f992a43831877c24f5f8d46764e9cd14052 (diff)
downloadwlan-957fe1936da4dd3f0e7d7b9dc2e726733dd3dc5e.tar.gz
Snap for 7487213 from c7c58f992a43831877c24f5f8d46764e9cd14052 to sc-v2-release
Change-Id: I4e719e9e2d76827e300ee9a1dc8099391ce2cfc0
-rwxr-xr-xbcmdhd/wifi_hal/common.cpp38
-rwxr-xr-xbcmdhd/wifi_hal/wifi_hal.cpp27
2 files changed, 42 insertions, 23 deletions
diff --git a/bcmdhd/wifi_hal/common.cpp b/bcmdhd/wifi_hal/common.cpp
index 4a56bd6..887b530 100755
--- a/bcmdhd/wifi_hal/common.cpp
+++ b/bcmdhd/wifi_hal/common.cpp
@@ -105,14 +105,34 @@ wifi_error wifi_register_vendor_handler(wifi_handle handle,
wifi_error result = WIFI_ERROR_OUT_OF_MEMORY;
if (info->num_event_cb < info->alloc_event_cb) {
- info->event_cb[info->num_event_cb].nl_cmd = NL80211_CMD_VENDOR;
- info->event_cb[info->num_event_cb].vendor_id = id;
- info->event_cb[info->num_event_cb].vendor_subcmd = subcmd;
- info->event_cb[info->num_event_cb].cb_func = func;
- info->event_cb[info->num_event_cb].cb_arg = arg;
- ALOGV("Added event handler %p:%p for vendor 0x%0x and subcmd 0x%0x at %d",
- arg, func, id, subcmd, info->num_event_cb);
- info->num_event_cb++;
+ /* To avoid an unwanted duplication of the record, find first.
+ * Update it if the same record is already exist.
+ * KEY => [nl_cmd, vendor_id, vendor_subcmd]
+ */
+ int i = 0;
+ bool is_update = false;
+ for (i = 0; i < info->num_event_cb; i++) {
+ if ((info->event_cb[i].nl_cmd == NL80211_CMD_VENDOR) &&
+ (info->event_cb[i].vendor_id == id) &&
+ (info->event_cb[i].vendor_subcmd == subcmd)) {
+ is_update = true;
+ break;
+ }
+ }
+
+ if (is_update) {
+ info->event_cb[i].cb_func = func;
+ info->event_cb[i].cb_arg = arg;
+ } else {
+ info->event_cb[info->num_event_cb].nl_cmd = NL80211_CMD_VENDOR;
+ info->event_cb[info->num_event_cb].vendor_id = id;
+ info->event_cb[info->num_event_cb].vendor_subcmd = subcmd;
+ info->event_cb[info->num_event_cb].cb_func = func;
+ info->event_cb[info->num_event_cb].cb_arg = arg;
+ info->num_event_cb++;
+ }
+ ALOGI("%s ""event handler %p:%p for vendor 0x%0x and subcmd 0x%0x at %d",
+ is_update ? "Updated" : "Added", arg, func, id, subcmd, info->num_event_cb);
result = WIFI_SUCCESS;
}
@@ -157,7 +177,7 @@ void wifi_unregister_vendor_handler(wifi_handle handle, uint32_t id, int subcmd)
if (info->event_cb[i].nl_cmd == NL80211_CMD_VENDOR
&& info->event_cb[i].vendor_id == id
&& info->event_cb[i].vendor_subcmd == subcmd) {
- ALOGV("Successfully removed event handler %p:%p for vendor 0x%0x, subcmd 0x%0x from %d",
+ ALOGI("Successfully removed event handler %p:%p for vendor 0x%0x, subcmd 0x%0x from %d",
info->event_cb[i].cb_arg, info->event_cb[i].cb_func, id, subcmd, i);
memmove(&info->event_cb[i], &info->event_cb[i+1],
(info->num_event_cb - i - 1) * sizeof(cb_info));
diff --git a/bcmdhd/wifi_hal/wifi_hal.cpp b/bcmdhd/wifi_hal/wifi_hal.cpp
index 8c5c7a4..bafbcf1 100755
--- a/bcmdhd/wifi_hal/wifi_hal.cpp
+++ b/bcmdhd/wifi_hal/wifi_hal.cpp
@@ -409,7 +409,7 @@ wifi_error wifi_pre_initialize(void)
}
/* Set the socket buffer size */
- if (nl_socket_set_buffer_size(event_sock, (2*1024*1024), 0) < 0) {
+ if (nl_socket_set_buffer_size(event_sock, (4*1024*1024), 0) < 0) {
ALOGE("Could not set size for event_sock: %s",
strerror(errno));
} else {
@@ -1085,27 +1085,27 @@ public:
int start() {
WifiRequest request(familyId(), ifaceId());
int result = createRequest(request, 1);
- if (result < 0) {
- return result;
- }
- result = requestResponse(request);
- if (result < 0) {
- ALOGI("Failed to set RSSI Monitor, result = %d", result);
+ if (result != WIFI_SUCCESS) {
+ ALOGE("Failed to create request; result = %d", result);
return result;
}
- ALOGI("Successfully set RSSI monitoring");
- result = registerVendorHandler(GOOGLE_OUI, GOOGLE_RSSI_MONITOR_EVENT);
+ registerVendorHandler(GOOGLE_OUI, GOOGLE_RSSI_MONITOR_EVENT);
+ ALOGI("Register GOOGLE_RSSI_MONITOR_EVENT handler");
- if (result < 0) {
+ result = requestResponse(request);
+ if (result != WIFI_SUCCESS) {
unregisterVendorHandler(GOOGLE_OUI, GOOGLE_RSSI_MONITOR_EVENT);
+ ALOGE("Failed to set RSSI Monitor, result = %d", result);
return result;
}
- ALOGI("Done!");
+
+ ALOGI("Successfully set RSSI monitoring");
return result;
}
virtual int cancel() {
+ unregisterVendorHandler(GOOGLE_OUI, GOOGLE_RSSI_MONITOR_EVENT);
WifiRequest request(familyId(), ifaceId());
int result = createRequest(request, 0);
@@ -1117,7 +1117,6 @@ public:
ALOGE("failed to stop RSSI monitoring = %d", result);
}
}
- unregisterVendorHandler(GOOGLE_OUI, GOOGLE_RSSI_MONITOR_EVENT);
return WIFI_SUCCESS;
}
@@ -1768,7 +1767,7 @@ wifi_error wifi_set_country_code(wifi_interface_handle handle, const char *count
static 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)
{
- ALOGD("Start RSSI monitor %d", id);
+ ALOGI("Starting RSSI monitor %d", id);
wifi_handle handle = getWifiHandle(iface);
SetRSSIMonitorCommand *cmd = new SetRSSIMonitorCommand(id, iface, max_rssi, min_rssi, eh);
NULL_CHECK_RETURN(cmd, "memory allocation failure", WIFI_ERROR_OUT_OF_MEMORY);
@@ -1788,7 +1787,7 @@ static wifi_error wifi_start_rssi_monitoring(wifi_request_id id, wifi_interface_
static wifi_error wifi_stop_rssi_monitoring(wifi_request_id id, wifi_interface_handle iface)
{
- ALOGD("Stopping RSSI monitor");
+ ALOGI("Stopping RSSI monitor %d", id);
if(id == -1) {
wifi_rssi_event_handler handler;