From patchwork Tue Jan 13 08:35:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz.Dziedzic@tieto.com X-Patchwork-Id: 5618341 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 87CDE9F2ED for ; Tue, 13 Jan 2015 08:36:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 881B62049D for ; Tue, 13 Jan 2015 08:36:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ED014204A0 for ; Tue, 13 Jan 2015 08:36:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751510AbbAMIgV (ORCPT ); Tue, 13 Jan 2015 03:36:21 -0500 Received: from mail-we0-f170.google.com ([74.125.82.170]:61046 "EHLO mail-we0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751183AbbAMIgU (ORCPT ); Tue, 13 Jan 2015 03:36:20 -0500 Received: by mail-we0-f170.google.com with SMTP id w61so1478983wes.1 for ; Tue, 13 Jan 2015 00:36:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id; bh=6yJc8hDtnaZamAigHaZoQQ9Mqzb+5Cxv6hyl4467IjE=; b=ByP8p7X9CrFA4clSvHiGc1fPbxr/hlhcNLr1vSgvMr7kjoe/NbfAaUt6OFF1o++CyO 0PshgjenEQSHDaYcp3MMRSoSRN1mgIlAMp1gVLjkEXk1hBIRWQrjGteoKsruETKBpDEu 3CcDfbIvVRV5jGQzvbnyB1ymXlaOr4U/aZi0w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=6yJc8hDtnaZamAigHaZoQQ9Mqzb+5Cxv6hyl4467IjE=; b=ZF3JillgWM2yfcFVDttgoSHxSKZLh7aWLqCMxFSyOu7Gm4Y4v/XAljBLOEBpDYzmLh HUEYUKQnkGAuOp5yP7Y0JqYLsvYHxOw+wxUEyQ+TSu0HILoH89EWMowBNKuQvD8mHLid 98HuLjp0/zTTbgR8RGjEtLLGnBmamWQME/mVZ7zbrAwU/++aBPrEx64NzWzBEsVgd360 8JJSaLalqLMoqX9aWok9Xe5xnhWkP64Lcbdb+33W7Tb0lUdsMiCKJfdwr6c6ejHHIUcn KuttBsVdTmSmMPMRPcMd5YXwClnymU6sHY9ZsWgRe8g8caKL9gycV+4iCoa3gEw4ZX2k /gBw== X-Gm-Message-State: ALoCoQlwTDwD0UPF6JGy25yQI+fzB9SVy3TAIINoFZf/V3Qn/fgReUeYNcUgplOBjm4VOXBx3tksOwk8szaXFZlO+koZK5gzXIV+5BtddJjXVKM1lKlSXK1v9jOeNzD+4K4lzzrFA3Ce7haLwZLrQZSc+TEx5PNhyFmyCTagHimm0WNFxumo/deqjbF4iQNAlk1ews1JzETN X-Received: by 10.180.72.199 with SMTP id f7mr38517765wiv.53.1421138178894; Tue, 13 Jan 2015 00:36:18 -0800 (PST) Received: from localhost.localdomain (apn-46-76-65-212.dynamic.gprs.plus.pl. [46.76.65.212]) by mx.google.com with ESMTPSA id cp4sm24746179wjb.16.2015.01.13.00.36.14 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Jan 2015 00:36:18 -0800 (PST) From: Janusz Dziedzic To: linux-wireless@vger.kernel.org Cc: johannes@sipsolutions.net, Janusz Dziedzic Subject: [RFC 1/2] cfg80211: add VHT support for IBSS Date: Tue, 13 Jan 2015 09:35:23 +0100 Message-Id: <1421138124-7661-1-git-send-email-janusz.dziedzic@tieto.com> X-Mailer: git-send-email 1.9.1 X-DomainID: tieto.com 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_SIGNED, 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 Add VHT support for IBSS. Signed-off-by: Janusz Dziedzic --- include/net/cfg80211.h | 17 +++++++++++++++++ include/uapi/linux/nl80211.h | 2 ++ net/wireless/nl80211.c | 34 ++++++++++++++++++++++++++++++++-- 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 1977357..d16ce05 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -1712,6 +1712,17 @@ struct cfg80211_disassoc_request { }; /** + * enum cfg80211_ibss_params_flags - Over-ride default IBSS behaviour. + * + * @IBSS_PARAMS_DISABLE_HT: Disable HT (802.11n) + * @IBSS_PARAMS_DISABLE_VHT: Disable VHT + */ +enum cfg80211_ibss_params_flags { + IBSS_PARAMS_DISABLE_HT = BIT(0), + IBSS_PARAMS_DISABLE_VHT = BIT(1), +}; + +/** * struct cfg80211_ibss_params - IBSS parameters * * This structure defines the IBSS parameters for the join_ibss() @@ -1738,9 +1749,12 @@ struct cfg80211_disassoc_request { * to operate on DFS channels. * @basic_rates: bitmap of basic rates to use when creating the IBSS * @mcast_rate: per-band multicast rate index + 1 (0: disabled) + * @flags See &enum cfg80211_ibss_params_flags * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask * will be used in ht_capa. Un-supported values will be ignored. * @ht_capa_mask: The bits of ht_capa which are to be used. + * @vht_capa: VHT Capability overrides + * @vht_capa_mask: The bits of vht_capa which are to be used. */ struct cfg80211_ibss_params { const u8 *ssid; @@ -1755,8 +1769,11 @@ struct cfg80211_ibss_params { bool control_port; bool userspace_handles_dfs; int mcast_rate[IEEE80211_NUM_BANDS]; + u32 flags; struct ieee80211_ht_cap ht_capa; struct ieee80211_ht_cap ht_capa_mask; + struct ieee80211_vht_cap vht_capa; + struct ieee80211_vht_cap vht_capa_mask; }; /** diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index a963d48..d78030fe 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -4306,11 +4306,13 @@ enum nl80211_feature_flags { /** * enum nl80211_ext_feature_index - bit index of extended features. + * @NL80211_FEATURE_VHT_IBSS: This driver supports IBSS with VHT datarates. * * @NUM_NL80211_EXT_FEATURES: number of extended features. * @MAX_NL80211_EXT_FEATURES: highest extended feature index. */ enum nl80211_ext_feature_index { + NL80211_FEATURE_VHT_IBSS, /* add new features before the definition below */ NUM_NL80211_EXT_FEATURES, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 7c2ce26..15f638a 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -7235,8 +7235,18 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info) break; case NL80211_CHAN_WIDTH_20: case NL80211_CHAN_WIDTH_40: - if (rdev->wiphy.features & NL80211_FEATURE_HT_IBSS) - break; + if (!(rdev->wiphy.features & NL80211_FEATURE_HT_IBSS)) + return -EINVAL; + break; + case NL80211_CHAN_WIDTH_80: + case NL80211_CHAN_WIDTH_80P80: + case NL80211_CHAN_WIDTH_160: + if (!(rdev->wiphy.features & NL80211_FEATURE_HT_IBSS)) + return -EINVAL; + if (!wiphy_ext_feature_isset(&rdev->wiphy, + NL80211_FEATURE_VHT_IBSS)) + return -EINVAL; + break; default: return -EINVAL; } @@ -7258,6 +7268,9 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info) return err; } + if (nla_get_flag(info->attrs[NL80211_ATTR_DISABLE_HT])) + ibss.flags |= IBSS_PARAMS_DISABLE_HT; + if (info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK]) memcpy(&ibss.ht_capa_mask, nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK]), @@ -7271,6 +7284,23 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info) sizeof(ibss.ht_capa)); } + if (nla_get_flag(info->attrs[NL80211_ATTR_DISABLE_VHT])) + ibss.flags |= IBSS_PARAMS_DISABLE_VHT; + + if (info->attrs[NL80211_ATTR_VHT_CAPABILITY_MASK]) + memcpy(&ibss.vht_capa_mask, + nla_data(info->attrs[NL80211_ATTR_VHT_CAPABILITY_MASK]), + sizeof(ibss.vht_capa_mask)); + + if (info->attrs[NL80211_ATTR_VHT_CAPABILITY]) { + if (!info->attrs[NL80211_ATTR_VHT_CAPABILITY_MASK]) + return -EINVAL; + memcpy(&ibss.vht_capa, + nla_data(info->attrs[NL80211_ATTR_VHT_CAPABILITY]), + sizeof(ibss.vht_capa)); + } + + if (info->attrs[NL80211_ATTR_MCAST_RATE] && !nl80211_parse_mcast_rate(rdev, ibss.mcast_rate, nla_get_u32(info->attrs[NL80211_ATTR_MCAST_RATE])))