cfg80211: add 802.11ad (60gHz band) support
authorVladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Mon, 2 Jul 2012 06:32:32 +0000 (09:32 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 2 Jul 2012 13:11:10 +0000 (15:11 +0200)
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>
drivers/net/wireless/iwlegacy/3945-rs.c
include/linux/nl80211.h
include/net/cfg80211.h
net/mac80211/tx.c
net/wireless/core.c
net/wireless/util.c

index 4b10157d86864685e8f635d07b8795fbaf3ef16f..d4fd29ad90dc6cf6b3182f41fe68491ee138cf1a 100644 (file)
@@ -946,7 +946,7 @@ il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
        case IEEE80211_BAND_5GHZ:
                rs_sta->expected_tpt = il3945_expected_tpt_a;
                break;
-       case IEEE80211_NUM_BANDS:
+       default:
                BUG();
                break;
        }
index 23003272c70ed1f862f087145c6c07b9328c0122..74cc55c1bf28edc3c037acd1de46190b8d9c0d81 100644 (file)
@@ -2545,10 +2545,12 @@ enum nl80211_tx_rate_attributes {
  * enum nl80211_band - Frequency band
  * @NL80211_BAND_2GHZ: 2.4 GHz ISM band
  * @NL80211_BAND_5GHZ: around 5 GHz band (4.9 - 5.7 GHz)
+ * @NL80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz)
  */
 enum nl80211_band {
        NL80211_BAND_2GHZ,
        NL80211_BAND_5GHZ,
+       NL80211_BAND_60GHZ,
 };
 
 /**
index fa269347355b2962f972143c608fffe35ca139c9..0b564e83a24ba1b5205cddbd9b7be79e69b729c7 100644 (file)
  *
  * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band
  * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
+ * @IEEE80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz)
  * @IEEE80211_NUM_BANDS: number of defined bands
  */
 enum ieee80211_band {
        IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ,
        IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ,
+       IEEE80211_BAND_60GHZ = NL80211_BAND_60GHZ,
 
        /* keep last */
        IEEE80211_NUM_BANDS
index 4e753032e48dc2276b19be12c12ff63c96cdc1ee..4990f4fb58642d51bd8ab1497d0581580ad0bddc 100644 (file)
@@ -140,6 +140,8 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
                        if (r->flags & IEEE80211_RATE_MANDATORY_A)
                                mrate = r->bitrate;
                        break;
+               case IEEE80211_BAND_60GHZ:
+                       /* TODO, for now fall through */
                case IEEE80211_NUM_BANDS:
                        WARN_ON(1);
                        break;
index ca2b95f248464b16b38af752a5c51c47cf1ee844..e13365f1fa63d45ba70b5855b7efd0d1196214b5 100644 (file)
@@ -468,8 +468,14 @@ int wiphy_register(struct wiphy *wiphy)
                        continue;
 
                sband->band = band;
-
-               if (WARN_ON(!sband->n_channels || !sband->n_bitrates))
+               if (WARN_ON(!sband->n_channels))
+                       return -EINVAL;
+               /*
+                * on 60gHz band, there are no legacy rates, so
+                * n_bitrates is 0
+                */
+               if (WARN_ON(band != IEEE80211_BAND_60GHZ &&
+                           !sband->n_bitrates))
                        return -EINVAL;
 
                /*
index a9260ac85cf182482d0a60a139386545292a2e67..0228c64e73d84a37a545d401d1bf5bb8e8b1f79c 100644 (file)
@@ -35,19 +35,29 @@ int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band)
 {
        /* see 802.11 17.3.8.3.2 and Annex J
         * there are overlapping channel numbers in 5GHz and 2GHz bands */
-       if (band == IEEE80211_BAND_5GHZ) {
-               if (chan >= 182 && chan <= 196)
-                       return 4000 + chan * 5;
-               else
-                       return 5000 + chan * 5;
-       } else { /* IEEE80211_BAND_2GHZ */
+       if (chan <= 0)
+               return 0; /* not supported */
+       switch (band) {
+       case IEEE80211_BAND_2GHZ:
                if (chan == 14)
                        return 2484;
                else if (chan < 14)
                        return 2407 + chan * 5;
+               break;
+       case IEEE80211_BAND_5GHZ:
+               if (chan >= 182 && chan <= 196)
+                       return 4000 + chan * 5;
                else
-                       return 0; /* not supported */
+                       return 5000 + chan * 5;
+               break;
+       case IEEE80211_BAND_60GHZ:
+               if (chan < 5)
+                       return 56160 + chan * 2160;
+               break;
+       default:
+               ;
        }
+       return 0; /* not supported */
 }
 EXPORT_SYMBOL(ieee80211_channel_to_frequency);
 
@@ -60,8 +70,12 @@ int ieee80211_frequency_to_channel(int freq)
                return (freq - 2407) / 5;
        else if (freq >= 4910 && freq <= 4980)
                return (freq - 4000) / 5;
-       else
+       else if (freq <= 45000) /* DMG band lower limit */
                return (freq - 5000) / 5;
+       else if (freq >= 58320 && freq <= 64800)
+               return (freq - 56160) / 2160;
+       else
+               return 0;
 }
 EXPORT_SYMBOL(ieee80211_frequency_to_channel);
 
@@ -137,6 +151,11 @@ static void set_mandatory_flags_band(struct ieee80211_supported_band *sband,
                }
                WARN_ON(want != 0 && want != 3 && want != 6);
                break;
+       case IEEE80211_BAND_60GHZ:
+               /* check for mandatory HT MCS 1..4 */
+               WARN_ON(!sband->ht_cap.ht_supported);
+               WARN_ON((sband->ht_cap.mcs.rx_mask[0] & 0x1e) != 0x1e);
+               break;
        case IEEE80211_NUM_BANDS:
                WARN_ON(1);
                break;