From: Karl Beldan <karl.beldan@gmail.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: Felix Fietkau <nbd@openwrt.org>,
linux-wireless <linux-wireless@vger.kernel.org>,
Karl Beldan <karl.beldan@rivierawaves.com>
Subject: [PATCH 1/2] mac80211: minstrels: spare numerous useless calls to get_random_bytes
Date: Fri, 8 Nov 2013 17:34:32 +0100 [thread overview]
Message-ID: <1383928473-798-1-git-send-email-karl.beldan@gmail.com> (raw)
From: Karl Beldan <karl.beldan@rivierawaves.com>
These are called to init the sample tables.
This occurs once in minstrel_ht upon its registration (since it uses one
single common sample table for all STAs), and once per sta addition in
minstrel.
Signed-off-by: Karl Beldan <karl.beldan@rivierawaves.com>
---
net/mac80211/rc80211_minstrel.c | 3 +--
net/mac80211/rc80211_minstrel_ht.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
index 7fa1b36..a40e4e3 100644
--- a/net/mac80211/rc80211_minstrel.c
+++ b/net/mac80211/rc80211_minstrel.c
@@ -422,10 +422,9 @@ init_sample_table(struct minstrel_sta_info *mi)
memset(mi->sample_table, 0xff, SAMPLE_COLUMNS * mi->n_rates);
for (col = 0; col < SAMPLE_COLUMNS; col++) {
+ get_random_bytes(rnd, sizeof(rnd));
for (i = 0; i < mi->n_rates; i++) {
- get_random_bytes(rnd, sizeof(rnd));
new_idx = (i + rnd[i & 7]) % mi->n_rates;
-
while (SAMPLE_TBL(mi, new_idx, col) != 0xff)
new_idx = (new_idx + 1) % mi->n_rates;
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c
index 5d60779..aeec401 100644
--- a/net/mac80211/rc80211_minstrel_ht.c
+++ b/net/mac80211/rc80211_minstrel_ht.c
@@ -1052,10 +1052,9 @@ init_sample_table(void)
memset(sample_table, 0xff, sizeof(sample_table));
for (col = 0; col < SAMPLE_COLUMNS; col++) {
+ get_random_bytes(rnd, sizeof(rnd));
for (i = 0; i < MCS_GROUP_RATES; i++) {
- get_random_bytes(rnd, sizeof(rnd));
new_idx = (i + rnd[i]) % MCS_GROUP_RATES;
-
while (sample_table[col][new_idx] != 0xff)
new_idx = (new_idx + 1) % MCS_GROUP_RATES;
--
1.8.2
next reply other threads:[~2013-11-08 16:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-08 16:34 Karl Beldan [this message]
2013-11-08 16:34 ` [PATCH 2/2] mac80211: minstrel_ht: do not sample unsupported rates Karl Beldan
2013-11-08 16:43 ` Felix Fietkau
2013-11-08 16:54 ` Karl Beldan
2013-11-11 12:10 ` [PATCH v2] " Karl Beldan
2013-11-11 15:46 ` Johannes Berg
2013-11-11 19:44 ` Karl Beldan
2013-11-08 16:39 ` [PATCH 1/2] mac80211: minstrels: spare numerous useless calls to get_random_bytes Felix Fietkau
2013-11-11 15:45 ` Johannes Berg
2013-11-11 19:43 ` Karl Beldan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1383928473-798-1-git-send-email-karl.beldan@gmail.com \
--to=karl.beldan@gmail.com \
--cc=johannes@sipsolutions.net \
--cc=karl.beldan@rivierawaves.com \
--cc=linux-wireless@vger.kernel.org \
--cc=nbd@openwrt.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).