All of lore.kernel.org
 help / color / mirror / Atom feed
* [ath9k-devel] [PATCH 1/2] ath10k: wmi_mgmt_rx setup band
@ 2013-04-16  9:54 Janusz Dziedzic
  2013-04-16  9:54 ` [ath9k-devel] [PATCH 2/2] ath10k: wmi_mgmt_rx setup rate info Janusz Dziedzic
  2013-04-17  6:30 ` [ath9k-devel] [PATCH 1/2] ath10k: wmi_mgmt_rx setup band Kalle Valo
  0 siblings, 2 replies; 5+ messages in thread
From: Janusz Dziedzic @ 2013-04-16  9:54 UTC (permalink / raw)
  To: ath9k-devel

Setup band using wmi_event and phy_mode
reported by FW/HW.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 drivers/net/wireless/ath/ath10k/wmi.c |   38 +++++++++++++++++++++++++++------
 1 file changed, 32 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 1cb55bb..4d2257a 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -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;
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [ath9k-devel] [PATCH 2/2] ath10k: wmi_mgmt_rx setup rate info
  2013-04-16  9:54 [ath9k-devel] [PATCH 1/2] ath10k: wmi_mgmt_rx setup band Janusz Dziedzic
@ 2013-04-16  9:54 ` Janusz Dziedzic
  2013-04-17  6:30 ` [ath9k-devel] [PATCH 1/2] ath10k: wmi_mgmt_rx setup band Kalle Valo
  1 sibling, 0 replies; 5+ messages in thread
From: Janusz Dziedzic @ 2013-04-16  9:54 UTC (permalink / raw)
  To: ath9k-devel

Setup rate info when receive mgmt frame
via WMI layer.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 drivers/net/wireless/ath/ath10k/wmi.c |   64 +++++++++++++++++++++++++++++++--
 1 file changed, 62 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 4d2257a..82debae 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -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
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [ath9k-devel] [PATCH 1/2] ath10k: wmi_mgmt_rx setup band
  2013-04-16  9:54 [ath9k-devel] [PATCH 1/2] ath10k: wmi_mgmt_rx setup band Janusz Dziedzic
  2013-04-16  9:54 ` [ath9k-devel] [PATCH 2/2] ath10k: wmi_mgmt_rx setup rate info Janusz Dziedzic
@ 2013-04-17  6:30 ` Kalle Valo
  2013-04-17  6:32   ` Kalle Valo
  1 sibling, 1 reply; 5+ messages in thread
From: Kalle Valo @ 2013-04-17  6:30 UTC (permalink / raw)
  To: ath9k-devel

Janusz Dziedzic <janusz.dziedzic@tieto.com> writes:

> Setup band using wmi_event and phy_mode
> reported by FW/HW.
>
> Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>

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).

> --- a/drivers/net/wireless/ath/ath10k/wmi.c
> +++ b/drivers/net/wireless/ath/ath10k/wmi.c
> @@ -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.

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ath9k-devel] [PATCH 1/2] ath10k: wmi_mgmt_rx setup band
  2013-04-17  6:30 ` [ath9k-devel] [PATCH 1/2] ath10k: wmi_mgmt_rx setup band Kalle Valo
@ 2013-04-17  6:32   ` Kalle Valo
  2013-04-17  7:05     ` Janusz.Dziedzic at tieto.com
  0 siblings, 1 reply; 5+ messages in thread
From: Kalle Valo @ 2013-04-17  6:32 UTC (permalink / raw)
  To: ath9k-devel

Kalle Valo <kvalo@qca.qualcomm.com> writes:

> Janusz Dziedzic <janusz.dziedzic@tieto.com> writes:
>
>> Setup band using wmi_event and phy_mode
>> reported by FW/HW.
>>
>> Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
>
> 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.

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ath9k-devel] [PATCH 1/2] ath10k: wmi_mgmt_rx setup band
  2013-04-17  6:32   ` Kalle Valo
@ 2013-04-17  7:05     ` Janusz.Dziedzic at tieto.com
  0 siblings, 0 replies; 5+ messages in thread
From: Janusz.Dziedzic at tieto.com @ 2013-04-17  7:05 UTC (permalink / raw)
  To: ath9k-devel

>-----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_rx setup band
>
>Kalle Valo <kvalo@qca.qualcomm.com> writes:
>
>> Janusz Dziedzic <janusz.dziedzic@tieto.com> writes:
>>
>>> Setup band using wmi_event and phy_mode reported by FW/HW.
>>>
>>> Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
>>
>> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-04-17  7:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-16  9:54 [ath9k-devel] [PATCH 1/2] ath10k: wmi_mgmt_rx setup band Janusz Dziedzic
2013-04-16  9:54 ` [ath9k-devel] [PATCH 2/2] ath10k: wmi_mgmt_rx setup rate info Janusz Dziedzic
2013-04-17  6:30 ` [ath9k-devel] [PATCH 1/2] ath10k: wmi_mgmt_rx setup band Kalle Valo
2013-04-17  6:32   ` Kalle Valo
2013-04-17  7:05     ` Janusz.Dziedzic at tieto.com

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.