From: Rakesh Kumar Date: Thu, 18 Mar 2010 13:51:42 -0500 Subject: [ath9k-devel] The expectation of rateset_to_mask in net/wireless/nl80211.c Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: ath9k-devel@lists.ath9k.org Hey, I wanted to modify iw to support NL80211_CMD_SET_TX_BITRATE_MASK and thus wanted to be clear about the expected input from the user-space. I see that the function rateset_to_mask converts an array of u8 received from userspace via netlink to a u32 mask for legacy rate. It uses following lines of code to achieve that: *for (i = 0; i < rates_len; i++) { int rate = (rates[i] & 0x7f) * 5; int ridx; for (ridx = 0; ridx < sband->n_bitrates; ridx++) { struct ieee80211_rate *srate = &sband->bitrates[ridx]; if (rate == srate->bitrate) { mask |= 1 << ridx; break; } } if (ridx == sband->n_bitrates) return 0; /* rate not found */ }* What I don't understand is the line * int rate = (rates[i] & 0x7f) * 5;* * * I am working with ath9k driver and the sband->bitrates array contains following values in that case: *2 RATE(10, 0x1b, 0),* *4 RATE(20, 0x1a, IEEE80211_RATE_SHORT_PREAMBLE),* *11 RATE(55, 0x19, IEEE80211_RATE_SHORT_PREAMBLE),* *22 RATE(110, 0x18, IEEE80211_RATE_SHORT_PREAMBLE),* *12 RATE(60, 0x0b, 0),* *18 RATE(90, 0x0f, 0),* *24 RATE(120, 0x0a, 0),* *36 RATE(180, 0x0e, 0),* *48 RATE(240, 0x09, 0),* *72 RATE(360, 0x0d, 0),* *96 RATE(480, 0x08, 0),* *108 RATE(540, 0x0c, 0),* But what beats me is that *why are we multiplying the incoming rate numbers by 5*? A prompt reply shall be highly appreciated. -- Rakesh -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.ath9k.org/pipermail/ath9k-devel/attachments/20100318/8202f18f/attachment.htm