From 3d026fbf4e1c36939cac677c80efcc361895d9f4 Mon Sep 17 00:00:00 2001 From: Paul Zhang Date: Sat, 3 Feb 2018 15:46:29 +0800 Subject: [PATCH] qcacld-3.0: Call callback to sync the user-space When the country code is changed, it needs to call the new cfg80211 api cfg80211_send_reg_change_event to sync the user-space info. Change-Id: I1e31ff122f9337c353d8be260b4802cc363790d6 CRs-Fixed: 2183992 --- core/hdd/src/wlan_hdd_regulatory.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/core/hdd/src/wlan_hdd_regulatory.c b/core/hdd/src/wlan_hdd_regulatory.c index 33a847665739..11bc84b9ae9d 100644 --- a/core/hdd/src/wlan_hdd_regulatory.c +++ b/core/hdd/src/wlan_hdd_regulatory.c @@ -959,13 +959,14 @@ static void hdd_regulatory_dyn_cbk(struct wlan_objmgr_psoc *psoc, struct pdev_osif_priv *pdev_priv; struct hdd_context *hdd_ctx; enum country_src cc_src; + struct regulatory_request request; uint8_t alpha2[REG_ALPHA2_LEN + 1]; pdev_priv = wlan_pdev_get_ospriv(pdev); wiphy = pdev_priv->wiphy; hdd_ctx = wiphy_priv(wiphy); - hdd_debug("%s: process channel list update from regulatory", __func__); + hdd_debug("process channel list update from regulatory"); fill_wiphy_band_channels(wiphy, chan_list, NL80211_BAND_2GHZ); fill_wiphy_band_channels(wiphy, chan_list, NL80211_BAND_5GHZ); @@ -980,6 +981,31 @@ static void hdd_regulatory_dyn_cbk(struct wlan_objmgr_psoc *psoc, if (avoid_freq_ind) hdd_ch_avoid_ind(hdd_ctx, &avoid_freq_ind->chan_list, &avoid_freq_ind->freq_list); + + if (SOURCE_UNKNOWN != cc_src) { + qdf_mem_set(&request, sizeof(request), 0); + + request.alpha2[0] = alpha2[0]; + request.alpha2[1] = alpha2[1]; + + switch (cc_src) { + case SOURCE_CORE: + request.initiator = NL80211_REGDOM_SET_BY_CORE; + break; + case SOURCE_11D: + request.initiator = NL80211_REGDOM_SET_BY_COUNTRY_IE; + break; + case SOURCE_USERSPACE: + request.initiator = NL80211_REGDOM_SET_BY_USER; + break; + case SOURCE_DRIVER: + default: + request.initiator = NL80211_REGDOM_SET_BY_DRIVER; + break; + } + + cfg80211_send_reg_change_event(&request, wiphy); + } } /**