From patchwork Fri Nov 18 19:22:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Stromdahl X-Patchwork-Id: 9437221 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 BFE9E60238 for ; Fri, 18 Nov 2016 19:24:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B89B829900 for ; Fri, 18 Nov 2016 19:24:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AD53A299D3; Fri, 18 Nov 2016 19:24:23 +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 538C329900 for ; Fri, 18 Nov 2016 19:24:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753393AbcKRTYW (ORCPT ); Fri, 18 Nov 2016 14:24:22 -0500 Received: from mail-qk0-f196.google.com ([209.85.220.196]:34712 "EHLO mail-qk0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752959AbcKRTYQ (ORCPT ); Fri, 18 Nov 2016 14:24:16 -0500 Received: by mail-qk0-f196.google.com with SMTP id y205so858121qkb.1 for ; Fri, 18 Nov 2016 11:24:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jQ6ZiwIp8QM/R+ugPBYYVexJbPxBrGJgwXo/+ZH+gF8=; b=qZrQqWU1xRCek3ypFeqj+pHXl3vJW1aabMVH88bvO31qtIGFaZwukOeSO6a941+r8J HeoitI2hFMuQ2ZJP1OJzleQTE6+ahLVZZ06W3DyA9d0+u/vZ0/bKUW2iei9jcd7KRqgH YbA7m9LDBRoRXA3Aoe/y/UAq/96HSMzfl6pQ8ARFUbEMzvVWd3KBA8bfr3hB8bm0yHY3 14wqaV/g3PzOjP9+Qpv6LwBQC7KOnwCQzQ2KKxMin5bNtEy2dh0v3IvBCrMmG0QRYohn lOgEqzeMjYUtd549d7/OihvY/FwVJOU0yoqlAyGWGQ8HxvOLwFX5y1KyxgKrqeGMpESr cWiQ== 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:in-reply-to :references; bh=jQ6ZiwIp8QM/R+ugPBYYVexJbPxBrGJgwXo/+ZH+gF8=; b=KNG0S/J+oqL1hEOFB6VLTH1rT7j0ju1Ve7VmYZpPgM77IIGSKH+x0k+Y0BSW5T7Pob yae1zDv4vl6tYsjGYeStlty0REYYMlh4CR6rOwvi4MkEX87uhpIi3lGyw7UO4LqcMWzZ Micbym0osZGt70bN/1Esl3//uZsaoyDJ7y2+NXVySY0rfxVWbiLIh9+XfzuebbCfGEZB fdMLF9ylcc1zu2mlxHtMldl5KWB8h4OMSth/ExtalMnNd7ibl2e7p1Iwax1QLiGZYTHE 0b3NPbZb3z6NRRPtDAY8myX0eHhnG8+rltyA13jZsf5uOhcUSuhCUGNwq5Am31kfofg7 VKRQ== X-Gm-Message-State: AKaTC02ZL95aSY6jJB+/CbBEV+954/qcvGGI3p1yWgsRd/GhBXPq3OMcGsrP3motrPrrrA== X-Received: by 10.46.78.26 with SMTP id c26mr803579ljb.46.1479497055743; Fri, 18 Nov 2016 11:24:15 -0800 (PST) Received: from erik-desktop.lan (81-233-218-8-no25.tbcn.telia.com. [81.233.218.8]) by smtp.gmail.com with ESMTPSA id 23sm2623298ljf.48.2016.11.18.11.24.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Nov 2016 11:24:15 -0800 (PST) From: Erik Stromdahl To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Cc: Erik Stromdahl Subject: [RFC v2 05/11] ath10k: htc: refactorization Date: Fri, 18 Nov 2016 20:22:45 +0100 Message-Id: <1479496971-19174-6-git-send-email-erik.stromdahl@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1479496971-19174-1-git-send-email-erik.stromdahl@gmail.com> References: <1479496971-19174-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 6ff5837..f4ffeef 100644 --- a/drivers/net/wireless/ath/ath10k/htc.c +++ b/drivers/net/wireless/ath/ath10k/htc.c @@ -457,42 +457,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); @@ -507,9 +471,40 @@ void ath10k_htc_rx_completion_handler(struct ath10k *ar, struct sk_buff *skb) 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); }