From patchwork Wed Mar 11 13:37:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 5985181 Return-Path: X-Original-To: patchwork-ath10k@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9CB26BF440 for ; Wed, 11 Mar 2015 13:41:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B9ED820394 for ; Wed, 11 Mar 2015 13:41:29 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EE2DC202AE for ; Wed, 11 Mar 2015 13:41:28 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YVgt1-0007nN-Gn; Wed, 11 Mar 2015 13:41:23 +0000 Received: from mail-lb0-x22c.google.com ([2a00:1450:4010:c04::22c]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YVgrW-000556-IM for ath10k@lists.infradead.org; Wed, 11 Mar 2015 13:39:53 +0000 Received: by lbjb6 with SMTP id b6so8836673lbj.9 for ; Wed, 11 Mar 2015 06:39:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id; bh=/eklo4TEZc5zawY/nyef4lx1DSZODMPtIbjPr5YMwbo=; b=3+Hkc2DJJEVTWKbnHhH+vaSZkRtyZxdIF1R7lg+apQtjEgK7kupPVGrbbhhY8+9wKe 6w6BqghXtMigUvz9xluSAWMneigFNJKWZataONtDzhaMPW/wct1CIMSG7/p/8iOAeVJ1 giz8MrNywXN9445RJxONhgkwiAvYiUxwKN+P0= 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=/eklo4TEZc5zawY/nyef4lx1DSZODMPtIbjPr5YMwbo=; b=i2nIjhVxKjnPovgCugWi+moJXzTiISvUt2PNgTZCxBSaP765mbKhqzRZxcoNJ+qEAx 1xsmgx2E154D64Jt/QSHWtn8pNfTizTw2zSPubKGXpuLM+w3feSA5xlkN21i/rnvwNET KgNNH4WEaj00QoY9EQo0AAQCW6KcRLvvnDaf4UfedOzok8rPfZr96SI+KD8LrK/FGJLV ceoR9xvixrOABOSgmf9WqQ0OPqI7+mNXU8W+5f4OSDUIuElDGE2m+Kx9EXugFX9uGqee lPrPlOBhx4Q5hc4FpbI8MrmJwpeVvX5NwLuskJT4yPc2LJZx9ps1O9R6jpICaoHZs1vD fxHg== X-Gm-Message-State: ALoCoQkptHEg5bHVUTqWx/u9SQOAHWZqASrCn/oi5upFCwkQpN7uhgKB8/w8SyGYmDb/BxAclH3k0FWyQf2+9hewxiDFAYo+OjGzjG4LRVZP84fdSxX/reruIQWdnz6PfaJicSRVJfD+GbS673gXhWmULZ6xQLcLEpDJvj2Sc6/gZ833UUZt8uM= X-Received: by 10.152.206.7 with SMTP id lk7mr35278838lac.55.1426081166864; Wed, 11 Mar 2015 06:39:26 -0700 (PDT) Received: from localhost.localdomain ([91.198.246.8]) by mx.google.com with ESMTPSA id iy9sm734769lbc.8.2015.03.11.06.39.25 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Mar 2015 06:39:26 -0700 (PDT) From: Michal Kazior To: ath10k@lists.infradead.org Subject: [PATCH] ath10k: protect driver from unsolicited htc ep0 events Date: Wed, 11 Mar 2015 14:37:11 +0100 Message-Id: <1426081031-15296-1-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 1.8.5.3 X-DomainID: tieto.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150311_063950_845012_3918D429 X-CRM114-Status: UNSURE ( 9.52 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.8 (/) Cc: linux-wireless@vger.kernel.org, Michal Kazior X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, 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 Some firmware revisions (tested with qca6174 rm2.0-00088) deliver unsolicited unknown (kind of garbled) HTC ep0 event to host in some cases. This issue was mainly observed with both qca988x and qca6174 being installed on a single host system. During driver probing if qca6174 booting sequences were somehow deferred (e.g. by qca988x implicitly making some resources busy presumably) the unsolicited event would came around 1s after ATH10K_HTC_MSG_READY_ID was delivered to host for qca6174. The unsolicited event would confuse driver and cause HTT initialization (and subsequently driver probing) to fail. Make the ep0 event processing more robust. The event will still be caught but instead will only generate a warning now. Signed-off-by: Michal Kazior --- drivers/net/wireless/ath/ath10k/htc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c index 2fd9e18..d33d5c4 100644 --- a/drivers/net/wireless/ath/ath10k/htc.c +++ b/drivers/net/wireless/ath/ath10k/htc.c @@ -414,7 +414,8 @@ static int ath10k_htc_rx_completion_handler(struct ath10k *ar, struct ath10k_htc_msg *msg = (struct ath10k_htc_msg *)skb->data; switch (__le16_to_cpu(msg->hdr.message_id)) { - default: + case ATH10K_HTC_MSG_READY_ID: + case ATH10K_HTC_MSG_CONNECT_SERVICE_RESP_ID: /* handle HTC control message */ if (completion_done(&htc->ctl_resp)) { /* @@ -438,6 +439,10 @@ static int ath10k_htc_rx_completion_handler(struct ath10k *ar, break; case ATH10K_HTC_MSG_SEND_SUSPEND_COMPLETE: htc->htc_ops.target_send_suspend_complete(ar); + break; + default: + ath10k_warn(ar, "ignoring unsolicited htc ep0 event\n"); + break; } goto out; }