From patchwork Wed Nov 23 07:59:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 9442689 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E599F6075F for ; Wed, 23 Nov 2016 07:59:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5B1D205A8 for ; Wed, 23 Nov 2016 07:59:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C8D0F20649; Wed, 23 Nov 2016 07:59:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 528E3205A8 for ; Wed, 23 Nov 2016 07:59:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756372AbcKWH7m (ORCPT ); Wed, 23 Nov 2016 02:59:42 -0500 Received: from mail-pg0-f44.google.com ([74.125.83.44]:35036 "EHLO mail-pg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756019AbcKWH7l (ORCPT ); Wed, 23 Nov 2016 02:59:41 -0500 Received: by mail-pg0-f44.google.com with SMTP id p66so3369328pga.2 for ; Tue, 22 Nov 2016 23:59:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=endlessm-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=2l+zhLt1ZwgJZKwlzcI00Q79I7BQb++1HBReu9jvQNs=; b=tj0LjpBoC3i7VCDDcY3KFUe8sIDnU+DwzzzfS1pf5rF/zoSoS6FFcwHWTSGwlLLpA3 1llEj6pD9EWVoNk2oT+kFP3IoaZ3Rpb8Gp19JpjqdJkE4dpb0zsAhPF30kySRVsWTmvn N3sVWt6N6j3mWS7RKSCMZc6m2sNl0Ycq3OVOAidfu1Qs5PH5fjJ7RT0EkhnqeV6eYSfm v4M9kmJbRX9ZbIqy1whrDovRaAtZs1V/xmnQktTWiJRDxWsfkBzHsX0qYVRVszxvYDGU /sOc4et8sovq/1/d16oNPnNv0hCQ0eiU/TTFzqMvRYVEJicdylYAjHq7UeWSageIZ5sC cnBw== 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; bh=2l+zhLt1ZwgJZKwlzcI00Q79I7BQb++1HBReu9jvQNs=; b=POMoN63dL5in0K2wQIjZLzQWJyeK/cGsoABFiKOPR8quwWiu7ya/wxruhl6piR1G8Q rZqr2XYQuRXw336gCw+R7WntjZZuXaFCED2ZPJ8h+Ron0Jl0KY+q2pqRqvvuEEs6V7WZ 3YHvG/bo6S7WVxf/Jyud7TIYLRJx45NWqVs42fsodjXm/lTELB/viSITQqYhlf8Jw5Zp fRCO9gRa9iSnsnagJtRlYb0s6wYFtnZvDhl2kk256VSDJMEluEtL3fjTO97LhI+fSjYX htolcBzSyH3lP/MC2I31wovGJ81q/Q1dDlBseLgO2GL5PID4HqQxTBcB3PgQDhGkLn3W miUA== X-Gm-Message-State: AKaTC02xzwUTx9qGSAN8VzmO41NL3i/ctjgrER9vs+GaMzglY8Mtf1OfYpjmrhYYq4U5Rrkc X-Received: by 10.99.119.71 with SMTP id s68mr3114048pgc.11.1479887980312; Tue, 22 Nov 2016 23:59:40 -0800 (PST) Received: from localhost.localdomain (125-227-158-176.HINET-IP.hinet.net. [125.227.158.176]) by smtp.gmail.com with ESMTPSA id g63sm50319731pfd.60.2016.11.22.23.59.38 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 22 Nov 2016 23:59:39 -0800 (PST) From: Chris Chiu To: johannes@sipsolutions.net, linux-wireless@vger.kernel.org Cc: linux@endlessm.com, Chris Chiu Subject: [PATCH] mac80211: fix Tx BA session stuck issue during sw scanning Date: Wed, 23 Nov 2016 15:59:28 +0800 Message-Id: <1479887968-17473-1-git-send-email-chiu@endlessm.com> X-Mailer: git-send-email 2.5.4 (Apple Git-61) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP ieee80211_iface_work() will check if sw scanning is in progress before handling block ack session. In our case, the RTL8821AE operate in station mode, when tx session expired, DELBA packet stuck during sw scanning and so do other data packets. ieee80211_scan_state_decision() will take lots of time in SCAN_SUSPEND/SCAN_RESUME state due to !tx_empty or bad_latency. Then the sw scanning mostly take > 20 seconds to finish or even worse in our case RTL8821AE have 37 channels for 2G+5G to scan and tx stalls ~300 seconds. AP side still thinks the connection is alive because it still receives the QoS NULL packet from STA. So the link state will never change but actually no data tx/rx during this long time. This commit tries to send out packet in SCAN_SUSPEND state so the sw scanning can complete more efficiently and less affect on Block Ack session handling. Verified on RTL8821AE for > 30000 pings and no Tx BA session stuck observed. Signed-off-by: Chris Chiu --- net/mac80211/ieee80211_i.h | 1 + net/mac80211/iface.c | 4 +++- net/mac80211/scan.c | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index f56d342..78c1a13 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -1076,6 +1076,7 @@ enum { SCAN_SW_SCANNING, SCAN_HW_SCANNING, SCAN_ONCHANNEL_SCANNING, + SCAN_SUSPEND_SCANNING, SCAN_COMPLETED, SCAN_ABORTED, SCAN_HW_CANCELLED, diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index b123a9e..0a43997 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -1215,8 +1215,10 @@ static void ieee80211_iface_work(struct work_struct *work) if (!ieee80211_sdata_running(sdata)) return; - if (test_bit(SCAN_SW_SCANNING, &local->scanning)) + if (test_bit(SCAN_SW_SCANNING, &local->scanning) && + !test_bit(SCAN_SUSPEND_SCANNING, &local->scanning)) { return; + } if (!ieee80211_can_run_worker(local)) return; diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index 070b40f..ebd32a0 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c @@ -800,6 +800,8 @@ static void ieee80211_scan_state_set_channel(struct ieee80211_local *local, break; } + test_and_clear_bit(SCAN_SUSPEND_SCANNING, &local->scanning); + if (ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL)) skip = 1; @@ -844,6 +846,8 @@ static void ieee80211_scan_state_suspend(struct ieee80211_local *local, /* disable PS */ ieee80211_offchannel_return(local); + __set_bit(SCAN_SUSPEND_SCANNING, &local->scanning); + *next_delay = HZ / 5; /* afterwards, resume scan & go to next channel */ local->next_scan_state = SCAN_RESUME;