ath10k: wmi_mgmt_rx setup band
PATCH 1/2 ath10k: wmi_mgmt_rx setup band
Setup band using wmi_event and phy_mode
reported by FW/HW.
--- drivers/net/wireless/ath/ath10k/wmi.c | 38 +++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath10k/wmi.c +32 -6
@@ -240,6 +240,35 @@ static int wmi_event_scan(struct ath10k *ar, struct sk_buff *skb)return 0 ; } + +static inline enum ieee80211_band phy_mode_to_band (u32 phy_mode) +{ +enum ieee80211_band band; + +switch (phy_mode) { +case MODE_11A : +case MODE_11NA_HT20 : +case MODE_11NA_HT40 : +case MODE_11AC_VHT20 : +case MODE_11AC_VHT40 : +case MODE_11AC_VHT80 : + band =IEEE80211_BAND_5GHZ ; +break ; +case MODE_11G : +case MODE_11B : +case MODE_11GONLY : +case MODE_11NG_HT20 : +case MODE_11NG_HT40 : +case MODE_11AC_VHT20_2G : +case MODE_11AC_VHT40_2G : +case MODE_11AC_VHT80_2G : +default : + band =IEEE80211_BAND_2GHZ ; + } + +return band; +} +static int wmi_event_mgmt_rx (struct ath10k *ar,struct sk_buff *skb) {struct wmi_mgmt_rx_event *event = (void *)skb->data;
@@ -247,6 +276,7 @@ static int wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)struct ieee80211_hdr *hdr;u32 rx_status;u32 channel; +u32 phy_mode;u32 snr;u32 buf_len;u16 fc;
@@ -255,6 +285,7 @@ static int wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb) buf_len =__le32_to_cpu (event->hdr.buf_len); rx_status =__le32_to_cpu (event->hdr.status); snr =__le32_to_cpu (event->hdr.snr); + phy_mode =__le32_to_cpu (event->hdr.phy_mode);memset (status,0 ,sizeof (*status));
@@ -275,12 +306,7 @@ static int wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)if (rx_status &WMI_RX_STATUS_ERR_MIC ) status->flag |=RX_FLAG_MMIC_ERROR ; -/* FIXME: We probably should use event->phy_mode for that */ -if (channel >14 ) - status->band =IEEE80211_BAND_5GHZ ; -else - status->band =IEEE80211_BAND_2GHZ ; - + status->band =phy_mode_to_band (phy_mode); status->freq =ieee80211_channel_to_frequency (channel, status->band); status->signal = snr +ATH10K_DEFAULT_NOISE_FLOOR ;
Signature · 1 line
1.7.9.5
PATCH 2/2 ath10k: wmi_mgmt_rx setup rate info
Setup rate info when receive mgmt frame
via WMI layer.
--- drivers/net/wireless/ath/ath10k/wmi.c | 64 +++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath10k/wmi.c +62 -2
@@ -269,6 +269,63 @@ static inline enum ieee80211_band phy_mode_to_band(u32 phy_mode)return band; } +static inline u8 get_rate_idx (u32 rate,enum ieee80211_band band) +{ +u8 rate_idx =0 ; + +/* rate in Kbps */ +switch (rate) { +case 1000 : + rate_idx =0 ; +break ; +case 2000 : + rate_idx =1 ; +break ; +case 5500 : + rate_idx =2 ; +break ; +case 11000 : + rate_idx =3 ; +break ; +case 6000 : + rate_idx =4 ; +break ; +case 9000 : + rate_idx =5 ; +break ; +case 12000 : + rate_idx =6 ; +break ; +case 18000 : + rate_idx =7 ; +break ; +case 24000 : + rate_idx =8 ; +break ; +case 36000 : + rate_idx =9 ; +break ; +case 48000 : + rate_idx =10 ; +break ; +case 54000 : + rate_idx =11 ; +break ; +default : +break ; + } + +if (band ==IEEE80211_BAND_5GHZ ) { +if (rate_idx >3 ) +/* Omit CCK rates */ + rate_idx -=4 ; +else + rate_idx =0 ; + } + +return rate_idx; +} +static int wmi_event_mgmt_rx (struct ath10k *ar,struct sk_buff *skb) {struct wmi_mgmt_rx_event *event = (void *)skb->data;
@@ -278,6 +335,7 @@ static int wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)u32 channel;u32 phy_mode;u32 snr; +u32 rate;u32 buf_len;u16 fc;
@@ -286,6 +344,7 @@ static int wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb) rx_status =__le32_to_cpu (event->hdr.status); snr =__le32_to_cpu (event->hdr.snr); phy_mode =__le32_to_cpu (event->hdr.phy_mode); + rate =__le32_to_cpu (event->hdr.rate);memset (status,0 ,sizeof (*status));
@@ -309,6 +368,7 @@ static int wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb) status->band =phy_mode_to_band (phy_mode); status->freq =ieee80211_channel_to_frequency (channel, status->band); status->signal = snr +ATH10K_DEFAULT_NOISE_FLOOR ; + status->rate_idx =get_rate_idx (rate, status->band);skb_pull (skb,sizeof (event->hdr));
@@ -321,8 +381,8 @@ static int wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb) fc & IEEE80211_FCTL_FTYPE, fc & IEEE80211_FCTL_STYPE);ath10k_dbg (ATH10K_DBG_WMI , -"event mgmt rx freq %d band %d snr %d\n" , - status->freq, status->band, status->signal); +"event mgmt rx freq %d band %d snr %d, rate_idx %d\n" , + status->freq, status->band, status->signal, status->rate_idx);/* * packets from HTC come aligned to 4byte boundaries
Signature · 1 line
1.7.9.5
PATCH 1/2 ath10k: wmi_mgmt_rx setup band
In reply to Janusz DziedzicQuoted 4 lines · Janusz Dziedzic
Setup band using
wmi_eventandphy_mode
reported by FW/HW.Signed-off-by Janusz Dziedzic <[email protected]>
Both applied, thanks.
But the commit logs don't still answer the question "why?". Especially the change from user space point of view is important (if there are any).
drivers/net/wireless/ath/ath10k/wmi.c static int wmi_event_scan(struct ath10k *ar, struct sk_buff *skb) · line 244
Quoted 8 lines
drivers/net/wireless/ath/ath10k/wmi.c +2
-0@@ -240,6 +240,35 @@ static int wmi_event_scan(struct ath10k *ar, struct sk_buff *skb)return 0 ; } + +static inline enum ieee80211_band phy_mode_to_band (u32 phy_mode)
I also removed the extra new line.
Signature · 1 line
Kalle Valo
PATCH 1/2 ath10k: wmi_mgmt_rx setup band
Quoted 8 lines · Kalle Valo
Quoted 4 lines · Janusz Dziedzic
Setup band using
wmi_eventandphy_mode
reported by FW/HW.Signed-off-by Janusz Dziedzic <[email protected]>Both applied, thanks.
Forgot to mention that there were conflicts with both patches. Please check that I didn't do anything stupid when fixing the conflicts.
Signature · 1 line
Kalle Valo
PATCH 1/2 ath10k: wmi_mgmt_rx setup band
Quoted 11 lines
-----Original Message-----
From: Kalle Valo [mailto:kvalo at qca.qualcomm.com]
Sent: 17 kwietnia 2013 08:33
To: Dziedzic Janusz
Cc: ath9k-devel at lists.ath9k.org
Subject: Re: [ath9k-devel] [PATCH 1/2] ath10k:wmi_mgmt_rxsetup bandQuoted 2 lines · Kalle Valo
Janusz Dziedzic <[email protected]> writes:
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
Setup band using
wmi_eventandphy_modereported by FW/HW.Signed-off-by Janusz Dziedzic <[email protected]>Both applied, thanks.
Forgot to mention that there were conflicts with both patches. Please check that I didn't do anything stupid when fixing the conflicts.
Thanks.
Everything is fine.
BR
Janusz