Browse Source

P2P: Document operating channel selection functions

Signed-hostap: Jouni Malinen <j@w1.fi>
Jouni Malinen 12 years ago
parent
commit
a5830ede8e
2 changed files with 24 additions and 0 deletions
  1. 13 0
      src/p2p/p2p.c
  2. 11 0
      src/p2p/p2p_go_neg.c

+ 13 - 0
src/p2p/p2p.c

@@ -1117,6 +1117,19 @@ void p2p_stop_find(struct p2p_data *p2p)
 }
 
 
+/**
+ * p2p_prepare_channel - Select operating channel for GO Negotiation
+ * @p2p: P2P module context from p2p_init()
+ * @dev: Selected peer device
+ * @force_freq: Forced frequency in MHz or 0 if not forced
+ * @pref_freq: Preferred frequency in MHz or 0 if no preference
+ * Returns: 0 on success, -1 on failure (channel not supported for P2P)
+ *
+ * This function is used to do initial operating channel selection for GO
+ * Negotiation prior to having received peer information. The selected channel
+ * may be further optimized in p2p_reselect_channel() once the peer information
+ * is available.
+ */
 static int p2p_prepare_channel(struct p2p_data *p2p, struct p2p_device *dev,
 			       unsigned int force_freq, unsigned int pref_freq)
 {

+ 11 - 0
src/p2p/p2p_go_neg.c

@@ -336,6 +336,17 @@ static struct wpabuf * p2p_build_go_neg_resp(struct p2p_data *p2p,
 }
 
 
+/**
+ * p2p_reselect_channel - Re-select operating channel based on peer information
+ * @p2p: P2P module context from p2p_init()
+ * @intersection: Support channel list intersection from local and peer
+ *
+ * This function is used to re-select the best channel after having received
+ * information from the peer to allow supported channel lists to be intersected.
+ * This can be used to improve initial channel selection done in
+ * p2p_prepare_channel() prior to the start of GO Negotiation. In addition, this
+ * can be used for Invitation case.
+ */
 void p2p_reselect_channel(struct p2p_data *p2p,
 			  struct p2p_channels *intersection)
 {