qcacld-3.0: Mark SRD channels as passive

Currently the driver does not mark the SRD channels
as passive which leads to hostapd starting P2P-GO
on a SRD channel, but since driver does not allow
the same, P2P-GO fails.

Fix is to inform the wiphy about the SRD channels by
making them as passive so that the hostpad does not
give the command to start the P2P-GO on the particular
SRD channel.

Change-Id: I5eaa457b8819d7a22d2e592d1b79fff15b364f40
CRs-Fixed: 2491045
Bug: 138939517
Signed-off-by: Vinay Gannevaram <quic_vganneva@quicinc.com>
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index 439bbe6..f40622d 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -9897,8 +9897,6 @@
 		goto out;
 	}
 
-	cds_fill_and_send_ctl_to_fw(&hdd_ctx->reg);
-
 	status = hdd_set_sme_chan_list(hdd_ctx);
 	if (status != QDF_STATUS_SUCCESS) {
 		hdd_err("Failed to init channel list: %d", status);
diff --git a/core/hdd/src/wlan_hdd_regulatory.c b/core/hdd/src/wlan_hdd_regulatory.c
index 8e3ac04..59733fe 100644
--- a/core/hdd/src/wlan_hdd_regulatory.c
+++ b/core/hdd/src/wlan_hdd_regulatory.c
@@ -621,9 +621,18 @@
 			} else {
 				cds_chan->state = CHANNEL_STATE_ENABLE;
 			}
+			/* This check is to mark SRD as passive if ini is 0 */
+			if (!hdd_ctx->config->etsi_srd_chan_in_master_mode &&
+			    cds_is_etsi13_regdmn_srd_chan(
+						    wiphy_chan->center_freq)) {
+				hdd_debug("freq %d is SRD, marked as passive",
+					  wiphy_chan->center_freq);
+				wiphy_chan->flags |=
+						IEEE80211_CHAN_PASSIVE_SCAN;
+				cds_chan->state = CHANNEL_STATE_DFS;
+			}
 			cds_chan->pwr_limit = wiphy_chan->max_power;
 			cds_chan->flags = wiphy_chan->flags;
-
 		}
 	}
 
@@ -809,7 +818,7 @@
 	ret_val = hdd_update_regulatory_info(hdd_ctx);
 	if (ret_val)
 		return ret_val;
-
+	cds_fill_and_send_ctl_to_fw(&hdd_ctx->reg);
 	hdd_process_regulatory_data(hdd_ctx, hdd_ctx->wiphy,
 				    hdd_ctx->reg.reset);
 
@@ -938,8 +947,6 @@
 		sme_generic_change_country_code(hdd_ctx->hHal,
 						hdd_ctx->reg.alpha2);
 
-		cds_fill_and_send_ctl_to_fw(&hdd_ctx->reg);
-
 		cds_get_dfs_region(&dfs_reg);
 		cds_set_wma_dfs_region(dfs_reg);
 		break;