linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Work on STBC Rx monitoring
@ 2013-05-19  7:38 Oleksij Rempel
  2013-05-19  7:38 ` [PATCH 1/3] mac80211: add STBC flag for radiotap Oleksij Rempel
                   ` (5 more replies)
  0 siblings, 6 replies; 20+ messages in thread
From: Oleksij Rempel @ 2013-05-19  7:38 UTC (permalink / raw)
  To: ath9k-devel, linux-wireless; +Cc: Oleksij Rempel

This patch set will pass RxSTBC flags from ath9k to ieee80211
and to radiotap.
This field is now a part of radiotap specification:
http://www.radiotap.org/defined-fields/MCS

Oleksij Rempel (3):
  mac80211: add STBC flag for radiotap
  ath9k: remove useless flag conversation.
  ath9k: check for Rx-STBC flag and pass it to ieee80211

 drivers/net/wireless/ath/ath9k/ar9003_mac.c |  5 +++--
 drivers/net/wireless/ath/ath9k/mac.c        | 16 ++++++++++++----
 drivers/net/wireless/ath/ath9k/mac.h        |  4 +++-
 drivers/net/wireless/ath/ath9k/recv.c       |  5 +----
 include/net/ieee80211_radiotap.h            |  7 +++++++
 include/net/mac80211.h                      |  4 ++++
 net/mac80211/main.c                         |  3 ++-
 net/mac80211/rx.c                           |  4 ++++
 net/mac80211/status.c                       |  3 ++-
 9 files changed, 38 insertions(+), 13 deletions(-)

-- 
1.8.1.2


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

* [PATCH 1/3] mac80211: add STBC flag for radiotap
  2013-05-19  7:38 [PATCH 0/3] Work on STBC Rx monitoring Oleksij Rempel
@ 2013-05-19  7:38 ` Oleksij Rempel
  2013-05-22 19:24   ` Johannes Berg
  2013-05-19  7:38 ` [PATCH 2/3] ath9k: remove useless flag conversation Oleksij Rempel
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 20+ messages in thread
From: Oleksij Rempel @ 2013-05-19  7:38 UTC (permalink / raw)
  To: ath9k-devel, linux-wireless; +Cc: Oleksij Rempel

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
 include/net/ieee80211_radiotap.h | 7 +++++++
 include/net/mac80211.h           | 4 ++++
 net/mac80211/main.c              | 3 ++-
 net/mac80211/rx.c                | 4 ++++
 net/mac80211/status.c            | 3 ++-
 5 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h
index c399963..c6d07cb 100644
--- a/include/net/ieee80211_radiotap.h
+++ b/include/net/ieee80211_radiotap.h
@@ -269,6 +269,7 @@ enum ieee80211_radiotap_type {
 #define IEEE80211_RADIOTAP_MCS_HAVE_GI		0x04
 #define IEEE80211_RADIOTAP_MCS_HAVE_FMT		0x08
 #define IEEE80211_RADIOTAP_MCS_HAVE_FEC		0x10
+#define IEEE80211_RADIOTAP_MCS_HAVE_STBC	0x20
 
 #define IEEE80211_RADIOTAP_MCS_BW_MASK		0x03
 #define		IEEE80211_RADIOTAP_MCS_BW_20	0
@@ -278,6 +279,12 @@ enum ieee80211_radiotap_type {
 #define IEEE80211_RADIOTAP_MCS_SGI		0x04
 #define IEEE80211_RADIOTAP_MCS_FMT_GF		0x08
 #define IEEE80211_RADIOTAP_MCS_FEC_LDPC		0x10
+#define IEEE80211_RADIOTAP_MCS_STBC_MASK	0x60
+#define		IEEE80211_RADIOTAP_MCS_STBC_1	1
+#define		IEEE80211_RADIOTAP_MCS_STBC_2	2
+#define		IEEE80211_RADIOTAP_MCS_STBC_3	3
+
+#define IEEE80211_RADIOTAP_MCS_STBC_SHIFT	5
 
 /* For IEEE80211_RADIOTAP_AMPDU_STATUS */
 #define IEEE80211_RADIOTAP_AMPDU_REPORT_ZEROLEN		0x0001
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 885898a..16705a9 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -805,6 +805,7 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
  *	on this subframe
  * @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC
  *	is stored in the @ampdu_delimiter_crc field)
+ * @RX_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3
  */
 enum mac80211_rx_flags {
 	RX_FLAG_MMIC_ERROR		= BIT(0),
@@ -832,8 +833,11 @@ enum mac80211_rx_flags {
 	RX_FLAG_80MHZ			= BIT(23),
 	RX_FLAG_80P80MHZ		= BIT(24),
 	RX_FLAG_160MHZ			= BIT(25),
+	RX_FLAG_STBC_MASK		= BIT(26) | BIT(27),
 };
 
+#define RX_FLAG_STBC_SHIFT		26
+
 /**
  * struct ieee80211_rx_status - receive status
  *
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 8a7bfc4..44191a3 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -589,7 +589,8 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
 	local->hw.conf.short_frame_max_tx_count = wiphy->retry_short;
 	local->hw.radiotap_mcs_details = IEEE80211_RADIOTAP_MCS_HAVE_MCS |
 					 IEEE80211_RADIOTAP_MCS_HAVE_GI |
-					 IEEE80211_RADIOTAP_MCS_HAVE_BW;
+					 IEEE80211_RADIOTAP_MCS_HAVE_BW |
+					 IEEE80211_RADIOTAP_MCS_HAVE_STBC;
 	local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
 					 IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH;
 	local->hw.uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES;
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 8e29526..22bb2af 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -258,6 +258,7 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
 	pos += 2;
 
 	if (status->flag & RX_FLAG_HT) {
+		unsigned int stbc = status->flag & RX_FLAG_STBC_MASK;
 		rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_MCS);
 		*pos++ = local->hw.radiotap_mcs_details;
 		*pos = 0;
@@ -267,6 +268,9 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
 			*pos |= IEEE80211_RADIOTAP_MCS_BW_40;
 		if (status->flag & RX_FLAG_HT_GF)
 			*pos |= IEEE80211_RADIOTAP_MCS_FMT_GF;
+		if (stbc)
+			*pos |= (stbc >> RX_FLAG_STBC_SHIFT)
+					<< IEEE80211_RADIOTAP_MCS_STBC_SHIFT;
 		pos++;
 		*pos++ = status->rate_idx;
 	}
diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index 4343920..41143f8 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -312,7 +312,8 @@ static void ieee80211_add_tx_radiotap_header(struct ieee80211_supported_band
 		rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_MCS);
 		pos[0] = IEEE80211_RADIOTAP_MCS_HAVE_MCS |
 			 IEEE80211_RADIOTAP_MCS_HAVE_GI |
-			 IEEE80211_RADIOTAP_MCS_HAVE_BW;
+			 IEEE80211_RADIOTAP_MCS_HAVE_BW |
+			 IEEE80211_RADIOTAP_MCS_HAVE_STBC;
 		if (info->status.rates[0].flags & IEEE80211_TX_RC_SHORT_GI)
 			pos[1] |= IEEE80211_RADIOTAP_MCS_SGI;
 		if (info->status.rates[0].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
-- 
1.8.1.2


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

* [PATCH 2/3] ath9k: remove useless flag conversation.
  2013-05-19  7:38 [PATCH 0/3] Work on STBC Rx monitoring Oleksij Rempel
  2013-05-19  7:38 ` [PATCH 1/3] mac80211: add STBC flag for radiotap Oleksij Rempel
