Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3548324pxu; Tue, 15 Dec 2020 09:27:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJwrSdQy7MvrueriL2MgUZZjfX6y5lKuEAh4kryArHcM7AJ6gZkBKd5LKFajjAmTaHzoTo5y X-Received: by 2002:a17:906:971a:: with SMTP id k26mr28475607ejx.279.1608053260897; Tue, 15 Dec 2020 09:27:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608053260; cv=none; d=google.com; s=arc-20160816; b=LYOQRHVWtG0LWjObhFBeipRmGZTNuwXA/wRiLw+XYQOnR2zFmpV7UYP/RblXREWq7T DaVRoY6ji9IGqN0B/d6RbDuxUSp9EW/mpr/tyIAt1Wxst5xdNAEDa70Y6LHDSnklwZis j3qI+jqpeQOki1BYApF1Glgy7vKuYkNG4HHm0Jolh7f+/WAJV4If0/TJXlncoo99CHsO 9VGIubPb3ygCagfik3bnMQ7jpJzqIYF4rIlDFd3Ec1S/uD72+cWJwWE9kpwfkoF0kGPN UzTYyfG2iN3NoPvKjnjJsdqoAknoXTsAqDhO2LJXW1XVsXtiEKPxXSBcPeV8N2B/k7tj f3Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=bVYMG5WZhN6ywm3fsphx3nHRkY2S1XFITqoy+sLOJAc=; b=KJY/zK7S+4sR4wnU8KcqCx1P3uMWfM3L1URpnJYVIrFYdH9Tt0M8WQhexzxWuGZ5Yu d0JLACL2ODi6ttyZEk3Lg3NDiJxOQjBo+9/x/Q0DCC1L0IZaMtAJmffsvTLQNqviTpoz ShXv1Ao8EyPYXKEczq55ycsR7+GtR+rEONhGsw7HoqEo49HEQqv5whmlBsSSCvidmN8L lGbcl8S082jku39/BgW02uZL23czwGG+/YjT8WUuTqVJg2IqzGa5+sXE1NBDIhxl9xZf kTS9Vgn/ga6YPQNQnBmanHjtVWY/Dbat+LlzHbSTChk+OUtl5VkkH7d6EumsOpe6PzkT FPbQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h26si1207089ejq.399.2020.12.15.09.27.17; Tue, 15 Dec 2020 09:27:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730744AbgLORYs (ORCPT + 99 others); Tue, 15 Dec 2020 12:24:48 -0500 Received: from alexa-out.qualcomm.com ([129.46.98.28]:7628 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729872AbgLORYk (ORCPT ); Tue, 15 Dec 2020 12:24:40 -0500 Received: from ironmsg07-lv.qualcomm.com (HELO ironmsg07-lv.qulacomm.com) ([10.47.202.151]) by alexa-out.qualcomm.com with ESMTP; 15 Dec 2020 09:24:00 -0800 X-QCInternal: smtphost Received: from ironmsg02-blr.qualcomm.com ([10.86.208.131]) by ironmsg07-lv.qulacomm.com with ESMTP/TLS/AES256-SHA; 15 Dec 2020 09:23:58 -0800 X-QCInternal: smtphost Received: from youghand-linux.qualcomm.com ([10.206.66.115]) by ironmsg02-blr.qualcomm.com with ESMTP; 15 Dec 2020 22:53:55 +0530 Received: by youghand-linux.qualcomm.com (Postfix, from userid 2370257) id A45F820F17; Tue, 15 Dec 2020 22:53:54 +0530 (IST) From: Youghandhar Chintala To: johannes@sipsolutions.net Cc: davem@davemloft.net, kuba@kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kuabhs@chromium.org, dianders@chromium.org, briannorris@chromium.org, pillair@codeaurora.org, Youghandhar Chintala Subject: [PATCH 2/3] mac80211: Add support to trigger sta disconnect on hardware restart Date: Tue, 15 Dec 2020 22:53:52 +0530 Message-Id: <20201215172352.5311-1-youghand@codeaurora.org> X-Mailer: git-send-email 2.29.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Currently in case of target hardware restart, we just reconfig and re-enable the security keys and enable the network queues to start data traffic back from where it was interrupted. Many ath10k wifi chipsets have sequence numbers for the data packets assigned by firmware and the mac sequence number will restart from zero after target hardware restart leading to mismatch in the sequence number expected by the remote peer vs the sequence number of the frame sent by the target firmware. This mismatch in sequence number will cause out-of-order packets on the remote peer and all the frames sent by the device are dropped until we reach the sequence number which was sent before we restarted the target hardware In order to fix this, we trigger a sta disconnect, for the targets which expose this corresponding wiphy flag, in case of target hw restart. After this there will be a fresh connection and thereby avoiding the dropping of frames by remote peer. The right fix would be to pull the entire data path into the host which is not feasible or would need lots of complex changes and will still be inefficient. Tested on ath10k using WCN3990, QCA6174 Signed-off-by: Youghandhar Chintala --- net/mac80211/ieee80211_i.h | 3 +++ net/mac80211/mlme.c | 9 +++++++++ net/mac80211/util.c | 22 +++++++++++++++++++--- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index cde2e3f..8cbeb5f 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -748,6 +748,8 @@ struct ieee80211_if_mesh { * back to wireless media and to the local net stack. * @IEEE80211_SDATA_DISCONNECT_RESUME: Disconnect after resume. * @IEEE80211_SDATA_IN_DRIVER: indicates interface was added to driver + * @IEEE80211_SDATA_DISCONNECT_HW_RESTART: Disconnect after hardware restart + * recovery */ enum ieee80211_sub_if_data_flags { IEEE80211_SDATA_ALLMULTI = BIT(0), @@ -755,6 +757,7 @@ enum ieee80211_sub_if_data_flags { IEEE80211_SDATA_DONT_BRIDGE_PACKETS = BIT(3), IEEE80211_SDATA_DISCONNECT_RESUME = BIT(4), IEEE80211_SDATA_IN_DRIVER = BIT(5), + IEEE80211_SDATA_DISCONNECT_HW_RESTART = BIT(6), }; /** diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 6adfcb9..e4d0d16 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -4769,6 +4769,15 @@ void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata) true); sdata_unlock(sdata); return; + } else if (sdata->flags & IEEE80211_SDATA_DISCONNECT_HW_RESTART) { + sdata->flags &= ~IEEE80211_SDATA_DISCONNECT_HW_RESTART; + mlme_dbg(sdata, "driver requested disconnect after hardware restart\n"); + ieee80211_sta_connection_lost(sdata, + ifmgd->associated->bssid, + WLAN_REASON_UNSPECIFIED, + true); + sdata_unlock(sdata); + return; } sdata_unlock(sdata); } diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 8c3c01a..98567a3 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -2567,9 +2567,12 @@ int ieee80211_reconfig(struct ieee80211_local *local) } mutex_unlock(&local->sta_mtx); - /* add back keys */ - list_for_each_entry(sdata, &local->interfaces, list) - ieee80211_reenable_keys(sdata); + + if (!(hw->wiphy->flags & WIPHY_FLAG_STA_DISCONNECT_ON_HW_RESTART)) { + /* add back keys */ + list_for_each_entry(sdata, &local->interfaces, list) + ieee80211_reenable_keys(sdata); + } /* Reconfigure sched scan if it was interrupted by FW restart */ mutex_lock(&local->mtx); @@ -2643,6 +2646,19 @@ int ieee80211_reconfig(struct ieee80211_local *local) IEEE80211_QUEUE_STOP_REASON_SUSPEND, false); + if ((hw->wiphy->flags & WIPHY_FLAG_STA_DISCONNECT_ON_HW_RESTART) && + !reconfig_due_to_wowlan) { + list_for_each_entry(sdata, &local->interfaces, list) { + if (!ieee80211_sdata_running(sdata)) + continue; + if (sdata->vif.type == NL80211_IFTYPE_STATION) { + sdata->flags |= + IEEE80211_SDATA_DISCONNECT_HW_RESTART; + ieee80211_sta_restart(sdata); + } + } + } + /* * If this is for hw restart things are still running. * We may want to change that later, however. -- 2.7.4