From patchwork Sat Jul 25 14:32:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 6865111 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 33F2EC05AC for ; Sat, 25 Jul 2015 14:32:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 675E12065B for ; Sat, 25 Jul 2015 14:32:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7AFB920652 for ; Sat, 25 Jul 2015 14:32:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932085AbbGYOci (ORCPT ); Sat, 25 Jul 2015 10:32:38 -0400 Received: from mail-wi0-f182.google.com ([209.85.212.182]:38111 "EHLO mail-wi0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932075AbbGYOch (ORCPT ); Sat, 25 Jul 2015 10:32:37 -0400 Received: by wibxm9 with SMTP id xm9so65211910wib.1 for ; Sat, 25 Jul 2015 07:32:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VWwPH2gIVvDNPRuH7wYXtTsw+VqaiBrWp7cyB1TqRSg=; b=t0nFWzu4suNYfV85HgDSn6KLmfHh4lkzgoEqSIdaIIlZXdWi4YgSivDA/5xGvxyIev LWAP6usUYhJVEshdPXwiwfs/dIiT6OesKQOV9oy8N5T1j6DRHyKHEtfF+FekEoOrxgfs yGU2G66+7paSI1bxbzKYPYSjYnxcLKNPHhU2fWYxaRCcMYvHNy2whV4I0IB0OKxTC5L/ 5FaH0fyxRT+VwWbzRHpdbg219Ui8cldXDGGnHTyqND/VE8qBMOs3yZ22WIKgX+oxjtW+ S/CeEuhZDuvLnxTuMARJ8kNzaosxekZTqPJ9jYpaA/mz/ZGroZKO1D4spidmJcwVm5b5 WYzw== X-Received: by 10.194.48.108 with SMTP id k12mr39729808wjn.151.1437834756452; Sat, 25 Jul 2015 07:32:36 -0700 (PDT) Received: from kxps.8.8.4.4 (ppp-133-20.30-151.libero.it. [151.30.20.133]) by smtp.gmail.com with ESMTPSA id lj2sm3545280wic.1.2015.07.25.07.32.35 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 25 Jul 2015 07:32:35 -0700 (PDT) From: Lorenzo Bianconi To: linux-wireless@vger.kernel.org Cc: johannes@sipsolutions.net Subject: [RFC 3/4] mac80211: define rate_control_apply_mask_ratetbl() Date: Sat, 25 Jul 2015 16:32:28 +0200 Message-Id: <1437834749-23765-4-git-send-email-lorenzo.bianconi83@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1437834749-23765-1-git-send-email-lorenzo.bianconi83@gmail.com> References: <1437834749-23765-1-git-send-email-lorenzo.bianconi83@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-8.0 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 Define rate_control_apply_mask_ratetbl() in order to apply ratemask in rate_control_set_rates() for station rate table Signed-off-by: Lorenzo Bianconi --- net/mac80211/rate.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c index 4f61ca0..7e71de9 100644 --- a/net/mac80211/rate.c +++ b/net/mac80211/rate.c @@ -651,6 +651,30 @@ static bool rate_control_cap_mask(struct ieee80211_sub_if_data *sdata, return true; } +static void +rate_control_apply_mask_ratetbl(struct sta_info *sta, + struct ieee80211_supported_band *sband, + struct ieee80211_sta_rates *rates) +{ + int i; + u32 mask; + u8 mcs_mask[IEEE80211_HT_MCS_MASK_LEN]; + enum nl80211_chan_width chan_width; + + if (!rate_control_cap_mask(sta->sdata, sband, &sta->sta, &mask, + mcs_mask)) + return; + + chan_width = sta->sdata->vif.bss_conf.chandef.width; + for (i = 0; i < IEEE80211_TX_RATE_TABLE_SIZE; i++) { + if (rates->rate[i].idx < 0) + break; + + rate_idx_match_mask(&rates->rate[i].idx, &rates->rate[i].flags, + sband, chan_width, mask, mcs_mask); + } +} + static void rate_control_apply_mask(struct ieee80211_sub_if_data *sdata, struct ieee80211_sta *sta, struct ieee80211_supported_band *sband, @@ -766,7 +790,10 @@ int rate_control_set_rates(struct ieee80211_hw *hw, { struct sta_info *sta = container_of(pubsta, struct sta_info, sta); struct ieee80211_sta_rates *old; + struct ieee80211_supported_band *sband; + sband = hw->wiphy->bands[ieee80211_get_sdata_band(sta->sdata)]; + rate_control_apply_mask_ratetbl(sta, sband, rates); /* * mac80211 guarantees that this function will not be called * concurrently, so the following RCU access is safe, even without