@ 2013-05-19  7:38 ` Oleksij Rempel
  2013-05-19  7:38 ` [PATCH 3/3] ath9k: check for Rx-STBC flag and pass it to ieee80211 Oleksij Rempel
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 20+ messages in thread
From: Oleksij Rempel @ 2013-05-19  7:38 UTC (permalink / raw)
  To: ath9k-devel, linux-wireless; +Cc: Oleksij Rempel

some flags used only outside of ath9k - In this case we can use
"enum mac80211_rx_flags" and pass it upstream without extra
conversation.

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
 drivers/net/wireless/ath/ath9k/ar9003_mac.c |  5 +++--
 drivers/net/wireless/ath/ath9k/mac.c        | 11 +++++++----
 drivers/net/wireless/ath/ath9k/mac.h        |  1 +
 drivers/net/wireless/ath/ath9k/recv.c       |  5 +----
 4 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mac.c b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
index 301bf72..5163abd 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
@@ -469,6 +469,7 @@ int ath9k_hw_process_rxdesc_edma(struct ath_hw *ah, struct ath_rx_status *rxs,
 
 	rxs->rs_status = 0;
 	rxs->rs_flags =  0;
+	rxs->flag =  0;
 
 	rxs->rs_datalen = rxsp->status2 & AR_DataLen;
 	rxs->rs_tstamp =  rxsp->status3;
@@ -493,8 +494,8 @@ int ath9k_hw_process_rxdesc_edma(struct ath_hw *ah, struct ath_rx_status *rxs,
 	rxs->rs_isaggr = (rxsp->status11 & AR_RxAggr) ? 1 : 0;
 	rxs->rs_moreaggr = (rxsp->status11 & AR_RxMoreAggr) ? 1 : 0;
 	rxs->rs_antenna = (MS(rxsp->status4, AR_RxAntenna) & 0x7);
-	rxs->rs_flags  = (rxsp->status4 & AR_GI) ? ATH9K_RX_GI : 0;
-	rxs->rs_flags  |= (rxsp->status4 & AR_2040) ? ATH9K_RX_2040 : 0;
+	rxs->flag  |= (rxsp->status4 & AR_GI) ? RX_FLAG_SHORT_GI : 0;
+	rxs->flag  |= (rxsp->status4 & AR_2040) ? RX_FLAG_40MHZ : 0;
 
 	rxs->evm0 = rxsp->status6;
 	rxs->evm1 = rxsp->status7;
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c
index 498fee0..a52081d 100644
--- a/drivers/net/wireless/ath/ath9k/mac.c
+++ b/drivers/net/wireless/ath/ath9k/mac.c
@@ -547,6 +547,7 @@ int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds,
 
 	rs->rs_status = 0;
 	rs->rs_flags = 0;
+	rs->flag = 0;
 
 	rs->rs_datalen = ads.ds_rxstatus1 & AR_DataLen;
 	rs->rs_tstamp = ads.AR_RcvTimestamp;
@@ -586,10 +587,12 @@ int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds,
 	rs->rs_moreaggr =
 		(ads.ds_rxstatus8 & AR_RxMoreAggr) ? 1 : 0;
 	rs->rs_antenna = MS(ads.ds_rxstatus3, AR_RxAntenna);
-	rs->rs_flags =
-		(ads.ds_rxstatus3 & AR_GI) ? ATH9K_RX_GI : 0;
-	rs->rs_flags |=
-		(ads.ds_rxstatus3 & AR_2040) ? ATH9K_RX_2040 : 0;
+
+	/* directly mapped flags for ieee80211_rx_status */
+	rs->flag |=
+		(ads.ds_rxstatus3 & AR_GI) ? RX_FLAG_SHORT_GI : 0;
+	rs->flag |=
+		(ads.ds_rxstatus3 & AR_2040) ? RX_FLAG_40MHZ : 0;
 
 	if (ads.ds_rxstatus8 & AR_PreDelimCRCErr)
 		rs->rs_flags |= ATH9K_RX_DELIM_CRC_PRE;
diff --git a/drivers/net/wireless/ath/ath9k/mac.h b/drivers/net/wireless/ath/ath9k/mac.h
index 5865f92..3f1e775 100644
--- a/drivers/net/wireless/ath/ath9k/mac.h
+++ b/drivers/net/wireless/ath/ath9k/mac.h
@@ -149,6 +149,7 @@ struct ath_rx_status {
 	u32 evm2;
 	u32 evm3;
 	u32 evm4;
+	u32 flag; /* see enum mac80211_rx_flags */
 };
 
 struct ath_htc_rx_status {
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index 8be2b5d..b4b758d 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -868,10 +868,7 @@ static int ath9k_process_rate(struct ath_common *common,
 	if (rx_stats->rs_rate & 0x80) {
 		/* HT rate */
 		rxs->flag |= RX_FLAG_HT;
-		if (rx_stats->rs_flags & ATH9K_RX_2040)
-			rxs->flag |= RX_FLAG_40MHZ;
-		if (rx_stats->rs_flags & ATH9K_RX_GI)
-			rxs->flag |= RX_FLAG_SHORT_GI;
+		rxs->flag |= rx_stats->flag;
 		rxs->rate_idx = rx_stats->rs_rate & 0x7f;
 		return 0;
 	}
-- 
1.8.1.2


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

* [PATCH 3/3] ath9k: check for Rx-STBC flag and pass it to ieee80211
  2013-05-19  7:38 [PATCH 0/3] Work on STBC Rx monitoring Oleksij Rempel
  2013-05-19  7:38 ` [PATCH 1/3] mac80211: add STBC flag for radiotap Oleksij Rempel
  2013-05-19  7:38 ` [PATCH 2/3] ath9k: remove useless flag conversation Oleksij Rempel
@ 2013-05-19  7:38 ` Oleksij Rempel
  2013-05-24 10:18 ` [PATCH 0/2] ath9k: STBC Rx monitoring Oleksij Rempel
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 20+ messages in thread
From: Oleksij Rempel @ 2013-05-19  7:38 UTC (permalink / raw)
  To: ath9k-devel, linux-wireless; +Cc: Oleksij Rempel

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
 drivers/net/wireless/ath/ath9k/mac.c | 5 +++++
 drivers/net/wireless/ath/ath9k/mac.h | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c
index a52081d..d055e38 100644
--- a/drivers/net/wireless/ath/ath9k/mac.c
+++ b/drivers/net/wireless/ath/ath9k/mac.c
@@ -593,6 +593,11 @@ int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds,
 		(ads.ds_rxstatus3 & AR_GI) ? RX_FLAG_SHORT_GI : 0;
 	rs->flag |=
 		(ads.ds_rxstatus3 & AR_2040) ? RX_FLAG_40MHZ : 0;
+	if (AR_SREV_9280_20_OR_LATER(ah))
+		rs->flag |=
+			(ads.ds_rxstatus3 & AR_STBC) ?
+				/* we can only Nss=1 STBC */
+				(1 << RX_FLAG_STBC_SHIFT) : 0;
 
 	if (ads.ds_rxstatus8 & AR_PreDelimCRCErr)
 		rs->rs_flags |= ATH9K_RX_DELIM_CRC_PRE;
diff --git a/drivers/net/wireless/ath/ath9k/mac.h b/drivers/net/wireless/ath/ath9k/mac.h
index 3f1e775..b02dfce 100644
--- a/drivers/net/wireless/ath/ath9k/mac.h
+++ b/drivers/net/wireless/ath/ath9k/mac.h
@@ -534,7 +534,8 @@ struct ar5416_desc {
 #define AR_2040             0x00000002
 #define AR_Parallel40       0x00000004
 #define AR_Parallel40_S     2
-#define AR_RxStatusRsvd30   0x000000f8
+#define AR_STBC             0x00000008 /* on ar9280 and later */
+#define AR_RxStatusRsvd30   0x000000f0
 #define AR_RxAntenna	    0xffffff00
 #define AR_RxAntenna_S	    8
 
-- 
1.8.1.2


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

* Re: [PATCH 1/3] mac80211: add STBC flag for radiotap
  2013-05-19  7:38 ` [PATCH 1/3] mac80211: add STBC flag for radiotap Oleksij Rempel
@ 2013-05-22 19:24   ` Johannes Berg
  2013-05-23  7:17     ` [PATCH v2 " Oleksij Rempel
                       ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Johannes Berg @ 2013-05-22 19:24 UTC (permalink / raw)
  To: Oleksij Rempel; +Cc: ath9k-devel, linux-wireless

On Sun, 2013-05-19 at 09:38 +0200, Oleksij Rempel wrote:

> + * @RX_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3

> +	RX_FLAG_STBC_MASK		= BIT(26) | BIT(27),



> @@ -258,6 +258,7 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
>  	pos += 2;
>  
>  	if (status->flag & RX_FLAG_HT) {
> +		unsigned int stbc = status->flag & RX_FLAG_STBC_MASK;
>  		rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_MCS);
>  		*pos++ = local->hw.radiotap_mcs_details;
>  		*pos = 0;
> @@ -267,6 +268,9 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
>  			*pos |= IEEE80211_RADIOTAP_MCS_BW_40;
>  		if (status->flag & RX_FLAG_HT_GF)
>  			*pos |= IEEE80211_RADIOTAP_MCS_FMT_GF;
> +		if (stbc)
> +			*pos |= (stbc >> RX_FLAG_STBC_SHIFT)
> +					<< IEEE80211_RADIOTAP_MCS_STBC_SHIFT;
>  		pos++;
>  		*pos++ = status->rate_idx;

Here you forgot the "HAVE" bit.


> -			 IEEE80211_RADIOTAP_MCS_HAVE_BW;
> +			 IEEE80211_RADIOTAP_MCS_HAVE_BW |
> +			 IEEE80211_RADIOTAP_MCS_HAVE_STBC;

And here it's completely bogus.

johannes


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

* [PATCH v2 1/3] mac80211: add STBC flag for radiotap
  2013-05-22 19:24   ` Johannes Berg
@ 2013-05-23  7:17     ` Oleksij Rempel
  2013-05-23 12:24       ` Johannes Berg
  2013-05-23 14:11     ` [PATCH v3 " Oleksij Rempel
  2013-05-24 10:05     ` [PATCH v4 " Oleksij Rempel
  2 siblings, 1 reply; 20+ messages in thread
From: Oleksij Rempel @ 2013-05-23  7:17 UTC (permalink / raw)
  To: ath9k-devel, linux-wireless, johannes; +Cc: Oleksij Rempel

revision:
- v2. set HAVE_STBC only if it is present.
      do not set STBC flag on TX packets.

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
 include/net/ieee80211_radiotap.h |  7 +++++++
 include/net/mac80211.h           |  4 ++++
 net/mac80211/rx.c                | 13 ++++++++++++-
 3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h
index c399963..c6d07cb 100644
--- a/include/net/ieee80211_radiotap.h
+++ b/include/net/ieee80211_radiotap.h
@@ -269,6 +269,7 @@ enum ieee80211_radiotap_type {
 #define IEEE80211_RADIOTAP_MCS_HAVE_GI		0x04
 #define IEEE80211_RADIOTAP_MCS_HAVE_FMT		0x08
 #define IEEE80211_RADIOTAP_MCS_HAVE_FEC		0x10
+#define IEEE80211_RADIOTAP_MCS_HAVE_STBC	0x20
 
 #define IEEE80211_RADIOTAP_MCS_BW_MASK		0x03
 #define		IEEE80211_RADIOTAP_MCS_BW_20	0
@@ -278,6 +279,12 @@ enum ieee80211_radiotap_type {
 #define IEEE80211_RADIOTAP_MCS_SGI		0x04
 #define IEEE80211_RADIOTAP_MCS_FMT_GF		0x08
 #define IEEE80211_RADIOTAP_MCS_FEC_LDPC		0x10
+#define IEEE80211_RADIOTAP_MCS_STBC_MASK	0x60
+#define		IEEE80211_RADIOTAP_MCS_STBC_1	1
+#define		IEEE80211_RADIOTAP_MCS_STBC_2	2
+#define		IEEE80211_RADIOTAP_MCS_STBC_3	3
+
+#define IEEE80211_RADIOTAP_MCS_STBC_SHIFT	5
 
 /* For IEEE80211_RADIOTAP_AMPDU_STATUS */
 #define IEEE80211_RADIOTAP_AMPDU_REPORT_ZEROLEN		0x0001
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 885898a..16705a9 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -805,6 +805,7 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
  *	on this subframe
  * @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC
  *	is stored in the @ampdu_delimiter_crc field)
+ * @RX_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3
  */
 enum mac80211_rx_flags {
 	RX_FLAG_MMIC_ERROR		= BIT(0),
@@ -832,8 +833,11 @@ enum mac80211_rx_flags {
 	RX_FLAG_80MHZ			= BIT(23),
 	RX_FLAG_80P80MHZ		= BIT(24),
 	RX_FLAG_160MHZ			= BIT(25),
+	RX_FLAG_STBC_MASK		= BIT(26) | BIT(27),
 };
 
+#define RX_FLAG_STBC_SHIFT		26
+
 /**
  * struct ieee80211_rx_status - receive status
  *
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 8e29526..db7c68a 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -258,8 +258,16 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
 	pos += 2;
 
 	if (status->flag & RX_FLAG_HT) {
+		unsigned int stbc = status->flag & RX_FLAG_STBC_MASK;
 		rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_MCS);
-		*pos++ = local->hw.radiotap_mcs_details;
+
+		/* MCS known field */
+		*pos = local->hw.radiotap_mcs_details;
+		if (stbc)
+			*pos |= IEEE80211_RADIOTAP_MCS_HAVE_STBC;
+		*pos++;
+
+		/* MCS flags field */
 		*pos = 0;
 		if (status->flag & RX_FLAG_SHORT_GI)
 			*pos |= IEEE80211_RADIOTAP_MCS_SGI;
@@ -267,6 +275,9 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
 			*pos |= IEEE80211_RADIOTAP_MCS_BW_40;
 		if (status->flag & RX_FLAG_HT_GF)
 			*pos |= IEEE80211_RADIOTAP_MCS_FMT_GF;
+		if (stbc)
+			*pos |= (stbc >> RX_FLAG_STBC_SHIFT)
+					<< IEEE80211_RADIOTAP_MCS_STBC_SHIFT;
 		pos++;
 		*pos++ = status->rate_idx;
 	}
-- 
1.8.1.2


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

* Re: [PATCH v2 1/3] mac80211: add STBC flag for radiotap
  2013-05-23  7:17     ` [PATCH v2 " Oleksij Rempel
@ 2013-05-23 12:24       ` Johannes Berg
  0 siblings, 0 replies; 20+ messages in thread
From: Johannes Berg @ 2013-05-23 12:24 UTC (permalink / raw)
  To: Oleksij Rempel; +Cc: ath9k-devel, linux-wireless

On Thu, 2013-05-23 at 09:17 +0200, Oleksij Rempel wrote:
> revision:
> - v2. set HAVE_STBC only if it is present.
>       do not set STBC flag on TX packets.

Please don't include changes *inside* the changelog. Also, an actual
commit message would be nice.

johannes


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

* [PATCH v3 1/3] mac80211: add STBC flag for radiotap
  2013-05-22 19:24   ` Johannes Berg
  2013-05-23  7:17     ` [PATCH v2 " Oleksij Rempel
@ 2013-05-23 14:11     ` Oleksij Rempel
  2013-05-23 21:33       ` Johannes Berg
  2013-05-24 10:05     ` [PATCH v4 " Oleksij Rempel
  2 siblings, 1 reply; 20+ messages in thread
From: Oleksij Rempel @ 2013-05-23 14:11 UTC (permalink / raw)
  To: ath9k-devel, linux-wireless, johannes; +Cc: Oleksij Rempel

Some chips can tell us if received frame was
encoded with STBC or not. To make this information available
in user space we can use updated radiotap specification:
http://www.radiotap.org/defined-fields/MCS

This patch add HAVE_STBC flag and provide number
of STBC encoded spatial streams (Nss).

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
 include/net/ieee80211_radiotap.h |  7 +++++++
 include/net/mac80211.h           |  4 ++++
 net/mac80211/rx.c                | 13 ++++++++++++-
 3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h
index c399963..c6d07cb 100644
--- a/include/net/ieee80211_radiotap.h
+++ b/include/net/ieee80211_radiotap.h
@@ -269,6 +269,7 @@ enum ieee80211_radiotap_type {
 #define IEEE80211_RADIOTAP_MCS_HAVE_GI		0x04
 #define IEEE80211_RADIOTAP_MCS_HAVE_FMT		0x08
 #define IEEE80211_RADIOTAP_MCS_HAVE_FEC		0x10
+#define IEEE80211_RADIOTAP_MCS_HAVE_STBC	0x20
 
 #define IEEE80211_RADIOTAP_MCS_BW_MASK		0x03
 #define		IEEE80211_RADIOTAP_MCS_BW_20	0
@@ -278,6 +279,12 @@ enum ieee80211_radiotap_type {
 #define IEEE80211_RADIOTAP_MCS_SGI		0x04
 #define IEEE80211_RADIOTAP_MCS_FMT_GF		0x08
 #define IEEE80211_RADIOTAP_MCS_FEC_LDPC		0x10
+#define IEEE80211_RADIOTAP_MCS_STBC_MASK	0x60
+#define		IEEE80211_RADIOTAP_MCS_STBC_1	1
+#define		IEEE80211_RADIOTAP_MCS_STBC_2	2
+#define		IEEE80211_RADIOTAP_MCS_STBC_3	3
+
+#define IEEE80211_RADIOTAP_MCS_STBC_SHIFT	5
 
 /* For IEEE80211_RADIOTAP_AMPDU_STATUS */
 #define IEEE80211_RADIOTAP_AMPDU_REPORT_ZEROLEN		0x0001
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 885898a..16705a9 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -805,6 +805,7 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
  *	on this subframe
  * @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC
  *	is stored in the @ampdu_delimiter_crc field)
+ * @RX_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3
  */
 enum mac80211_rx_flags {
 	RX_FLAG_MMIC_ERROR		= BIT(0),
@@ -832,8 +833,11 @@ enum mac80211_rx_flags {
 	RX_FLAG_80MHZ			= BIT(23),
 	RX_FLAG_80P80MHZ		= BIT(24),
 	RX_FLAG_160MHZ			= BIT(25),
+	RX_FLAG_STBC_MASK		= BIT(26) | BIT(27),
 };
 
+#define RX_FLAG_STBC_SHIFT		26
+
 /**
  * struct ieee80211_rx_status - receive status
  *
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 8e29526..db7c68a 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -258,8 +258,16 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
 	pos += 2;
 
 	if (status->flag & RX_FLAG_HT) {
+		unsigned int stbc = status->flag & RX_FLAG_STBC_MASK;
 		rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_MCS);
-		*pos++ = local->hw.radiotap_mcs_details;
+
+		/* MCS known field */
+		*pos = local->hw.radiotap_mcs_details;
+		if (stbc)
+			*pos |= IEEE80211_RADIOTAP_MCS_HAVE_STBC;
+		*pos++;
+
+		/* MCS flags field */
 		*pos = 0;
 		if (status->flag & RX_FLAG_SHORT_GI)
 			*pos |= IEEE80211_RADIOTAP_MCS_SGI;
@@ -267,6 +275,9 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
 			*pos |= IEEE80211_RADIOTAP_MCS_BW_40;
 		if (status->flag & RX_FLAG_HT_GF)
 			*pos |= IEEE80211_RADIOTAP_MCS_FMT_GF;
+		if (stbc)
+			*pos |= (stbc >> RX_FLAG_STBC_SHIFT)
+					<< IEEE80211_RADIOTAP_MCS_STBC_SHIFT;
 		pos++;
 		*pos++ = status->rate_idx;
 	}
-- 
1.8.1.2


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

* Re: [PATCH v3 1/3] mac80211: add STBC flag for radiotap
  2013-05-23 14:11     ` [PATCH v3 " Oleksij Rempel
@ 2013-05-23 21:33       ` Johannes Berg
  0 siblings, 0 replies; 20+ messages in thread
From: Johannes Berg @ 2013-05-23 21:33 UTC (permalink / raw)
  To: Oleksij Rempel; +Cc: ath9k-devel, linux-wireless

On Thu, 2013-05-23 at 16:11 +0200, Oleksij Rempel wrote:

> -		*pos++ = local->hw.radiotap_mcs_details;
> +
> +		/* MCS known field */
> +		*pos = local->hw.radiotap_mcs_details;
> +		if (stbc)
> +			*pos |= IEEE80211_RADIOTAP_MCS_HAVE_STBC;

I think you shouldn't make this change, and the driver should include
the HAVE_STBC flag in the hw.radiotap_mcs_details. I actually thought of
this approach as well, but now just realized that this means that if the
driver _knows_ that a certain frame was received w/o STBC, this
knowledge cannot be transferred to the user, which would be a loss of
information.

> +               if (stbc)
> +                       *pos |= (stbc >> RX_FLAG_STBC_SHIFT)
> +                                       <<
> IEEE80211_RADIOTAP_MCS_STBC_SHIFT;

No need for the if() here, OR'ing in 0 doesn't do anything.

johannes


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

* [PATCH v4 1/3] mac80211: add STBC flag for radiotap
  2013-05-22 19:24   ` Johannes Berg
  2013-05-23  7:17     ` [PATCH v2 " Oleksij Rempel
  2013-05-23 14:11     ` [PATCH v3 " Oleksij Rempel
@ 2013-05-24 10:05     ` Oleksij Rempel
  2013-05-24 10:08       ` Johannes Berg
  2 siblings, 1 reply; 20+ messages in thread
From: Oleksij Rempel @ 2013-05-24 10:05 UTC (permalink / raw)
  To: ath9k-devel, linux-wireless, johannes; +Cc: Oleksij Rempel

Some chips can tell us if received frame was
encoded with STBC or not. To make this information available
in user space we can use updated radiotap specification:
http://www.radiotap.org/defined-fields/MCS

This patch will set number of STBC encoded spatial streams (Nss).
The HAVE_STBC flag should be provided by driver.

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
 include/net/ieee80211_radiotap.h | 7 +++++++
 include/net/mac80211.h           | 4 ++++
 net/mac80211/rx.c                | 4 ++++
 3 files changed, 15 insertions(+)

diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h
index c399963..c6d07cb 100644
--- a/include/net/ieee80211_radiotap.h
+++ b/include/net/ieee80211_radiotap.h
@@ -269,6 +269,7 @@ enum ieee80211_radiotap_type {
 #define IEEE80211_RADIOTAP_MCS_HAVE_GI		0x04
 #define IEEE80211_RADIOTAP_MCS_HAVE_FMT		0x08
 #define IEEE80211_RADIOTAP_MCS_HAVE_FEC		0x10
+#define IEEE80211_RADIOTAP_MCS_HAVE_STBC	0x20
 
 #define IEEE80211_RADIOTAP_MCS_BW_MASK		0x03
 #define		IEEE80211_RADIOTAP_MCS_BW_20	0
@@ -278,6 +279,12 @@ enum ieee80211_radiotap_type {
 #define IEEE80211_RADIOTAP_MCS_SGI		0x04
 #define IEEE80211_RADIOTAP_MCS_FMT_GF		0x08
 #define IEEE80211_RADIOTAP_MCS_FEC_LDPC		0x10
+#define IEEE80211_RADIOTAP_MCS_STBC_MASK	0x60
+#define		IEEE80211_RADIOTAP_MCS_STBC_1	1
+#define		IEEE80211_RADIOTAP_MCS_STBC_2	2
+#define		IEEE80211_RADIOTAP_MCS_STBC_3	3
+
+#define IEEE80211_RADIOTAP_MCS_STBC_SHIFT	5
 
 /* For IEEE80211_RADIOTAP_AMPDU_STATUS */
 #define IEEE80211_RADIOTAP_AMPDU_REPORT_ZEROLEN		0x0001
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 885898a..16705a9 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -805,6 +805,7 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
  *	on this subframe
  * @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC
  *	is stored in the @ampdu_delimiter_crc field)
+ * @RX_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3
  */
 enum mac80211_rx_flags {
 	RX_FLAG_MMIC_ERROR		= BIT(0),
@@ -832,8 +833,11 @@ enum mac80211_rx_flags {
 	RX_FLAG_80MHZ			= BIT(23),
 	RX_FLAG_80P80MHZ		= BIT(24),
 	RX_FLAG_160MHZ			= BIT(25),
+	RX_FLAG_STBC_MASK		= BIT(26) | BIT(27),
 };
 
+#define RX_FLAG_STBC_SHIFT		26
+
 /**
  * struct ieee80211_rx_status - receive status
  *
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 8e29526..811dd64 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -258,6 +258,7 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
 	pos += 2;
 
 	if (status->flag & RX_FLAG_HT) {
+		unsigned int stbc;
 		rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_MCS);
 		*pos++ = local->hw.radiotap_mcs_details;
 		*pos = 0;
@@ -267,6 +268,9 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
 			*pos |= IEEE80211_RADIOTAP_MCS_BW_40;
 		if (status->flag & RX_FLAG_HT_GF)
 			*pos |= IEEE80211_RADIOTAP_MCS_FMT_GF;
+		stbc = status->flag & RX_FLAG_STBC_MASK;
+		*pos |= (stbc >> RX_FLAG_STBC_SHIFT)
+				<< IEEE80211_RADIOTAP_MCS_STBC_SHIFT;
 		pos++;
 		*pos++ = status->rate_idx;
 	}
-- 
1.8.1.2


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

* Re: [PATCH v4 1/3] mac80211: add STBC flag for radiotap
  2013-05-24 10:05     ` [PATCH v4 " Oleksij Rempel
@ 2013-05-24 10:08       ` Johannes Berg
  2013-05-24 10:11         ` Oleksij Rempel
  0 siblings, 1 reply; 20+ messages in thread
From: Johannes Berg @ 2013-05-24 10:08 UTC (permalink / raw)
  To: Oleksij Rempel; +Cc: ath9k-devel, linux-wireless

On Fri, 2013-05-24 at 12:05 +0200, Oleksij Rempel wrote:
> Some chips can tell us if received frame was
> encoded with STBC or not. To make this information available
> in user space we can use updated radiotap specification:
> http://www.radiotap.org/defined-fields/MCS
> 
> This patch will set number of STBC encoded spatial streams (Nss).
> The HAVE_STBC flag should be provided by driver.

Applied, thanks.

johannes


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

* Re: [PATCH v4 1/3] mac80211: add STBC flag for radiotap
  2013-05-24 10:08       ` Johannes Berg
@ 2013-05-24 10:11         ` Oleksij Rempel
  0 siblings, 0 replies; 20+ messages in thread
From: Oleksij Rempel @ 2013-05-24 10:11 UTC (permalink / raw)
  To: Johannes Berg; +Cc: ath9k-devel, linux-wireless

Am 24.05.2013 12:08, schrieb Johannes Berg:
> On Fri, 2013-05-24 at 12:05 +0200, Oleksij Rempel wrote:
>> Some chips can tell us if received frame was
>> encoded with STBC or not. To make this information available
>> in user space we can use updated radiotap specification:
>> http://www.radiotap.org/defined-fields/MCS
>>
>> This patch will set number of STBC encoded spatial streams (Nss).
>> The HAVE_STBC flag should be provided by driver.
>
> Applied, thanks.
>

thank you.

-- 
Regards,
Oleksij

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

* [PATCH 0/2] ath9k: STBC Rx monitoring
  2013-05-19  7:38 [PATCH 0/3] Work on STBC Rx monitoring Oleksij Rempel
                   ` (2 preceding siblings ...)
  2013-05-19  7:38 ` [PATCH 3/3] ath9k: check for Rx-STBC flag and pass it to ieee80211 Oleksij Rempel
@ 2013-05-24 10:18 ` Oleksij Rempel
  2013-05-24 10:18   ` [PATCH 1/2] ath9k: remove useless flag conversation Oleksij Rempel
  2013-05-24 10:18   ` [PATCH 2/2] ath9k: check for Rx-STBC flag and pass it to ieee80211 Oleksij Rempel
  2013-05-24 18:30 ` [PATCH v4 " Oleksij Rempel
  2013-05-30  8:57 ` [PATCH 0/3] Work on STBC Rx monitoring Oleksij Rempel
  5 siblings, 2 replies; 20+ messages in thread
From: Oleksij Rempel @ 2013-05-24 10:18 UTC (permalink / raw)
  To: ath9k-devel, linux-wireless; +Cc: Oleksij Rempel

this are two remaining patches to allow STBC Rx monitoring
on ath9k devices.
This patches depend on currently applied:
[PATCH v4 1/3] mac80211: add STBC flag for radiotap

Oleksij Rempel (2):
  ath9k: remove useless flag conversation.
  ath9k: check for Rx-STBC flag and pass it to ieee80211

 drivers/net/wireless/ath/ath9k/ar9003_mac.c |  5 +++--
 drivers/net/wireless/ath/ath9k/init.c       |  9 +++++++--
 drivers/net/wireless/ath/ath9k/mac.c        | 16 ++++++++++++----
 drivers/net/wireless/ath/ath9k/mac.h        |  4 +++-
 drivers/net/wireless/ath/ath9k/recv.c       |  5 +----
 5 files changed, 26 insertions(+), 13 deletions(-)

-- 
1.8.1.2


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

* [PATCH 1/2] ath9k: remove useless flag conversation.
  2013-05-24 10:18 ` [PATCH 0/2] ath9k: STBC Rx monitoring Oleksij Rempel
@ 2013-05-24 10:18   ` Oleksij Rempel
  2013-05-24 10:18   ` [PATCH 2/2] ath9k: check for Rx-STBC flag and pass it to ieee80211 Oleksij Rempel
  1 sibling, 0 replies; 20+ messages in thread
From: Oleksij Rempel @ 2013-05-24 10:18 UTC (permalink / raw)
  To: ath9k-devel, linux-wireless; +Cc: Oleksij Rempel

some flags used only outside of ath9k - In this case we can use
"enum mac80211_rx_flags" and pass it upstream without extra
conversation.

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
 drivers/net/wireless/ath/ath9k/ar9003_mac.c |  5 +++--
 drivers/net/wireless/ath/ath9k/mac.c        | 11 +++++++----
 drivers/net/wireless/ath/ath9k/mac.h        |  1 +
 drivers/net/wireless/ath/ath9k/recv.c       |  5 +----
 4 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mac.c b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
index 301bf72..5163abd 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
@@ -469,6 +469,7 @@ int ath9k_hw_process_rxdesc_edma(struct ath_hw *ah, struct ath_rx_status *rxs,
 
 	rxs->rs_status = 0;
 	rxs->rs_flags =  0;
+	rxs->flag =  0;
 
 	rxs->rs_datalen = rxsp->status2 & AR_DataLen;
 	rxs->rs_tstamp =  rxsp->status3;
@@ -493,8 +494,8 @@ int ath9k_hw_process_rxdesc_edma(struct ath_hw *ah, struct ath_rx_status *rxs,
 	rxs->rs_isaggr = (rxsp->status11 & AR_RxAggr) ? 1 : 0;
 	rxs->rs_moreaggr = (rxsp->status11 & AR_RxMoreAggr) ? 1 : 0;
 	rxs->rs_antenna = (MS(rxsp->status4, AR_RxAntenna) & 0x7);
-	rxs->rs_flags  = (rxsp->status4 & AR_GI) ? ATH9K_RX_GI : 0;
-	rxs->rs_flags  |= (rxsp->status4 & AR_2040) ? ATH9K_RX_2040 : 0;
+	rxs->flag  |= (rxsp->status4 & AR_GI) ? RX_FLAG_SHORT_GI : 0;
+	rxs->flag  |= (rxsp->status4 & AR_2040) ? RX_FLAG_40MHZ : 0;
 
 	rxs->evm0 = rxsp->status6;
 	rxs->evm1 = rxsp->status7;
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c
index 498fee0..a52081d 100644
--- a/drivers/net/wireless/ath/ath9k/mac.c
+++ b/drivers/net/wireless/ath/ath9k/mac.c
@@ -547,6 +547,7 @@ int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds,
 
 	rs->rs_status = 0;
 	rs->rs_flags = 0;
+	rs->flag = 0;
 
 	rs->rs_datalen = ads.ds_rxstatus1 & AR_DataLen;
 	rs->rs_tstamp = ads.AR_RcvTimestamp;
@@ -586,10 +587,12 @@ int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds,
 	rs->rs_moreaggr =
 		(ads.ds_rxstatus8 & AR_RxMoreAggr) ? 1 : 0;
 	rs->rs_antenna = MS(ads.ds_rxstatus3, AR_RxAntenna);
-	rs->rs_flags =
-		(ads.ds_rxstatus3 & AR_GI) ? ATH9K_RX_GI : 0;
-	rs->rs_flags |=
-		(ads.ds_rxstatus3 & AR_2040) ? ATH9K_RX_2040 : 0;
+
+	/* directly mapped flags for ieee80211_rx_status */
+	rs->flag |=
+		(ads.ds_rxstatus3 & AR_GI) ? RX_FLAG_SHORT_GI : 0;
+	rs->flag |=
+		(ads.ds_rxstatus3 & AR_2040) ? RX_FLAG_40MHZ : 0;
 
 	if (ads.ds_rxstatus8 & AR_PreDelimCRCErr)
 		rs->rs_flags |= ATH9K_RX_DELIM_CRC_PRE;
diff --git a/drivers/net/wireless/ath/ath9k/mac.h b/drivers/net/wireless/ath/ath9k/mac.h
index 5865f92..3f1e775 100644
--- a/drivers/net/wireless/ath/ath9k/mac.h
+++ b/drivers/net/wireless/ath/ath9k/mac.h
@@ -149,6 +149,7 @@ struct ath_rx_status {
 	u32 evm2;
 	u32 evm3;
 	u32 evm4;
+	u32 flag; /* see enum mac80211_rx_flags */
 };
 
 struct ath_htc_rx_status {
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index 8be2b5d..b4b758d 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -868,10 +868,7 @@ static int ath9k_process_rate(struct ath_common *common,
 	if (rx_stats->rs_rate & 0x80) {
 		/* HT rate */
 		rxs->flag |= RX_FLAG_HT;
-		if (rx_stats->rs_flags & ATH9K_RX_2040)
-			rxs->flag |= RX_FLAG_40MHZ;
-		if (rx_stats->rs_flags & ATH9K_RX_GI)
-			rxs->flag |= RX_FLAG_SHORT_GI;
+		rxs->flag |= rx_stats->flag;
 		rxs->rate_idx = rx_stats->rs_rate & 0x7f;
 		return 0;
 	}
-- 
1.8.1.2


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

* [PATCH 2/2] ath9k: check for Rx-STBC flag and pass it to ieee80211
  2013-05-24 10:18 ` [PATCH 0/2] ath9k: STBC Rx monitoring Oleksij Rempel
  2013-05-24 10:18   ` [PATCH 1/2] ath9k: remove useless flag conversation Oleksij Rempel
@ 2013-05-24 10:18   ` Oleksij Rempel
  2013-05-24 10:29     ` Johannes Berg
  2013-05-24 11:35     ` Oleksij Rempel
  1 sibling, 2 replies; 20+ messages in thread
From: Oleksij Rempel @ 2013-05-24 10:18 UTC (permalink / raw)
  To: ath9k-devel, linux-wireless; +Cc: Oleksij Rempel

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
 drivers/net/wireless/ath/ath9k/init.c | 9 +++++++--
 drivers/net/wireless/ath/ath9k/mac.c  | 5 +++++
 drivers/net/wireless/ath/ath9k/mac.h  | 3 ++-
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index aba4151..7739b05 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -769,8 +769,13 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
 		IEEE80211_HW_REPORTS_TX_ACK_STATUS |
 		IEEE80211_HW_SUPPORTS_RC_TABLE;
 
-	if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT)
-		 hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
+	if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) {
+		hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
+
+		if (AR_SREV_9280_20_OR_LATER(ah))
+			hw->radiotap_mcs_details |=
+				IEEE80211_RADIOTAP_MCS_HAVE_STBC;
+	}
 
 	if (AR_SREV_9160_10_OR_LATER(sc->sc_ah) || ath9k_modparam_nohwcrypt)
 		hw->flags |= IEEE80211_HW_MFP_CAPABLE;
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c
index a52081d..d055e38 100644
--- a/drivers/net/wireless/ath/ath9k/mac.c
+++ b/drivers/net/wireless/ath/ath9k/mac.c
@@ -593,6 +593,11 @@ int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds,
 		(ads.ds_rxstatus3 & AR_GI) ? RX_FLAG_SHORT_GI : 0;
 	rs->flag |=
 		(ads.ds_rxstatus3 & AR_2040) ? RX_FLAG_40MHZ : 0;
+	if (AR_SREV_9280_20_OR_LATER(ah))
+		rs->flag |=
+			(ads.ds_rxstatus3 & AR_STBC) ?
+				/* we can only Nss=1 STBC */
+				(1 << RX_FLAG_STBC_SHIFT) : 0;
 
 	if (ads.ds_rxstatus8 & AR_PreDelimCRCErr)
 		rs->rs_flags |= ATH9K_RX_DELIM_CRC_PRE;
diff --git a/drivers/net/wireless/ath/ath9k/mac.h b/drivers/net/wireless/ath/ath9k/mac.h
index 3f1e775..b02dfce 100644
--- a/drivers/net/wireless/ath/ath9k/mac.h
+++ b/drivers/net/wireless/ath/ath9k/mac.h
@@ -534,7 +534,8 @@ struct ar5416_desc {
 #define AR_2040             0x00000002
 #define AR_Parallel40       0x00000004
 #define AR_Parallel40_S     2
-#define AR_RxStatusRsvd30   0x000000f8
+#define AR_STBC             0x00000008 /* on ar9280 and later */
+#define AR_RxStatusRsvd30   0x000000f0
 #define AR_RxAntenna	    0xffffff00
 #define AR_RxAntenna_S	    8
 
-- 
1.8.1.2


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

* Re: [PATCH 2/2] ath9k: check for Rx-STBC flag and pass it to ieee80211
  2013-05-24 10:18   ` [PATCH 2/2] ath9k: check for Rx-STBC flag and pass it to ieee80211 Oleksij Rempel
@ 2013-05-24 10:29     ` Johannes Berg
  2013-05-24 10:32       ` Oleksij Rempel
  2013-05-24 11:35     ` Oleksij Rempel
  1 sibling, 1 reply; 20+ messages in thread
From: Johannes Berg @ 2013-05-24 10:29 UTC (permalink / raw)
  To: Oleksij Rempel; +Cc: ath9k-devel, linux-wireless

On Fri, 2013-05-24 at 12:18 +0200, Oleksij Rempel wrote:
> Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
> ---
>  drivers/net/wireless/ath/ath9k/init.c | 9 +++++++--
>  drivers/net/wireless/ath/ath9k/mac.c  | 5 +++++
>  drivers/net/wireless/ath/ath9k/mac.h  | 3 ++-
>  3 files changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
> index aba4151..7739b05 100644
> --- a/drivers/net/wireless/ath/ath9k/init.c
> +++ b/drivers/net/wireless/ath/ath9k/init.c
> @@ -769,8 +769,13 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
>  		IEEE80211_HW_REPORTS_TX_ACK_STATUS |
>  		IEEE80211_HW_SUPPORTS_RC_TABLE;
>  
> -	if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT)
> -		 hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
> +	if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) {
> +		hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
> +
> +		if (AR_SREV_9280_20_OR_LATER(ah))
> +			hw->radiotap_mcs_details |=
> +				IEEE80211_RADIOTAP_MCS_HAVE_STBC;
> +	}

Are you sure this is right? It seems that if other devices don't support
STBC they can report all frames to be w/o STBC. Or do they support STBC
but don't report it?

johannes


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

* Re: [PATCH 2/2] ath9k: check for Rx-STBC flag and pass it to ieee80211
  2013-05-24 10:29     ` Johannes Berg
@ 2013-05-24 10:32       ` Oleksij Rempel
  0 siblings, 0 replies; 20+ messages in thread
From: Oleksij Rempel @ 2013-05-24 10:32 UTC (permalink / raw)
  To: Johannes Berg; +Cc: ath9k-devel, linux-wireless

Am 24.05.2013 12:29, schrieb Johannes Berg:
> On Fri, 2013-05-24 at 12:18 +0200, Oleksij Rempel wrote:
>> Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
>> ---
>>   drivers/net/wireless/ath/ath9k/init.c | 9 +++++++--
>>   drivers/net/wireless/ath/ath9k/mac.c  | 5 +++++
>>   drivers/net/wireless/ath/ath9k/mac.h  | 3 ++-
>>   3 files changed, 14 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
>> index aba4151..7739b05 100644
>> --- a/drivers/net/wireless/ath/ath9k/init.c
>> +++ b/drivers/net/wireless/ath/ath9k/init.c
>> @@ -769,8 +769,13 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
>>   		IEEE80211_HW_REPORTS_TX_ACK_STATUS |
>>   		IEEE80211_HW_SUPPORTS_RC_TABLE;
>>
>> -	if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT)
>> -		 hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
>> +	if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) {
>> +		hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
>> +
>> +		if (AR_SREV_9280_20_OR_LATER(ah))
>> +			hw->radiotap_mcs_details |=
>> +				IEEE80211_RADIOTAP_MCS_HAVE_STBC;
>> +	}
>
> Are you sure this is right? It seems that if other devices don't support
> STBC they can report all frames to be w/o STBC. Or do they support STBC
> but don't report it?

They support STBC but don't report it. First device whhic can report it 
is ar9280.


-- 
Regards,
Oleksij

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

* Re: [PATCH 2/2] ath9k: check for Rx-STBC flag and pass it to ieee80211
  2013-05-24 10:18   ` [PATCH 2/2] ath9k: check for Rx-STBC flag and pass it to ieee80211 Oleksij Rempel
  2013-05-24 10:29     ` Johannes Berg
@ 2013-05-24 11:35     ` Oleksij Rempel
  1 sibling, 0 replies; 20+ messages in thread
From: Oleksij Rempel @ 2013-05-24 11:35 UTC (permalink / raw)
  To: Oleksij Rempel; +Cc: ath9k-devel, linux-wireless

Am 24.05.2013 12:18, schrieb Oleksij Rempel:
> Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
> ---
>   drivers/net/wireless/ath/ath9k/init.c | 9 +++++++--
>   drivers/net/wireless/ath/ath9k/mac.c  | 5 +++++
>   drivers/net/wireless/ath/ath9k/mac.h  | 3 ++-
>   3 files changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
> index aba4151..7739b05 100644
> --- a/drivers/net/wireless/ath/ath9k/init.c
> +++ b/drivers/net/wireless/ath/ath9k/init.c
> @@ -769,8 +769,13 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
>   		IEEE80211_HW_REPORTS_TX_ACK_STATUS |
>   		IEEE80211_HW_SUPPORTS_RC_TABLE;
>
> -	if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT)
> -		 hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
> +	if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) {
> +		hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
> +
> +		if (AR_SREV_9280_20_OR_LATER(ah))
> +			hw->radiotap_mcs_details |=
> +				IEEE80211_RADIOTAP_MCS_HAVE_STBC;

comment for my self. i forgot to include <net/ieee80211_radiotap.h>
for IEEE80211_RADIOTAP_MCS_HAVE_STBC. This patch is broken.

-- 
Regards,
Oleksij

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

* [PATCH v4 2/2] ath9k: check for Rx-STBC flag and pass it to ieee80211
  2013-05-19  7:38 [PATCH 0/3] Work on STBC Rx monitoring Oleksij Rempel
                   ` (3 preceding siblings ...)
  2013-05-24 10:18 ` [PATCH 0/2] ath9k: STBC Rx monitoring Oleksij Rempel
@ 2013-05-24 18:30 ` Oleksij Rempel
  2013-05-30  8:57 ` [PATCH 0/3] Work on STBC Rx monitoring Oleksij Rempel
  5 siblings, 0 replies; 20+ messages in thread
From: Oleksij Rempel @ 2013-05-24 18:30 UTC (permalink / raw)
  To: ath9k-devel, linux-wireless; +Cc: Oleksij Rempel

This patch make use of STBC flag in DMA RX descriptor.
Only devices after ar9280 can provide this information.

If card support it we will set HAVE_STBC flag, to show
clint programm thet STBC is supported but not received.

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
 drivers/net/wireless/ath/ath9k/init.c | 10 ++++++++--
 drivers/net/wireless/ath/ath9k/mac.c  |  5 +++++
 drivers/net/wireless/ath/ath9k/mac.h  |  3 ++-
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index aba4151..b9c97d4 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -21,6 +21,7 @@
 #include <linux/ath9k_platform.h>
 #include <linux/module.h>
 #include <linux/relay.h>
+#include <net/ieee80211_radiotap.h>
 
 #include "ath9k.h"
 
@@ -769,8 +770,13 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
 		IEEE80211_HW_REPORTS_TX_ACK_STATUS |
 		IEEE80211_HW_SUPPORTS_RC_TABLE;
 
-	if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT)
-		 hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
+	if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) {
+		hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
+
+		if (AR_SREV_9280_20_OR_LATER(ah))
+			hw->radiotap_mcs_details |=
+				IEEE80211_RADIOTAP_MCS_HAVE_STBC;
+	}
 
 	if (AR_SREV_9160_10_OR_LATER(sc->sc_ah) || ath9k_modparam_nohwcrypt)
 		hw->flags |= IEEE80211_HW_MFP_CAPABLE;
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c
index a52081d..d055e38 100644
--- a/drivers/net/wireless/ath/ath9k/mac.c
+++ b/drivers/net/wireless/ath/ath9k/mac.c
@@ -593,6 +593,11 @@ int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds,
 		(ads.ds_rxstatus3 & AR_GI) ? RX_FLAG_SHORT_GI : 0;
 	rs->flag |=
 		(ads.ds_rxstatus3 & AR_2040) ? RX_FLAG_40MHZ : 0;
+	if (AR_SREV_9280_20_OR_LATER(ah))
+		rs->flag |=
+			(ads.ds_rxstatus3 & AR_STBC) ?
+				/* we can only Nss=1 STBC */
+				(1 << RX_FLAG_STBC_SHIFT) : 0;
 
 	if (ads.ds_rxstatus8 & AR_PreDelimCRCErr)
 		rs->rs_flags |= ATH9K_RX_DELIM_CRC_PRE;
diff --git a/drivers/net/wireless/ath/ath9k/mac.h b/drivers/net/wireless/ath/ath9k/mac.h
index 3f1e775..b02dfce 100644
--- a/drivers/net/wireless/ath/ath9k/mac.h
+++ b/drivers/net/wireless/ath/ath9k/mac.h
@@ -534,7 +534,8 @@ struct ar5416_desc {
 #define AR_2040             0x00000002
 #define AR_Parallel40       0x00000004
 #define AR_Parallel40_S     2
-#define AR_RxStatusRsvd30   0x000000f8
+#define AR_STBC             0x00000008 /* on ar9280 and later */
+#define AR_RxStatusRsvd30   0x000000f0
 #define AR_RxAntenna	    0xffffff00
 #define AR_RxAntenna_S	    8
 
-- 
1.8.1.2


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

* Re: [PATCH 0/3] Work on STBC Rx monitoring
  2013-05-19  7:38 [PATCH 0/3] Work on STBC Rx monitoring Oleksij Rempel
                   ` (4 preceding siblings ...)
  2013-05-24 18:30 ` [PATCH v4 " Oleksij Rempel
@ 2013-05-30  8:57 ` Oleksij Rempel
  5 siblings, 0 replies; 20+ messages in thread
From: Oleksij Rempel @ 2013-05-30  8:57 UTC (permalink / raw)
  To: Oleksij Rempel; +Cc: ath9k-devel, linux-wireless, Felix Fietkau

Any updates here? can some one please apply last two patches?
Felix?

Am 19.05.2013 09:38, schrieb Oleksij Rempel:
> This patch set will pass RxSTBC flags from ath9k to ieee80211
> and to radiotap.
> This field is now a part of radiotap specification:
> http://www.radiotap.org/defined-fields/MCS
>
> Oleksij Rempel (3):
>    mac80211: add STBC flag for radiotap
>    ath9k: remove useless flag conversation.
>    ath9k: check for Rx-STBC flag and pass it to ieee80211
>
>   drivers/net/wireless/ath/ath9k/ar9003_mac.c |  5 +++--
>   drivers/net/wireless/ath/ath9k/mac.c        | 16 ++++++++++++----
>   drivers/net/wireless/ath/ath9k/mac.h        |  4 +++-
>   drivers/net/wireless/ath/ath9k/recv.c       |  5 +----
>   include/net/ieee80211_radiotap.h            |  7 +++++++
>   include/net/mac80211.h                      |  4 ++++
>   net/mac80211/main.c                         |  3 ++-
>   net/mac80211/rx.c                           |  4 ++++
>   net/mac80211/status.c                       |  3 ++-
>   9 files changed, 38 insertions(+), 13 deletions(-)
>


-- 
Regards,
Oleksij

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

end of thread, other threads:[~2013-05-30  8:57 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-19  7:38 [PATCH 0/3] Work on STBC Rx monitoring Oleksij Rempel
2013-05-19  7:38 ` [PATCH 1/3] mac80211: add STBC flag for radiotap Oleksij Rempel
2013-05-22 19:24   ` Johannes Berg
2013-05-23  7:17     ` [PATCH v2 " Oleksij Rempel
2013-05-23 12:24       ` Johannes Berg
2013-05-23 14:11     ` [PATCH v3 " Oleksij Rempel
2013-05-23 21:33       ` Johannes Berg
2013-05-24 10:05     ` [PATCH v4 " Oleksij Rempel
2013-05-24 10:08       ` Johannes Berg
2013-05-24 10:11         ` Oleksij Rempel
2013-05-19  7:38 ` [PATCH 2/3] ath9k: remove useless flag conversation Oleksij Rempel
2013-05-19  7:38 ` [PATCH 3/3] ath9k: check for Rx-STBC flag and pass it to ieee80211 Oleksij Rempel
2013-05-24 10:18 ` [PATCH 0/2] ath9k: STBC Rx monitoring Oleksij Rempel
2013-05-24 10:18   ` [PATCH 1/2] ath9k: remove useless flag conversation Oleksij Rempel
2013-05-24 10:18   ` [PATCH 2/2] ath9k: check for Rx-STBC flag and pass it to ieee80211 Oleksij Rempel
2013-05-24 10:29     ` Johannes Berg
2013-05-24 10:32       ` Oleksij Rempel
2013-05-24 11:35     ` Oleksij Rempel
2013-05-24 18:30 ` [PATCH v4 " Oleksij Rempel
2013-05-30  8:57 ` [PATCH 0/3] Work on STBC Rx monitoring Oleksij Rempel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).