aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHardik Kantilal Patel <hkpatel@qti.qualcomm.com>2013-09-14 18:09:48 -0700
committerDmitry Shmidt <dimitrysh@google.com>2013-09-17 09:47:49 -0700
commit03b5cdf515ae7259d67b33c22d829495ac80e631 (patch)
tree38a4fe9acb26d2bec956452a46c5d9bf7ca9cea5
parente3b0dce889225eda34ecc6455eaeeaa5b12b4475 (diff)
downloadwpa_supplicant_8-03b5cdf515ae7259d67b33c22d829495ac80e631.tar.gz
P2P: Prefer 20 MHz operating channels on 5 GHz band over 2.4 GHz
When no other user preference is specified, opt to use an operating channel that allows 5 GHz band to be used rather than 2.4 GHz. Previously, this was already done in practice for HT40 channels since no such channel is enabled for P2P on 2.4 GHz. This commit extends this to apply 5 GHz preference for 20 MHz channels as well. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
-rw-r--r--src/p2p/p2p_go_neg.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/p2p/p2p_go_neg.c b/src/p2p/p2p_go_neg.c
index 8740ed5b..17fb3293 100644
--- a/src/p2p/p2p_go_neg.c
+++ b/src/p2p/p2p_go_neg.c
@@ -416,6 +416,27 @@ void p2p_reselect_channel(struct p2p_data *p2p,
}
}
+ /* Prefer a 5 GHz channel */
+ for (i = 0; i < intersection->reg_classes; i++) {
+ struct p2p_reg_class *c = &intersection->reg_class[i];
+ if ((c->reg_class == 115 || c->reg_class == 124) &&
+ c->channels) {
+ unsigned int r;
+
+ /*
+ * Pick one of the available channels in the operating
+ * class at random.
+ */
+ os_get_random((u8 *) &r, sizeof(r));
+ r %= c->channels;
+ p2p_dbg(p2p, "Pick possible 5 GHz channel (op_class %u channel %u) from intersection",
+ c->reg_class, c->channel[r]);
+ p2p->op_reg_class = c->reg_class;
+ p2p->op_channel = c->channel[r];
+ return;
+ }
+ }
+
/*
* Try to see if the original channel is in the intersection. If
* so, no need to change anything, as it already contains some