ath10k: enable VHT160 and VHT80+80 modes
PATCH v2 1/2 ath10k: enable VHT160 and VHT80+80 modes
From: Lei Wang <[email protected]>
Set right channel frequencies in VHT160 mode according to the VHT160 interoperability workaround added as part of IEEE Std 802.11™-2016 in "Table 9-252—VHT Operation Information subfields", band_center_freq2 corresponds to CCFS1 in Table 9-253. Previous implementation (band_center_freq2 = 0 for VHT160) is only deprecated.
Enable VHT80+80 mode and set the proper peer RX nss value for VHT160 and VHT80+80 mode.
Based on patches by Sebastian Gottschall:
https://lkml.kernel.org/r/[email protected]
https://lkml.kernel.org/r/[email protected]
Tested: qca9984 with firmware ver 10.4-3.10-00047
--- drivers/net/wireless/ath/ath10k/mac.c | 84 +++++++++++++++++++++++++---------- drivers/net/wireless/ath/ath10k/wmi.c | 23 ++++++---- drivers/net/wireless/ath/ath10k/wmi.h | 5 ++- 3 files changed, 80 insertions(+), 32 deletions(-)
drivers/net/wireless/ath/ath10k/mac.c +61 -23
@@ -2505,6 +2505,30 @@ ath10k_peer_assoc_h_vht_limit(u16 tx_mcs_set,return tx_mcs_set; } +static u32 get_160mhz_nss_from_maxrate (int rate) +{ +u32 nss; + +switch (rate) { +case 780 : + nss =1 ; +break ; +case 1560 : + nss =2 ; +break ; +case 2106 : + nss =3 ;/* not support MCS9 from spec*/ +break ; +case 3120 : + nss =4 ; +break ; +default : + nss =1 ; + } + +return nss; +} + static void ath10k_peer_assoc_h_vht(struct ath10k *ar, struct ieee80211_vif *vif, struct ieee80211_sta *sta,
@@ -2512,6 +2536,7 @@ static void ath10k_peer_assoc_h_vht(struct ath10k *ar, {const struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap;struct ath10k_vif *arvif = (void *)vif->drv_priv; +struct ath10k_hw_params *hw = &ar->hw_params;struct cfg80211_chan_def def;enum nl80211_band band;const u16 *vht_mcs_mask;
@@ -2578,22 +2603,38 @@ static void ath10k_peer_assoc_h_vht(struct ath10k *ar, arg->peer_vht_rates.tx_mcs_set =ath10k_peer_assoc_h_vht_limit (__le16_to_cpu (vht_cap->vht_mcs.tx_mcs_map), vht_mcs_mask); -ath10k_dbg (ar,ATH10K_DBG_MAC ,"mac vht peer %pM max_mpdu %d flags 0x%x\n" , - sta->addr, arg->peer_max_mpdu, arg->peer_flags); +/* Configure bandwidth-NSS mapping to FW +* for the chip's tx chains setting on 160Mhz bw +*/ +if (arg->peer_phymode ==MODE_11AC_VHT160 || + arg->peer_phymode ==MODE_11AC_VHT80_80 ) { +u32 rx_nss; +u32 max_rate; -if (arg->peer_vht_rates.rx_max_rate && - (sta->vht_cap.cap &IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK )) { -switch (arg->peer_vht_rates.rx_max_rate) { -case 1560 : -/* Must be 2x2 at 160Mhz is all it can do. */ - arg->peer_bw_rxnss_override =2 ; -break ; -case 780 : -/* Can only do 1x1 at 160Mhz (Long Guard Interval) */ - arg->peer_bw_rxnss_override =1 ; -break ; + max_rate = arg->peer_vht_rates.rx_max_rate; + rx_nss =get_160mhz_nss_from_maxrate (max_rate); + +if (rx_nss ==0 ) + rx_nss = arg->peer_num_spatial_streams; +else + rx_nss =min (arg->peer_num_spatial_streams, rx_nss); + + max_rate = hw->vht160_mcs_tx_highest; + rx_nss =min (rx_nss,get_160mhz_nss_from_maxrate (max_rate)); + + arg->peer_bw_rxnss_override = +FIELD_PREP (WMI_PEER_NSS_MAP_ENABLE ,1 ) | +FIELD_PREP (WMI_PEER_NSS_160MHZ_MASK , (rx_nss -1 )); + +if (arg->peer_phymode ==MODE_11AC_VHT80_80 ) { + arg->peer_bw_rxnss_override |= +FIELD_PREP (WMI_PEER_NSS_80_80MHZ_MASK , (rx_nss -1 )); } } +ath10k_dbg (ar,ATH10K_DBG_MAC , +"mac vht peer %pM max_mpdu %d flags 0x%x peer_rx_nss_override 0x%x\n" , + sta->addr, arg->peer_max_mpdu, + arg->peer_flags, arg->peer_bw_rxnss_override); } static void ath10k_peer_assoc_h_qos(struct ath10k *ar,
@@ -2745,9 +2786,9 @@ static int ath10k_peer_assoc_prepare(struct ath10k *ar,ath10k_peer_assoc_h_crypto (ar, vif, sta, arg);ath10k_peer_assoc_h_rates (ar, vif, sta, arg);ath10k_peer_assoc_h_ht (ar, vif, sta, arg); +ath10k_peer_assoc_h_phymode (ar, vif, sta, arg);ath10k_peer_assoc_h_vht (ar, vif, sta, arg);ath10k_peer_assoc_h_qos (ar, vif, sta, arg); -ath10k_peer_assoc_h_phymode (ar, vif, sta, arg);return 0 ; }
@@ -4563,13 +4604,6 @@ static struct ieee80211_sta_vht_cap ath10k_create_vht_cap(struct ath10k *ar) vht_cap.cap |= val; } -/* Currently the firmware seems to be buggy, don't enable 80+80 -* mode until that's resolved. -*/ -if ((ar->vht_cap_info &IEEE80211_VHT_CAP_SHORT_GI_160 ) && - (ar->vht_cap_info &IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK ) ==0 ) - vht_cap.cap |=IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ ; - mcs_map =0 ;for (i =0 ; i <8 ; i++) {if ((i < ar->num_rf_chains) && (ar->cfg_tx_chainmask &BIT (i)))
@@ -8625,7 +8659,9 @@ static const struct ieee80211_iface_combination ath10k_10_4_if_comb[] = { .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |BIT (NL80211_CHAN_WIDTH_20 ) |BIT (NL80211_CHAN_WIDTH_40 ) | - BIT(NL80211_CHAN_WIDTH_80), +BIT (NL80211_CHAN_WIDTH_80 ) | +BIT (NL80211_CHAN_WIDTH_80P80 ) | + BIT(NL80211_CHAN_WIDTH_160), #endif }, };
@@ -8643,7 +8679,9 @@ ieee80211_iface_combination ath10k_10_4_bcn_int_if_comb[] = { .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |BIT (NL80211_CHAN_WIDTH_20 ) |BIT (NL80211_CHAN_WIDTH_40 ) | - BIT(NL80211_CHAN_WIDTH_80), +BIT (NL80211_CHAN_WIDTH_80 ) | +BIT (NL80211_CHAN_WIDTH_80P80 ) | + BIT(NL80211_CHAN_WIDTH_160), #endif }, };
drivers/net/wireless/ath/ath10k/wmi.c +15 -8
@@ -1714,12 +1714,23 @@ void ath10k_wmi_put_wmi_channel(struct wmi_channel *ch,if (arg->chan_radar) flags |=WMI_CHAN_FLAG_DFS ; + ch->band_center_freq2 =0 ; ch->mhz =__cpu_to_le32 (arg->freq); ch->band_center_freq1 =__cpu_to_le32 (arg->band_center_freq1);if (arg->mode ==MODE_11AC_VHT80_80 ) ch->band_center_freq2 =__cpu_to_le32 (arg->band_center_freq2); -else - ch->band_center_freq2 =0 ; + +if (arg->mode ==MODE_11AC_VHT160 ) { +if (arg->freq > arg->band_center_freq1) + ch->band_center_freq1 = +__cpu_to_le32 (arg->band_center_freq1 +40 ); +else + ch->band_center_freq1 = +__cpu_to_le32 (arg->band_center_freq1 -40 ); + + ch->band_center_freq2 =__cpu_to_le32 (arg->band_center_freq1); + } + ch->min_power = arg->min_power; ch->max_power = arg->max_power; ch->reg_power = arg->max_reg_power;
@@ -7628,12 +7639,8 @@ ath10k_wmi_peer_assoc_fill_10_4(struct ath10k *ar, void *buf,struct wmi_10_4_peer_assoc_complete_cmd *cmd = buf;ath10k_wmi_peer_assoc_fill_10_2 (ar, buf, arg); -if (arg->peer_bw_rxnss_override) - cmd->peer_bw_rxnss_override = -__cpu_to_le32 ((arg->peer_bw_rxnss_override -1 ) | -BIT (PEER_BW_RXNSS_OVERRIDE_OFFSET )); -else - cmd->peer_bw_rxnss_override =0 ; + cmd->peer_bw_rxnss_override = +__cpu_to_le32 (arg->peer_bw_rxnss_override); } static int
drivers/net/wireless/ath/ath10k/wmi.h +4 -1
@@ -6508,7 +6508,10 @@ struct wmi_10_2_peer_assoc_complete_cmd {__le32 info0;/* WMI_PEER_ASSOC_INFO0_ */ } __packed; -#define PEER_BW_RXNSS_OVERRIDE_OFFSET 31 +/* NSS Mapping to FW */ +#define WMI_PEER_NSS_MAP_ENABLE BIT(31) +#define WMI_PEER_NSS_160MHZ_MASK GENMASK(2, 0) +#define WMI_PEER_NSS_80_80MHZ_MASK GENMASK(5, 3)struct wmi_10_4_peer_assoc_complete_cmd {struct wmi_10_2_peer_assoc_complete_cmd cmd;
Signature · 6 lines
2.7.4 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
PATCH v2 2/2 ath10k: enable radar detection in secondary segment
From: Lei Wang <[email protected]>
Enable radar detection in secondary segment for VHT160 and VHT80+80 mode on DFS channels. Otherwise, when injecting radar pulse in the secondary segment, the DUT can't detect radar pulse.
Tested: qca9984 with firmware ver 10.4-3.10-00047
--- drivers/net/wireless/ath/ath10k/wmi-tlv.c | 6 ++--- drivers/net/wireless/ath/ath10k/wmi.c | 39 ++++++++++++++++++++++--------- drivers/net/wireless/ath/ath10k/wmi.h | 5 ++-- 3 files changed, 34 insertions(+), 16 deletions(-)
drivers/net/wireless/ath/ath10k/wmi-tlv.c +3 -3
@@ -2123,7 +2123,7 @@ ath10k_wmi_tlv_op_gen_vdev_start(struct ath10k *ar, tlv->tag =__cpu_to_le16 (WMI_TLV_TAG_STRUCT_CHANNEL ); tlv->len =__cpu_to_le16 (sizeof (*ch)); ch = (void *)tlv->value; -ath10k_wmi_put_wmi_channel (ch, &arg->channel); +ath10k_wmi_put_wmi_channel (ar, ch, &arg->channel); ptr +=sizeof (*tlv); ptr +=sizeof (*ch);
@@ -2763,7 +2763,7 @@ ath10k_wmi_tlv_op_gen_scan_chan_list(struct ath10k *ar, tlv->len =__cpu_to_le16 (sizeof (*ci)); ci = (void *)tlv->value; -ath10k_wmi_put_wmi_channel (ci, ch); +ath10k_wmi_put_wmi_channel (ar, ci, ch); chans +=sizeof (*tlv); chans +=sizeof (*ci);
@@ -3450,7 +3450,7 @@ ath10k_wmi_tlv_op_gen_tdls_peer_update(struct ath10k *ar, tlv->tag =__cpu_to_le16 (WMI_TLV_TAG_STRUCT_CHANNEL ); tlv->len =__cpu_to_le16 (sizeof (*chan)); chan = (void *)tlv->value; -ath10k_wmi_put_wmi_channel (chan, &chan_arg[i]); +ath10k_wmi_put_wmi_channel (ar, chan, &chan_arg[i]); ptr +=sizeof (*tlv); ptr +=sizeof (*chan);
drivers/net/wireless/ath/ath10k/wmi.c +28 -11
@@ -1694,10 +1694,11 @@ static const struct wmi_peer_flags_map wmi_10_2_peer_flags_map = { .bw160 = WMI_10_2_PEER_160MHZ, }; -void ath10k_wmi_put_wmi_channel (struct wmi_channel *ch, +void ath10k_wmi_put_wmi_channel (struct ath10k *ar,struct wmi_channel *ch,const struct wmi_channel_arg *arg) {u32 flags =0 ; +struct ieee80211_channel *chan =NULL ;memset (ch,0 ,sizeof (*ch));
@@ -1717,20 +1718,36 @@ void ath10k_wmi_put_wmi_channel(struct wmi_channel *ch, ch->band_center_freq2 =0 ; ch->mhz =__cpu_to_le32 (arg->freq); ch->band_center_freq1 =__cpu_to_le32 (arg->band_center_freq1); -if (arg->mode ==MODE_11AC_VHT80_80 ) +if (arg->mode ==MODE_11AC_VHT80_80 ) { ch->band_center_freq2 =__cpu_to_le32 (arg->band_center_freq2); + chan =ieee80211_get_channel (ar->hw->wiphy, + arg->band_center_freq2 -10 ); + }if (arg->mode ==MODE_11AC_VHT160 ) { -if (arg->freq > arg->band_center_freq1) - ch->band_center_freq1 = -__cpu_to_le32 (arg->band_center_freq1 +40 ); -else - ch->band_center_freq1 = -__cpu_to_le32 (arg->band_center_freq1 -40 ); +u32 band_center_freq1; +u32 band_center_freq2; + +if (arg->freq > arg->band_center_freq1) { + band_center_freq1 = arg->band_center_freq1 +40 ; + band_center_freq2 = arg->band_center_freq1 -40 ; + }else { + band_center_freq1 = arg->band_center_freq1 -40 ; + band_center_freq2 = arg->band_center_freq1 +40 ; + } + ch->band_center_freq1 = +__cpu_to_le32 (band_center_freq1); +/* Minus 10 to get a defined 5G channel frequency*/ + chan =ieee80211_get_channel (ar->hw->wiphy, + band_center_freq2 -10 ); +/* The center frequency of the entire VHT160 */ ch->band_center_freq2 =__cpu_to_le32 (arg->band_center_freq1); } +if (chan && chan->flags &IEEE80211_CHAN_RADAR ) + flags |=WMI_CHAN_FLAG_DFS_CFREQ2 ; + ch->min_power = arg->min_power; ch->max_power = arg->max_power; ch->reg_power = arg->max_reg_power;
@@ -7176,7 +7193,7 @@ ath10k_wmi_op_gen_vdev_start(struct ath10k *ar,memcpy (cmd->ssid.ssid, arg->ssid, arg->ssid_len); } -ath10k_wmi_put_wmi_channel (&cmd->chan, &arg->channel); +ath10k_wmi_put_wmi_channel (ar, &cmd->chan, &arg->channel); ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi vdev %s id 0x%x flags: 0x%0X, freq %d, mode %d, ch_flags: 0x%0X, max_power: %d\n",
@@ -7548,7 +7565,7 @@ ath10k_wmi_op_gen_scan_chan_list(struct ath10k *ar, ch = &arg->channels[i]; ci = &cmd->chan_info[i]; -ath10k_wmi_put_wmi_channel (ci, ch); +ath10k_wmi_put_wmi_channel (ar, ci, ch); }return skb;
@@ -8952,7 +8969,7 @@ ath10k_wmi_10_4_gen_tdls_peer_update(struct ath10k *ar,for (i =0 ; i < cap->peer_chan_len; i++) { chan = (struct wmi_channel *)&peer_cap->peer_chan_list[i]; -ath10k_wmi_put_wmi_channel (chan, &chan_arg[i]); +ath10k_wmi_put_wmi_channel (ar, chan, &chan_arg[i]); } ath10k_dbg(ar, ATH10K_DBG_WMI,
drivers/net/wireless/ath/ath10k/wmi.h +3 -2
@@ -2094,7 +2094,8 @@ enum wmi_channel_change_cause {/* Indicate reason for channel switch */ #define WMI_CHANNEL_CHANGE_CAUSE_CSA (1 << 13) - +/* DFS required on channel for 2nd segment of VHT160 and VHT80+80*/ +#define WMI_CHAN_FLAG_DFS_CFREQ2 (1 << 15)#define WMI_MAX_SPATIAL_STREAM 3/* default max ss */ /* HT Capabilities*/
@@ -7351,7 +7352,7 @@ void ath10k_wmi_put_start_scan_common(struct wmi_start_scan_common *cmn, const struct wmi_start_scan_arg *arg);void ath10k_wmi_set_wmm_param (struct wmi_wmm_params *params,const struct wmi_wmm_params_arg *arg); -void ath10k_wmi_put_wmi_channel (struct wmi_channel *ch, +void ath10k_wmi_put_wmi_channel (struct ath10k *ar,struct wmi_channel *ch,const struct wmi_channel_arg *arg);int ath10k_wmi_start_scan_verify (const struct wmi_start_scan_arg *arg);
Signature · 6 lines
2.7.4 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Quoted 17 lines · Sowmiya Sree Elavalagan
Set right channel frequencies in VHT160 mode according to the VHT160 interoperability workaround added as part of IEEE Std 802.11™-2016 in "Table 9-252—VHT Operation Information subfields",
band_center_freq2corresponds to CCFS1 in Table 9-253. Previous implementation (band_center_freq2= 0 for VHT160) is only deprecated.Enable VHT80+80 mode and set the proper peer RX nss value for VHT160 and VHT80+80 mode.
Based on patches by Sebastian Gottschall:
https://lkml.kernel.org/r/[email protected]
https://lkml.kernel.org/r/[email protected]
Tested: qca9984 with firmware ver 10.4-3.10-00047
Quoted 7 lines
Co-developed-by Sebastian Gottschall <[email protected]>Signed-off-by Sebastian Gottschall <[email protected]>Co-developed-by Rick Wu <[email protected]>Signed-off-by Rick Wu <[email protected]>Signed-off-by Lei Wang <[email protected]>Signed-off-by Sowmiya Sree Elavalagan <[email protected]>Signed-off-by Kalle Valo <[email protected]>
2 patches applied to ath-next branch of ath.git, thanks.
3db24065c2c8 ath10k: enable VHT160 and VHT80+80 modes 795def8b14ff ath10k: enable radar detection in secondary segment
Signature · 8 lines
https://patchwork.kernel.org/patch/11465505/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Quoted 17 lines · Sowmiya Sree Elavalagan
Set right channel frequencies in VHT160 mode according to the VHT160 interoperability workaround added as part of IEEE Std 802.11™-2016 in "Table 9-252—VHT Operation Information subfields",
band_center_freq2corresponds to CCFS1 in Table 9-253. Previous implementation (band_center_freq2= 0 for VHT160) is only deprecated.Enable VHT80+80 mode and set the proper peer RX nss value for VHT160 and VHT80+80 mode.
Based on patches by Sebastian Gottschall:
https://lkml.kernel.org/r/[email protected]
https://lkml.kernel.org/r/[email protected]
Tested: qca9984 with firmware ver 10.4-3.10-00047
Quoted 7 lines
Co-developed-by Sebastian Gottschall <[email protected]>Signed-off-by Sebastian Gottschall <[email protected]>Co-developed-by Rick Wu <[email protected]>Signed-off-by Rick Wu <[email protected]>Signed-off-by Lei Wang <[email protected]>Signed-off-by Sowmiya Sree Elavalagan <[email protected]>Signed-off-by Kalle Valo <[email protected]>
2 patches applied to ath-next branch of ath.git, thanks.
3db24065c2c8 ath10k: enable VHT160 and VHT80+80 modes 795def8b14ff ath10k: enable radar detection in secondary segment
Signature · 3 lines
https://patchwork.kernel.org/patch/11465505/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches