From patchwork Tue Feb 3 10:41:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Puzyniak X-Patchwork-Id: 5767371 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 1E5589F2ED for ; Tue, 3 Feb 2015 10:40:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4430020C2E for ; Tue, 3 Feb 2015 10:40:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3CDFE20C33 for ; Tue, 3 Feb 2015 10:40:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755323AbbBCKkh (ORCPT ); Tue, 3 Feb 2015 05:40:37 -0500 Received: from mail-wg0-f46.google.com ([74.125.82.46]:43755 "EHLO mail-wg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752291AbbBCKka (ORCPT ); Tue, 3 Feb 2015 05:40:30 -0500 Received: by mail-wg0-f46.google.com with SMTP id l2so43797616wgh.5 for ; Tue, 03 Feb 2015 02:40:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rjsgmyntlvUHJabGrYRcRzrUVjc2KnsuoYAzdZnKpuU=; b=lnJDiK6L07DORN6wiwmtVRnh8f1efD7eNFva/mI19TMxi/jjhZs9p8cYb6Nw4k0uhk JDhg5iPO4DGd+8BIaUvTVkelZy/QcHqgzzaQ+GbBU7HfnN3mBedUHsFFSM+zl894ehDn 4vfEYSaWjaoAXlu+FIlilnOfk72bDiuQ7Ny14= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rjsgmyntlvUHJabGrYRcRzrUVjc2KnsuoYAzdZnKpuU=; b=Y0qQsT5daHKAl29vCtMGTcIZtVqBg6WoiHhbhKZjlmnguF3PUTvG6Q9NZFUAzwbzGf DKGqILY8RfHvhWAhCWfA3Zyx7W0N6WDAYwA3V0Ge/jkfjE2Z5gUkZV9InJoszPk3mr8h 69OBmpsNUdIrI0CiRBCS911Y1NsEQzZw//p48trWCwdDI5CMa8wvH8Wje1hcCPbSKh1a RuGgurFd9bzJFmD4hMe3UZs+bVxKMQy+aeN7TCAw47sG2JZJ9vYAxgCXtOqCUyMPiWcL O97F+BrM2X42yAxmE8mS0HwwOGjNlZuuQbGtGFTvmxjddtBsVDUb2D1xqOvOiu64u1s+ PWmw== X-Gm-Message-State: ALoCoQmfH/28Z4jXGdm7YMTYDlySF2TAuSKmiHSmlUMTRcoSFX1/oxT5QtfKs2ALsOSFnLkOxdf5DijzZCQdcTqz79e4xS2Kd7SRNZu8lkKKtungH8nG7bqt73OeBvolU6jgKSNET8EO X-Received: by 10.180.105.10 with SMTP id gi10mr33019580wib.24.1422960029446; Tue, 03 Feb 2015 02:40:29 -0800 (PST) Received: from dell-lap.com (apn-31-1-134-151.dynamic.gprs.plus.pl. [31.1.134.151]) by mx.google.com with ESMTPSA id v7sm23981339wib.5.2015.02.03.02.40.28 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 Feb 2015 02:40:28 -0800 (PST) From: Marek Puzyniak To: ath10k@lists.infradead.org, linux-wireless@vger.kernel.org Cc: Marek Puzyniak Subject: [RFC 3/4] mac80211: initialize rate control earlier for tdls station Date: Tue, 3 Feb 2015 11:41:53 +0100 Message-Id: <1422960114-25137-4-git-send-email-marek.puzyniak@tieto.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1422960114-25137-1-git-send-email-marek.puzyniak@tieto.com> References: <1422960114-25137-1-git-send-email-marek.puzyniak@tieto.com> X-DomainID: tieto.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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,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 Currently when TDLS station in driver goes from assoc to authorized state it can not use rate control parameters because rate control is not initialized yet. Some drivers require parameters already initialized by rate control when entering authorized state. It can be done by initializing rate control after station transition to authorized state but before notifying driver about that. Signed-off-by: Marek Puzyniak --- net/mac80211/cfg.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index a777114..3849054 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -952,12 +952,21 @@ static int sta_apply_auth_flags(struct ieee80211_local *local, } if (mask & BIT(NL80211_STA_FLAG_AUTHORIZED)) { - if (set & BIT(NL80211_STA_FLAG_AUTHORIZED)) + if (set & BIT(NL80211_STA_FLAG_AUTHORIZED)) { + /* + * When peer becomes authorized, init rate control as + * well. Some drivers require rate control initialized + * before drv_sta_state() is called. + */ + if (test_sta_flag(sta, WLAN_STA_TDLS_PEER)) + rate_control_rate_init(sta); + ret = sta_info_move_state(sta, IEEE80211_STA_AUTHORIZED); - else if (test_sta_flag(sta, WLAN_STA_AUTHORIZED)) + } else if (test_sta_flag(sta, WLAN_STA_AUTHORIZED)) { ret = sta_info_move_state(sta, IEEE80211_STA_ASSOC); - else + } else { ret = 0; + } if (ret) return ret; } @@ -1346,11 +1355,6 @@ static int ieee80211_change_station(struct wiphy *wiphy, if (err) goto out_err; - /* When peer becomes authorized, init rate control as well */ - if (test_sta_flag(sta, WLAN_STA_TDLS_PEER) && - test_sta_flag(sta, WLAN_STA_AUTHORIZED)) - rate_control_rate_init(sta); - mutex_unlock(&local->sta_mtx); if ((sdata->vif.type == NL80211_IFTYPE_AP ||