From patchwork Wed Apr 2 13:31:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rostislav Lisovy X-Patchwork-Id: 3928781 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5BE06BF540 for ; Wed, 2 Apr 2014 13:33:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9909920200 for ; Wed, 2 Apr 2014 13:33:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C45E4201FD for ; Wed, 2 Apr 2014 13:33:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932074AbaDBNdj (ORCPT ); Wed, 2 Apr 2014 09:33:39 -0400 Received: from mail-wi0-f179.google.com ([209.85.212.179]:44128 "EHLO mail-wi0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932216AbaDBNcH (ORCPT ); Wed, 2 Apr 2014 09:32:07 -0400 Received: by mail-wi0-f179.google.com with SMTP id z2so514472wiv.12 for ; Wed, 02 Apr 2014 06:32:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VYkEOGdMU3yAyVw+j7Ew00YiNAcET4tlS/hsiZHtwOs=; b=lbgkF4c/AT31nmU3EXW4mSNvrB8+OTnrC8thiSjJ9/ApzmG7tJCHbCXMMm7G8IczCX +DX65k7lSpCWrUOvonwvWgD+Du1KvDrL47GNH9I8fSY8qrHOxydS9Xx4TVp04mwNvsrs pJyeR8EXPWH4bBzYcZh9zY3ApOBEk/w9thYVX8nw+msa4/72zuFtMvOPM4dyP2QFRv9C seLayEEMFsg1q3UN8lzlBR/T1VJMesIiu3WXD+TOLswbgloTmuAxLLrzLx6U4Gma6sGs kjNVbWQUWz2zOycazqCHvU9TcNV4M4zC251jelwPuOMnMkvfLP15VWi7vbsEPCmq6PV/ bcqQ== X-Received: by 10.180.85.234 with SMTP id k10mr28753547wiz.32.1396445526266; Wed, 02 Apr 2014 06:32:06 -0700 (PDT) Received: from c2c-vostro1.felk.cvut.cz ([147.32.86.112]) by mx.google.com with ESMTPSA id y7sm4593119eev.5.2014.04.02.06.32.04 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 02 Apr 2014 06:32:05 -0700 (PDT) From: Rostislav Lisovy To: Johannes Berg , "John W. Linville" , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Michal Sojka , s.sander@nordsys.de, jan-niklas.meier@volkswagen.de, Rostislav Lisovy Subject: [PATCH 2/4] cfg80211: Take the BW restrictions into account when checking the channel Date: Wed, 2 Apr 2014 15:31:53 +0200 Message-Id: <1396445515-5808-3-git-send-email-rostislav.lisovy@fel.cvut.cz> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1396445515-5808-1-git-send-email-rostislav.lisovy@fel.cvut.cz> References: <1396445515-5808-1-git-send-email-rostislav.lisovy@fel.cvut.cz> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 Since there are frequency bands restricting maximum channel bandwidth to 5MHz or 10MHz, check the particular bandwidth flags in cfg80211_chandef_usable() to comply with the restrictions. Signed-off-by: Rostislav Lisovy --- net/wireless/chan.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/wireless/chan.c b/net/wireless/chan.c index 78559b5..87e1576 100644 --- a/net/wireless/chan.c +++ b/net/wireless/chan.c @@ -531,12 +531,14 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy, width = 5; break; case NL80211_CHAN_WIDTH_10: + prohibited_flags |= IEEE80211_CHAN_NO_10MHZ; width = 10; break; case NL80211_CHAN_WIDTH_20: if (!ht_cap->ht_supported) return false; case NL80211_CHAN_WIDTH_20_NOHT: + prohibited_flags |= IEEE80211_CHAN_NO_20MHZ; width = 20; break; case NL80211_CHAN_WIDTH_40: