ath11k: Use freq instead of channel number in rx path
authorPradeep Kumar Chitrapu <pradeepc@codeaurora.org>
Tue, 9 Jun 2020 06:31:03 +0000 (09:31 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 11 Jun 2020 05:05:09 +0000 (08:05 +0300)
As 6GHz cahnnel numbers overlap with those of 5GHz and 2GHz bands,
it is necessary to use frequency when determining the band info
in rx path.

Signed-off-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200603001724.12161-4-pradeepc@codeaurora.org
drivers/net/wireless/ath/ath11k/dp_rx.c
drivers/net/wireless/ath/ath11k/wmi.c
drivers/net/wireless/ath/ath11k/wmi.h

index a54610d75c40a2073c6e1fa692981e35036fed59..112f130f91c2cccc29870eae88b15ed68bbf333c 100644 (file)
@@ -2162,6 +2162,7 @@ static void ath11k_dp_rx_h_ppdu(struct ath11k *ar, struct hal_rx_desc *rx_desc,
                                struct ieee80211_rx_status *rx_status)
 {
        u8 channel_num;
+       u32 center_freq;
 
        rx_status->freq = 0;
        rx_status->rate_idx = 0;
@@ -2172,8 +2173,11 @@ static void ath11k_dp_rx_h_ppdu(struct ath11k *ar, struct hal_rx_desc *rx_desc,
        rx_status->flag |= RX_FLAG_NO_SIGNAL_VAL;
 
        channel_num = ath11k_dp_rx_h_msdu_start_freq(rx_desc);
+       center_freq = ath11k_dp_rx_h_msdu_start_freq(rx_desc) >> 16;
 
-       if (channel_num >= 1 && channel_num <= 14) {
+       if (center_freq >= 5935 && center_freq <= 7105) {
+               rx_status->band = NL80211_BAND_6GHZ;
+       } else if (channel_num >= 1 && channel_num <= 14) {
                rx_status->band = NL80211_BAND_2GHZ;
        } else if (channel_num >= 36 && channel_num <= 173) {
                rx_status->band = NL80211_BAND_5GHZ;
index 291fb274134f4d91f241641afcecbe615523dbed..500108fa59d92d47912394da65531eadb7a82b19 100644 (file)
@@ -3833,6 +3833,7 @@ static int ath11k_pull_mgmt_rx_params_tlv(struct ath11k_base *ab,
        }
 
        hdr->pdev_id =  ev->pdev_id;
+       hdr->chan_freq = ev->chan_freq;
        hdr->channel =  ev->channel;
        hdr->snr =  ev->snr;
        hdr->rate =  ev->rate;
@@ -5204,7 +5205,9 @@ static void ath11k_mgmt_rx_event(struct ath11k_base *ab, struct sk_buff *skb)
        if (rx_ev.status & WMI_RX_STATUS_ERR_MIC)
                status->flag |= RX_FLAG_MMIC_ERROR;
 
-       if (rx_ev.channel >= 1 && rx_ev.channel <= 14) {
+       if (rx_ev.chan_freq >= ATH11K_MIN_6G_FREQ) {
+               status->band = NL80211_BAND_6GHZ;
+       } else if (rx_ev.channel >= 1 && rx_ev.channel <= 14) {
                status->band = NL80211_BAND_2GHZ;
        } else if (rx_ev.channel >= 36 && rx_ev.channel <= ATH11K_MAX_5G_CHAN) {
                status->band = NL80211_BAND_5GHZ;
index b9f3e559ced77333e93698e58ef3000b28af6aa0..afa3c4cf90e9fabcdc52e18769372cdbaf990b98 100644 (file)
@@ -4228,6 +4228,7 @@ struct wmi_pdev_temperature_event {
 #define WLAN_MGMT_TXRX_HOST_MAX_ANTENNA 4
 
 struct mgmt_rx_event_params {
+       u32 chan_freq;
        u32 channel;
        u32 snr;
        u8 rssi_ctl[WLAN_MGMT_TXRX_HOST_MAX_ANTENNA];
@@ -4257,6 +4258,7 @@ struct wmi_mgmt_rx_hdr {
        u32 rx_tsf_l32;
        u32 rx_tsf_u32;
        u32 pdev_id;
+       u32 chan_freq;
 } __packed;
 
 #define MAX_ANTENNA_EIGHT 8