From patchwork Tue Feb 21 16:15:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Stromdahl X-Patchwork-Id: 9585029 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 D0E4E6042F for ; Tue, 21 Feb 2017 16:16:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEFBD283A6 for ; Tue, 21 Feb 2017 16:16:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3B0A285F3; Tue, 21 Feb 2017 16:16:51 +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=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 191AD283A6 for ; Tue, 21 Feb 2017 16:16:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=TcZIoyINNASUYsn5x+Wz4Be78vciEs71FduZIovZpsg=; b=AJOFamT/OnFApDxmY1pyBsrYUL TW1Nhx7d8a1dQZeTlsWRL8ZbhZ/V2ELh/9wS1jtfLBCJWXoBcpRXegNyF70/SiWMqJIHbHzhIRnf4 Mgm/K43qLe0wE5sTQ9PcfuvYoSUXlLMcGNN0s23G/qZUyQOmEiQENANfatYNoxN9BR7S95sVDVa5l 7A7H7mqMqUDxETkjWDc1e41+luCE2HJu3PTeb7MmVoMMjs93WsFSRLNXQ+AGqwErUoyEqFp17ZBcd QMjIesoGQouwbEUzNVu8Fp+gJ+H1cHeHuPL/tptVqbN/mgKW045hAJ/cajWFGr01WI+5DFJVMPUbV B4djqGww==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cgD7M-0006uA-6z; Tue, 21 Feb 2017 16:16:44 +0000 Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cgD7C-0006dd-ON for ath10k@lists.infradead.org; Tue, 21 Feb 2017 16:16:37 +0000 Received: by mail-lf0-x244.google.com with SMTP id z127so9537030lfa.2 for ; Tue, 21 Feb 2017 08:16:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5xa9EnT9UxA3fNSbU3TOsLmB3Qhvskbzn6nE5snR/sc=; b=Dr0O0kOf1RyUqriRrjFsGb5h58n0eNy8rl9+MB46mQo1Ll/XCmvfIbPbb5lAy82zXc pBCaVZ/8w5oUSRxdoCbJqlmn7PbcCFTOoJD8AHYbN7Z1Ot2+Es5bDwL0LByqyRUfsc0s jmNfyaIILTC+O4YwWiwGNsOlZgdF6Kin6xzRoDLJYbGVaEY2DV1A4m4tUvt3I+vWHgtF it33wqoPZ1PqowkUQ48onvaZvOJAKWj+LLFXSuc9g/Xffryi1J7ML5q1BjPa/EupJ2Wn Gls/LRqg8or6/QV5brxHLM5y9q/kKhOXlB4WcXZflZg60pM3fTu6NKjF4DQ9rhAn7B+V Xlwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5xa9EnT9UxA3fNSbU3TOsLmB3Qhvskbzn6nE5snR/sc=; b=olB0zMxBp+TsjlepBC305piydEjlCp5bgj2W/mqZrkRo16+rqw2XYDOFlWbGMdpx/1 hn52Scw24zUns2BDHVnJbn+DJJsw/+pvnitrbSQrgOn3r7UmI8EuTMEQugsSPYxYOnx4 Xc2JVygkuV4R7jCzAlyUpemUPGjKjHTmGg0+MH0tXlbVhLPl6iQcCZ1a2mc4y2XKvCLO Qvqhej/+7gn4I52RkvnngB4ZnL7SD3ZQB4VZMdAAiJpZlFZo2JZtayAyJ/KcGQL4UOFo pRuFYNFVGyfIBL0Y+n/A/rM/pMUNy0KQjHRfbAMYFYOyNJBZruAQmMNqSaGfFSRcseUP ZyGA== X-Gm-Message-State: AMke39k65tvSPXqXuA4a7mLdrIsxFwhDvLuN3kFe9BaPfTT2JTFbfN38Gg/o1EffO/1ZHQ== X-Received: by 10.46.80.29 with SMTP id e29mr7197476ljb.121.1487693776130; Tue, 21 Feb 2017 08:16:16 -0800 (PST) Received: from erik-mate-1604.lan (90-227-62-61-no75.tbcn.telia.com. [90.227.62.61]) by smtp.gmail.com with ESMTPSA id t29sm6336069ljd.39.2017.02.21.08.16.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 21 Feb 2017 08:16:15 -0800 (PST) From: Erik Stromdahl To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Subject: [RFC v4 04/21] ath10k: htc: refactorization Date: Tue, 21 Feb 2017 17:15:24 +0100 Message-Id: <1487693741-10042-5-git-send-email-erik.stromdahl@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487693741-10042-1-git-send-email-erik.stromdahl@gmail.com> References: <1487693741-10042-1-git-send-email-erik.stromdahl@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170221_081635_127706_3995395E X-CRM114-Status: GOOD ( 12.68 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Erik Stromdahl MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 f39eef6..eb036b3 100644 --- a/drivers/net/wireless/ath/ath10k/htc.c +++ b/drivers/net/wireless/ath/ath10k/htc.c @@ -459,42 +459,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); @@ -509,9 +473,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); }