From patchwork Wed Mar 15 15:45:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 9625981 X-Patchwork-Delegate: kvalo@adurom.com 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 2952C604A9 for ; Wed, 15 Mar 2017 15:45:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1BEEE28659 for ; Wed, 15 Mar 2017 15:45:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10A602865F; Wed, 15 Mar 2017 15:45:49 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 8922E28659 for ; Wed, 15 Mar 2017 15:45:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754137AbdCOPps (ORCPT ); Wed, 15 Mar 2017 11:45:48 -0400 Received: from wolverine02.qualcomm.com ([199.106.114.251]:31425 "EHLO wolverine02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753859AbdCOPpq (ORCPT ); Wed, 15 Mar 2017 11:45:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1489592745; x=1521128745; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/tzd+TIuw+QhMbSy4wo6BFCI3NgKq7lEtNdqPnWkRLY=; b=vO3diwQHygbKKuOzdXRvZWAmQapZ7tEuWYJRU0RsZo9AmJUwD0Aag4UT PhJHxJdzptidhhZ0CYMf4AwGn+e/KHyEfUoT0b329oWuX6tmwY2AJvqG1 pSiamA0wENyQ0/4uGAxdC1komK9K/Veqmojr0tRve7CzWnDaHUfgM6NU7 0=; X-IronPort-AV: E=Sophos;i="5.36,169,1486454400"; d="scan'208";a="366196018" Received: from unknown (HELO ironmsg02-L.qualcomm.com) ([10.53.140.109]) by wolverine02.qualcomm.com with ESMTP; 15 Mar 2017 08:45:45 -0700 X-IronPort-AV: E=McAfee;i="5800,7501,8467"; a="885561010" X-MGA-submission: =?us-ascii?q?MDE5GtxRcsjkq2G1h+hEWqPlyNqh+GBhT3G23o?= =?us-ascii?q?JA+cq0i3oyX0NN1/ZVYYfDqf3EhRr7m95FmpXlUJ8CIPeFIG2fJP0mmq?= =?us-ascii?q?HK/mBRrc6+frnfK+WwltALQ08cccUHcaUkUdZ2QTRa5NFM3RypgGm/1d?= =?us-ascii?q?V3?= Received: from nasanexm02g.na.qualcomm.com ([10.85.0.88]) by ironmsg02-L.qualcomm.com with ESMTP/TLS/RC4-SHA; 15 Mar 2017 08:45:45 -0700 Received: from euamsexm01a.eu.qualcomm.com (10.251.127.40) by nasanexm02g.na.qualcomm.com (10.85.0.88) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Wed, 15 Mar 2017 08:45:44 -0700 Received: from potku.adurom.net (10.80.80.8) by euamsexm01a.eu.qualcomm.com (10.251.127.40) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Wed, 15 Mar 2017 16:45:39 +0100 Subject: [PATCH v6 04/10] ath10k: htc: refactorization From: Kalle Valo To: CC: Date: Wed, 15 Mar 2017 17:45:35 +0200 Message-ID: <148959273559.31432.1473763056505214776.stgit@potku.adurom.net> In-Reply-To: <148959263520.31432.8488419244476213373.stgit@potku.adurom.net> References: <148959263520.31432.8488419244476213373.stgit@potku.adurom.net> User-Agent: StGit/0.17.1-17-ge4e0 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: NASANEXM01C.na.qualcomm.com (10.85.0.83) To euamsexm01a.eu.qualcomm.com (10.251.127.40) 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 From: Erik Stromdahl Code refactorization: Moved the code for ep 0 in ath10k_htc_rx_completion_handler to ath10k_htc_control_rx_complete. This eases the implementation of SDIO/mbox significantly since the ep_rx_complete cb is invoked directly from the SDIO/mbox hif layer. Since the ath10k_htc_control_rx_complete already is present (only containing a warning message) there is no reason for not using it (instead of having a special case for ep 0 in ath10k_htc_rx_completion_handler). Signed-off-by: Erik Stromdahl Signed-off-by: Kalle Valo --- drivers/net/wireless/ath/ath10k/htc.c | 73 +++++++++++++++------------------ 1 file changed, 34 insertions(+), 39 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c index 92d5ac45327a..a8452ce77873 100644 --- a/drivers/net/wireless/ath/ath10k/htc.c +++ b/drivers/net/wireless/ath/ath10k/htc.c @@ -461,42 +461,6 @@ void ath10k_htc_rx_completion_handler(struct ath10k *ar, struct sk_buff *skb) /* zero length packet with trailer data, just drop these */ goto out; - if (eid == ATH10K_HTC_EP_0) { - struct ath10k_htc_msg *msg = (struct ath10k_htc_msg *)skb->data; - - switch (__le16_to_cpu(msg->hdr.message_id)) { - case ATH10K_HTC_MSG_READY_ID: - case ATH10K_HTC_MSG_CONNECT_SERVICE_RESP_ID: - /* handle HTC control message */ - if (completion_done(&htc->ctl_resp)) { - /* - * this is a fatal error, target should not be - * sending unsolicited messages on the ep 0 - */ - ath10k_warn(ar, "HTC rx ctrl still processing\n"); - complete(&htc->ctl_resp); - goto out; - } - - htc->control_resp_len = - min_t(int, skb->len, - ATH10K_HTC_MAX_CTRL_MSG_LEN); - - memcpy(htc->control_resp_buffer, skb->data, - htc->control_resp_len); - - complete(&htc->ctl_resp); - 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; - } - ath10k_dbg(ar, ATH10K_DBG_HTC, "htc rx completion ep %d skb %pK\n", eid, skb); ep->ep_ops.ep_rx_complete(ar, skb); @@ -511,9 +475,40 @@ EXPORT_SYMBOL(ath10k_htc_rx_completion_handler); static void ath10k_htc_control_rx_complete(struct ath10k *ar, struct sk_buff *skb) { - /* This is unexpected. FW is not supposed to send regular rx on this - * endpoint. */ - ath10k_warn(ar, "unexpected htc rx\n"); + struct ath10k_htc *htc = &ar->htc; + struct ath10k_htc_msg *msg = (struct ath10k_htc_msg *)skb->data; + + switch (__le16_to_cpu(msg->hdr.message_id)) { + case ATH10K_HTC_MSG_READY_ID: + case ATH10K_HTC_MSG_CONNECT_SERVICE_RESP_ID: + /* handle HTC control message */ + if (completion_done(&htc->ctl_resp)) { + /* this is a fatal error, target should not be + * sending unsolicited messages on the ep 0 + */ + ath10k_warn(ar, "HTC rx ctrl still processing\n"); + complete(&htc->ctl_resp); + goto out; + } + + htc->control_resp_len = + min_t(int, skb->len, + ATH10K_HTC_MAX_CTRL_MSG_LEN); + + memcpy(htc->control_resp_buffer, skb->data, + htc->control_resp_len); + + complete(&htc->ctl_resp); + 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; + } + +out: kfree_skb(skb); }