[7570][7872][7885][9610] wlbt: [M1712][O MR1]Failure to start SoftAP
authorSrishti Piplani <srishti.p@samsung.com>
Thu, 2 Aug 2018 06:43:20 +0000 (12:13 +0530)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:23:02 +0000 (20:23 +0300)
Changes done to check if the channel is a DFS channel while
selecting a valid channel, when the framework issues an indoor
channel for starting the AP.

Change-Id: Idd96c5721ee97fda026675547f43f786740bc1ee
SCSC-Bug-Id: SSB-42443
Signed-off-by: Srishti Piplani <srishti.p@samsung.com>
drivers/net/wireless/scsc/cfg80211_ops.c
drivers/net/wireless/scsc/dev.h
drivers/net/wireless/scsc/mgt.c

index d481bba93f9dac2a51228e47b3e78f2d00732d9a..1f7a5b8ede7f48ebba717473e00636172db6f13b 100755 (executable)
@@ -1881,6 +1881,9 @@ int slsi_start_ap(struct wiphy *wiphy, struct net_device *dev,
 #endif
        struct ieee80211_channel  *channel = NULL;
        int indoor_channel = 0;
+       int i;
+       u32 chan_flags;
+       u16 center_freq;
 
        SLSI_MUTEX_LOCK(sdev->start_stop_mutex);
        if (sdev->device_state != SLSI_DEVICE_STATE_STARTED) {
@@ -1909,18 +1912,6 @@ int slsi_start_ap(struct wiphy *wiphy, struct net_device *dev,
        }
 #endif
 
-       channel =  ieee80211_get_channel(sdev->wiphy, settings->chandef.chan->center_freq);
-       if ((channel->flags) & (IEEE80211_CHAN_INDOOR_ONLY)) {
-               settings->chandef.chan = ieee80211_get_channel(wiphy,
-                                                                sdev->device_config.domain_info.no_indoor_freq);
-               settings->chandef.center_freq1 = sdev->device_config.domain_info.no_indoor_freq;
-               indoor_channel = 1;
-       }
-
-       r = slsi_ap_start_validate(dev, sdev, settings);
-       if (r != 0)
-               goto exit_with_vif_mutex;
-
        memset(&ndev_vif->ap, 0, sizeof(ndev_vif->ap));
        /* Initialise all allocated peer structures to remove old data. */
        /*slsi_netif_init_all_peers(sdev, dev);*/
@@ -1935,17 +1926,57 @@ int slsi_start_ap(struct wiphy *wiphy, struct net_device *dev,
                                r = -EINVAL;
                                goto exit_with_vif_mutex;
                        }
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 9))
-                       if (slsi_check_channelization(sdev, ndev_vif->chandef) != 0) {
+               }
+       }
+       if (sdev->band_5g_supported && ((settings->chandef.chan->center_freq / 1000) == 5)) {
+               channel =  ieee80211_get_channel(sdev->wiphy, settings->chandef.chan->center_freq);
+               if (!channel) {
+                       SLSI_ERR(sdev, "Invalid frequency %d used to start AP. Channel not found\n",
+                                settings->chandef.chan->center_freq);
+                       r = -EINVAL;
+                       goto exit_with_vif_mutex;
+               }
+               if ((channel->flags) & (IEEE80211_CHAN_INDOOR_ONLY)) {
+                       chan_flags = (IEEE80211_CHAN_INDOOR_ONLY | IEEE80211_CHAN_RADAR | IEEE80211_CHAN_DISABLED |
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 10, 13)
+                                     IEEE80211_CHAN_PASSIVE_SCAN
 #else
-                       if (slsi_check_channelization(sdev, ndev_vif->channel_type) != 0) {
-#endif
+                                     IEEE80211_CHAN_NO_IR
+#endif
+                                    );
+
+                       for (i = 0; i < wiphy->bands[NL80211_BAND_5GHZ]->n_channels; i++) {
+                               if (!(wiphy->bands[NL80211_BAND_5GHZ]->channels[i].flags & chan_flags)) {
+                                       center_freq = wiphy->bands[NL80211_BAND_5GHZ]->channels[i].center_freq;
+                                       settings->chandef.chan = ieee80211_get_channel(wiphy, center_freq);
+                                       settings->chandef.center_freq1 = center_freq;
+                                       SLSI_DBG1(sdev, SLSI_CFG80211, "ap valid frequency :%d, chan_flags:%x\n",
+                                                 center_freq, wiphy->bands[NL80211_BAND_5GHZ]->channels[i].flags);
+                                       indoor_channel = 1;
+                                       break;
+                               }
+                       }
+                       if (indoor_channel == 0) {
+                               SLSI_ERR(sdev, "No valid channel found to start the AP");
                                r = -EINVAL;
                                goto exit_with_vif_mutex;
                        }
                }
        }
 
+       r = slsi_ap_start_validate(dev, sdev, settings);
+       if (r != 0)
+               goto exit_with_vif_mutex;
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 9))
+       if (slsi_check_channelization(sdev, ndev_vif->chandef) != 0) {
+#else
+       if (slsi_check_channelization(sdev, ndev_vif->channel_type) != 0) {
+#endif
+               r = -EINVAL;
+               goto exit_with_vif_mutex;
+       }
+
        if (ndev_vif->iftype == NL80211_IFTYPE_P2P_GO) {
                slsi_p2p_group_start_remove_unsync_vif(sdev);
                SLSI_ETHER_COPY(device_address, sdev->netdev_addresses[SLSI_NET_INDEX_P2P]);
index 17e9931a06c6b4aa74685dbee7cd5f1af3c0e7e9..8bfe8f89d176332fa9c8ef1fa34c8c9ee05acb3b 100755 (executable)
@@ -736,7 +736,6 @@ struct netdev_vif {
 };
 
 struct slsi_802_11d_reg_domain {
-       int                        no_indoor_freq;
        u8                         *countrylist;
        struct ieee80211_regdomain *regdomain;
        int                        country_len;
index 2e7267b69453dec1f0a8b9db8e3106c40b17925b..be46f3489b45a5853cade47bc8d1d3c794ad39f4 100755 (executable)
@@ -3873,7 +3873,6 @@ static void slsi_reg_mib_to_regd(struct slsi_mib_data *mib, struct slsi_802_11d_
        u16 freq;
        u8 byte_val;
        struct ieee80211_reg_rule *reg_rule;
-       int freq_found = 0;
 
        domain_info->regdomain->alpha2[0] = *(u8 *)(&mib->data[i]);
        i++;
@@ -3908,12 +3907,7 @@ static void slsi_reg_mib_to_regd(struct slsi_mib_data *mib, struct slsi_802_11d_
 
                /* Flags 1 byte */
                reg_rule->flags = slsi_remap_reg_rule_flags(*(u8 *)(&mib->data[i + 6]));
-               if (!freq_found)
-                       if (((reg_rule->freq_range.start_freq_khz / 1000000) == 5) &&
-                           !(reg_rule->flags & NL80211_RRF_NO_OUTDOOR)) {
-                               domain_info->no_indoor_freq = (reg_rule->freq_range.start_freq_khz / 1000) + 10;
-                               freq_found = 1;
-                       }
+
                i += 7;
 
                num_rules++; /* Num of reg rules */