From b97cfa4bf5267917339a323505dfd104f8ceba46 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 17 Jan 2010 20:49:28 +0000 Subject: [PATCH] iw, mac80211: get the frequency info per-netdev instead of per-phy SVN-Revision: 19194 --- package/iw/patches/110-freq.patch | 20 ++++---- .../patches/560-cfg80211_get_freq.patch | 34 ++++++++++++++ .../patches/560-nl80211_get_freq.patch | 47 ------------------- .../patches/570-mac80211_get_freq.patch | 29 ------------ 4 files changed, 44 insertions(+), 86 deletions(-) create mode 100644 package/mac80211/patches/560-cfg80211_get_freq.patch delete mode 100644 package/mac80211/patches/560-nl80211_get_freq.patch delete mode 100644 package/mac80211/patches/570-mac80211_get_freq.patch diff --git a/package/iw/patches/110-freq.patch b/package/iw/patches/110-freq.patch index 9a00a65e3f..f73d303bb6 100644 --- a/package/iw/patches/110-freq.patch +++ b/package/iw/patches/110-freq.patch @@ -1,9 +1,9 @@ ---- a/info.c -+++ b/info.c -@@ -62,6 +62,27 @@ static int print_phy_handler(struct nl_m - if (tb_msg[NL80211_ATTR_WIPHY_NAME]) - printf("Wiphy %s\n", nla_get_string(tb_msg[NL80211_ATTR_WIPHY_NAME])); - +--- a/interface.c ++++ b/interface.c +@@ -260,6 +260,27 @@ static int print_iface_handler(struct nl + printf("%s\tifindex %d\n", indent, nla_get_u32(tb_msg[NL80211_ATTR_IFINDEX])); + if (tb_msg[NL80211_ATTR_IFTYPE]) + printf("%s\ttype %s\n", indent, iftype_name(nla_get_u32(tb_msg[NL80211_ATTR_IFTYPE]))); + if (tb_msg[NL80211_ATTR_WIPHY_FREQ]) { + const char *mode; + @@ -22,9 +22,9 @@ + mode = ""; + } + -+ printf("\tCurrent frequency: %d MHz %s\n", nla_get_u32(tb_msg[NL80211_ATTR_WIPHY_FREQ]), mode); ++ printf("%s\tfrequency %d MHz %s\n", indent, nla_get_u32(tb_msg[NL80211_ATTR_WIPHY_FREQ]), mode); + } + - nla_for_each_nested(nl_band, tb_msg[NL80211_ATTR_WIPHY_BANDS], rem_band) { - printf("\tBand %d:\n", bandidx); - bandidx++; + + return NL_SKIP; + } diff --git a/package/mac80211/patches/560-cfg80211_get_freq.patch b/package/mac80211/patches/560-cfg80211_get_freq.patch new file mode 100644 index 0000000000..93c9d6e5b4 --- /dev/null +++ b/package/mac80211/patches/560-cfg80211_get_freq.patch @@ -0,0 +1,34 @@ +--- a/net/wireless/core.h ++++ b/net/wireless/core.h +@@ -75,6 +75,7 @@ struct cfg80211_registered_device { + + /* current channel */ + struct ieee80211_channel *channel; ++ enum nl80211_channel_type channel_type; + + /* must be last because of the way we do wiphy_priv(), + * and it should at least be aligned to NETDEV_ALIGN */ +--- a/net/wireless/chan.c ++++ b/net/wireless/chan.c +@@ -97,6 +97,7 @@ int rdev_set_freq(struct cfg80211_regist + return result; + + rdev->channel = chan; ++ rdev->channel_type = channel_type; + + return 0; + } +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -881,6 +881,11 @@ static int nl80211_send_iface(struct sk_ + NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); + NLA_PUT_STRING(msg, NL80211_ATTR_IFNAME, dev->name); + NLA_PUT_U32(msg, NL80211_ATTR_IFTYPE, dev->ieee80211_ptr->iftype); ++ if (rdev->channel) { ++ NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, rdev->channel->center_freq); ++ NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, rdev->channel_type); ++ } ++ + + NLA_PUT_U32(msg, NL80211_ATTR_GENERATION, + rdev->devlist_generation ^ diff --git a/package/mac80211/patches/560-nl80211_get_freq.patch b/package/mac80211/patches/560-nl80211_get_freq.patch deleted file mode 100644 index 25d915473c..0000000000 --- a/package/mac80211/patches/560-nl80211_get_freq.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- a/include/net/cfg80211.h -+++ b/include/net/cfg80211.h -@@ -954,6 +954,8 @@ struct cfg80211_pmksa { - * - * @set_txq_params: Set TX queue parameters - * -+ * @get_channel: Get operating channel -+ * - * @set_channel: Set channel - * - * @scan: Request to do a scan. If returning zero, the scan request is given -@@ -1079,6 +1081,10 @@ struct cfg80211_ops { - int (*set_txq_params)(struct wiphy *wiphy, - struct ieee80211_txq_params *params); - -+ int (*get_channel)(struct wiphy *wiphy, -+ struct ieee80211_channel **chan, -+ enum nl80211_channel_type *channel_type); -+ - int (*set_channel)(struct wiphy *wiphy, - struct ieee80211_channel *chan, - enum nl80211_channel_type channel_type); ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -427,7 +427,8 @@ static int nl80211_send_wiphy(struct sk_ - struct nlattr *nl_modes; - struct nlattr *nl_cmds; - enum ieee80211_band band; -- struct ieee80211_channel *chan; -+ struct ieee80211_channel *chan = NULL; -+ enum nl80211_channel_type chan_type; - struct ieee80211_rate *rate; - int i; - u16 ifmodes = dev->wiphy.interface_modes; -@@ -465,6 +466,12 @@ static int nl80211_send_wiphy(struct sk_ - NLA_PUT_U8(msg, NL80211_ATTR_MAX_NUM_PMKIDS, - dev->wiphy.max_num_pmkids); - -+ if (dev->ops->get_channel && -+ dev->ops->get_channel(&dev->wiphy, &chan, &chan_type) == 0) { -+ NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, chan->center_freq); -+ NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, chan_type); -+ } -+ - nl_modes = nla_nest_start(msg, NL80211_ATTR_SUPPORTED_IFTYPES); - if (!nl_modes) - goto nla_put_failure; diff --git a/package/mac80211/patches/570-mac80211_get_freq.patch b/package/mac80211/patches/570-mac80211_get_freq.patch deleted file mode 100644 index 073fe6386c..0000000000 --- a/package/mac80211/patches/570-mac80211_get_freq.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -1154,6 +1154,18 @@ static int ieee80211_set_txq_params(stru - return 0; - } - -+static int ieee80211_get_oper_channel(struct wiphy *wiphy, -+ struct ieee80211_channel **chan, -+ enum nl80211_channel_type *channel_type) -+{ -+ struct ieee80211_local *local = wiphy_priv(wiphy); -+ -+ *chan = local->oper_channel; -+ *channel_type = local->oper_channel_type; -+ -+ return 0; -+} -+ - static int ieee80211_set_channel(struct wiphy *wiphy, - struct ieee80211_channel *chan, - enum nl80211_channel_type channel_type) -@@ -1494,6 +1506,7 @@ struct cfg80211_ops mac80211_config_ops - #endif - .change_bss = ieee80211_change_bss, - .set_txq_params = ieee80211_set_txq_params, -+ .get_channel = ieee80211_get_oper_channel, - .set_channel = ieee80211_set_channel, - .suspend = ieee80211_suspend, - .resume = ieee80211_resume, -- 2.30.2