wlan: Added the gEnableDFSPnoChnlScan ini parameter

Currently DFS channels are sent as a part of PNO request.
This ini variable is added to enable/disable the DFS
channels in PNO request.
Also added a check to handle the scenario where all the
channels sent by supplicant are DFS in PNO request.

Change-Id: Ie95e74bd46ff442eb71451007fa4aa2331d61252
CRs-Fixed: 754763
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 93329ff..b1887b5 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -13235,6 +13235,8 @@
     v_U32_t num_channels_allowed = WNI_CFG_VALID_CHANNEL_LIST_LEN;
     eHalStatus status = eHAL_STATUS_FAILURE;
     int ret = 0;
+    hdd_config_t *pConfig = NULL;
+    v_U32_t num_ignore_dfs_ch = 0;
 
     if (NULL == pAdapter)
     {
@@ -13253,6 +13255,7 @@
         return -EINVAL;
     }
 
+    pConfig = pHddCtx->cfg_ini;
     hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
     if (NULL == hHal)
     {
@@ -13347,6 +13350,16 @@
             {
                 if (request->channels[i]->hw_value == channels_allowed[indx])
                 {
+                    if ((!pConfig->enableDFSPnoChnlScan) &&
+                      (NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(channels_allowed[indx])))
+                    {
+                        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                        "%s : Dropping DFS channel : %d",
+                        __func__,channels_allowed[indx]);
+                        num_ignore_dfs_ch++;
+                        break;
+                    }
+
                     valid_ch[num_ch++] = request->channels[i]->hw_value;
                     len += snprintf(chList+len, 5, "%d ",
                                          request->channels[i]->hw_value);
@@ -13355,8 +13368,16 @@
             }
         }
         hddLog(VOS_TRACE_LEVEL_INFO,"Channel-List:  %s ", chList);
-     }
 
+        /*If all channels are DFS and dropped, then ignore the PNO request*/
+        if (num_ignore_dfs_ch == request->n_channels)
+        {
+            VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+             "%s : All requested channels are DFS channels", __func__);
+            ret = -EINVAL;
+            goto error;
+        }
+     }
     /* Filling per profile  params */
     for (i = 0; i < pPnoRequest->ucNetworksCount; i++)
     {