aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>2012-07-02 02:32:32 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-07-02 09:11:10 -0400
commit3a0c52a6d82cc41da965284412608c74aece34e4 (patch)
tree4238ce4e3ed8ca7fde647491f48de7d3633a53e3
parentd9b3b28b93812715dcee8e4eed8cb8d0707a45f8 (diff)
cfg80211: add 802.11ad (60gHz band) support
Add enumerations for both cfg80211 and nl80211. This expands wiphy.bands etc. arrays. Extend channel <-> frequency translation to cover 60g band and modify the rate check logic since there are no legacy mandatory rates (only MCS is used.) Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--drivers/net/wireless/iwlegacy/3945-rs.c2
-rw-r--r--include/linux/nl80211.h2
-rw-r--r--include/net/cfg80211.h2
-rw-r--r--net/mac80211/tx.c2
-rw-r--r--net/wireless/core.c10
-rw-r--r--net/wireless/util.c35
6 files changed, 42 insertions, 11 deletions
diff --git a/drivers/net/wireless/iwlegacy/3945-rs.c b/drivers/net/wireless/iwlegacy/3945-rs.c
index 4b10157d8686..d4fd29ad90dc 100644
--- a/drivers/net/wireless/iwlegacy/3945-rs.c
+++ b/drivers/net/wireless/iwlegacy/3945-rs.c
@@ -946,7 +946,7 @@ il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
946 case IEEE80211_BAND_5GHZ: 946 case IEEE80211_BAND_5GHZ:
947 rs_sta->expected_tpt = il3945_expected_tpt_a; 947 rs_sta->expected_tpt = il3945_expected_tpt_a;
948 break; 948 break;
949 case IEEE80211_NUM_BANDS: 949 default:
950 BUG(); 950 BUG();
951 break; 951 break;
952 } 952 }
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 23003272c70e..74cc55c1bf28 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -2545,10 +2545,12 @@ enum nl80211_tx_rate_attributes {
2545 * enum nl80211_band - Frequency band 2545 * enum nl80211_band - Frequency band
2546 * @NL80211_BAND_2GHZ: 2.4 GHz ISM band 2546 * @NL80211_BAND_2GHZ: 2.4 GHz ISM band
2547 * @NL80211_BAND_5GHZ: around 5 GHz band (4.9 - 5.7 GHz) 2547 * @NL80211_BAND_5GHZ: around 5 GHz band (4.9 - 5.7 GHz)
2548 * @NL80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz)
2548 */ 2549 */
2549enum nl80211_band { 2550enum nl80211_band {
2550 NL80211_BAND_2GHZ, 2551 NL80211_BAND_2GHZ,
2551 NL80211_BAND_5GHZ, 2552 NL80211_BAND_5GHZ,
2553 NL80211_BAND_60GHZ,
2552}; 2554};
2553 2555
2554/** 2556/**
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index fa269347355b..0b564e83a24b 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -70,11 +70,13 @@
70 * 70 *
71 * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band 71 * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band
72 * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7) 72 * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
73 * @IEEE80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz)
73 * @IEEE80211_NUM_BANDS: number of defined bands 74 * @IEEE80211_NUM_BANDS: number of defined bands
74 */ 75 */
75enum ieee80211_band { 76enum ieee80211_band {
76 IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ, 77 IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ,
77 IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ, 78 IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ,
79 IEEE80211_BAND_60GHZ = NL80211_BAND_60GHZ,
78 80
79 /* keep last */ 81 /* keep last */
80 IEEE80211_NUM_BANDS 82 IEEE80211_NUM_BANDS
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 4e753032e48d..4990f4fb5864 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -140,6 +140,8 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
140 if (r->flags & IEEE80211_RATE_MANDATORY_A) 140 if (r->flags & IEEE80211_RATE_MANDATORY_A)
141 mrate = r->bitrate; 141 mrate = r->bitrate;
142 break; 142 break;
143 case IEEE80211_BAND_60GHZ:
144 /* TODO, for now fall through */
143 case IEEE80211_NUM_BANDS: 145 case IEEE80211_NUM_BANDS:
144 WARN_ON(1); 146 WARN_ON(1);
145 break; 147 break;
diff --git a/net/wireless/core.c b/net/wireless/core.c
index ca2b95f24846..e13365f1fa63 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -468,8 +468,14 @@ int wiphy_register(struct wiphy *wiphy)
468 continue; 468 continue;
469 469
470 sband->band = band; 470 sband->band = band;
471 471 if (WARN_ON(!sband->n_channels))
472 if (WARN_ON(!sband->n_channels || !sband->n_bitrates)) 472 return -EINVAL;
473 /*
474 * on 60gHz band, there are no legacy rates, so
475 * n_bitrates is 0
476 */
477 if (WARN_ON(band != IEEE80211_BAND_60GHZ &&
478 !sband->n_bitrates))
473 return -EINVAL; 479 return -EINVAL;
474 480
475 /* 481 /*
diff --git a/net/wireless/util.c b/net/wireless/util.c
index a9260ac85cf1..0228c64e73d8 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -35,19 +35,29 @@ int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band)
35{ 35{
36 /* see 802.11 17.3.8.3.2 and Annex J 36 /* see 802.11 17.3.8.3.2 and Annex J
37 * there are overlapping channel numbers in 5GHz and 2GHz bands */ 37 * there are overlapping channel numbers in 5GHz and 2GHz bands */
38 if (band == IEEE80211_BAND_5GHZ) { 38 if (chan <= 0)
39 if (chan >= 182 && chan <= 196) 39 return 0; /* not supported */
40 return 4000 + chan * 5; 40 switch (band) {
41 else 41 case IEEE80211_BAND_2GHZ:
42 return 5000 + chan * 5;
43 } else { /* IEEE80211_BAND_2GHZ */
44 if (chan == 14) 42 if (chan == 14)
45 return 2484; 43 return 2484;
46 else if (chan < 14) 44 else if (chan < 14)
47 return 2407 + chan * 5; 45 return 2407 + chan * 5;
46 break;
47 case IEEE80211_BAND_5GHZ:
48 if (chan >= 182 && chan <= 196)
49 return 4000 + chan * 5;
48 else 50 else
49 return 0; /* not supported */ 51 return 5000 + chan * 5;
52 break;
53 case IEEE80211_BAND_60GHZ:
54 if (chan < 5)
55 return 56160 + chan * 2160;
56 break;
57 default:
58 ;
50 } 59 }
60 return 0; /* not supported */
51} 61}
52EXPORT_SYMBOL(ieee80211_channel_to_frequency); 62EXPORT_SYMBOL(ieee80211_channel_to_frequency);
53 63
@@ -60,8 +70,12 @@ int ieee80211_frequency_to_channel(int freq)
60 return (freq - 2407) / 5; 70 return (freq - 2407) / 5;
61 else if (freq >= 4910 && freq <= 4980) 71 else if (freq >= 4910 && freq <= 4980)
62 return (freq - 4000) / 5; 72 return (freq - 4000) / 5;
63 else 73 else if (freq <= 45000) /* DMG band lower limit */
64 return (freq - 5000) / 5; 74 return (freq - 5000) / 5;
75 else if (freq >= 58320 && freq <= 64800)
76 return (freq - 56160) / 2160;
77 else
78 return 0;
65} 79}
66EXPORT_SYMBOL(ieee80211_frequency_to_channel); 80EXPORT_SYMBOL(ieee80211_frequency_to_channel);
67 81
@@ -137,6 +151,11 @@ static void set_mandatory_flags_band(struct ieee80211_supported_band *sband,
137 } 151 }
138 WARN_ON(want != 0 && want != 3 && want != 6); 152 WARN_ON(want != 0 && want != 3 && want != 6);
139 break; 153 break;
154 case IEEE80211_BAND_60GHZ:
155 /* check for mandatory HT MCS 1..4 */
156 WARN_ON(!sband->ht_cap.ht_supported);
157 WARN_ON((sband->ht_cap.mcs.rx_mask[0] & 0x1e) != 0x1e);
158 break;
140 case IEEE80211_NUM_BANDS: 159 case IEEE80211_NUM_BANDS:
141 WARN_ON(1); 160 WARN_ON(1);
142 break; 161 break;