From patchwork Wed Feb 27 12:00:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karl Beldan X-Patchwork-Id: 2193071 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 9B1CC3FD4E for ; Wed, 27 Feb 2013 12:03:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759870Ab3B0MDD (ORCPT ); Wed, 27 Feb 2013 07:03:03 -0500 Received: from mail-wi0-f181.google.com ([209.85.212.181]:59310 "EHLO mail-wi0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759790Ab3B0MDC (ORCPT ); Wed, 27 Feb 2013 07:03:02 -0500 Received: by mail-wi0-f181.google.com with SMTP id hm6so539575wib.14 for ; Wed, 27 Feb 2013 04:03:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=LhQvkEGfAKsSv0vsnY/uZyHtRaR1+uOPqOtaBTecdSY=; b=K6HNHbiGUpdMOkicHrxZrqJ6H0w8bB8OInHfxDw9CoweIvwjyotpmbInOX+w43XMtw ZBWV1BxGT4/cVs9mRIISD1Ketytqf9gC3e+Q8cLymoMYseqwSyjhtCvrzKhjjR86xt8S gXXLerBfL44i2NUBa3MPFmlAYmULMZi/z8knnjWmn6n/fPso91engsxSIAuKRjQpRcik YEQU76uh/byVTc5YB8wjqYwctwuq24d+wjcKTza4AJNYgMDvW6OvpIeD7oTd/bNmkZyY HqbrijxqMJIE9XHnViORivMPdqW6cUDmwuTRTUFG6tDLuXWhXRH1jyEuuetD8q9YXI9f BAeA== X-Received: by 10.180.103.161 with SMTP id fx1mr25726980wib.25.1361966580656; Wed, 27 Feb 2013 04:03:00 -0800 (PST) Received: from magnum.frso.rivierawaves.com (vpn.rivierawaves.com. [91.151.119.162]) by mx.google.com with ESMTPS id cf8sm8269378wib.1.2013.02.27.04.02.59 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 27 Feb 2013 04:02:59 -0800 (PST) From: Karl Beldan To: Johannes Berg Cc: linux-wireless , Karl Beldan , Karl Beldan Subject: [PATCH 2/2] mac80211: fix the check for mcs rates masking Date: Wed, 27 Feb 2013 13:00:34 +0100 Message-Id: <1361966434-28343-2-git-send-email-karl.beldan@gmail.com> X-Mailer: git-send-email 1.7.10.GIT In-Reply-To: <1361966434-28343-1-git-send-email-karl.beldan@gmail.com> References: <1361966434-28343-1-git-send-email-karl.beldan@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Karl Beldan Currently the mcs bitrates mask rate_idx_mcs_mask is only applied when the pre-ht bitrates mask rate_idx_mask of the same band differs from the default mask. Fix it by comparing the rate_idx_mcs_mask with the ht_cap.mcs.rx_mask, the copy of the rate_idx_mcs_mask is now done if the check succeeds. This results, when no pre-ht bitrates is disabled && an mcs idx is, to one more memcmp, otherwise the cost remains identical. Signed-off-by: Karl Beldan --- net/mac80211/rate.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c index cfbd7d5..4c0a14d 100644 --- a/net/mac80211/rate.c +++ b/net/mac80211/rate.c @@ -460,8 +460,11 @@ void rate_control_get_rate(struct ieee80211_sub_if_data *sdata, * the common case. */ mask = txrc->rate_idx_mask; - memcpy(mcs_mask, txrc->rate_idx_mcs_mask, sizeof(mcs_mask)); - if (mask != (1 << txrc->sband->n_bitrates) - 1) { + if (mask != (1 << txrc->sband->n_bitrates) - 1 || + memcmp(txrc->sband->ht_cap.mcs.rx_mask, txrc->rate_idx_mcs_mask, + sizeof(txrc->rate_idx_mcs_mask))) { + memcpy(mcs_mask, txrc->rate_idx_mcs_mask, sizeof(mcs_mask)); + if (sta) { /* Filter out rates that the STA does not support */ mask &= sta->sta.supp_rates[info->band];