linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iw: fix typos in MCS set parsing code
@ 2009-08-11  6:47 Gabor Juhos
  2009-08-11  6:54 ` Johannes Berg
  0 siblings, 1 reply; 3+ messages in thread
From: Gabor Juhos @ 2009-08-11  6:47 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Luis R. Rodriguez, Gabor Juhos

The current code uses wrong binary operator for masking,
and the shift values for the 'tx_max_num_spatial_streams' and
'tx_unequal_modulation' fields are off-by-one.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
 info.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/info.c b/info.c
index 2db0fc7..542745b 100644
--- a/info.c
+++ b/info.c
@@ -159,8 +159,8 @@ static int print_phy_handler(struct nl_msg *msg, void *arg)
 			max_rx_supp_data_rate = ((mcs[10] >> 8) & ((mcs[11] & 0x3) << 8));
 			tx_mcs_set_defined = !!(mcs[12] & (1 << 0));
 			tx_mcs_set_equal = !(mcs[12] & (1 << 1));
-			tx_max_num_spatial_streams = (mcs[12] | ((1 << 3) | (1 << 4))) + 1;
-			tx_unequal_modulation = !!(mcs[12] & (1 << 5));
+			tx_max_num_spatial_streams = (mcs[12] & ((1 << 2) | (1 << 3))) + 1;
+			tx_unequal_modulation = !!(mcs[12] & (1 << 4));
 
 			if (max_rx_supp_data_rate)
 				printf("\t\tHT Max RX data rate: %d Mbps\n", max_rx_supp_data_rate);
-- 
1.5.3.2


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

* Re: [PATCH] iw: fix typos in MCS set parsing code
  2009-08-11  6:47 [PATCH] iw: fix typos in MCS set parsing code Gabor Juhos
@ 2009-08-11  6:54 ` Johannes Berg
  2009-08-11  7:20   ` Gabor Juhos
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2009-08-11  6:54 UTC (permalink / raw)
  To: Gabor Juhos; +Cc: linux-wireless, Luis R. Rodriguez

[-- Attachment #1: Type: text/plain, Size: 655 bytes --]

On Tue, 2009-08-11 at 08:47 +0200, Gabor Juhos wrote:
> The current code uses wrong binary operator for masking,
> and the shift values for the 'tx_max_num_spatial_streams' and
> 'tx_unequal_modulation' fields are off-by-one.

> -			tx_max_num_spatial_streams = (mcs[12] | ((1 << 3) | (1 << 4))) + 1;
> -			tx_unequal_modulation = !!(mcs[12] & (1 << 5));
> +			tx_max_num_spatial_streams = (mcs[12] & ((1 << 2) | (1 << 3))) + 1;
> +			tx_unequal_modulation = !!(mcs[12] & (1 << 4));

Are you sure? The "Supported MCS Set" field is defined as a series of
_bits_, and the bits are transmitted the other way around within each
byte.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

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

* Re: [PATCH] iw: fix typos in MCS set parsing code
  2009-08-11  6:54 ` Johannes Berg
@ 2009-08-11  7:20   ` Gabor Juhos
  0 siblings, 0 replies; 3+ messages in thread
From: Gabor Juhos @ 2009-08-11  7:20 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Luis R. Rodriguez

Johannes Berg írta:
> On Tue, 2009-08-11 at 08:47 +0200, Gabor Juhos wrote:
>> The current code uses wrong binary operator for masking,
>> and the shift values for the 'tx_max_num_spatial_streams' and
>> 'tx_unequal_modulation' fields are off-by-one.
> 
>> -			tx_max_num_spatial_streams = (mcs[12] | ((1 << 3) | (1 << 4))) + 1;
>> -			tx_unequal_modulation = !!(mcs[12] & (1 << 5));
>> +			tx_max_num_spatial_streams = (mcs[12] & ((1 << 2) | (1 << 3))) + 1;
>> +			tx_unequal_modulation = !!(mcs[12] & (1 << 4));
> 
> Are you sure? The "Supported MCS Set" field is defined as a series of
> _bits_, and the bits are transmitted the other way around within each
> byte.

Yes, I'm sure. Here are the relevant definitions from <linux/ieee80211.h>:

#define IEEE80211_HT_MCS_TX_DEFINED             0x01
#define IEEE80211_HT_MCS_TX_RX_DIFF             0x02
/* value 0 == 1 stream etc */
#define IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK    0x0C
#define IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT   2
#define         IEEE80211_HT_MCS_TX_MAX_STREAMS 4
#define IEEE80211_HT_MCS_TX_UNEQUAL_MODULATION  0x10

Gabor


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

end of thread, other threads:[~2009-08-11 12:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-11  6:47 [PATCH] iw: fix typos in MCS set parsing code Gabor Juhos
2009-08-11  6:54 ` Johannes Berg
2009-08-11  7:20   ` Gabor Juhos

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