]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Prefer 5 GHz channels for initial pick
authorJouni Malinen <jouni@qca.qualcomm.com>
Mon, 18 Nov 2013 15:55:04 +0000 (17:55 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 18 Nov 2013 15:55:04 +0000 (17:55 +0200)
If there are no other preferences from local configuration or driver,
prefer a random 5 GHz channel instead of falling back to the fixed
pre-configured channel (which is selected by default to be 1, 6, or 11).

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

src/p2p/p2p.c

index b2a0093dcd8592f2557dcb5792d504a7d79b74eb..31a4819d6b532f2327fb2838a47c30821b0eae90 100644 (file)
@@ -1180,6 +1180,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[] = { 115, 124, 0 };
 
        p2p_dbg(p2p, "Prepare channel best");
 
@@ -1211,6 +1212,11 @@ static void p2p_prepare_channel_best(struct p2p_data *p2p)
                p2p_dbg(p2p, "Select first pref_chan entry as operating channel preference");
                p2p->op_reg_class = p2p->cfg->pref_chan[0].op_class;
                p2p->op_channel = p2p->cfg->pref_chan[0].chan;
+       } else if (p2p_channel_select(&p2p->cfg->channels, op_classes_5ghz,
+                                     &p2p->op_reg_class, &p2p->op_channel) ==
+                  0) {
+               p2p_dbg(p2p, "Select possible 5 GHz channel (op_class %u channel %u) as operating channel preference",
+                       p2p->op_reg_class, p2p->op_channel);
        } else {
                p2p_dbg(p2p, "Select pre-configured channel as operating channel preference");
                p2p->op_reg_class = p2p->cfg->op_reg_class;