From patchwork Fri Jan 13 21:26:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Stromdahl X-Patchwork-Id: 9516451 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 6BC4060761 for ; Fri, 13 Jan 2017 21:27:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D55F28780 for ; Fri, 13 Jan 2017 21:27:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 525DD28787; Fri, 13 Jan 2017 21:27:01 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 EE45C28780 for ; Fri, 13 Jan 2017 21:27:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751372AbdAMV07 (ORCPT ); Fri, 13 Jan 2017 16:26:59 -0500 Received: from mail-lf0-f65.google.com ([209.85.215.65]:36650 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751353AbdAMV0x (ORCPT ); Fri, 13 Jan 2017 16:26:53 -0500 Received: by mail-lf0-f65.google.com with SMTP id h65so7028121lfi.3 for ; Fri, 13 Jan 2017 13:26:52 -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=LeS74/pV49nE2F75zy02osMP7N8C3tYd6L6+dsQRCzVFcFHjXS43MVVNp/OOXJGWJy ESbGEkI6ER3k7klLrpTU/VBLhDmTAm1J84mhgf5JSe04VEvrAedLxvCUp+8dwUm330RH EHfqYYH8IjRU4HDk/TYMK/7DUw5oUXanaGW+oVeRT7c4NoMNor4BxcBeuLYquHIkkHaK ivcHKQKpPNpK+NkxyYPrbgsDduii1eB64EnaalQ8pEGQ9Hx1TwmdqhvYKnbV158H/H/q heznljg2k3AWCqa/pWtTeHCH/ScIJUFkfawzEaZ6QALK1GY6EFKnGxbzQt7333ydZZyj jgFA== 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=n5ybIrCpKAFnvJcP75bHFFlUP8OQ5fg77IQp8mGlSvJr0vWXy7a3zkra/EKYzHhafL z9St3uJPJggxmy0r0Pu1utB/TIGEIfan7bxVs9LdbNxF4r1g0TPf8tv1xImTihZtxZtZ MMinx91Gl/gSTjKvtcW71nBBlxmzjjgebwZhjJNv+MJx5HWEAJolJU8UReX4D/BZZNMU RommxkxIPVbYYlaEcvRZCEWYge7VHX4tnTaW/o72DSLAcqk53pwRPlx2v5Qbtpa6O7sb e2cfI24GnF3bb3YHw0BQ5/xUucnTztXbcw5FYlNYO8B3cimeVp3HPXF00D2lpoCFrYE5 0pUA== X-Gm-Message-State: AIkVDXK4yrnswxOc6CDZqSKmoi3vbK89Ue3B8NZs/LcGwTRP/vdgxbb8NNeUQeabqN8iiA== X-Received: by 10.46.22.6 with SMTP id w6mr7664392ljd.31.1484342807005; Fri, 13 Jan 2017 13:26:47 -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 r127sm4458010lfr.3.2017.01.13.13.26.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Jan 2017 13:26:46 -0800 (PST) From: Erik Stromdahl To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Cc: Erik Stromdahl Subject: [RFC v3 4/8] ath10k: htc: refactorization Date: Fri, 13 Jan 2017 22:26:07 +0100 Message-Id: <1484342771-6160-5-git-send-email-erik.stromdahl@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484342771-6160-1-git-send-email-erik.stromdahl@gmail.com> References: <1484342771-6160-1-git-send-email-erik.stromdahl@gmail.com> 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 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); }