aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/util.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-11-09 05:39:59 -0500
committerJohannes Berg <johannes.berg@intel.com>2012-11-26 06:42:59 -0500
commit4bf88530be971bf95a7830ca61b4120980bf4347 (patch)
tree405d426806cb76551d09f427dafeeee79dac0dea /net/mac80211/util.c
parent3d9d1d6656a73ea8407734cfb00b81d14ef62d4b (diff)
mac80211: convert to channel definition struct
Convert mac80211 (and where necessary, some drivers a little bit) to the new channel definition struct. This will allow extending mac80211 for VHT, which is currently restricted to channel contexts since there are no drivers using that which makes it easier. As I also don't care about VHT for drivers not using the channel context API, I won't convert the previous API to VHT support. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/util.c')
-rw-r--r--net/mac80211/util.c45
1 files changed, 25 insertions, 20 deletions
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 2f08a7e09b7e..3b3dd32f121f 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -898,7 +898,7 @@ void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata,
898 rcu_read_lock(); 898 rcu_read_lock();
899 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); 899 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
900 use_11b = (chanctx_conf && 900 use_11b = (chanctx_conf &&
901 chanctx_conf->channel->band == IEEE80211_BAND_2GHZ) && 901 chanctx_conf->def.chan->band == IEEE80211_BAND_2GHZ) &&
902 !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE); 902 !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE);
903 rcu_read_unlock(); 903 rcu_read_unlock();
904 904
@@ -991,7 +991,7 @@ void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata,
991 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); 991 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
992 992
993 if (chanctx_conf && 993 if (chanctx_conf &&
994 chanctx_conf->channel->band == IEEE80211_BAND_2GHZ && 994 chanctx_conf->def.chan->band == IEEE80211_BAND_2GHZ &&
995 have_higher_than_11mbit) 995 have_higher_than_11mbit)
996 sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE; 996 sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE;
997 else 997 else
@@ -1871,8 +1871,7 @@ u8 *ieee80211_ie_build_vht_cap(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap,
1871} 1871}
1872 1872
1873u8 *ieee80211_ie_build_ht_oper(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap, 1873u8 *ieee80211_ie_build_ht_oper(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap,
1874 struct ieee80211_channel *channel, 1874 const struct cfg80211_chan_def *chandef,
1875 enum nl80211_channel_type channel_type,
1876 u16 prot_mode) 1875 u16 prot_mode)
1877{ 1876{
1878 struct ieee80211_ht_operation *ht_oper; 1877 struct ieee80211_ht_operation *ht_oper;
@@ -1880,23 +1879,25 @@ u8 *ieee80211_ie_build_ht_oper(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap,
1880 *pos++ = WLAN_EID_HT_OPERATION; 1879 *pos++ = WLAN_EID_HT_OPERATION;
1881 *pos++ = sizeof(struct ieee80211_ht_operation); 1880 *pos++ = sizeof(struct ieee80211_ht_operation);
1882 ht_oper = (struct ieee80211_ht_operation *)pos; 1881 ht_oper = (struct ieee80211_ht_operation *)pos;
1883 ht_oper->primary_chan = 1882 ht_oper->primary_chan = ieee80211_frequency_to_channel(
1884 ieee80211_frequency_to_channel(channel->center_freq); 1883 chandef->chan->center_freq);
1885 switch (channel_type) { 1884 switch (chandef->width) {
1886 case NL80211_CHAN_HT40MINUS: 1885 case NL80211_CHAN_WIDTH_160:
1887 ht_oper->ht_param = IEEE80211_HT_PARAM_CHA_SEC_BELOW; 1886 case NL80211_CHAN_WIDTH_80P80:
1888 break; 1887 case NL80211_CHAN_WIDTH_80:
1889 case NL80211_CHAN_HT40PLUS: 1888 case NL80211_CHAN_WIDTH_40:
1890 ht_oper->ht_param = IEEE80211_HT_PARAM_CHA_SEC_ABOVE; 1889 if (chandef->center_freq1 > chandef->chan->center_freq)
1890 ht_oper->ht_param = IEEE80211_HT_PARAM_CHA_SEC_ABOVE;
1891 else
1892 ht_oper->ht_param = IEEE80211_HT_PARAM_CHA_SEC_BELOW;
1891 break; 1893 break;
1892 case NL80211_CHAN_HT20:
1893 default: 1894 default:
1894 ht_oper->ht_param = IEEE80211_HT_PARAM_CHA_SEC_NONE; 1895 ht_oper->ht_param = IEEE80211_HT_PARAM_CHA_SEC_NONE;
1895 break; 1896 break;
1896 } 1897 }
1897 if (ht_cap->cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 && 1898 if (ht_cap->cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 &&
1898 channel_type != NL80211_CHAN_NO_HT && 1899 chandef->width != NL80211_CHAN_WIDTH_20_NOHT &&
1899 channel_type != NL80211_CHAN_HT20) 1900 chandef->width != NL80211_CHAN_WIDTH_20)
1900 ht_oper->ht_param |= IEEE80211_HT_PARAM_CHAN_WIDTH_ANY; 1901 ht_oper->ht_param |= IEEE80211_HT_PARAM_CHAN_WIDTH_ANY;
1901 1902
1902 ht_oper->operation_mode = cpu_to_le16(prot_mode); 1903 ht_oper->operation_mode = cpu_to_le16(prot_mode);
@@ -1910,13 +1911,17 @@ u8 *ieee80211_ie_build_ht_oper(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap,
1910 return pos + sizeof(struct ieee80211_ht_operation); 1911 return pos + sizeof(struct ieee80211_ht_operation);
1911} 1912}
1912 1913
1913enum nl80211_channel_type 1914void ieee80211_ht_oper_to_chandef(struct ieee80211_channel *control_chan,
1914ieee80211_ht_oper_to_channel_type(struct ieee80211_ht_operation *ht_oper) 1915 struct ieee80211_ht_operation *ht_oper,
1916 struct cfg80211_chan_def *chandef)
1915{ 1917{
1916 enum nl80211_channel_type channel_type; 1918 enum nl80211_channel_type channel_type;
1917 1919
1918 if (!ht_oper) 1920 if (!ht_oper) {
1919 return NL80211_CHAN_NO_HT; 1921 cfg80211_chandef_create(chandef, control_chan,
1922 NL80211_CHAN_NO_HT);
1923 return;
1924 }
1920 1925
1921 switch (ht_oper->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) { 1926 switch (ht_oper->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
1922 case IEEE80211_HT_PARAM_CHA_SEC_NONE: 1927 case IEEE80211_HT_PARAM_CHA_SEC_NONE:
@@ -1932,7 +1937,7 @@ ieee80211_ht_oper_to_channel_type(struct ieee80211_ht_operation *ht_oper)
1932 channel_type = NL80211_CHAN_NO_HT; 1937 channel_type = NL80211_CHAN_NO_HT;
1933 } 1938 }
1934 1939
1935 return channel_type; 1940 cfg80211_chandef_create(chandef, control_chan, channel_type);
1936} 1941}
1937 1942
1938int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata, 1943int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata,