From patchwork Mon Nov 24 14:34:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emmanuel Grumbach X-Patchwork-Id: 5367091 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 567E29F39D for ; Mon, 24 Nov 2014 14:36:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6FA3A20395 for ; Mon, 24 Nov 2014 14:36:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 87BF8202C8 for ; Mon, 24 Nov 2014 14:36:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932309AbaKXOge (ORCPT ); Mon, 24 Nov 2014 09:36:34 -0500 Received: from mail-wi0-f175.google.com ([209.85.212.175]:37539 "EHLO mail-wi0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932288AbaKXOgc (ORCPT ); Mon, 24 Nov 2014 09:36:32 -0500 Received: by mail-wi0-f175.google.com with SMTP id l15so5859214wiw.14 for ; Mon, 24 Nov 2014 06:36:31 -0800 (PST) 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=V1d04w2W4UR5qKYIcSr+DnO6BJUOYAW4rfHs2SHedrE=; b=EbZfwieuwoCVwUIY7EUA4P+6cRZXnYD1U3t6vjh+iQi/mkYQZ9twVurpjBa5hRBSho hlqraljllrU0kMGd8ojaGdqpI9xUEvgvTZu5tj6zcw65dAcQoevBqfB5EhB/aLP4xqjn yfze3Zts1cwu2E+tXGULT2qIkb4gke2VZUH3OMGdoMGj+cumuhvNAWGDGnMhccgjextz FM8NAS2RhLc48lcmeX773LLxXQErKxnxz/+3y/3WiMH6ZfT5zh9Jr2OtNSbhTYyPwmx4 qaF2OaiJn8i6Os/Oc//YI3dCYCE3/TJ9sRhlCLGeJttZ6bd+9VnXM73jisXwGCbwT9P1 jVPw== X-Received: by 10.194.103.232 with SMTP id fz8mr35113471wjb.110.1416839791556; Mon, 24 Nov 2014 06:36:31 -0800 (PST) Received: from localhost.localdomain (46-116-150-134.bb.netvision.net.il. [46.116.150.134]) by mx.google.com with ESMTPSA id n3sm21274744wjz.21.2014.11.24.06.36.30 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Nov 2014 06:36:30 -0800 (PST) From: Emmanuel Grumbach To: linux-wireless@vger.kernel.org Cc: Luciano Coelho Subject: [PATCH 58/75] iwlwifi: mvm: schedule CSA time event a bit before beacon 1 Date: Mon, 24 Nov 2014 16:34:34 +0200 Message-Id: <1416839691-28533-58-git-send-email-egrumbach@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: 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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 From: Luciano Coelho Instead of using a hardcoded number of TUs before beacon 0 as the time to start the absence and actual channel switch, calculate it in relation to the beacon interval. We use 10 TUs + beacon interval before beacon 0 to target a bit before beacon 1. This gives us enough time to switch to the new channel before the AP/GO switches. Signed-off-by: Luciano Coelho --- drivers/net/wireless/iwlwifi/mvm/mac80211.c | 12 ++++++++---- drivers/net/wireless/iwlwifi/mvm/mvm.h | 13 +++++++++---- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index ac1cef6..3ce5831 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c @@ -3189,14 +3189,18 @@ static int iwl_mvm_pre_channel_switch(struct ieee80211_hw *hw, break; case NL80211_IFTYPE_STATION: - apply_time = chsw->timestamp + - (vif->bss_conf.beacon_int * chsw->count * 1024); + /* Schedule the time event to a bit before beacon 1, + * to make sure we're in the new channel when the + * GO/AP arrives. + */ + apply_time = chsw->device_timestamp + + ((vif->bss_conf.beacon_int * (chsw->count - 1) - + IWL_MVM_CHANNEL_SWITCH_TIME_CLIENT) * 1024); if (chsw->block_tx) iwl_mvm_csa_client_absent(mvm, vif); - iwl_mvm_schedule_csa_period(mvm, vif, - IWL_MVM_CHANNEL_SWITCH_TIME_CLIENT, + iwl_mvm_schedule_csa_period(mvm, vif, vif->bss_conf.beacon_int, apply_time); break; default: diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h index 2816c6b..99a2590 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h @@ -87,12 +87,17 @@ /* A TimeUnit is 1024 microsecond */ #define MSEC_TO_TU(_msec) (_msec*1000/1024) -/* These values represent the number of TUs before CSA "beacon 0" TBTT - * when the CSA time-event needs to be scheduled to start. They must - * be big enough to ensure that we switch in time. +/* For GO, this value represents the number of TUs before CSA "beacon + * 0" TBTT when the CSA time-event needs to be scheduled to start. It + * must be big enough to ensure that we switch in time. */ #define IWL_MVM_CHANNEL_SWITCH_TIME_GO 40 -#define IWL_MVM_CHANNEL_SWITCH_TIME_CLIENT 110 + +/* For client, this value represents the number of TUs before CSA + * "beacon 1" TBTT, instead. This is because we don't know when the + * GO/AP will be in the new channel, so we switch early enough. + */ +#define IWL_MVM_CHANNEL_SWITCH_TIME_CLIENT 10 /* * This value (in TUs) is used to fine tune the CSA NoA end time which should