Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp633781pxx; Mon, 26 Oct 2020 17:34:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEWRqCcqg8OyP66UvjuMcEvVkmuT7KcCijxx6xHGcwM/680E9HBFFOHCPMszA50qBn70Nu X-Received: by 2002:a17:906:e08f:: with SMTP id gh15mr17365406ejb.165.1603758890528; Mon, 26 Oct 2020 17:34:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603758890; cv=none; d=google.com; s=arc-20160816; b=uuwQ3kth24Pdsd1Hpl67xqosaauFi2BcpOmUmqD9La3D6iKtG0yOEYQTIUtftkrRKK EtmtL0WuoTs4D/+/5oMa9CNcoVAx5K5ASZ8/JT0o7+FrD4DdW3HodqPxWlyf1WPLEr0k 2nsSrwuH9nwufc1yIQbIB7WhxH6stnROSGT+0P9aZXXzcVB6nl7nr/N3fY3puff2wmiU NGBxcWfkZpZAjsikpZiH2UZAW7LqZQgmSyTyKc0SvSM1RptidAwg5boFxuAtP1bVSMhq 2ZpWwX1E/r1qvmK/vaCx4J6A2a3UZuSq4GJprjDp3BZDozRJS6vbMMjTphVoLj8yxEDs qJVw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cWsuA67bVN8iCjXGrxzE1a6+8CoDL+1acfqIdLw14xU=; b=OQkvnw+VOLePfakvgN4BYyp9SqOkEb1PUHH0fencz4PIy31oaKqNn48qnv8b/FFnW3 iabo9CtNQqh1U873Iq2YpmNmgd67GkaDZvUhQDQgCFW4vQ85d+FAlvE2mXnm161hfEuN cPTo+SVlriTIgHOHtmvNYMbQwCQWT2+hedsW7l0y1LRpiF1NNs4m4vYBXS4X8rOwJ36Q BZuB2rjKzVKGp66jqA++P1Lyc+paarsH/Zy0Y3F8vUvXmHSVfvTqdLfeF31LQeu9c15k /S8bSZEeZ0JbuoQ04+UlD2w4z0Ii3P/EoHh761DTri+fMxBxuI2hcVAs0jQF55GFctCn 6vew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=T4hTpqUy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w1si7602655edf.49.2020.10.26.17.34.28; Mon, 26 Oct 2020 17:34:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=T4hTpqUy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2441358AbgJ0AWw (ORCPT + 99 others); Mon, 26 Oct 2020 20:22:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:34178 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2410335AbgJZXzj (ORCPT ); Mon, 26 Oct 2020 19:55:39 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5DE6D22384; Mon, 26 Oct 2020 23:55:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603756538; bh=0ae7PabnxCOKNlt1cA/HXiMihXNfOWTEJTsGHrkhhTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T4hTpqUyb7LLniV4lsNJtAohwEG5QaMLX1aBRolpUj5qcmVB4z1vAxQCauATqSWxb SX9XfvOFk09Pmjw3tOchHn6KtKnq4UnyU8Np/eqPlzgO57uY7hLDL2s2VSEqUviwjn pLgDRBsbY0GHiZkGLTPcFaGrgPXdRL0iNZEeAZfI= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Wen Gong , Kalle Valo , Sasha Levin , ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 17/80] ath10k: start recovery process when payload length exceeds max htc length for sdio Date: Mon, 26 Oct 2020 19:54:13 -0400 Message-Id: <20201026235516.1025100-17-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201026235516.1025100-1-sashal@kernel.org> References: <20201026235516.1025100-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wen Gong [ Upstream commit 2fd3c8f34d08af0a6236085f9961866ad92ef9ec ] When simulate random transfer fail for sdio write and read, it happened "payload length exceeds max htc length" and recovery later sometimes. Test steps: 1. Add config and update kernel: CONFIG_FAIL_MMC_REQUEST=y CONFIG_FAULT_INJECTION=y CONFIG_FAULT_INJECTION_DEBUG_FS=y 2. Run simulate fail: cd /sys/kernel/debug/mmc1/fail_mmc_request echo 10 > probability echo 10 > times # repeat until hitting issues 3. It happened payload length exceeds max htc length. [ 199.935506] ath10k_sdio mmc1:0001:1: payload length 57005 exceeds max htc length: 4088 .... [ 264.990191] ath10k_sdio mmc1:0001:1: payload length 57005 exceeds max htc length: 4088 4. after some time, such as 60 seconds, it start recovery which triggered by wmi command timeout for periodic scan. [ 269.229232] ieee80211 phy0: Hardware restart was requested [ 269.734693] ath10k_sdio mmc1:0001:1: device successfully recovered The simulate fail of sdio is not a real sdio transter fail, it only set an error status in mmc_should_fail_request after the transfer end, actually the transfer is success, then sdio_io_rw_ext_helper will return error status and stop transfer the left data. For example, the really RX len is 286 bytes, then it will split to 2 blocks in sdio_io_rw_ext_helper, one is 256 bytes, left is 30 bytes, if the first 256 bytes get an error status by mmc_should_fail_request,then the left 30 bytes will not read in this RX operation. Then when the next RX arrive, the left 30 bytes will be considered as the header of the read, the top 4 bytes of the 30 bytes will be considered as lookaheads, but actually the 4 bytes is not the lookaheads, so the len from this lookaheads is not correct, it exceeds max htc length 4088 sometimes. When happened exceeds, the buffer chain is not matched between firmware and ath10k, then it need to start recovery ASAP. Recently then recovery will be started by wmi command timeout, but it will be long time later, for example, it is 60+ seconds later from the periodic scan, if it does not have periodic scan, it will be longer. Start recovery when it happened "payload length exceeds max htc length" will be reasonable. This patch only effect sdio chips. Tested with QCA6174 SDIO with firmware WLAN.RMH.4.4.1-00029. Signed-off-by: Wen Gong Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20200108031957.22308-3-wgong@codeaurora.org Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath10k/sdio.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c index 8fe626deadeb0..24b1927a07518 100644 --- a/drivers/net/wireless/ath/ath10k/sdio.c +++ b/drivers/net/wireless/ath/ath10k/sdio.c @@ -550,6 +550,10 @@ static int ath10k_sdio_mbox_rx_alloc(struct ath10k *ar, le16_to_cpu(htc_hdr->len), ATH10K_HTC_MBOX_MAX_PAYLOAD_LENGTH); ret = -ENOMEM; + + queue_work(ar->workqueue, &ar->restart_work); + ath10k_warn(ar, "exceeds length, start recovery\n"); + goto err; } -- 2.25.1