From patchwork Mon Feb 17 13:22:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rostislav Lisovy X-Patchwork-Id: 3663161 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9BBAFBF13A for ; Mon, 17 Feb 2014 13:23:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7F7AB20160 for ; Mon, 17 Feb 2014 13:23:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 47BBA2013D for ; Mon, 17 Feb 2014 13:23:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753492AbaBQNXT (ORCPT ); Mon, 17 Feb 2014 08:23:19 -0500 Received: from mail-ee0-f41.google.com ([74.125.83.41]:46825 "EHLO mail-ee0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752791AbaBQNXO (ORCPT ); Mon, 17 Feb 2014 08:23:14 -0500 Received: by mail-ee0-f41.google.com with SMTP id e51so6541849eek.0 for ; Mon, 17 Feb 2014 05:23:13 -0800 (PST) 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=xDVV/t39zklW3HJgFWxvJ835pPoVydLbrPQDRZSwSSM=; b=DFMtd9FswV0rUL4K2CNriek33AYPRLqRkBuCb96FwyMP1NLAwka3WxIskwLn9VlOf8 fV9SDuWrV31VctG0NmlTj2CtmpvNP43C+1m4gRXlKXp/YVw+OyzJO+aCcO1ATBNGP4ck F9pTENg+ion+vpH36aepZBfH6IbF88Hu1Q0NFOJYvdHqQ2sq3WGrt/l8d7ej0/cJ180S svi241FUW0XHDRwbGoG3+srZbDrbEMDyfGo/YGNv8504t3re0y2JpyHqXSG7WlQIiOXi RxH47MgVpeXmFCRORKep7AsOdfSVs958spIkTP9QmASIJVOgplxJXOiFvD4sX5tY0Nys 9Zlw== X-Received: by 10.15.65.68 with SMTP id p44mr2210085eex.63.1392643393155; Mon, 17 Feb 2014 05:23:13 -0800 (PST) Received: from c2c-vostro1.felk.cvut.cz ([147.32.86.166]) by mx.google.com with ESMTPSA id f45sm57328922eeg.5.2014.02.17.05.23.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Feb 2014 05:23:12 -0800 (PST) From: Rostislav Lisovy To: Johannes Berg , "John W. Linville" , linux-wireless@vger.kernel.org, ath9k-devel@lists.ath9k.org Cc: Michal Sojka , s.sander@nordsys.de, jan-niklas.meier@volkswagen.de, Rostislav Lisovy Subject: [RFC 2/4] ath9k: Allow 5/10 MHz channel setting (for OCB) Date: Mon, 17 Feb 2014 14:22:52 +0100 Message-Id: <1392643374-3545-3-git-send-email-lisovy@gmail.com> X-Mailer: git-send-email 1.8.5.1 In-Reply-To: <1392643374-3545-1-git-send-email-lisovy@gmail.com> References: <1392643374-3545-1-git-send-email-lisovy@gmail.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=-7.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 Signed-off-by: Rostislav Lisovy --- drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 5 +++++ drivers/net/wireless/ath/ath9k/hw.h | 3 ++- drivers/net/wireless/ath/ath9k/init.c | 20 ++++++++++++++++++++ drivers/net/wireless/ath/ath9k/recv.c | 6 ++++++ drivers/net/wireless/ath/ath9k/xmit.c | 6 ++++++ drivers/net/wireless/ath/regd.c | 9 ++++++--- drivers/net/wireless/rtlwifi/regd.c | 9 ++++++--- 7 files changed, 51 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c index c028df7..348864e 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c @@ -1095,6 +1095,11 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, rx_status->signal = rxbuf->rxstatus.rs_rssi + ATH_DEFAULT_NOISE_FLOOR; rx_status->antenna = rxbuf->rxstatus.rs_antenna; rx_status->flag |= RX_FLAG_MACTIME_END; + if (IS_CHAN_HALF_RATE(priv->ah->curchan)) + rx_status->flag |= RX_FLAG_10MHZ; + else if (IS_CHAN_QUARTER_RATE(priv->ah->curchan)) + rx_status->flag |= RX_FLAG_5MHZ; + return true; diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index a2c9a5d..88e44c7 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h @@ -69,7 +69,7 @@ #define ATH9K_RSSI_BAD -128 -#define ATH9K_NUM_CHANNELS 38 +#define ATH9K_NUM_CHANNELS 54 /* Register read/write primitives */ #define REG_WRITE(_ah, _reg, _val) \ @@ -422,6 +422,7 @@ struct ath9k_channel { #define IS_CHAN_HALF_RATE(_c) (!!((_c)->channelFlags & CHANNEL_HALF)) #define IS_CHAN_QUARTER_RATE(_c) (!!((_c)->channelFlags & CHANNEL_QUARTER)) + #define IS_CHAN_A_FAST_CLOCK(_ah, _c) \ (IS_CHAN_5GHZ(_c) && ((_ah)->caps.hw_caps & ATH9K_HW_CAP_FASTCLOCK)) diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index 710192e..7bad46f 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c @@ -128,6 +128,26 @@ static const struct ieee80211_channel ath9k_5ghz_chantable[] = { CHAN5G(5785, 35), /* Channel 157 */ CHAN5G(5805, 36), /* Channel 161 */ CHAN5G(5825, 37), /* Channel 165 */ + + CHAN5G(5850, 38), /* Channel 170 */ + /* ITA-G5B */ + CHAN5G(5855, 39), /* Channel 171 */ + CHAN5G(5860, 40), /* Channel 172 */ + CHAN5G(5865, 41), /* Channel 173 */ + CHAN5G(5870, 42), /* Channel 174 */ + /* ITS-G5A */ + CHAN5G(5875, 43), /* Channel 175 */ + CHAN5G(5880, 44), /* Channel 176 */ + CHAN5G(5885, 45), /* Channel 177 */ + CHAN5G(5890, 46), /* Channel 178 */ + CHAN5G(5895, 47), /* Channel 179 */ + CHAN5G(5900, 48), /* Channel 180 */ + CHAN5G(5905, 49), /* Channel 181 */ + /* ITS-G5D */ + CHAN5G(5910, 50), /* Channel 182 */ + CHAN5G(5915, 51), /* Channel 183 */ + CHAN5G(5920, 52), /* Channel 184 */ + CHAN5G(5925, 53), /* Channel 185 */ }; /* Atheros hardware rate code addition for short premble */ diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index 95ddca5..ea8d15d 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c @@ -1435,6 +1435,12 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) retval = ath9k_rx_skb_preprocess(sc, hdr_skb, &rs, rxs, &decrypt_error, tsf); + + if (IS_CHAN_HALF_RATE(ah->curchan)) + rxs->flag |= RX_FLAG_10MHZ; + else if (IS_CHAN_QUARTER_RATE(ah->curchan)) + rxs->flag |= RX_FLAG_5MHZ; + if (retval) goto requeue_drop_frag; diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index b5a19e0..7770f4a 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c @@ -2335,6 +2335,12 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, /* Frame was ACKed */ tx_info->flags |= IEEE80211_TX_STAT_ACK; + if (IS_CHAN_HALF_RATE(sc->sc_ah->curchan)) + tx_info->flags |= IEEE80211_TX_CTL_10MHZ; + else if (IS_CHAN_QUARTER_RATE(sc->sc_ah->curchan)) + tx_info->flags |= IEEE80211_TX_CTL_5MHZ; + + padpos = ieee80211_hdrlen(hdr->frame_control); padsize = padpos & 3; if (padsize && skb->len>padpos+padsize) { diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c index 1217c52..9a7b934 100644 --- a/drivers/net/wireless/ath/regd.c +++ b/drivers/net/wireless/ath/regd.c @@ -195,6 +195,7 @@ ath_reg_apply_beaconing_flags(struct wiphy *wiphy, const struct ieee80211_reg_rule *reg_rule; struct ieee80211_channel *ch; unsigned int i; + u32 bandwidth = 0; for (band = 0; band < IEEE80211_NUM_BANDS; band++) { @@ -212,7 +213,8 @@ ath_reg_apply_beaconing_flags(struct wiphy *wiphy, continue; if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE) { - reg_rule = freq_reg_info(wiphy, ch->center_freq); + reg_rule = freq_reg_info(wiphy, ch->center_freq, + bandwidth); if (IS_ERR(reg_rule)) continue; /* @@ -249,6 +251,7 @@ ath_reg_apply_active_scan_flags(struct wiphy *wiphy, struct ieee80211_supported_band *sband; struct ieee80211_channel *ch; const struct ieee80211_reg_rule *reg_rule; + u32 bandwidth = 0; sband = wiphy->bands[IEEE80211_BAND_2GHZ]; if (!sband) @@ -276,7 +279,7 @@ ath_reg_apply_active_scan_flags(struct wiphy *wiphy, */ ch = &sband->channels[11]; /* CH 12 */ - reg_rule = freq_reg_info(wiphy, ch->center_freq); + reg_rule = freq_reg_info(wiphy, ch->center_freq, bandwidth); if (!IS_ERR(reg_rule)) { if (!(reg_rule->flags & NL80211_RRF_PASSIVE_SCAN)) if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN) @@ -284,7 +287,7 @@ ath_reg_apply_active_scan_flags(struct wiphy *wiphy, } ch = &sband->channels[12]; /* CH 13 */ - reg_rule = freq_reg_info(wiphy, ch->center_freq); + reg_rule = freq_reg_info(wiphy, ch->center_freq, bandwidth); if (!IS_ERR(reg_rule)) { if (!(reg_rule->flags & NL80211_RRF_PASSIVE_SCAN)) if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN) diff --git a/drivers/net/wireless/rtlwifi/regd.c b/drivers/net/wireless/rtlwifi/regd.c index d7d0d49..89836b0 100644 --- a/drivers/net/wireless/rtlwifi/regd.c +++ b/drivers/net/wireless/rtlwifi/regd.c @@ -158,6 +158,7 @@ static void _rtl_reg_apply_beaconing_flags(struct wiphy *wiphy, const struct ieee80211_reg_rule *reg_rule; struct ieee80211_channel *ch; unsigned int i; + u32 bandwidth = 0; for (band = 0; band < IEEE80211_NUM_BANDS; band++) { @@ -172,7 +173,8 @@ static void _rtl_reg_apply_beaconing_flags(struct wiphy *wiphy, (ch->flags & IEEE80211_CHAN_RADAR)) continue; if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE) { - reg_rule = freq_reg_info(wiphy, ch->center_freq); + reg_rule = freq_reg_info(wiphy, ch->center_freq, + bandwidth); if (IS_ERR(reg_rule)) continue; @@ -208,6 +210,7 @@ static void _rtl_reg_apply_active_scan_flags(struct wiphy *wiphy, struct ieee80211_supported_band *sband; struct ieee80211_channel *ch; const struct ieee80211_reg_rule *reg_rule; + u32 bandwidth = 0; if (!wiphy->bands[IEEE80211_BAND_2GHZ]) return; @@ -235,7 +238,7 @@ static void _rtl_reg_apply_active_scan_flags(struct wiphy *wiphy, */ ch = &sband->channels[11]; /* CH 12 */ - reg_rule = freq_reg_info(wiphy, ch->center_freq); + reg_rule = freq_reg_info(wiphy, ch->center_freq, bandwidth); if (!IS_ERR(reg_rule)) { if (!(reg_rule->flags & NL80211_RRF_PASSIVE_SCAN)) if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN) @@ -243,7 +246,7 @@ static void _rtl_reg_apply_active_scan_flags(struct wiphy *wiphy, } ch = &sband->channels[12]; /* CH 13 */ - reg_rule = freq_reg_info(wiphy, ch->center_freq); + reg_rule = freq_reg_info(wiphy, ch->center_freq, bandwidth); if (!IS_ERR(reg_rule)) { if (!(reg_rule->flags & NL80211_RRF_PASSIVE_SCAN)) if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN)