P2P: Add Operating class 125 for P2P supported channels
authorAmr BEN ABDESSALEM <amrx.ben.abdessalem@intel.com>
Thu, 2 Apr 2015 16:22:58 +0000 (18:22 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 12 Jun 2015 17:39:49 +0000 (20:39 +0300)
Add operating class 125 (channels 149..169) to the list of P2P supported
channels. This allows the 5 GHz channels 161 and 169 to be used for P2P
GO when those channels are allowed for AP mode in the current regulatory
domain.

Signed-off-by: Amr BEN ABDESSALEM <amrx.ben.abdessalem@intel.com>
src/common/ieee802_11_common.c
src/p2p/p2p.c
src/p2p/p2p_go_neg.c
src/p2p/p2p_utils.c
wpa_supplicant/p2p_supplicant.c

index e23007a..284d630 100644 (file)
@@ -630,6 +630,10 @@ static int ieee80211_chan_to_freq_us(u8 op_class, u8 chan)
                if (chan < 149 || chan > 161)
                        return -1;
                return 5000 + 5 * chan;
+       case 5: /* channels 149,153,157,161,165 */
+               if (chan < 149 || chan > 165)
+                       return -1;
+               return 5000 + 5 * chan;
        case 34: /* 60 GHz band, channels 1..3 */
                if (chan < 1 || chan > 3)
                        return -1;
@@ -782,12 +786,15 @@ static int ieee80211_chan_to_freq_global(u8 op_class, u8 chan)
                        return -1;
                return 5000 + 5 * chan;
        case 124: /* channels 149,153,157,161 */
-       case 125: /* channels 149,153,157,161,165,169 */
        case 126: /* channels 149,157; 40 MHz */
        case 127: /* channels 153,161; 40 MHz */
                if (chan < 149 || chan > 161)
                        return -1;
                return 5000 + 5 * chan;
+       case 125: /* channels 149,153,157,161,165,169 */
+               if (chan < 149 || chan > 169)
+                       return -1;
+               return 5000 + 5 * chan;
        case 128: /* center freqs 42, 58, 106, 122, 138, 155; 80 MHz */
        case 130: /* center freqs 42, 58, 106, 122, 138, 155; 80 MHz */
                if (chan < 36 || chan > 161)
index c02044b..b31bc36 100644 (file)
@@ -1381,7 +1381,7 @@ static int p2p_prepare_channel_pref(struct p2p_data *p2p,
 static void p2p_prepare_channel_best(struct p2p_data *p2p)
 {
        u8 op_class, op_channel;
-       const int op_classes_5ghz[] = { 124, 115, 0 };
+       const int op_classes_5ghz[] = { 124, 125, 115, 0 };
        const int op_classes_ht40[] = { 126, 127, 116, 117, 0 };
        const int op_classes_vht[] = { 128, 0 };
 
index 63837eb..19f1daa 100644 (file)
@@ -379,7 +379,7 @@ void p2p_reselect_channel(struct p2p_data *p2p,
        int freq;
        u8 op_reg_class, op_channel;
        unsigned int i;
-       const int op_classes_5ghz[] = { 124, 115, 0 };
+       const int op_classes_5ghz[] = { 124, 125, 115, 0 };
        const int op_classes_ht40[] = { 126, 127, 116, 117, 0 };
        const int op_classes_vht[] = { 128, 0 };
 
index f32751d..eee3c5a 100644 (file)
@@ -101,6 +101,15 @@ int p2p_freq_to_channel(unsigned int freq, u8 *op_class, u8 *channel)
                return 0;
        }
 
+       if (freq >= 5745 && freq <= 5845) {
+               if ((freq - 5000) % 5)
+                       return -1;
+
+               *op_class = 125; /* 5 GHz, channels 149..169 */
+               *channel = (freq - 5000) / 5;
+               return 0;
+       }
+
        if (freq >= 58320 && freq <= 64800) {
                if ((freq - 58320) % 2160)
                        return -1;
index 5c8a3b2..84cc559 100644 (file)
@@ -3116,6 +3116,7 @@ static const struct p2p_oper_class_map op_class[] = {
 #endif
        { HOSTAPD_MODE_IEEE80211A, 115, 36, 48, 4, BW20 },
        { HOSTAPD_MODE_IEEE80211A, 124, 149, 161, 4, BW20 },
+       { HOSTAPD_MODE_IEEE80211A, 125, 149, 169, 4, BW20 },
        { HOSTAPD_MODE_IEEE80211A, 116, 36, 44, 8, BW40PLUS },
        { HOSTAPD_MODE_IEEE80211A, 117, 40, 48, 8, BW40MINUS },
        { HOSTAPD_MODE_IEEE80211A, 126, 149, 157, 8, BW40PLUS },
@@ -5226,6 +5227,7 @@ static int wpas_p2p_init_go_params(struct wpa_supplicant *wpa_s,
                    wpa_s->conf->p2p_oper_reg_class == 116 ||
                    wpa_s->conf->p2p_oper_reg_class == 117 ||
                    wpa_s->conf->p2p_oper_reg_class == 124 ||
+                   wpa_s->conf->p2p_oper_reg_class == 125 ||
                    wpa_s->conf->p2p_oper_reg_class == 126 ||
                    wpa_s->conf->p2p_oper_reg_class == 127) &&
                   freq_included(channels,