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