prima: Check for INDOOR flag in channels in case of SAP
qcacld-2.0 to prima propagation
For SAP, valid channels should not include INDOOR-ONLY channels.
So check that flag before returning to user-space in case the
interface is SOFTAP.
CRs-Fixed: 886169
Change-Id: Ibfe62a342fb660949b22ae19179a28710bd5e86d
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 7be4527..1158afd 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -4208,16 +4208,20 @@
struct wireless_dev *wdev,
const void *data, int dataLen)
{
- hdd_context_t *pHddCtx = wiphy_priv(wiphy);
- tANI_U32 ChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0};
- tANI_U8 numChannels = 0;
+ hdd_context_t *pHddCtx = wiphy_priv(wiphy);
+ struct net_device *dev = wdev->netdev;
+ hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+ uint32_t chan_list[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0};
+ uint8_t num_channels = 0;
+ uint8_t num_chan_new = 0;
+ uint8_t buf[256] = {0};
struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1];
tANI_U32 requestId, maxChannels;
tWifiBand wifiBand;
eHalStatus status;
struct sk_buff *replySkb;
- tANI_U8 i;
- int ret;
+ tANI_U8 i,j,k;
+ int ret,len = 0;;
ENTER();
@@ -4264,22 +4268,43 @@
hddLog(VOS_TRACE_LEVEL_INFO, FL("Max channels %d"), maxChannels);
status = sme_GetValidChannelsByBand((tHalHandle)(pHddCtx->hHal),
- wifiBand, ChannelList,
- &numChannels);
+ wifiBand, chan_list,
+ &num_channels);
if (eHAL_STATUS_SUCCESS != status) {
hddLog(VOS_TRACE_LEVEL_ERROR,
FL("sme_GetValidChannelsByBand failed (err=%d)"), status);
return -EINVAL;
}
- numChannels = VOS_MIN(numChannels, maxChannels);
- hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of channels (%d)"), numChannels);
+ num_channels = VOS_MIN(num_channels, maxChannels);
+ num_chan_new = num_channels;
+ /* remove the indoor only channels if iface is SAP */
+ if (WLAN_HDD_SOFTAP == pAdapter->device_mode)
+ {
+ num_chan_new = 0;
+ for (i = 0; i < num_channels; i++)
+ for (j = 0; j < IEEE80211_NUM_BANDS; j++) {
+ if (wiphy->bands[j] == NULL)
+ continue;
+ for (k = 0; k < wiphy->bands[j]->n_channels; k++) {
+ if ((chan_list[i] ==
+ wiphy->bands[j]->channels[k].center_freq) &&
+ (!(wiphy->bands[j]->channels[k].flags &
+ IEEE80211_CHAN_INDOOR_ONLY))) {
+ chan_list[num_chan_new] = chan_list[i];
+ num_chan_new++;
+ }
+ }
+ }
+ }
- for (i = 0; i < numChannels; i++)
- hddLog(VOS_TRACE_LEVEL_INFO, "Channel: %u ", ChannelList[i]);
+ hddLog(LOG1, FL("Number of channels: %d"), num_chan_new);
+ for (i = 0; i < num_chan_new; i++)
+ len += scnprintf(buf + len, sizeof(buf) - len, "%u ", chan_list[i]);
+ hddLog(LOG1, "Channels: %s", buf);
replySkb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) +
- sizeof(u32) * numChannels +
+ sizeof(u32) * num_chan_new +
NLMSG_HDRLEN);
if (!replySkb) {
@@ -4289,9 +4314,9 @@
}
if (nla_put_u32(replySkb,
QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_CHANNELS,
- numChannels) ||
+ num_chan_new) ||
nla_put(replySkb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CHANNELS,
- sizeof(u32) * numChannels, ChannelList)) {
+ sizeof(u32) * num_chan_new, chan_list)) {
hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail"));
kfree_skb(replySkb);