[PATCH] Avoid channel reselection, if any of the best channel is selected as operating channel

Sreenath S sreenats at broadcom.com
Fri Oct 4 02:43:34 EDT 2013


Hi Jouni,

Thanks for the update.

I will see how this patch can be reworked considering your suggestions.

Regards,
Sreenath
________________________________________
From: Jouni Malinen [j at w1.fi]
Sent: 31 August 2013 21:09
To: Sreenath S
Cc: hostap at lists.shmoo.com
Subject: Re: [PATCH] Avoid channel reselection, if any of the best channel is selected as operating channel

On Tue, Jan 22, 2013 at 07:43:51PM +0530, Sreenath wrote:
> Set P2P_DEV_FORCE_FREQ flag if any of the best channel is selected as
> the operating channel, to prevent channel reselection in GO channel
> selection.

Is this really desirable in all cases? Channels are reselected after
having learned about the options available for the peer device in GO
Negotiation after having learned that information. This patch would
change that to skip the reselection if a locally determined best channel
was selected before  knowing peer capabilities. This would sound like
something that could result in undesired group formation failures if the
peer device does not support the channel we think is best for some
reason. If the local device does not have any concurrent operations (or
support multi-channel concurrency), it could be more desirable to allow
connection to go through on a channel that works for the peer.


By the way, this is a rebased version of the patch in question against
the current hostap.git snapshot:


diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index 178a8f6..3480781 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -1175,7 +1175,7 @@ static int p2p_prepare_channel_pref(struct p2p_data *p2p,
 }


-static void p2p_prepare_channel_best(struct p2p_data *p2p)
+static void p2p_prepare_channel_best(struct p2p_data *p2p, int *best_freq)
 {
        u8 op_class, op_channel;

@@ -1188,6 +1188,7 @@ static void p2p_prepare_channel_best(struct p2p_data *p2p)
                p2p_dbg(p2p, "Select best overall channel as operating channel preference");
                p2p->op_reg_class = op_class;
                p2p->op_channel = op_channel;
+               *best_freq = 1;
        } else if (!p2p->cfg->cfg_op_channel && p2p->best_freq_5 > 0 &&
                   p2p_supported_freq(p2p, p2p->best_freq_5) &&
                   p2p_freq_to_channel(p2p->best_freq_5, &op_class, &op_channel)
@@ -1195,6 +1196,7 @@ static void p2p_prepare_channel_best(struct p2p_data *p2p)
                p2p_dbg(p2p, "Select best 5 GHz channel as operating channel preference");
                p2p->op_reg_class = op_class;
                p2p->op_channel = op_channel;
+               *best_freq = 1;
        } else if (!p2p->cfg->cfg_op_channel && p2p->best_freq_24 > 0 &&
                   p2p_supported_freq(p2p, p2p->best_freq_24) &&
                   p2p_freq_to_channel(p2p->best_freq_24, &op_class,
@@ -1202,6 +1204,7 @@ static void p2p_prepare_channel_best(struct p2p_data *p2p)
                p2p_dbg(p2p, "Select best 2.4 GHz channel as operating channel preference");
                p2p->op_reg_class = op_class;
                p2p->op_channel = op_channel;
+               *best_freq = 1;
        } else if (p2p->cfg->num_pref_chan > 0 &&
                   p2p_channels_includes(&p2p->cfg->channels,
                                         p2p->cfg->pref_chan[0].op_class,
@@ -1209,10 +1212,12 @@ 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;
+               *best_freq = 0;
        } else {
                p2p_dbg(p2p, "Select pre-configured channel as operating channel preference");
                p2p->op_reg_class = p2p->cfg->op_reg_class;
                p2p->op_channel = p2p->cfg->op_channel;
+               *best_freq = 0;
        }

        os_memcpy(&p2p->channels, &p2p->cfg->channels,
@@ -1236,19 +1241,22 @@ static void p2p_prepare_channel_best(struct p2p_data *p2p)
 int p2p_prepare_channel(struct p2p_data *p2p, struct p2p_device *dev,
                        unsigned int force_freq, unsigned int pref_freq)
 {
+       int best_freq = 0;
+
        p2p_dbg(p2p, "Prepare channel - force_freq=%u pref_freq=%u",
                force_freq, pref_freq);
        if (force_freq || pref_freq) {
                if (p2p_prepare_channel_pref(p2p, force_freq, pref_freq) < 0)
                        return -1;
        } else {
-               p2p_prepare_channel_best(p2p);
+               p2p_prepare_channel_best(p2p, &best_freq);
        }
        p2p_dbg(p2p, "Own preference for operation channel: Operating Class %u Channel %u%s",
                p2p->op_reg_class, p2p->op_channel,
-               force_freq ? " (forced)" : "");
+               force_freq ? " (forced)" :
+               best_freq ? " (best)" : "");

-       if (force_freq)
+       if (force_freq || best_freq)
                dev->flags |= P2P_DEV_FORCE_FREQ;
        else
                dev->flags &= ~P2P_DEV_FORCE_FREQ;

--
Jouni Malinen                                            PGP id EFC895FA




More information about the HostAP mailing list