From patchwork Thu Aug 6 21:47:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 6963171 X-Patchwork-Delegate: johannes@sipsolutions.net 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1EA759F52D for ; Thu, 6 Aug 2015 21:47:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4766620695 for ; Thu, 6 Aug 2015 21:47:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 29E352068E for ; Thu, 6 Aug 2015 21:47:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756575AbbHFVro (ORCPT ); Thu, 6 Aug 2015 17:47:44 -0400 Received: from mail-wi0-f174.google.com ([209.85.212.174]:37486 "EHLO mail-wi0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756287AbbHFVrl (ORCPT ); Thu, 6 Aug 2015 17:47:41 -0400 Received: by wibhh20 with SMTP id hh20so41708416wib.0 for ; Thu, 06 Aug 2015 14:47:40 -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=a05GVJRumQUILUfuxzHTQKTQkFjR8r6XxSAPN1w6Qap9XUj/x81LspXcwDIcL57694 LVYc6ZGcC210/eU6O2yxdfqyK4JNKZQfCN+GXr4zEH9EOnz9guSbRI2ZtoHWKpwoG4f3 AI/XCrNIf9SyUTsxe/RTC1UPGL7am+KH6fN7lAu7vyq5rIGixWyYTKrkt9gOWvlrcKzU pvkULefcUXZxZiaZYEDG2sNjR5G0RTCyGjtAe5+3waWcy8c2W60pa75N9v+vzgTW+ZDk jo1uBElMOE8w4ymg2VgJSEFGn7mHAV9Y6AGS/5A/CxSfC9YNL6N6+Iuhffhb2QymBWWC k/hw== X-Received: by 10.180.87.99 with SMTP id w3mr140988wiz.4.1438897660886; Thu, 06 Aug 2015 14:47:40 -0700 (PDT) Received: from localhost.localdomain (host21-198-dynamic.25-79-r.retail.telecomitalia.it. [79.25.198.21]) by smtp.gmail.com with ESMTPSA id fa8sm5275844wib.14.2015.08.06.14.47.39 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 06 Aug 2015 14:47:40 -0700 (PDT) From: Lorenzo Bianconi To: linux-wireless@vger.kernel.org Cc: johannes@sipsolutions.net Subject: [PATCH 3/4] mac80211: define rate_control_apply_mask_ratetbl() Date: Thu, 6 Aug 2015 23:47:32 +0200 Message-Id: <1438897653-4629-4-git-send-email-lorenzo.bianconi83@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1438897653-4629-1-git-send-email-lorenzo.bianconi83@gmail.com> References: <1438897653-4629-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=-6.9 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