From patchwork Fri Jan 16 10:38:41 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: 5646991 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 6619F9F357 for ; Fri, 16 Jan 2015 10:39:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6C26D20160 for ; Fri, 16 Jan 2015 10:39:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 656ED2010F for ; Fri, 16 Jan 2015 10:39:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754216AbbAPKjm (ORCPT ); Fri, 16 Jan 2015 05:39:42 -0500 Received: from mail-wi0-f171.google.com ([209.85.212.171]:54524 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754211AbbAPKji (ORCPT ); Fri, 16 Jan 2015 05:39:38 -0500 Received: by mail-wi0-f171.google.com with SMTP id ho1so3112071wib.4 for ; Fri, 16 Jan 2015 02:39:37 -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:in-reply-to:references; bh=y1NKWjE8YZvZfudY9ala3Amv2T+SMXT4r8+i9VyDmbw=; b=TIRl4ZrIUyQdgPAco8fmwacABDTbM2aiidx3IAm2ClRUwzp/Q5HnHKklvKseSIFNCW JmI81eECnaBuC5okzZZFclw5MRYqrVcPeYhUr9nI6Rf8uwjKJFo/WJIymaN8iUF4BlCH rtgVVfUU6Q7B68rGoewF2YQDHbctfkc/MAVgA= 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:in-reply-to :references; bh=y1NKWjE8YZvZfudY9ala3Amv2T+SMXT4r8+i9VyDmbw=; b=hv8EWLfrSOcb6wWVNA7uYHxm1u02QNLnA4whJ+zrJxfwUH0JePD6NEyPXGbOM0bQWu fChN7lpiKO5ejsnJ+LlcB1nr7eg4mQx1RKzSfgtJn5gNBj91Sw4ZGyXypEUQdekQNhfA cvmUEAWU4YtzerzeWtRrzqsWzKTd5pU28Rnpqz8uiuykBsqhNE0W7OCTT9wCm7L4dbsP 7TrDiz6cNmtT1+nOxVT4BEZmugwIYtcCpd6/F0LPPDqMk8+JWfCfyDJqYzZLGurSX9ug zPqnvuVDIcwxwBmuLhkavEAqiH32/IbHFVzqGmPCjOS18F2lDxrYrNJMSXgNPBYwhBVq jLIw== X-Gm-Message-State: ALoCoQkXUPLLSO6FrXYNgxul5z/5LZzYwkKJwNC6UD5gUr0LSVo4ooSyr0eZKlmcu957Zf+Zv+aZTc/V0kcZskBbkkbL8hb/oKGnAH4vwRanJojChyzxXsW3hTI9TOPGsGEs7L0cga5YAMc+gN59OaUtjLj5uclxTMm51hqeEULUekEY9qNW/YYMtxrw/oRF7bMRWCVlMt5c X-Received: by 10.180.95.4 with SMTP id dg4mr4712081wib.61.1421404777330; Fri, 16 Jan 2015 02:39:37 -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 bo5sm148423wjc.39.2015.01.16.02.39.35 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 16 Jan 2015 02:39:36 -0800 (PST) From: Janusz Dziedzic To: linux-wireless@vger.kernel.org Cc: johannes@sipsolutions.net, Janusz Dziedzic Subject: [RFCv2 3/6] mac80211: add VHT support for IBSS Date: Fri, 16 Jan 2015 11:38:41 +0100 Message-Id: <1421404724-32326-3-git-send-email-janusz.dziedzic@tieto.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1421404724-32326-1-git-send-email-janusz.dziedzic@tieto.com> References: <1421404724-32326-1-git-send-email-janusz.dziedzic@tieto.com> 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 VHT80/VHT160 support for IBSS. Drivers could activate this feature by setting NL80211_FEATURE_VHT_IBSS flag. Signed-off-by: Janusz Dziedzic --- net/mac80211/ibss.c | 11 +++++++++++ net/mac80211/ieee80211_i.h | 2 ++ net/mac80211/util.c | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 13b8105..1ffcfab 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c @@ -188,6 +188,15 @@ ieee80211_ibss_build_presp(struct ieee80211_sub_if_data *sdata, */ pos = ieee80211_ie_build_ht_oper(pos, &sband->ht_cap, chandef, 0); + + if (chandef->width != NL80211_CHAN_WIDTH_20 && + chandef->width != NL80211_CHAN_WIDTH_40 && + sband->vht_cap.vht_supported) { + pos = ieee80211_ie_build_vht_cap(pos, &sband->vht_cap, + sband->vht_cap.cap); + pos = ieee80211_ie_build_vht_oper(pos, &sband->vht_cap, + chandef); + } } if (local->hw.queues >= IEEE80211_NUM_ACS) @@ -411,6 +420,8 @@ static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, cfg80211_chandef_create(&chandef, cbss->channel, chan_type); break; case NL80211_CHAN_WIDTH_40: + case NL80211_CHAN_WIDTH_80: + case NL80211_CHAN_WIDTH_160: cfg80211_chandef_create(&chandef, cbss->channel, NL80211_CHAN_WIDTH_20_NOHT); chandef.width = sdata->u.ibss.chandef.width; diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 156ea79..95ce152 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -1935,6 +1935,8 @@ u8 *ieee80211_ie_build_ht_oper(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap, u16 prot_mode); u8 *ieee80211_ie_build_vht_cap(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap, u32 cap); +u8 *ieee80211_ie_build_vht_oper(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap, + const struct cfg80211_chan_def *chandef); int ieee80211_parse_bitrates(struct cfg80211_chan_def *chandef, const struct ieee80211_supported_band *sband, const u8 *srates, int srates_len, u32 *rates); diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 83ba6cd..ee6a601 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -2329,6 +2329,41 @@ u8 *ieee80211_ie_build_ht_oper(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap, return pos + sizeof(struct ieee80211_ht_operation); } +u8 *ieee80211_ie_build_vht_oper(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap, + const struct cfg80211_chan_def *chandef) +{ + struct ieee80211_vht_operation *vht_oper; + + /* Build VHT Operation */ + *pos++ = WLAN_EID_VHT_OPERATION; + *pos++ = sizeof(struct ieee80211_vht_operation); + + vht_oper = (struct ieee80211_vht_operation *)pos; + + vht_oper->center_freq_seg1_idx = + ieee80211_frequency_to_channel(chandef->center_freq1); + vht_oper->center_freq_seg2_idx = 0; + vht_oper->basic_mcs_set = vht_cap->vht_mcs.rx_mcs_map; + + switch (chandef->width) { + case NL80211_CHAN_WIDTH_80: + vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_80MHZ; + break; + case NL80211_CHAN_WIDTH_80P80: + vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_80P80MHZ; + vht_oper->center_freq_seg2_idx = + ieee80211_frequency_to_channel(chandef->center_freq2); + break; + case NL80211_CHAN_WIDTH_160: + vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_160MHZ; + break; + default: + return pos; + } + + return pos + sizeof(struct ieee80211_vht_operation); +} + void ieee80211_ht_oper_to_chandef(struct ieee80211_channel *control_chan, const struct ieee80211_ht_operation *ht_oper, struct cfg80211_chan_def *chandef)