From ae4413b3422b6447ebf5c090c56f212f0942401a Mon Sep 17 00:00:00 2001 From: Om Prakash Tripathi Date: Fri, 3 Nov 2017 16:11:11 +0530 Subject: [PATCH] qcacmn: Add support for wide band scan Add support for 40 MHz or wider channel bandwidth scan Change-Id: I72f3cf42e6dc957ef56842d0c333c62169cb6d68 CRs-Fixed: 2139415 --- wmi_unified_non_tlv.c | 16 +++++++++------- wmi_unified_tlv.c | 38 +++++++++++++++++++++++++++++++------- 2 files changed, 40 insertions(+), 14 deletions(-) diff --git a/wmi_unified_non_tlv.c b/wmi_unified_non_tlv.c index 5db01d936e..9d54af3344 100644 --- a/wmi_unified_non_tlv.c +++ b/wmi_unified_non_tlv.c @@ -1871,8 +1871,8 @@ static QDF_STATUS send_scan_start_cmd_non_tlv(wmi_unified_t wmi_handle, #ifdef TEST_CODE len += sizeof(wmi_chan_list) + 3 * sizeof(A_UINT32); #else - if (param->num_chan) { - len += sizeof(wmi_chan_list) + (param->num_chan - 1) + if (param->chan_list.num_chan) { + len += sizeof(wmi_chan_list) + (param->chan_list.num_chan - 1) * sizeof(A_UINT32); } #endif @@ -1994,13 +1994,14 @@ static QDF_STATUS send_scan_start_cmd_non_tlv(wmi_unified_t wmi_handle, tmp_ptr += (2 + chan_list->num_chan); /* increase by words */- #else #define FREQUENCY_THRESH 1000 - if (param->num_chan) { + if (param->chan_list.num_chan) { chan_list = (wmi_chan_list *) tmp_ptr; chan_list->tag = WMI_CHAN_LIST_TAG; - chan_list->num_chan = param->num_chan; - qdf_mem_copy(chan_list->channel_list, param->chan_list, - ((param->num_chan) * sizeof(uint32_t))); - tmp_ptr += (2 + param->num_chan); /* increase by words */ + chan_list->num_chan = param->chan_list.num_chan; + for (i = 0; i < param->chan_list.num_chan; ++i) + chan_list->channel_list[i] = + param->chan_list.chan[i].freq; + tmp_ptr += (2 + param->chan_list.num_chan); } #endif if (param->num_ssids) { @@ -8535,6 +8536,7 @@ static void populate_non_tlv_service(uint32_t *wmi_service) wmi_service[wmi_service_offchan_tx_wmi] = WMI_SERVICE_UNAVAILABLE; wmi_service[wmi_service_chan_load_info] = WMI_SERVICE_UNAVAILABLE; wmi_service[wmi_service_ack_timeout] = WMI_SERVICE_UNAVAILABLE; + wmi_service[wmi_service_widebw_scan] = WMI_SERVICE_UNAVAILABLE; } /** diff --git a/wmi_unified_tlv.c b/wmi_unified_tlv.c index 8d8c1fbad2..18f4ee77da 100644 --- a/wmi_unified_tlv.c +++ b/wmi_unified_tlv.c @@ -2277,13 +2277,14 @@ static QDF_STATUS send_scan_start_cmd_tlv(wmi_unified_t wmi_handle, wmi_mac_addr *bssid; int len = sizeof(*cmd); uint8_t extraie_len_with_pad = 0; + uint8_t phymode_roundup = 0; struct probe_req_whitelist_attr *ie_whitelist = ¶ms->ie_whitelist; /* Length TLV placeholder for array of uint32_t */ len += WMI_TLV_HDR_SIZE; /* calculate the length of buffer required */ - if (params->num_chan) - len += params->num_chan * sizeof(uint32_t); + if (params->chan_list.num_chan) + len += params->chan_list.num_chan * sizeof(uint32_t); /* Length TLV placeholder for array of wmi_ssid structures */ len += WMI_TLV_HDR_SIZE; @@ -2306,6 +2307,13 @@ static QDF_STATUS send_scan_start_cmd_tlv(wmi_unified_t wmi_handle, if (ie_whitelist->num_vendor_oui) len += ie_whitelist->num_vendor_oui * sizeof(wmi_vendor_oui); + len += WMI_TLV_HDR_SIZE; /* Length of TLV for array of scan phymode */ + if (params->scan_f_wide_band) + phymode_roundup = + qdf_roundup(params->chan_list.num_chan * sizeof(uint8_t), + sizeof(uint32_t)); + len += phymode_roundup; + /* Allocate the memory */ wmi_buf = wmi_buf_alloc(wmi_handle, len); if (!wmi_buf) { @@ -2337,7 +2345,7 @@ static QDF_STATUS send_scan_start_cmd_tlv(wmi_unified_t wmi_handle, cmd->max_scan_time = params->max_scan_time; cmd->probe_delay = params->probe_delay; cmd->burst_duration = params->burst_duration; - cmd->num_chan = params->num_chan; + cmd->num_chan = params->chan_list.num_chan; cmd->num_bssid = params->num_bssid; cmd->num_ssids = params->num_ssids; cmd->ie_len = params->extraie.len; @@ -2359,13 +2367,15 @@ static QDF_STATUS send_scan_start_cmd_tlv(wmi_unified_t wmi_handle, buf_ptr += sizeof(*cmd); tmp_ptr = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); - for (i = 0; i < params->num_chan; ++i) - tmp_ptr[i] = params->chan_list[i]; + for (i = 0; i < params->chan_list.num_chan; ++i) + tmp_ptr[i] = params->chan_list.chan[i].freq; WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, - (params->num_chan * sizeof(uint32_t))); - buf_ptr += WMI_TLV_HDR_SIZE + (params->num_chan * sizeof(uint32_t)); + (params->chan_list.num_chan * sizeof(uint32_t))); + buf_ptr += WMI_TLV_HDR_SIZE + + (params->chan_list.num_chan * sizeof(uint32_t)); + if (params->num_ssids > WMI_SCAN_MAX_NUM_SSID) { WMI_LOGE("Invalid value for numSsid"); goto error; @@ -2419,6 +2429,19 @@ static QDF_STATUS send_scan_start_cmd_tlv(wmi_unified_t wmi_handle, buf_ptr += cmd->num_vendor_oui * sizeof(wmi_vendor_oui); } + /* Add phy mode TLV if it's a wide band scan */ + if (params->scan_f_wide_band) { + WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, phymode_roundup); + buf_ptr = (uint8_t *) (buf_ptr + WMI_TLV_HDR_SIZE); + for (i = 0; i < params->chan_list.num_chan; ++i) + buf_ptr[i] = + WMI_SCAN_CHAN_SET_MODE(params->chan_list.chan[i].phymode); + buf_ptr += phymode_roundup; + } else { + /* Add ZERO legth phy mode TLV */ + WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, 0); + } + ret = wmi_unified_cmd_send( get_pdev_wmi_handle(wmi_handle, cmd->vdev_id), wmi_buf, len, WMI_START_SCAN_CMDID); @@ -20314,6 +20337,7 @@ static void populate_tlv_service(uint32_t *wmi_service) wmi_service[wmi_service_chan_load_info] = WMI_SERVICE_CHAN_LOAD_INFO; wmi_service[wmi_service_extended_nss_support] = WMI_SERVICE_EXTENDED_NSS_SUPPORT; + wmi_service[wmi_service_widebw_scan] = WMI_SERVICE_SCAN_PHYMODE_SUPPORT; } /**