From patchwork Thu Oct 13 16:39:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Stromdahl X-Patchwork-Id: 9375445 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 02E7660487 for ; Thu, 13 Oct 2016 16:42:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E900F2A16B for ; Thu, 13 Oct 2016 16:42:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC4362A16E; Thu, 13 Oct 2016 16:42: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 6A8342A16B for ; Thu, 13 Oct 2016 16:42:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933197AbcJMQmA (ORCPT ); Thu, 13 Oct 2016 12:42:00 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:34209 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933158AbcJMQlu (ORCPT ); Thu, 13 Oct 2016 12:41:50 -0400 Received: by mail-lf0-f65.google.com with SMTP id x23so7786467lfi.1 for ; Thu, 13 Oct 2016 09:41:15 -0700 (PDT) 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=LxwLYuC3HydPUJT14q7SYeXoGq47ZGPIMPkhjHMb6cg=; b=Kig5mPVu+4vmY1EDWx9rzChhqXs2+a234Z56AmmhmSA00fWb9or5fNHfmDP3jWSV9h 1+y1+iMxSdTtZNnMqsodKjcYDadkYR67c3bGycZWQjAAWANz6s5K0DEtUnvXuc8Jsdat GzHO7x5Lic8yKCcPdgPB6bi1QJtRlKAA6cahMSCJVzjBok2RoDhKthaymuG4NseU597U hoPl5sHOSq0sj2QpvHM8n8DhUCeqH5wM/UVPurmmQKeaQgml/k5/2583T531Rep3bnhj 395u3pkZZMdGWkBKh1eBIM6M2Y1sLnVMnZURqd7aCmYQgzSVgWMYmoE6qHpC9bosaWFA IVUA== 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=LxwLYuC3HydPUJT14q7SYeXoGq47ZGPIMPkhjHMb6cg=; b=V1/Ln6tJoiqnNlreqGySNv40K2fGeCbuJl1+9Imp/YOGCD3TSFBRBG1n5GO9wf/OWb RG9V00CJtY6GBiqoa1KRzx3JhUwif69JOKJc7h6szUAbAYGs1N6+3gQDXf4ZIZVQLNSA csxcParV4+GwR4l0ekjPz9JZatKV1OnHDOLZ+xHQddZDs6jkwuYxvKsDVW3Qks+B29FQ d0ZXMoI7SriZjTnoMOehauvz8b3DhmXtH9KYzjQk1S42SS+AvzUlWqXGuFG+f4dBlNKg AUYM9nL+Fy7zeKFw0+fnMH6QsHK7bC2pZk95/vhd5bnkUvCcwWNO7RlbkYbfMrjWsMKZ 1vzw== X-Gm-Message-State: AA6/9Rm83bbTPHXtburA6Kve0a2IeSokEx0RVFc+Hf7mCmXPFQQzkIIfx8K2nJHhgGtJAQ== X-Received: by 10.25.163.132 with SMTP id m126mr2899499lfe.9.1476376874326; Thu, 13 Oct 2016 09:41:14 -0700 (PDT) Received: from erik-desktop.lan (81-233-218-8-no25.tbcn.telia.com. [81.233.218.8]) by smtp.gmail.com with ESMTPSA id j124sm3986330lfe.3.2016.10.13.09.41.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Oct 2016 09:41:13 -0700 (PDT) From: Erik Stromdahl To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org Cc: Erik Stromdahl Subject: [RFC 3/5] ath6kl: Added disable credit flow ctrl for mbox Date: Thu, 13 Oct 2016 18:39:27 +0200 Message-Id: <1476376769-4708-4-git-send-email-erik.stromdahl@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1476376769-4708-1-git-send-email-erik.stromdahl@gmail.com> References: <1476376769-4708-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 Added support for disabling credit flow control for htc_mbox in a similar way as htc_pipe. The tx_credit_flow_enabled member was moved out from the pipe struct in struct htc_endpoint since it is now used by htc_mbox as well. Signed-off-by: Erik Stromdahl --- drivers/net/wireless/ath/ath6kl/htc.h | 2 +- drivers/net/wireless/ath/ath6kl/htc_mbox.c | 18 ++++++++++++++++-- drivers/net/wireless/ath/ath6kl/htc_pipe.c | 14 +++++++------- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/ath/ath6kl/htc.h b/drivers/net/wireless/ath/ath6kl/htc.h index 112d8a9..532b13b 100644 --- a/drivers/net/wireless/ath/ath6kl/htc.h +++ b/drivers/net/wireless/ath/ath6kl/htc.h @@ -521,12 +521,12 @@ struct htc_endpoint { u32 conn_flags; struct htc_endpoint_stats ep_st; u16 tx_drop_packet_threshold; + bool tx_credit_flow_enabled; struct { u8 pipeid_ul; u8 pipeid_dl; struct list_head tx_lookup_queue; - bool tx_credit_flow_enabled; } pipe; }; diff --git a/drivers/net/wireless/ath/ath6kl/htc_mbox.c b/drivers/net/wireless/ath/ath6kl/htc_mbox.c index 6e8c493..2c4477d 100644 --- a/drivers/net/wireless/ath/ath6kl/htc_mbox.c +++ b/drivers/net/wireless/ath/ath6kl/htc_mbox.c @@ -603,7 +603,7 @@ static void ath6kl_htc_tx_pkts_get(struct htc_target *target, struct htc_endpoint *endpoint, struct list_head *queue) { - int req_cred; + int req_cred = 0; u8 flags; struct htc_packet *packet; unsigned int len; @@ -623,7 +623,8 @@ static void ath6kl_htc_tx_pkts_get(struct htc_target *target, len = CALC_TXRX_PADDED_LEN(target, packet->act_len + HTC_HDR_LENGTH); - if (htc_check_credits(target, endpoint, &flags, + if (endpoint->tx_credit_flow_enabled && + htc_check_credits(target, endpoint, &flags, packet->endpoint, len, &req_cred)) break; @@ -2434,6 +2435,7 @@ static int ath6kl_htc_mbox_conn_service(struct htc_target *target, struct htc_conn_service_msg *conn_msg; struct htc_endpoint *endpoint; enum htc_endpoint_id assigned_ep = ENDPOINT_MAX; + bool disable_credit_flowctrl = false; unsigned int max_msg_sz = 0; int status = 0; u16 msg_id; @@ -2459,6 +2461,10 @@ static int ath6kl_htc_mbox_conn_service(struct htc_target *target, conn_msg->svc_id = cpu_to_le16(conn_req->svc_id); conn_msg->conn_flags = cpu_to_le16(conn_req->conn_flags); + if (conn_req->conn_flags & + HTC_CONN_FLGS_DISABLE_CRED_FLOW_CTRL) + disable_credit_flowctrl = true; + set_htc_pkt_info(tx_pkt, NULL, (u8 *) conn_msg, sizeof(*conn_msg) + conn_msg->svc_meta_len, ENDPOINT_0, HTC_SERVICE_TX_PACKET_TAG); @@ -2562,6 +2568,13 @@ static int ath6kl_htc_mbox_conn_service(struct htc_target *target, /* save local connection flags */ endpoint->conn_flags = conn_req->flags; + if (disable_credit_flowctrl && endpoint->tx_credit_flow_enabled) { + endpoint->tx_credit_flow_enabled = false; + ath6kl_dbg(ATH6KL_DBG_HTC, + "SVC: 0x%4.4X ep:%d TX flow control off\n", + endpoint->svc_id, assigned_ep); + } + fail_tx: if (tx_pkt) htc_reclaim_txctrl_buf(target, tx_pkt); @@ -2590,6 +2603,7 @@ static void reset_ep_state(struct htc_target *target) INIT_LIST_HEAD(&endpoint->rx_bufq); INIT_LIST_HEAD(&endpoint->txq); endpoint->target = target; + endpoint->tx_credit_flow_enabled = true; } /* reset distribution list */ diff --git a/drivers/net/wireless/ath/ath6kl/htc_pipe.c b/drivers/net/wireless/ath/ath6kl/htc_pipe.c index ca1a18c..93aac63 100644 --- a/drivers/net/wireless/ath/ath6kl/htc_pipe.c +++ b/drivers/net/wireless/ath/ath6kl/htc_pipe.c @@ -408,7 +408,7 @@ static enum htc_send_queue_result htc_try_send(struct htc_target *target, } } - if (!ep->pipe.tx_credit_flow_enabled) { + if (!ep->tx_credit_flow_enabled) { tx_resources = ath6kl_hif_pipe_get_free_queue_number(ar, ep->pipe.pipeid_ul); @@ -452,7 +452,7 @@ static enum htc_send_queue_result htc_try_send(struct htc_target *target, if (get_queue_depth(&ep->txq) == 0) break; - if (ep->pipe.tx_credit_flow_enabled) { + if (ep->tx_credit_flow_enabled) { /* * Credit based mechanism provides flow control * based on target transmit resource availability, @@ -482,7 +482,7 @@ static enum htc_send_queue_result htc_try_send(struct htc_target *target, /* send what we can */ htc_issue_packets(target, ep, &send_queue); - if (!ep->pipe.tx_credit_flow_enabled) { + if (!ep->tx_credit_flow_enabled) { pipeid = ep->pipe.pipeid_ul; tx_resources = ath6kl_hif_pipe_get_free_queue_number(ar, pipeid); @@ -768,7 +768,7 @@ static int ath6kl_htc_pipe_tx_complete(struct ath6kl *ar, struct sk_buff *skb) } skb = NULL; - if (!ep->pipe.tx_credit_flow_enabled) { + if (!ep->tx_credit_flow_enabled) { /* * note: when using TX credit flow, the re-checking of queues * happens when credits flow back from the target. in the @@ -1194,7 +1194,7 @@ static void reset_endpoint_states(struct htc_target *target) INIT_LIST_HEAD(&ep->pipe.tx_lookup_queue); INIT_LIST_HEAD(&ep->rx_bufq); ep->target = target; - ep->pipe.tx_credit_flow_enabled = true; + ep->tx_credit_flow_enabled = true; } } @@ -1399,8 +1399,8 @@ static int ath6kl_htc_pipe_conn_service(struct htc_target *target, ep->svc_id, ep->pipe.pipeid_ul, ep->pipe.pipeid_dl, ep->eid); - if (disable_credit_flowctrl && ep->pipe.tx_credit_flow_enabled) { - ep->pipe.tx_credit_flow_enabled = false; + if (disable_credit_flowctrl && ep->tx_credit_flow_enabled) { + ep->tx_credit_flow_enabled = false; ath6kl_dbg(ATH6KL_DBG_HTC, "SVC: 0x%4.4X ep:%d TX flow control off\n", ep->svc_id, assigned_epid);