From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6E34C2D0E4 for ; Tue, 17 Nov 2020 08:58:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 715DE24692 for ; Tue, 17 Nov 2020 08:58:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="OKzpGbU0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726215AbgKQI6L (ORCPT ); Tue, 17 Nov 2020 03:58:11 -0500 Received: from m42-4.mailgun.net ([69.72.42.4]:57540 "EHLO m42-4.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726035AbgKQI6L (ORCPT ); Tue, 17 Nov 2020 03:58:11 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1605603490; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=vVq4rWqc2Al9hgCqmO1ZWWMCo4rSK9mpUcxTcbkmSGg=; b=OKzpGbU0wbmMwMd1UVlZ1b9DcO91Aq8J+jtzfpaNx3SxxPj+A1/XQZYrvgIoLeF/FxP2cO6J s5uMEs2W0M/SrTuYLx2qnVn7kpWsiUJOpc1K/eyIOl5c5qYfhdwuo1vXH6ym31bNntmzpup1 eN3wXX332r4E286q38J9PD0Rjf8= X-Mailgun-Sending-Ip: 69.72.42.4 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n09.prod.us-west-2.postgun.com with SMTP id 5fb3909b40d44461255c0151 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 17 Nov 2020 08:58:03 GMT Sender: kathirve=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 06376C43460; Tue, 17 Nov 2020 08:58:03 +0000 (UTC) Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: kathirve) by smtp.codeaurora.org (Postfix) with ESMTPSA id D46E4C433C6; Tue, 17 Nov 2020 08:58:01 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 17 Nov 2020 14:28:01 +0530 From: kathirve@codeaurora.org To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org Subject: Re: [PATCHv2] mac80211: choosing first channel from the list In-Reply-To: <1603884387-23757-1-git-send-email-kathirve@codeaurora.org> References: <1603884387-23757-1-git-send-email-kathirve@codeaurora.org> Message-ID: <06b13326118d3fdeb3f665aa54af9c4e@codeaurora.org> X-Sender: kathirve@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 2020-10-28 16:56, Karthikeyan Kathirvel wrote: > Though the first channel from sband channel list is invalid > or disabled still mac80211 is choosing this disabled channel > as a default channel for monitor interface. This will end-up > in choosing wrong channel. > > Fixed by assigning the first available valid or enabled channel > to the respective radios. > > Signed-off-by: Karthikeyan Kathirvel > --- > > v2: > rebased > > net/mac80211/main.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/net/mac80211/main.c b/net/mac80211/main.c > index b4a2efe..a4aefd6 100644 > --- a/net/mac80211/main.c > +++ b/net/mac80211/main.c > @@ -982,8 +982,15 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) > continue; > > if (!dflt_chandef.chan) { > + /* > + * Assigning the first enabled channel to dflt_chandef from the > + * list of channels available specific to country > + */ > + for (i = 0; i < sband->n_channels; i++) > + if (!(sband->channels[i].flags & IEEE80211_CHAN_DISABLED)) > + break; > cfg80211_chandef_create(&dflt_chandef, > - &sband->channels[0], > + &sband->channels[i == sband->n_channels ? 0 : i], > NL80211_CHAN_NO_HT); > /* init channel we're on */ > if (!local->use_chanctx && !local->_oper_chandef.chan) { Please ignore this.