From patchwork Tue Jun 9 15:27:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias May X-Patchwork-Id: 6573521 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 854839F1C1 for ; Tue, 9 Jun 2015 15:35:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A72BE204A2 for ; Tue, 9 Jun 2015 15:35:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2D3DC20490 for ; Tue, 9 Jun 2015 15:35:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752106AbbFIPfT (ORCPT ); Tue, 9 Jun 2015 11:35:19 -0400 Received: from mail.neratec.com ([46.140.151.2]:49802 "EHLO mail.neratec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933205AbbFIPfK (ORCPT ); Tue, 9 Jun 2015 11:35:10 -0400 X-Greylist: delayed 478 seconds by postgrey-1.27 at vger.kernel.org; Tue, 09 Jun 2015 11:35:09 EDT Received: from localhost (localhost [127.0.0.1]) by mail.neratec.com (Postfix) with ESMTP id CE8C3A06B60 for ; Tue, 9 Jun 2015 17:27:10 +0200 (CEST) Received: from mail.neratec.com ([127.0.0.1]) by localhost (mail.neratec.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id g-V_rQ8puxTq; Tue, 9 Jun 2015 17:27:10 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.neratec.com (Postfix) with ESMTP id 68488A06B5F; Tue, 9 Jun 2015 17:27:10 +0200 (CEST) X-Virus-Scanned: amavisd-new at neratec.com Received: from mail.neratec.com ([127.0.0.1]) by localhost (mail.neratec.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id X7l5LDl7gEuc; Tue, 9 Jun 2015 17:27:10 +0200 (CEST) Received: from CHD500279.neratec.local (CHD500279.neratec.local [192.168.11.50]) by mail.neratec.com (Postfix) with ESMTPSA id 51D46A06B45; Tue, 9 Jun 2015 17:27:10 +0200 (CEST) From: Matthias May To: linux-wireless@vger.kernel.org Cc: Matthias May Subject: [PATCH] cfg80211: check correct maximum bandwidth for quarter and half rate. Date: Tue, 9 Jun 2015 17:27:05 +0200 Message-Id: <1433863625-30579-1-git-send-email-matthias.may@neratec.com> X-Mailer: git-send-email 2.1.4 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When using quarter and half rates we might want to use self defined frequencies with self defined country codes closer to the border. To avoid these frequencies to be disabled, we need to check if the frequency fits the band with the actual bandwidth. Signed-off-by: Matthias May --- net/wireless/reg.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/wireless/reg.c b/net/wireless/reg.c index fc2f135..c8fabda 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -1016,6 +1016,7 @@ freq_reg_info_regd(struct wiphy *wiphy, u32 center_freq, for (i = 0; i < regd->n_reg_rules; i++) { const struct ieee80211_reg_rule *rr; const struct ieee80211_freq_range *fr = NULL; + u32 max_bw = MHZ_TO_KHZ(20); rr = ®d->reg_rules[i]; fr = &rr->freq_range; @@ -1028,8 +1028,10 @@ freq_reg_info_regd(struct wiphy *wiphy, u32 center_freq, */ if (!band_rule_found) band_rule_found = freq_in_rule_band(fr, center_freq); + if (fr->max_bandwidth_khz < max_bw) + max_bw = fr->max_bandwidth_khz; - bw_fits = reg_does_bw_fit(fr, center_freq, MHZ_TO_KHZ(20)); + bw_fits = reg_does_bw_fit(fr, center_freq, max_bw); if (band_rule_found && bw_fits) return rr;