From patchwork Tue Mar 11 13:05:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rostislav Lisovy X-Patchwork-Id: 3812431 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 978129F402 for ; Tue, 11 Mar 2014 13:06:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BD5982021C for ; Tue, 11 Mar 2014 13:06:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E39DD202A1 for ; Tue, 11 Mar 2014 13:06:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754084AbaCKNF2 (ORCPT ); Tue, 11 Mar 2014 09:05:28 -0400 Received: from mail-ea0-f173.google.com ([209.85.215.173]:55023 "EHLO mail-ea0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753951AbaCKNF0 (ORCPT ); Tue, 11 Mar 2014 09:05:26 -0400 Received: by mail-ea0-f173.google.com with SMTP id r15so4252549ead.18 for ; Tue, 11 Mar 2014 06:05:25 -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=kqEcweafRyjI6juyZxNlr107b6Ndjl5CWh/EgG9n7QY=; b=TY4FmLMhF9e9gvrCgXIz7ZheS6hoplkHW/OEK9TesmDA/2o3wQ+oo60QMS1LhzJoa4 I6r79wbnjDdKYr/7qfMddTiJ0LCcIxNE02Wuf7EQbAymOQYIJ7RV1j33swEtHpKQfWBN KV//aazpcV18iyJTcK28ui0A/29KRx40MrC1y24Wc6zOJSMoUwaHu8PJt9gMa8yRG9cy GA7KMZbpjfls8bvkhez0ZeKGnLB3f1eKQN3q+iLV1x8dYWGQFFd4TzoNdavpRrENeZMw 5CM0jKIS4knX1K8+wHUjStO7G/1JURjNlPc63HI13FoFyiuSix1TutAup6G0kSmszXos PwYw== X-Received: by 10.14.8.7 with SMTP id 7mr10305628eeq.56.1394543125414; Tue, 11 Mar 2014 06:05:25 -0700 (PDT) Received: from c2c-vostro1.felk.cvut.cz ([147.32.86.166]) by mx.google.com with ESMTPSA id o5sm57343965eeg.8.2014.03.11.06.05.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 11 Mar 2014 06:05:24 -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/5] nl80211: Support for 5/10 MHz channels when reporting BW restrictions Date: Tue, 11 Mar 2014 14:05:11 +0100 Message-Id: <1394543114-6700-3-git-send-email-rostislav.lisovy@fel.cvut.cz> X-Mailer: git-send-email 1.8.5.1 In-Reply-To: <1394543114-6700-1-git-send-email-rostislav.lisovy@fel.cvut.cz> References: <1394543114-6700-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=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, 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 If the 'split wiphy dump' is enabled report the extra attributes (if present) describing the bandwidth restrictions. If the 'split wiphy dump' is not enabled completely omit those channels that have flags set to either IEEE80211_CHAN_NO_10MHZ or IEEE80211_CHAN_NO_20MHZ thus preventing breaking of old user-space tools. Signed-off-by: Rostislav Lisovy --- net/wireless/nl80211.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 4fe2e6e..c62c572 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -563,6 +563,13 @@ static int nl80211_msg_put_channel(struct sk_buff *msg, struct ieee80211_channel *chan, bool large) { + /* Some channels must be completely excluded from the + * list to protect old user-space tools from breaking + */ + if (!large && chan->flags & + (IEEE80211_CHAN_NO_10MHZ | IEEE80211_CHAN_NO_20MHZ)) + return 0; + if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_FREQ, chan->center_freq)) goto nla_put_failure; @@ -606,6 +613,12 @@ static int nl80211_msg_put_channel(struct sk_buff *msg, if ((chan->flags & IEEE80211_CHAN_NO_160MHZ) && nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_160MHZ)) goto nla_put_failure; + if ((chan->flags & IEEE80211_CHAN_NO_20MHZ) && + nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_20MHZ)) + goto nla_put_failure; + if ((chan->flags & IEEE80211_CHAN_NO_10MHZ) && + nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_10MHZ)) + goto nla_put_failure; } if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER,