From patchwork Mon Nov 20 14:01:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Peter_Gro=C3=9Fe?= X-Patchwork-Id: 10066513 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 44B02603FA for ; Mon, 20 Nov 2017 14:02:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F1AA28BC4 for ; Mon, 20 Nov 2017 14:02:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 23D7B2922B; Mon, 20 Nov 2017 14:02:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2E51E28BC4 for ; Mon, 20 Nov 2017 14:02:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Message-ID:Subject:To:From:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=BGXMPKbVL55v0uW+lxOgGDubVwQNU39OncAnym9AJlk=; b=OGpD6QnGIPWLWAJsf69hKH4w3 Z1TgiA7faG6ICQbctksPGK5qZ/6WMx7WIFs/UzOGka/lAiPNyCGrD2gpqrARzk7ki+PvGAwdzcBp2 VUj+9/oojTBZ0HkWmtW1wLtVowm76jXalpIHwdIFRUQ4Us1SUrefezFpdRRnJhWgHzvrYeMWheVj6 o1HKrA9tHCCEJq7SQLb8EOVLBRlKXaCxlkJJC8ORULojlUpU5789qOY2s/y6H0IVxZtr4O6eMLE0M SHFYRr7ddq8pbYQt/X7dR6cteABSrdZvikZ7wmzLE7TuZ7EvHwYcpjLDx1pPPygyXi/lqCfIBFL+T nVtTivDJw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eGme5-0002JZ-Q5; Mon, 20 Nov 2017 14:01:57 +0000 Received: from james.theweblords.de ([217.11.55.87]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eGmdo-0001vu-VL for ath10k@lists.infradead.org; Mon, 20 Nov 2017 14:01:47 +0000 Received: (qmail 29975 invoked by uid 210); 20 Nov 2017 14:01:17 -0000 X-Qmail-Scanner-Diagnostics: from wl-r3-84.rz.tu-ilmenau.de (petronios@theweblords.de@wl-r3-84.rz.tu-ilmenau.de) by james (envelope-from , uid 201) with qmail-scanner-2.10st (mhr: 1.0. spamassassin: 3.4.1. perlscan: 2.10st. Clear:RC:1(141.24.16.84):. Processed in 0.679861 secs); 20 Nov 2017 14:01:17 -0000 Received: from wl-r3-84.rz.tu-ilmenau.de (HELO localhost) (petronios@theweblords.de@141.24.16.84) by james.theweblords.de with ESMTPA; 20 Nov 2017 14:01:16 -0000 Date: Mon, 20 Nov 2017 15:01:15 +0100 From: Peter =?UTF-8?B?R3Jvw59l?= To: ath10k@lists.infradead.org Subject: Re: Support for 5/10 MHz channel width Message-ID: <20171120150115.0c0a8a3c@friiks.de> In-Reply-To: <07148f03-50ac-72ef-3e34-9a93d5d75026@dd-wrt.com> References: <20171118230818.5e07509a@friiks.de> <07148f03-50ac-72ef-3e34-9a93d5d75026@dd-wrt.com> X-Mailer: Claws Mail 3.15.1-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171120_060141_356500_99586384 X-CRM114-Status: GOOD ( 11.73 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On Sun, 19 Nov 2017 00:35:22 +0100 Sebastian Gottschall wrote: > maybe easy to implement. the firmware does support it. > --- wmi.h       (Revision 3720) > +++ wmi.h       (Arbeitskopie) > @@ -1986,6 +1986,8 @@ >  #define WMI_CHAN_FLAG_DFS            (1 << 10) >  #define WMI_CHAN_FLAG_ALLOW_HT       (1 << 11) >  #define WMI_CHAN_FLAG_ALLOW_VHT      (1 << 12) > +#define WMI_CHAN_FLAG_QUARTER       (1 << 13) > +#define WMI_CHAN_FLAG_HALF      (1 << 14) > >  /* Indicate reason for channel switch */ >  #define WMI_CHANNEL_CHANGE_CAUSE_CSA (1 << 13) > > this should help you out with playing Thanks for the hint. I tried setting these flags, but my wifi card still uses full rate. My test setup consists of 2 ath9k cards and 1 ath10k card (QCA988X). I'm able to transmit frames between the ath9k cards using channel widths 5MHz, 10MHz and 20Mhz (so half and quarter rates work), but I only see these frames on the ath10k card when using 20MHz channel width. Therefor I assume, setting these flags doesn't do anything or I missed something. I tried firmware versions 10.2.4.70.54 and 10.2.4.70.66. See attached patch and dmesg output. Am I on the right track? Regards Peter From f48ebb763159a2369590c860c27504ad394b1aa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Gro=C3=9Fe?= Date: Mon, 20 Nov 2017 14:52:33 +0100 Subject: [PATCH] ath10k: add support for 5 / 10 MHz channels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Große --- drivers/net/wireless/ath/ath10k/mac.c | 19 +++++++++++++++---- drivers/net/wireless/ath/ath10k/wmi.c | 4 ++++ drivers/net/wireless/ath/ath10k/wmi.h | 4 ++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 55c808f03a84..635d53ae0ac7 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -558,6 +558,8 @@ chan_to_phymode(const struct cfg80211_chan_def *chandef) break; case NL80211_BAND_5GHZ: switch (chandef->width) { + case NL80211_CHAN_WIDTH_5: + case NL80211_CHAN_WIDTH_10: case NL80211_CHAN_WIDTH_20_NOHT: phymode = MODE_11A; break; @@ -576,10 +578,6 @@ chan_to_phymode(const struct cfg80211_chan_def *chandef) case NL80211_CHAN_WIDTH_80P80: phymode = MODE_11AC_VHT80_80; break; - case NL80211_CHAN_WIDTH_5: - case NL80211_CHAN_WIDTH_10: - phymode = MODE_UNKNOWN; - break; } break; default: @@ -986,6 +984,12 @@ static int ath10k_monitor_vdev_start(struct ath10k *ar, int vdev_id) arg.channel.chan_radar = !!(channel->flags & IEEE80211_CHAN_RADAR); + if (chandef->width == NL80211_CHAN_WIDTH_10) { + arg.channel.rate_half = 1; + } else if (chandef->width == NL80211_CHAN_WIDTH_5) { + arg.channel.rate_quarter = 1; + } + arg.channel.min_power = 0; arg.channel.max_power = channel->max_power * 2; arg.channel.max_reg_power = channel->max_reg_power * 2; @@ -1433,6 +1437,12 @@ static int ath10k_vdev_start_restart(struct ath10k_vif *arvif, arg.channel.max_reg_power = chandef->chan->max_reg_power * 2; arg.channel.max_antenna_gain = chandef->chan->max_antenna_gain * 2; + if (chandef->width == NL80211_CHAN_WIDTH_10) { + arg.channel.rate_half = 1; + } else if (chandef->width == NL80211_CHAN_WIDTH_5) { + arg.channel.rate_quarter = 1; + } + if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { arg.ssid = arvif->u.ap.ssid; arg.ssid_len = arvif->u.ap.ssid_len; @@ -8202,6 +8212,7 @@ int ath10k_mac_register(struct ath10k *ar) ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; + ar->hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_5_10_MHZ; ar->hw->wiphy->max_remain_on_channel_duration = 5000; ar->hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD; diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index 3efb404b83c0..3d409878ab4a 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -1635,6 +1635,10 @@ void ath10k_wmi_put_wmi_channel(struct wmi_channel *ch, flags |= WMI_CHAN_FLAG_HT40_PLUS; if (arg->chan_radar) flags |= WMI_CHAN_FLAG_DFS; + if (arg->rate_half) + flags |= WMI_CHAN_FLAG_HALF; + if (arg->rate_quarter) + flags |= WMI_CHAN_FLAG_QUARTER; ch->mhz = __cpu_to_le32(arg->freq); ch->band_center_freq1 = __cpu_to_le32(arg->band_center_freq1); diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h index baa38c8f847c..f8848bd26011 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.h +++ b/drivers/net/wireless/ath/ath10k/wmi.h @@ -1826,6 +1826,8 @@ struct wmi_channel_arg { bool allow_vht; bool ht40plus; bool chan_radar; + bool rate_half; + bool rate_quarter; /* note: power unit is 0.5 dBm */ u32 min_power; u32 max_power; @@ -1847,6 +1849,8 @@ enum wmi_channel_change_cause { #define WMI_CHAN_FLAG_DFS (1 << 10) #define WMI_CHAN_FLAG_ALLOW_HT (1 << 11) #define WMI_CHAN_FLAG_ALLOW_VHT (1 << 12) +#define WMI_CHAN_FLAG_QUARTER (1 << 13) +#define WMI_CHAN_FLAG_HALF (1 << 14) /* Indicate reason for channel switch */ #define WMI_CHANNEL_CHANGE_CAUSE_CSA (1 << 13) -- 2.13.6