From patchwork Fri Nov 8 16:34:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karl Beldan X-Patchwork-Id: 3159031 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9461C9F326 for ; Fri, 8 Nov 2013 16:35:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EC19120445 for ; Fri, 8 Nov 2013 16:35:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4F45520443 for ; Fri, 8 Nov 2013 16:35:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757526Ab3KHQe6 (ORCPT ); Fri, 8 Nov 2013 11:34:58 -0500 Received: from mail-wg0-f52.google.com ([74.125.82.52]:49186 "EHLO mail-wg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757511Ab3KHQe6 (ORCPT ); Fri, 8 Nov 2013 11:34:58 -0500 Received: by mail-wg0-f52.google.com with SMTP id z12so1100232wgg.7 for ; Fri, 08 Nov 2013 08:34:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=cUCdYuLu03XIRjC5gBuI0y2eqWdyMVw6WDkRQT/Uzcg=; b=yssfj5slLd4acvrfTDSAJd3zpsv9mGHp5b/jyKkzlWikTfz4rmoxWsUy2leoqVc/l4 jL2Xtm40hVYYi9T1R3RQr0YiSKexNSeja1ev4dYTjPx/KwEvy4MM+MD8QO9BagF1ro7G 3G5gKUdEQwjLMFJd1Dqnpwwa1MPEfmV9G2m3FY1hFJ51rFML0FMdhdnt/jqOi5Fh0qtC sVOUEcoH9sBwgM5fssYO9Sz6H2C7bzE2Uc/Om4XxmwGMotFgntSupvmw39erqCPlAuBl TJeqt0lpcLyNbIJvaeprbCrHUU2sZCTZbi5jq11Yddhepvh7spwWsbHZYA8E9wjp5ELS B94g== X-Received: by 10.180.91.67 with SMTP id cc3mr2987042wib.65.1383928496725; Fri, 08 Nov 2013 08:34:56 -0800 (PST) Received: from magnum.frso.rivierawaves.com (vpn.rivierawaves.com. [91.151.119.162]) by mx.google.com with ESMTPSA id y20sm7032703wib.0.2013.11.08.08.34.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Nov 2013 08:34:56 -0800 (PST) From: Karl Beldan To: Johannes Berg Cc: Felix Fietkau , linux-wireless , Karl Beldan Subject: [PATCH 1/2] mac80211: minstrels: spare numerous useless calls to get_random_bytes Date: Fri, 8 Nov 2013 17:34:32 +0100 Message-Id: <1383928473-798-1-git-send-email-karl.beldan@gmail.com> X-Mailer: git-send-email 1.8.2 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Karl Beldan 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 Acked-by: Felix Fietkau --- 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;