mac80211: fix warning in select_queue with kernel 3.14
[oweals/openwrt.git] / package / kernel / mac80211 / patches / 570-restrict_dfs_regions.patch
1 --- a/drivers/net/wireless/ath/ath10k/mac.c
2 +++ b/drivers/net/wireless/ath/ath10k/mac.c
3 @@ -4321,6 +4321,7 @@ static const struct ieee80211_iface_comb
4                                         BIT(NL80211_CHAN_WIDTH_20) |
5                                         BIT(NL80211_CHAN_WIDTH_40) |
6                                         BIT(NL80211_CHAN_WIDTH_80),
7 +               .radar_detect_regions = BIT(NL80211_DFS_ETSI),
8  #endif
9         },
10  };
11 --- a/drivers/net/wireless/ath/ath9k/init.c
12 +++ b/drivers/net/wireless/ath/ath9k/init.c
13 @@ -688,6 +688,7 @@ static const struct ieee80211_iface_comb
14                 .beacon_int_infra_match = true,
15                 .radar_detect_widths =  BIT(NL80211_CHAN_WIDTH_20_NOHT) |
16                                         BIT(NL80211_CHAN_WIDTH_20),
17 +               .radar_detect_regions = BIT(NL80211_DFS_ETSI),
18         }
19  #endif
20  };
21 --- a/include/net/cfg80211.h
22 +++ b/include/net/cfg80211.h
23 @@ -2620,6 +2620,7 @@ struct ieee80211_iface_limit {
24   *     between infrastructure and AP types must match. This is required
25   *     only in special cases.
26   * @radar_detect_widths: bitmap of channel widths supported for radar detection
27 + * @radar_detect_regions: bitmap of regions supported for radar detection
28   *
29   * With this structure the driver can describe which interface
30   * combinations it supports concurrently.
31 @@ -2677,6 +2678,7 @@ struct ieee80211_iface_combination {
32         u8 n_limits;
33         bool beacon_int_infra_match;
34         u8 radar_detect_widths;
35 +       u8 radar_detect_regions;
36  };
37  
38  struct ieee80211_txrx_stypes {
39 --- a/net/wireless/util.c
40 +++ b/net/wireless/util.c
41 @@ -1259,6 +1259,7 @@ int cfg80211_can_use_iftype_chan(struct 
42                                  enum cfg80211_chan_mode chanmode,
43                                  u8 radar_detect)
44  {
45 +       const struct ieee80211_regdomain *regdom;
46         struct wireless_dev *wdev_iter;
47         u32 used_iftypes = BIT(iftype);
48         int num[NUM_NL80211_IFTYPES];
49 @@ -1267,6 +1268,7 @@ int cfg80211_can_use_iftype_chan(struct 
50         struct ieee80211_channel *ch;
51         enum cfg80211_chan_mode chmode;
52         int num_different_channels = 0;
53 +       enum nl80211_dfs_regions region = 0;
54         int total = 1;
55         int i, j;
56  
57 @@ -1285,6 +1287,14 @@ int cfg80211_can_use_iftype_chan(struct 
58                 return 0;
59         }
60  
61 +       if (radar_detect) {
62 +               rcu_read_lock();
63 +               regdom = rcu_dereference(cfg80211_regdomain);
64 +               if (regdom)
65 +                       region = regdom->dfs_region;
66 +               rcu_read_unlock();
67 +       }
68 +
69         memset(num, 0, sizeof(num));
70         memset(used_channels, 0, sizeof(used_channels));
71  
72 @@ -1392,6 +1402,10 @@ int cfg80211_can_use_iftype_chan(struct 
73                 if (radar_detect && !(c->radar_detect_widths & radar_detect))
74                         goto cont;
75  
76 +               if (radar_detect && c->radar_detect_regions &&
77 +                   !(c->radar_detect_regions & BIT(region)))
78 +                       goto cont;
79 +
80                 /*
81                  * Finally check that all iftypes that we're currently
82                  * using are actually part of this combination. If they