From patchwork Thu Nov 27 12:30:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emmanuel Grumbach X-Patchwork-Id: 5395981 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 B21099F39B for ; Thu, 27 Nov 2014 12:35:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ECC75201E4 for ; Thu, 27 Nov 2014 12:35:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1F56F2015E for ; Thu, 27 Nov 2014 12:35:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754717AbaK0MfX (ORCPT ); Thu, 27 Nov 2014 07:35:23 -0500 Received: from mga11.intel.com ([192.55.52.93]:5645 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754703AbaK0MfU (ORCPT ); Thu, 27 Nov 2014 07:35:20 -0500 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 27 Nov 2014 04:35:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="422244841" Received: from unknown (HELO egrumbacLAB.jer.intel.com) ([10.12.217.187]) by FMSMGA003.fm.intel.com with ESMTP; 27 Nov 2014 04:25:25 -0800 From: Emmanuel Grumbach To: linux-wireless@vger.kernel.org Cc: michal.kazior@tieto.com, Emmanuel Grumbach Subject: [RFC] mac80211: take reserved vif into account when calculating the min_def Date: Thu, 27 Nov 2014 14:30:46 +0200 Message-Id: <1417091446-16308-1-git-send-email-emmanuel.grumbach@intel.com> X-Mailer: git-send-email 1.9.1 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, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 When we want to calculate the minimal bandwidth needed for a channel context, we need to take into account vifs that have reserved the channel context. I hit an issue with iwlwifi and channel switch as a client. We would allocate a virgin channel context and reserve it. At that stage, the min_def was 20MHz. Then we would use it after CSA, and start transmitting, but the channel context was still 20MHz even if the GO was in 40MHz. This made the firmware unhappy. Signed-off-by: Emmanuel Grumbach --- net/mac80211/chan.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index 4c74e8d..769e0c5 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c @@ -256,7 +256,8 @@ ieee80211_get_chanctx_max_required_bw(struct ieee80211_local *local, if (!ieee80211_sdata_running(sdata)) continue; - if (rcu_access_pointer(sdata->vif.chanctx_conf) != conf) + if (rcu_access_pointer(sdata->vif.chanctx_conf) != conf && + &sdata->reserved_chanctx->conf != conf) continue; switch (vif->type) { @@ -271,6 +272,7 @@ ieee80211_get_chanctx_max_required_bw(struct ieee80211_local *local, case NL80211_IFTYPE_WDS: case NL80211_IFTYPE_MESH_POINT: width = vif->bss_conf.chandef.width; + width = max(width, sdata->reserved_chandef.width); break; case NL80211_IFTYPE_UNSPECIFIED: case NUM_NL80211_IFTYPES: @@ -899,6 +901,8 @@ int ieee80211_vif_reserve_chanctx(struct ieee80211_sub_if_data *sdata, sdata->reserved_radar_required = radar_required; sdata->reserved_ready = false; + ieee80211_recalc_chanctx_min_def(local, new_ctx); + return 0; }