ar71xx: create sysupgrade file for the WZR-HP-G300NH
[openwrt.git] / package / mac80211 / patches / 560-nl80211_get_freq.patch
1 --- a/include/net/cfg80211.h
2 +++ b/include/net/cfg80211.h
3 @@ -954,6 +954,8 @@ struct cfg80211_pmksa {
4   *
5   * @set_txq_params: Set TX queue parameters
6   *
7 + * @get_channel: Get operating channel
8 + *
9   * @set_channel: Set channel
10   *
11   * @scan: Request to do a scan. If returning zero, the scan request is given
12 @@ -1079,6 +1081,10 @@ struct cfg80211_ops {
13         int     (*set_txq_params)(struct wiphy *wiphy,
14                                   struct ieee80211_txq_params *params);
15  
16 +       int     (*get_channel)(struct wiphy *wiphy,
17 +                              struct ieee80211_channel **chan,
18 +                              enum nl80211_channel_type *channel_type);
19 +
20         int     (*set_channel)(struct wiphy *wiphy,
21                                struct ieee80211_channel *chan,
22                                enum nl80211_channel_type channel_type);
23 --- a/net/wireless/nl80211.c
24 +++ b/net/wireless/nl80211.c
25 @@ -427,7 +427,8 @@ static int nl80211_send_wiphy(struct sk_
26         struct nlattr *nl_modes;
27         struct nlattr *nl_cmds;
28         enum ieee80211_band band;
29 -       struct ieee80211_channel *chan;
30 +       struct ieee80211_channel *chan = NULL;
31 +       enum nl80211_channel_type chan_type;
32         struct ieee80211_rate *rate;
33         int i;
34         u16 ifmodes = dev->wiphy.interface_modes;
35 @@ -465,6 +466,12 @@ static int nl80211_send_wiphy(struct sk_
36         NLA_PUT_U8(msg, NL80211_ATTR_MAX_NUM_PMKIDS,
37                    dev->wiphy.max_num_pmkids);
38  
39 +       if (dev->ops->get_channel &&
40 +           dev->ops->get_channel(&dev->wiphy, &chan, &chan_type) == 0) {
41 +               NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, chan->center_freq);
42 +               NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, chan_type);
43 +       }
44 +
45         nl_modes = nla_nest_start(msg, NL80211_ATTR_SUPPORTED_IFTYPES);
46         if (!nl_modes)
47                 goto nla_put_failure;