From: Jeff Johnson <quic_jjohnson@quicinc.com>
To: Kalle Valo <kvalo@kernel.org>, <linux-wireless@vger.kernel.org>
Cc: <ath12k@lists.infradead.org>
Subject: Re: [PATCH 27/50] wifi: ath12k: add htc.c
Date: Thu, 18 Aug 2022 12:33:05 -0700 [thread overview]
Message-ID: <8ebc4b7e-6b65-8443-eac6-13b940337166@quicinc.com> (raw)
In-Reply-To: <20220812161003.27279-28-kvalo@kernel.org>
On 8/12/2022 9:09 AM, Kalle Valo wrote:
> From: Kalle Valo <quic_kvalo@quicinc.com>
>
> (Patches split into one patch per file for easier review, but the final
> commit will be one big patch. See the cover letter for more info.)
>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
> ---
> drivers/net/wireless/ath/ath12k/htc.c | 789 ++++++++++++++++++++++++++++++++++
> 1 file changed, 789 insertions(+)
>
> diff --git a/drivers/net/wireless/ath/ath12k/htc.c b/drivers/net/wireless/ath/ath12k/htc.c
snip
> +static struct sk_buff *ath12k_htc_build_tx_ctrl_skb(void *ab)
why void * instead of struct ath12k_base *?
> +{
> + struct sk_buff *skb;
> + struct ath12k_skb_cb *skb_cb;
> +
> + skb = dev_alloc_skb(ATH12K_HTC_CONTROL_BUFFER_SIZE);
> + if (!skb)
> + return NULL;
> +
> + skb_reserve(skb, sizeof(struct ath12k_htc_hdr));
> + WARN_ON_ONCE(!IS_ALIGNED((unsigned long)skb->data, 4));
> +
> + skb_cb = ATH12K_SKB_CB(skb);
> + memset(skb_cb, 0, sizeof(*skb_cb));
> +
> + ath12k_dbg(ab, ATH12K_DBG_HTC, "%s: skb %pK\n", __func__, skb);
does this log really serve any useful purpose?
> + return skb;
> +}
> +
snip
> +static u8 ath12k_htc_get_credit_allocation(struct ath12k_htc *htc,
> + u16 service_id)
> +{
> + u8 i, allocation = 0;
> +
> + for (i = 0; i < ATH12K_HTC_MAX_SERVICE_ALLOC_ENTRIES; i++) {
> + if (htc->service_alloc_table[i].service_id == service_id) {
> + allocation =
> + htc->service_alloc_table[i].credit_allocation;
should you break from the loop here, or can there be more/bigger
allocations for the same service id?
> + }
> + }
> +
> + return allocation;
> +}
> +
> +static int ath12k_htc_setup_target_buffer_assignments(struct ath12k_htc *htc)
> +{
> + struct ath12k_htc_svc_tx_credits *serv_entry;
> + u32 svc_id[] = {
static const?
> + ATH12K_HTC_SVC_ID_WMI_CONTROL,
> + ATH12K_HTC_SVC_ID_WMI_CONTROL_MAC1,
> + ATH12K_HTC_SVC_ID_WMI_CONTROL_MAC2,
> + };
> + int i, credits;
> +
> + credits = htc->total_transmit_credits;
> + serv_entry = htc->service_alloc_table;
> +
> + if ((htc->wmi_ep_count == 0) ||
> + (htc->wmi_ep_count > ARRAY_SIZE(svc_id)))
> + return -EINVAL;
> +
> + /* Divide credits among number of endpoints for WMI */
> + credits = credits / htc->wmi_ep_count;
> + for (i = 0; i < htc->wmi_ep_count; i++) {
> + serv_entry[i].service_id = svc_id[i];
> + serv_entry[i].credit_allocation = credits;
> + }
> +
> + return 0;
> +}
> +
snip
> +int ath12k_htc_start(struct ath12k_htc *htc)
> +{
> + struct sk_buff *skb;
> + int status = 0;
nit: initializer always overwritten by ath12k_htc_send()?
> + struct ath12k_base *ab = htc->ab;
> + struct ath12k_htc_setup_complete_extended *msg;
> +
> + skb = ath12k_htc_build_tx_ctrl_skb(htc->ab);
> + if (!skb)
> + return -ENOMEM;
> +
> + skb_put(skb, sizeof(*msg));
> + memset(skb->data, 0, skb->len);
> +
> + msg = (struct ath12k_htc_setup_complete_extended *)skb->data;
> + msg->msg_id = le32_encode_bits(ATH12K_HTC_MSG_SETUP_COMPLETE_EX_ID,
> + HTC_MSG_MESSAGEID);
> +
> + ath12k_dbg(ab, ATH12K_DBG_HTC, "HTC is using TX credit flow control\n");
> +
> + status = ath12k_htc_send(htc, ATH12K_HTC_EP_0, skb);
> + if (status) {
> + kfree_skb(skb);
> + return status;
> + }
> +
> + return 0;
> +}
> +
> +int ath12k_htc_init(struct ath12k_base *ab)
> +{
> + struct ath12k_htc *htc = &ab->htc;
> + struct ath12k_htc_svc_conn_req conn_req;
> + struct ath12k_htc_svc_conn_resp conn_resp;
> + int ret;
> +
> + spin_lock_init(&htc->tx_lock);
> +
> + ath12k_htc_reset_endpoint_states(htc);
> +
> + htc->ab = ab;
> +
> + switch (ab->wmi_ab.preferred_hw_mode) {
> + case WMI_HOST_HW_MODE_SINGLE:
> + htc->wmi_ep_count = 1;
> + break;
> + case WMI_HOST_HW_MODE_DBS:
> + case WMI_HOST_HW_MODE_DBS_OR_SBS:
> + htc->wmi_ep_count = 2;
> + break;
> + case WMI_HOST_HW_MODE_DBS_SBS:
> + htc->wmi_ep_count = 3;
> + break;
> + default:
> + htc->wmi_ep_count = ab->hw_params->max_radios;
> + break;
> + }
> +
> + /* setup our pseudo HTC control endpoint connection */
> + memset(&conn_req, 0, sizeof(conn_req));
> + memset(&conn_resp, 0, sizeof(conn_resp));
is this better than having = {} initializers?
> + conn_req.ep_ops.ep_tx_complete = ath12k_htc_control_tx_complete;
> + conn_req.ep_ops.ep_rx_complete = ath12k_htc_control_rx_complete;
> + conn_req.max_send_queue_depth = ATH12K_NUM_CONTROL_TX_BUFFERS;
> + conn_req.service_id = ATH12K_HTC_SVC_ID_RSVD_CTRL;
> +
> + /* connect fake service */
> + ret = ath12k_htc_connect_service(htc, &conn_req, &conn_resp);
> + if (ret) {
> + ath12k_err(ab, "could not connect to htc service (%d)\n", ret);
> + return ret;
> + }
> +
> + init_completion(&htc->ctl_resp);
> +
> + return 0;
> +}
>
--
ath12k mailing list
ath12k@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/ath12k
next prev parent reply other threads:[~2022-08-18 19:33 UTC|newest]
Thread overview: 132+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-12 16:09 [PATCH 00/50] wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices Kalle Valo
2022-08-12 16:09 ` [PATCH 01/50] wifi: ath12k: add Kconfig Kalle Valo
2022-08-12 16:09 ` [PATCH 02/50] wifi: ath12k: add Makefile Kalle Valo
2022-08-12 16:09 ` [PATCH 03/50] wifi: ath12k: add ce.c Kalle Valo
2022-09-13 4:28 ` Ping-Ke Shih
2022-10-04 11:08 ` Karthikeyan Periyasamy (QUIC)
2022-08-12 16:09 ` [PATCH 04/50] wifi: ath12k: add ce.h Kalle Valo
2022-08-12 16:09 ` [PATCH 05/50] wifi: ath12k: add core.c Kalle Valo
2022-09-13 6:18 ` Ping-Ke Shih
2022-10-12 23:12 ` Sriram R (QUIC)
2022-10-21 8:32 ` Kalle Valo
2022-08-12 16:09 ` [PATCH 06/50] wifi: ath12k: add core.h Kalle Valo
2022-08-13 0:16 ` Jeff Johnson
2022-10-21 10:58 ` Kalle Valo
2022-08-12 16:09 ` [PATCH 07/50] wifi: ath12k: add dbring.c Kalle Valo
[not found] ` <d9403714-d7ef-3a7c-0448-e5b2b0a60c34@quicinc.com>
2022-10-21 11:06 ` Kalle Valo
2022-11-09 9:12 ` Kalle Valo
2022-08-12 16:09 ` [PATCH 08/50] wifi: ath12k: add dbring.h Kalle Valo
[not found] ` <3f8edc37-6be7-efe5-ac02-2d068f428277@quicinc.com>
2022-10-21 11:07 ` Kalle Valo
2022-10-21 11:12 ` Kalle Valo
2022-08-12 16:09 ` [PATCH 09/50] wifi: ath12k: add debug.c Kalle Valo
2022-08-12 16:09 ` [PATCH 10/50] wifi: ath12k: add debug.h Kalle Valo
[not found] ` <8b456221-07aa-2620-784f-ae44ed2aa431@quicinc.com>
2022-10-21 11:18 ` Kalle Valo
2022-08-12 16:09 ` [PATCH 11/50] wifi: ath12k: add dp.c Kalle Valo
2022-08-16 15:17 ` Jeff Johnson
[not found] ` <CH0PR02MB82123C176B0E05156B66C9F1F6229@CH0PR02MB8212.namprd02.prod.outlook.com>
[not found] ` <94e894a8-a262-959e-a6ab-869dcba9e0fa@quicinc.com>
2022-10-13 16:37 ` Pradeep Kumar Chitrapu
2022-10-13 20:17 ` Jeff Johnson
2022-10-21 11:43 ` Kalle Valo
2022-10-11 19:20 ` Pradeep Kumar Chitrapu
2022-08-12 16:09 ` [PATCH 12/50] wifi: ath12k: add dp.h Kalle Valo
2022-08-15 1:56 ` Ping-Ke Shih
2022-09-05 17:27 ` Kalle Valo
2022-10-21 11:45 ` Kalle Valo
2022-08-12 16:09 ` [PATCH 13/50] wifi: ath12k: add dp_mon.c Kalle Valo
2022-08-16 20:13 ` Jeff Johnson
2022-10-21 13:07 ` Kalle Valo
2022-08-12 16:09 ` [PATCH 14/50] wifi: ath12k: add dp_mon.h Kalle Valo
2022-08-12 16:09 ` [PATCH 15/50] wifi: ath12k: add dp_rx.c Kalle Valo
2022-08-17 0:37 ` Jeff Johnson
2022-10-12 23:29 ` Sriram R (QUIC)
2022-10-13 6:48 ` Jeff Johnson
2022-10-14 2:43 ` Sriram R (QUIC)
2022-10-14 3:01 ` Sriram R (QUIC)
2022-10-21 13:13 ` Kalle Valo
2022-08-17 23:19 ` Jeff Johnson
2022-10-12 23:27 ` Sriram R (QUIC)
2022-10-12 23:39 ` Sriram R (QUIC)
2022-10-13 6:50 ` Jeff Johnson
2022-10-14 2:43 ` Sriram R (QUIC)
2022-10-13 5:54 ` Sriram R (QUIC)
2022-10-21 13:30 ` Kalle Valo
2022-10-21 13:52 ` Kalle Valo
2022-08-12 16:09 ` [PATCH 16/50] wifi: ath12k: add dp_rx.h Kalle Valo
2022-08-12 16:09 ` [PATCH 17/50] wifi: ath12k: add dp_tx.c Kalle Valo
2022-08-17 23:35 ` Jeff Johnson
[not found] ` <CH0PR02MB821206158809DF78955A0EC8F6249@CH0PR02MB8212.namprd02.prod.outlook.com>
2022-10-14 7:49 ` Pradeep Kumar Chitrapu
2022-11-08 13:14 ` Kalle Valo
2022-10-11 19:20 ` Pradeep Kumar Chitrapu
2022-08-12 16:09 ` [PATCH 18/50] wifi: ath12k: add dp_tx.h Kalle Valo
2022-08-12 16:09 ` [PATCH 19/50] wifi: ath12k: add hal.c Kalle Valo
2022-08-17 23:52 ` Jeff Johnson
2022-10-04 11:13 ` Karthikeyan Periyasamy (QUIC)
2022-08-12 16:09 ` [PATCH 20/50] wifi: ath12k: add hal.h Kalle Valo
2022-08-12 16:09 ` [PATCH 21/50] wifi: ath12k: add hal_desc.h Kalle Valo
2022-08-12 16:09 ` [PATCH 22/50] wifi: ath12k: add hal_rx.c Kalle Valo
2022-08-12 16:09 ` [PATCH 23/50] wifi: ath12k: add hal_rx.h Kalle Valo
2022-08-18 0:21 ` Jeff Johnson
2022-10-04 11:15 ` Karthikeyan Periyasamy (QUIC)
2022-08-12 16:09 ` [PATCH 24/50] wifi: ath12k: add hal_tx.c Kalle Valo
2022-08-18 17:21 ` Jeff Johnson
2022-10-04 11:20 ` Karthikeyan Periyasamy (QUIC)
2022-08-12 16:09 ` [PATCH 25/50] wifi: ath12k: add hal_tx.h Kalle Valo
2022-08-12 16:09 ` [PATCH 26/50] wifi: ath12k: add hif.h Kalle Valo
2022-08-12 16:09 ` [PATCH 27/50] wifi: ath12k: add htc.c Kalle Valo
2022-08-18 19:33 ` Jeff Johnson [this message]
2022-10-04 11:23 ` Karthikeyan Periyasamy (QUIC)
2022-08-12 16:09 ` [PATCH 28/50] wifi: ath12k: add htc.h Kalle Valo
2022-08-18 21:10 ` Jeff Johnson
2022-10-04 11:27 ` Karthikeyan Periyasamy (QUIC)
2022-08-12 16:09 ` [PATCH 29/50] wifi: ath12k: add hw.c Kalle Valo
2022-08-18 21:31 ` Jeff Johnson
2022-10-04 11:28 ` Karthikeyan Periyasamy (QUIC)
2022-08-12 16:09 ` [PATCH 30/50] wifi: ath12k: add hw.h Kalle Valo
2022-08-18 22:30 ` Jeff Johnson
2022-11-08 13:27 ` Kalle Valo
2022-08-12 16:09 ` [PATCH 31/50] wifi: ath12k: add mac.c Kalle Valo
2022-08-15 6:09 ` Ping-Ke Shih
2022-09-05 17:31 ` Kalle Valo
2022-08-16 18:09 ` Jeff Johnson
2022-11-08 13:55 ` Kalle Valo
2022-08-12 16:09 ` [PATCH 32/50] wifi: ath12k: add mac.h Kalle Valo
2022-08-12 16:09 ` [PATCH 33/50] wifi: ath12k: add mhi.c Kalle Valo
2022-08-18 22:25 ` Jeff Johnson
2022-08-19 18:56 ` Jeff Johnson
2022-11-08 14:00 ` Kalle Valo
2022-11-09 16:49 ` Jeff Johnson
2022-08-12 16:09 ` [PATCH 34/50] wifi: ath12k: add mhi.h Kalle Valo
2022-08-18 22:30 ` Jeff Johnson
2022-11-08 14:01 ` Kalle Valo
2022-08-12 16:09 ` [PATCH 35/50] wifi: ath12k: add pci.c Kalle Valo
2022-08-18 23:02 ` Jeff Johnson
2022-11-08 14:45 ` Kalle Valo
2022-08-12 16:09 ` [PATCH 36/50] wifi: ath12k: add pci.h Kalle Valo
2022-08-18 23:18 ` Jeff Johnson
2022-11-08 14:56 ` Kalle Valo
2022-08-12 16:09 ` [PATCH 37/50] wifi: ath12k: add peer.c Kalle Valo
2022-08-18 23:34 ` Jeff Johnson
2022-10-04 11:30 ` Karthikeyan Periyasamy (QUIC)
2022-08-12 16:09 ` [PATCH 38/50] wifi: ath12k: add peer.h Kalle Valo
2022-08-17 19:25 ` Jeff Johnson
2022-10-12 23:13 ` Sriram R (QUIC)
2022-08-12 16:09 ` [PATCH 39/50] wifi: ath12k: add qmi.c Kalle Valo
2022-08-22 17:14 ` Jeff Johnson
2022-11-08 14:59 ` Kalle Valo
2022-08-12 16:09 ` [PATCH 40/50] wifi: ath12k: add qmi.h Kalle Valo
2022-08-19 0:25 ` Jeff Johnson
2022-11-08 15:06 ` Kalle Valo
2022-08-12 16:09 ` [PATCH 41/50] wifi: ath12k: add reg.c Kalle Valo
2022-08-12 16:09 ` [PATCH 42/50] wifi: ath12k: add reg.h Kalle Valo
2022-08-12 16:09 ` [PATCH 43/50] wifi: ath12k: add rx_desc.h Kalle Valo
2022-08-12 16:09 ` [PATCH 44/50] wifi: ath12k: add trace.c Kalle Valo
2022-08-12 16:09 ` [PATCH 45/50] wifi: ath12k: add trace.h Kalle Valo
2022-08-12 16:09 ` [PATCH 46/50] wifi: ath12k: add wmi.c Kalle Valo
2022-08-19 20:45 ` Jeff Johnson
2022-09-07 7:36 ` Ping-Ke Shih
2022-11-08 15:40 ` Kalle Valo
2022-08-12 16:10 ` [PATCH 47/50] wifi: ath12k: add wmi.h Kalle Valo
2022-08-19 1:11 ` Jeff Johnson
2022-11-08 15:43 ` Kalle Valo
2022-08-12 16:10 ` [PATCH 48/50] wifi: ath: add ath12k to Makefile Kalle Valo
2022-08-12 16:10 ` [PATCH 49/50] wifi: ath: add ath12k to Kconfig Kalle Valo
2022-08-12 16:10 ` [PATCH 50/50] MAINTAINERS: add ath12k Kalle Valo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8ebc4b7e-6b65-8443-eac6-13b940337166@quicinc.com \
--to=quic_jjohnson@quicinc.com \
--cc=ath12k@lists.infradead.org \
--cc=kvalo@kernel.org \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox