From patchwork Fri Oct 4 06:43:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sreenath X-Patchwork-Id: 280476 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "maxx.shmoo.com", Issuer "CA Cert Signing Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 430002C00E2 for ; Fri, 4 Oct 2013 16:43:55 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 599759D23F; Fri, 4 Oct 2013 02:43:53 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id J7qZdRGR-Nkn; Fri, 4 Oct 2013 02:43:53 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 9EE449D242; Fri, 4 Oct 2013 02:43:48 -0400 (EDT) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id D87E09D242 for ; Fri, 4 Oct 2013 02:43:46 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6BP9KtlqZAGG for ; Fri, 4 Oct 2013 02:43:41 -0400 (EDT) Received: from mms3.broadcom.com (mms3.broadcom.com [216.31.210.19]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 9DD279D23F for ; Fri, 4 Oct 2013 02:43:41 -0400 (EDT) Received: from [10.9.208.53] by mms3.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.5)); Thu, 03 Oct 2013 23:43:34 -0700 X-Server-Uuid: B86B6450-0931-4310-942E-F00ED04CA7AF Received: from SJEXCHCAS03.corp.ad.broadcom.com (10.16.203.8) by IRVEXCHCAS06.corp.ad.broadcom.com (10.9.208.53) with Microsoft SMTP Server (TLS) id 14.1.438.0; Thu, 3 Oct 2013 23:43:35 -0700 Received: from SJEXCHMB09.corp.ad.broadcom.com ( [fe80::3da7:665e:cc78:181f]) by SJEXCHCAS03.corp.ad.broadcom.com ( [::1]) with mapi id 14.01.0438.000; Thu, 3 Oct 2013 23:43:35 -0700 From: "Sreenath S" To: "Jouni Malinen" Subject: RE: [PATCH] Avoid channel reselection, if any of the best channel is selected as operating channel Thread-Topic: [PATCH] Avoid channel reselection, if any of the best channel is selected as operating channel Thread-Index: Ac34qrZax+b3th8SS2m23NizQvJjnyt8Dq4ABox+tPI= Date: Fri, 4 Oct 2013 06:43:34 +0000 Message-ID: <5F8A83CFE238064080EB46F88B8161C1013BD073@SJEXCHMB09.corp.ad.broadcom.com> References: <50FE9E9F.8040900@broadcom.com>,<20130831153924.GF11910@w1.fi> In-Reply-To: <20130831153924.GF11910@w1.fi> Accept-Language: en-GB, en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.9.208.57] MIME-Version: 1.0 X-WSS-ID: 7E50BC1C2L891483735-01-01 Cc: "hostap@lists.shmoo.com" X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com Hi Jouni, Thanks for the update. I will see how this patch can be reworked considering your suggestions. Regards, Sreenath 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;