From patchwork Fri Jan 16 10:38:44 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: 5647011 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 BFD359F357 for ; Fri, 16 Jan 2015 10:39:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D1154201C0 for ; Fri, 16 Jan 2015 10:39:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D3E452010F for ; Fri, 16 Jan 2015 10:39:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754250AbbAPKjr (ORCPT ); Fri, 16 Jan 2015 05:39:47 -0500 Received: from mail-wi0-f175.google.com ([209.85.212.175]:61665 "EHLO mail-wi0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754211AbbAPKjn (ORCPT ); Fri, 16 Jan 2015 05:39:43 -0500 Received: by mail-wi0-f175.google.com with SMTP id l15so3114273wiw.2 for ; Fri, 16 Jan 2015 02:39:42 -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=0q3mSJts9WFaExZA/NfYV9tPiAGwe+/vrSaIJ04vtw0=; b=UUmmhp71OcIxtImws0lKb1+3wwRvDi4CLdUumowiUHLkOMFaAka0+sj0Va+It2mUng 5VXYgq7fS5qqZG87JUNn6RTPbtdsrntB3cR+lmX3QcO8BgWJZ+8KHAUC+l0hKxaJ1JgX UKnVW7GxAUpMGYpcP+CcGDcx7UwHZguL/s0Vg= 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=0q3mSJts9WFaExZA/NfYV9tPiAGwe+/vrSaIJ04vtw0=; b=LP1QNkC08MMIbMHWhrqq9N1qfz1+p/W4KscH/GL06jaq1toNo4JoTBSjcq540duPIO /RtKkeC1M91bTlXHQuEJEfir9F9fkQmEI1EcZTszelXhrxIjOMmdSk6uHKbFMINDoETK 4KhMVyn3f75mlAnw5DrA29gyg6P4lt7ur/9dPr3hqvi7qYlecWQPZcpdCRKZpakoPXw+ A02hhLbAf/KBRkepb+EZQF83gV+EIkrsqWi8velIMlgnNFb1uWVsoy3Pq5fFlm41Qfn5 GolMiC2uN89ZGwpnKcsG/geI7KeCVg2lv+mw6LHuUBxxrnB5AmqQq0Hoo75e+W6CABpQ GdYw== X-Gm-Message-State: ALoCoQkOAaivnJSArtzghOAcJlZNZHL/gN1FTBGIJd6QyZN/XQDULkwOggmL9inDxC9koaVIlOhVWN1bXjuuHijG+j4tAGExYpJnoBMMj1CdZxcpQ1sZIWJBk1frY/0dH2GszWHDkCD+9dTnfOU2lqCCzMLqmfQHgPHneO+eGKBIG2ARfHgz4qfd+j8dVFBjnSKo79Fk187N X-Received: by 10.180.88.33 with SMTP id bd1mr4925585wib.10.1421404782217; Fri, 16 Jan 2015 02:39:42 -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.40 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 16 Jan 2015 02:39:41 -0800 (PST) From: Janusz Dziedzic To: linux-wireless@vger.kernel.org Cc: johannes@sipsolutions.net, Janusz Dziedzic Subject: [RFCv2 6/6] mac80211: IBSS setup correctly BW for VHT Date: Fri, 16 Jan 2015 11:38:44 +0100 Message-Id: <1421404724-32326-6-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 Setup correctly BW in case of STA using VHT. Signed-off-by: Janusz Dziedzic --- net/mac80211/ibss.c | 25 ++++++++++++++++--------- net/mac80211/ieee80211_i.h | 3 +++ net/mac80211/util.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 9 deletions(-) diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 3c6df2b..b4263b5 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c @@ -1072,18 +1072,25 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, memcpy(&htcap_ie, elems->ht_cap_elem, sizeof(htcap_ie)); - /* - * fall back to HT20 if we don't use or use - * the other extension channel - */ - if (chandef.center_freq1 != - sdata->u.ibss.chandef.center_freq1) - htcap_ie.cap_info &= - cpu_to_le16(~IEEE80211_HT_CAP_SUP_WIDTH_20_40); - rates_updated |= ieee80211_ht_cap_ie_to_sta_ht_cap( sdata, sband, &htcap_ie, sta); + if (elems->vht_operation && elems->vht_cap_elem && + sdata->u.ibss.chandef.width != NL80211_CHAN_WIDTH_20 && + sdata->u.ibss.chandef.width != NL80211_CHAN_WIDTH_40) { + /* we both use VHT */ + struct ieee80211_vht_cap vhtcap_ie; + struct ieee80211_sta_vht_cap vht_cap = sta->sta.vht_cap; + + ieee80211_vht_oper_to_chandef(channel, + elems->vht_operation, + &chandef); + memcpy(&vhtcap_ie, elems->vht_cap_elem, sizeof(vhtcap_ie)); + ieee80211_vht_cap_ie_to_sta_vht_cap(sdata, sband, &vhtcap_ie, sta); + if (memcmp(&vht_cap, &sta->sta.vht_cap, sizeof(vht_cap))) + rates_updated |= true; + } + if (bw != sta->sta.bandwidth) rates_updated |= true; } diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 05d3af5..a3e93ad 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -1953,6 +1953,9 @@ u8 *ieee80211_add_wmm_info_ie(u8 *buf, u8 qosinfo); void ieee80211_ht_oper_to_chandef(struct ieee80211_channel *control_chan, const struct ieee80211_ht_operation *ht_oper, struct cfg80211_chan_def *chandef); +void ieee80211_vht_oper_to_chandef(struct ieee80211_channel *control_chan, + const struct ieee80211_vht_operation *oper, + struct cfg80211_chan_def *chandef); u32 ieee80211_chandef_downgrade(struct cfg80211_chan_def *c); int __must_check diff --git a/net/mac80211/util.c b/net/mac80211/util.c index ee6a601..f5599ac 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -2393,6 +2393,37 @@ void ieee80211_ht_oper_to_chandef(struct ieee80211_channel *control_chan, cfg80211_chandef_create(chandef, control_chan, channel_type); } +void ieee80211_vht_oper_to_chandef(struct ieee80211_channel *control_chan, + const struct ieee80211_vht_operation *oper, + struct cfg80211_chan_def *chandef) +{ + if (!oper) + return; + + chandef->chan = control_chan; + + switch (oper->chan_width) { + case IEEE80211_VHT_CHANWIDTH_USE_HT: + break; + case IEEE80211_VHT_CHANWIDTH_80MHZ: + chandef->width = NL80211_CHAN_WIDTH_80; + break; + case IEEE80211_VHT_CHANWIDTH_160MHZ: + chandef->width = NL80211_CHAN_WIDTH_160; + break; + case IEEE80211_VHT_CHANWIDTH_80P80MHZ: + chandef->width = NL80211_CHAN_WIDTH_80P80; + break; + } + + chandef->center_freq1 = ieee80211_channel_to_frequency( + oper->center_freq_seg1_idx, + control_chan->band); + chandef->center_freq2 = ieee80211_channel_to_frequency( + oper->center_freq_seg2_idx, + control_chan->band); +} + int ieee80211_parse_bitrates(struct cfg80211_chan_def *chandef, const struct ieee80211_supported_band *sband, const u8 *srates, int srates_len, u32 *rates)