Skip to contentSkip to conversation

ath10k: htc cleanup

PATCH New Michal Kazior 2 participants 5 messages Apr 18, 2013 – Apr 22, 2013 Qualcomm Atheros ATH10K wireless driver

lore
Share & tools
lore
#0 lore raw

cover ath10k: htc cleanup

Patch #1 is quite big, but I wanted to avoid sending like 15 patches. I can send an unsquashed patchset if need be.

If my understanding is correct we should also rename htt and wmi structures and add ath10k_ prefix to them. If not, then we should probably drop this most of this patchset and add the prefix only to some selected structs.

Michal Kazior (3):
ath10k: add ath10k_ prefix to htc structs, defs, enums
ath10k: merge htc-priv.h into htc.h
ath10k: rename htc_tx_lock

 drivers/net/wireless/ath/ath10k/core.c     |   33 +-
 drivers/net/wireless/ath/ath10k/core.h     |    4 +-
 drivers/net/wireless/ath/ath10k/htc-priv.h |  271 ---------------
 drivers/net/wireless/ath/ath10k/htc.c      |  490 ++++++++++++++--------------
 drivers/net/wireless/ath/ath10k/htc.h      |  354 +++++++++++++++++---
 drivers/net/wireless/ath/ath10k/htt.c      |   30 +-
 drivers/net/wireless/ath/ath10k/htt.h      |    7 +-
 drivers/net/wireless/ath/ath10k/htt_tx.c   |    8 +-
 drivers/net/wireless/ath/ath10k/pci.c      |   50 +--
 drivers/net/wireless/ath/ath10k/wmi.c      |   22 +-
 10 files changed, 622 insertions(+), 647 deletions(-)
 delete mode 100644 drivers/net/wireless/ath/ath10k/htc-priv.h
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/3 ath10k: add ath10k_ prefix to htc structs, defs, enums

Conform to kernel driver symbol naming scheme.

---
 drivers/net/wireless/ath/ath10k/core.c     |   33 +-
 drivers/net/wireless/ath/ath10k/core.h     |    4 +-
 drivers/net/wireless/ath/ath10k/htc-priv.h |  173 +++++-----
 drivers/net/wireless/ath/ath10k/htc.c      |  482 ++++++++++++++--------------
 drivers/net/wireless/ath/ath10k/htc.h      |  106 +++---
 drivers/net/wireless/ath/ath10k/htt.c      |   30 +-
 drivers/net/wireless/ath/ath10k/htt.h      |    7 +-
 drivers/net/wireless/ath/ath10k/htt_tx.c   |    8 +-
 drivers/net/wireless/ath/ath10k/pci.c      |   50 +--
 drivers/net/wireless/ath/ath10k/wmi.c      |   22 +-
 10 files changed, 453 insertions(+), 462 deletions(-)
drivers/net/wireless/ath/ath10k/core.c +13 -20
index 0f11c06..b693410 100644
@@ -101,20 +101,13 @@ static int ath10k_check_fw_version(struct ath10k *ar)
 static int ath10k_init_connect_htc(struct ath10k *ar)
 {
 	int status;
-	struct htc_service_connect_req connect;
-
-	memset(&connect, 0, sizeof(connect));
-
-	connect.ep_callbacks.context = ar;
-	connect.ep_callbacks.ep_tx_complete = NULL;
-	connect.ep_callbacks.ep_rx_complete = NULL;
 
 	status = ath10k_wmi_connect_htc_service(ar);
 	if (status)
 		goto conn_fail;
 
 	/* Start HTC */
-	status = ath10k_htc_start(ar->htc_handle);
+	status = ath10k_htc_start(ar->htc);
 	if (status)
 		goto conn_fail;
 
@@ -130,7 +123,7 @@ static int ath10k_init_connect_htc(struct ath10k *ar)
 	return 0;
 
 timeout:
-	ath10k_htc_stop(ar->htc_handle);
+	ath10k_htc_stop(ar->htc);
 conn_fail:
 	return status;
 }
@@ -532,7 +525,7 @@ EXPORT_SYMBOL(ath10k_core_destroy);
 
 int ath10k_core_register(struct ath10k *ar)
 {
-	struct htc_target_cb htc_cb;
+	struct ath10k_htc_ops htc_ops;
 	struct bmi_target_info target_info;
 	int status;
 
@@ -559,10 +552,10 @@ int ath10k_core_register(struct ath10k *ar)
 		goto err;
 	}
 
-	htc_cb.target_send_suspend_complete = ath10k_send_suspend_complete;
+	htc_ops.target_send_suspend_complete = ath10k_send_suspend_complete;
 
-	ar->htc_handle = ath10k_htc_create(ar, &htc_cb);
-	if (ar->htc_handle == NULL) {
+	ar->htc = ath10k_htc_create(ar, &htc_ops);
+	if (ar->htc == NULL) {
 		status = -ENOMEM;
 		goto err;
 	}
@@ -577,11 +570,11 @@ int ath10k_core_register(struct ath10k *ar)
 		goto err_htc_destroy;
 	}
 
-	status = ath10k_htc_wait_target(ar->htc_handle);
+	status = ath10k_htc_wait_target(ar->htc);
 	if (status)
 		goto err_wmi_detach;
 
-	ar->htt = ath10k_htt_attach(ar, ar->htc_handle);
+	ar->htt = ath10k_htt_attach(ar, ar->htc);
 	if (!ar->htt) {
 		status = -ENOMEM;
 		goto err_wmi_detach;
@@ -623,13 +616,13 @@ int ath10k_core_register(struct ath10k *ar)
 err_unregister_mac:
 	ath10k_mac_unregister(ar);
 err_disconnect_htc:
-	ath10k_htc_stop(ar->htc_handle);
+	ath10k_htc_stop(ar->htc);
 err_htt_detach:
 	ath10k_htt_detach(ar->htt);
 err_wmi_detach:
 	ath10k_wmi_detach(ar);
 err_htc_destroy:
-	ath10k_htc_destroy(ar->htc_handle);
+	ath10k_htc_destroy(ar->htc);
 err:
 	return status;
 }
@@ -644,15 +637,15 @@ void ath10k_core_unregister(struct ath10k *ar)
 	 */
 	ath10k_mac_unregister(ar);
 
-	if (!WARN_ON(!ar->htc_handle))
-		ath10k_htc_stop(ar->htc_handle);
+	if (!WARN_ON(!ar->htc))
+		ath10k_htc_stop(ar->htc);
 
 	/* FIXME: we may need to free up htt tx desc here too */
 	ath10k_htt_detach(ar->htt);
 
 	ath10k_wmi_detach(ar);
 
-	ath10k_htc_destroy(ar->htc_handle);
+	ath10k_htc_destroy(ar->htc);
 }
 EXPORT_SYMBOL(ath10k_core_unregister);
 
drivers/net/wireless/ath/ath10k/core.h +2 -2
index b345777..97a79db 100644
@@ -122,7 +122,7 @@ struct ath10k_bmi {
 struct ath10k_wmi {
 	struct ath10k *ar;
 
-	enum htc_endpoint_id eid;
+	enum ath10k_htc_ep_id eid;
 	struct completion service_ready;
 	struct completion unified_ready;
 	atomic_t pending_tx_count;
@@ -298,7 +298,7 @@ struct ath10k {
 
 	struct ath10k_bmi bmi;
 
-	struct htc_target *htc_handle;
+	struct ath10k_htc *htc;
 	struct htt_struct *htt;
 
 	struct ath10k_hw_params {
drivers/net/wireless/ath/ath10k/htc-priv.h +85 -88

283 lines not on this page · raw message

drivers/net/wireless/ath/ath10k/htc.c +241 -241

1,049 lines not on this page · raw message

drivers/net/wireless/ath/ath10k/htc.h +54 -52

145 lines not on this page · raw message

drivers/net/wireless/ath/ath10k/htt.c +15 -15
index 1828dd8..e5480d1 100644
@@ -35,39 +35,39 @@ static void ath10k_htt_wake_queue(void *context)
 
 static int ath10k_htt_htc_attach(struct htt_struct *htt)
 {
-	struct htc_service_connect_req connect;
-	struct htc_service_connect_resp response;
+	struct ath10k_htc_svc_conn_req conn_req;
+	struct ath10k_htc_svc_conn_resp conn_resp;
 	int status;
 
-	memset(&connect, 0, sizeof(connect));
-	memset(&response, 0, sizeof(response));
+	memset(&conn_req, 0, sizeof(conn_req));
+	memset(&conn_resp, 0, sizeof(conn_resp));
 
-	connect.ep_callbacks.context = htt;
-	connect.ep_callbacks.ep_tx_complete = ath10k_htt_htc_tx_complete;
-	connect.ep_callbacks.ep_rx_complete = ath10k_htt_t2h_msg_handler;
-	connect.ep_callbacks.stop_queue = ath10k_htt_stop_queue;
-	connect.ep_callbacks.wake_queue = ath10k_htt_wake_queue;
+	conn_req.ep_ops.context = htt;
+	conn_req.ep_ops.ep_tx_complete = ath10k_htt_htc_tx_complete;
+	conn_req.ep_ops.ep_rx_complete = ath10k_htt_t2h_msg_handler;
+	conn_req.ep_ops.stop_queue = ath10k_htt_stop_queue;
+	conn_req.ep_ops.wake_queue = ath10k_htt_wake_queue;
 
 	/*
 	 * Specify how deep to let a queue get before ath10k_htc_send will
 	 * call the ep_send_full function due to excessive send queue depth.
 	 */
-	connect.max_send_queue_depth = HTT_MAX_SEND_QUEUE_DEPTH;
+	conn_req.max_send_queue_depth = HTT_MAX_SEND_QUEUE_DEPTH;
 
 	/* connect to control service */
-	connect.service_id = HTC_SVC_HTT_DATA_MSG;
+	conn_req.service_id = ATH10K_HTC_SVC_ID_HTT_DATA_MSG;
 
-	status = ath10k_htc_connect_service(htt->htc_target, &connect, &response);
+	status = ath10k_htc_connect_service(htt->htc, &conn_req, &conn_resp);
 
 	if (status)
 		return status;
 
-	htt->ep_id = response.ep_id;
+	htt->eid = conn_resp.eid;
 
 	return 0;
 }
 
-struct htt_struct *ath10k_htt_attach(struct ath10k *ar, void *htc_target)
+struct htt_struct *ath10k_htt_attach(struct ath10k *ar, struct ath10k_htc *htc)
 {
 	struct htt_struct *htt;
 
@@ -76,7 +76,7 @@ struct htt_struct *ath10k_htt_attach(struct ath10k *ar, void *htc_target)
 		goto fail1;
 
 	htt->ar = ar;
-	htt->htc_target = htc_target;
+	htt->htc = htc;
 	htt->cfg.max_throughput_mbps = 800;
 
 	/*
drivers/net/wireless/ath/ath10k/htt.h +3 -4
index e618b18..c94f137 100644
@@ -1111,10 +1111,9 @@ struct htt_rx_info {
 
 struct htt_struct {
 	struct ath10k *ar;
+	struct ath10k_htc *htc;
 
-	void *htc_target;
-
-	enum htc_endpoint_id ep_id;
+	enum ath10k_htc_ep_id eid;
 
 	struct {
 		int max_throughput_mbps;
@@ -1268,7 +1267,7 @@ struct htt_rx_desc {
 
 /* FIXME: add htt_tx_desc_init() */
 
-struct htt_struct *ath10k_htt_attach(struct ath10k *ar, void *htc);
+struct htt_struct *ath10k_htt_attach(struct ath10k *ar, struct ath10k_htc *htc);
 int ath10k_htt_attach_target(struct htt_struct *htt);
 void ath10k_htt_detach(struct htt_struct *htt);
 
drivers/net/wireless/ath/ath10k/htt_tx.c +4 -4
index 910b2e7..2186056 100644
@@ -102,7 +102,7 @@ int ath10k_htt_h2t_ver_req_msg(struct htt_struct *htt)
 
 	ATH10K_SKB_CB(skb)->htt.is_conf = true;
 
-	ret = ath10k_htc_send(htt->htc_target, htt->ep_id, skb);
+	ret = ath10k_htc_send(htt->htc, htt->eid, skb);
 	if (ret) {
 		dev_kfree_skb_any(skb);
 		return ret;
@@ -185,7 +185,7 @@ int ath10k_htt_send_rx_ring_cfg_ll(struct htt_struct *htt)
 
 	ATH10K_SKB_CB(skb)->htt.is_conf = true;
 
-	ret = ath10k_htc_send(htt->htc_target, htt->ep_id, skb);
+	ret = ath10k_htc_send(htt->htc, htt->eid, skb);
 	if (ret) {
 		dev_kfree_skb_any(skb);
 		return ret;
@@ -243,7 +243,7 @@ int ath10k_htt_mgmt_tx(struct htt_struct *htt, struct sk_buff *msdu)
 	skb_cb->htt.refcount = 2;
 	skb_cb->htt.msdu = msdu;
 
-	res = ath10k_htc_send(htt->htc_target, htt->ep_id, txdesc);
+	res = ath10k_htc_send(htt->htc, htt->eid, txdesc);
 	if (res)
 		goto err;
 
@@ -381,7 +381,7 @@ int ath10k_htt_tx(struct htt_struct *htt, struct sk_buff *msdu)
 	skb_cb->htt.txfrag = txfrag;
 	skb_cb->htt.msdu = msdu;
 
-	res = ath10k_htc_send(htt->htc_target, htt->ep_id, txdesc);
+	res = ath10k_htc_send(htt->htc, htt->eid, txdesc);
 	if (res)
 		goto err;
 
drivers/net/wireless/ath/ath10k/pci.c +25 -25

141 lines not on this page · raw message

drivers/net/wireless/ath/ath10k/wmi.c +11 -11
index 230655f..e0f8635 100644
@@ -112,7 +112,7 @@ static int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb,
 
 	trace_ath10k_wmi_cmd(cmd_id, skb->data, skb->len);
 
-	status = ath10k_htc_send(ar->htc_handle, ar->wmi.eid, skb);
+	status = ath10k_htc_send(ar->htc, ar->wmi.eid, skb);
 	if (status) {
 		dev_kfree_skb_any(skb);
 		atomic_dec(&ar->wmi.pending_tx_count);
@@ -1110,28 +1110,28 @@ void ath10k_wmi_detach(struct ath10k *ar)
 int ath10k_wmi_connect_htc_service(struct ath10k *ar)
 {
 	int status;
-	struct htc_service_connect_req connect;
-	struct htc_service_connect_resp response;
+	struct ath10k_htc_svc_conn_req conn_req;
+	struct ath10k_htc_svc_conn_resp conn_resp;
 
-	memset(&connect, 0, sizeof(connect));
-	memset(&response, 0, sizeof(response));
+	memset(&conn_req, 0, sizeof(conn_req));
+	memset(&conn_resp, 0, sizeof(conn_resp));
 
 	/* these fields are the same for all service endpoints */
-	connect.ep_callbacks.context = ar;
-	connect.ep_callbacks.ep_tx_complete = ath10k_wmi_htc_tx_complete;
-	connect.ep_callbacks.ep_rx_complete = ath10k_wmi_process_rx;
+	conn_req.ep_ops.context = ar;
+	conn_req.ep_ops.ep_tx_complete = ath10k_wmi_htc_tx_complete;
+	conn_req.ep_ops.ep_rx_complete = ath10k_wmi_process_rx;
 
 	/* connect to control service */
-	connect.service_id = HTC_SVC_WMI_CONTROL;
+	conn_req.service_id = ATH10K_HTC_SVC_ID_WMI_CONTROL;
 
-	status = ath10k_htc_connect_service(ar->htc_handle, &connect, &response);
+	status = ath10k_htc_connect_service(ar->htc, &conn_req, &conn_resp);
 	if (status) {
 		ath10k_warn("failed to connect to WMI CONTROL"
 			    " service status: %d\n", status);
 		return status;
 	}
 
-	ar->wmi.eid = response.ep_id;
+	ar->wmi.eid = conn_resp.eid;
 	return 0;
 }
 
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/3 ath10k: merge htc-priv.h into htc.h

In reply to Michal Kazior

The file was already slated for removal for quite
some time now.

---
 drivers/net/wireless/ath/ath10k/htc-priv.h |  268 ----------------------------
 drivers/net/wireless/ath/ath10k/htc.c      |    2 +-
 drivers/net/wireless/ath/ath10k/htc.h      |  252 ++++++++++++++++++++++++++
 3 files changed, 253 insertions(+), 269 deletions(-)
 delete mode 100644 drivers/net/wireless/ath/ath10k/htc-priv.h
drivers/net/wireless/ath/ath10k/htc-priv.h deleted +0 -268
deleted file mode 100644
index 444e685..0000000
@@ -1,268 +0,0 @@
-/*
- * Copyright (c) 2005-2011 Atheros Communications Inc.
- * Copyright (c) 2011-2013 Qualcomm Atheros, Inc.
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef _HTC_PRIV_H
-#define _HTC_PRIV_H
-
-#include <linux/semaphore.h>
-#include <linux/timer.h>
-
-#include "htc.h"
-#include "hif.h"
-
-/*
- * HTC - host-target control protocol
- *
- * tx packets are generally <htc_hdr><payload>
- * rx packets are more complex: <htc_hdr><payload><trailer>
- *
- * The payload + trailer length is stored in len.
- * To get payload-only length one needs to payload - trailer_len.
- *
- * Trailer contains (possibly) multiple <htc_record>.
- * Each record is a id-len-value.
- *
- * HTC header flags, control_byte0, control_byte1
- * have different meaning depending whether its tx
- * or rx.
- *
- * Alignment: htc_hdr, payload and trailer are
- * 4-byte aligned.
- */
-
-enum ath10k_htc_tx_flags {
-	ATH10K_HTC_FLAG_NEED_CREDIT_UPDATE = 0x01,
-	ATH10K_HTC_FLAG_SEND_BUNDLE        = 0x02
-};
-
-enum ath10k_htc_rx_flags {
-	ATH10K_HTC_FLAG_TRAILER_PRESENT = 0x02,
-	ATH10K_HTC_FLAG_BUNDLE_MASK     = 0xF0
-};
-
-struct ath10k_htc_hdr {
-	u8 eid; /* @enum ath10k_htc_ep_id */
-	u8 flags; /* @enum ath10k_htc_tx_flags, ath10k_htc_rx_flags */
-	__le16 len;
-	union {
-		u8 trailer_len; /* for rx */
-		u8 control_byte0;
-	} __packed;
-	union {
-		u8 seq_no; /* for tx */
-		u8 control_byte1;
-	} __packed;
-	u8 pad0;
-	u8 pad1;
-} __packed __aligned(4);
-
-enum ath10k_ath10k_htc_msg_id {
-	ATH10K_HTC_MSG_READY_ID                = 1,
-	ATH10K_HTC_MSG_CONNECT_SERVICE_ID      = 2,
-	ATH10K_HTC_MSG_CONNECT_SERVICE_RESP_ID = 3,
-	ATH10K_HTC_MSG_SETUP_COMPLETE_ID       = 4,
-	ATH10K_HTC_MSG_SETUP_COMPLETE_EX_ID    = 5,
-	ATH10K_HTC_MSG_SEND_SUSPEND_COMPLETE   = 6
-};
-
-enum ath10k_htc_version {
-	ATH10K_HTC_VERSION_2P0 = 0x00, /* 2.0 */
-	ATH10K_HTC_VERSION_2P1 = 0x01, /* 2.1 */
-};
-
-enum ath10k_htc_conn_flags {
-	ATH10K_HTC_CONN_FLAGS_THRESHOLD_LEVEL_ONE_FOURTH    = 0x0,
-	ATH10K_HTC_CONN_FLAGS_THRESHOLD_LEVEL_ONE_HALF      = 0x1,
-	ATH10K_HTC_CONN_FLAGS_THRESHOLD_LEVEL_THREE_FOURTHS = 0x2,
-	ATH10K_HTC_CONN_FLAGS_THRESHOLD_LEVEL_UNITY         = 0x3,
-#define ATH10K_HTC_CONN_FLAGS_THRESHOLD_LEVEL_MASK 0x3
-	ATH10K_HTC_CONN_FLAGS_REDUCE_CREDIT_DRIBBLE    = 1 << 2,
-	ATH10K_HTC_CONN_FLAGS_DISABLE_CREDIT_FLOW_CTRL = 1 << 3
-#define ATH10K_HTC_CONN_FLAGS_RECV_ALLOC_MASK 0xFF00
-#define ATH10K_HTC_CONN_FLAGS_RECV_ALLOC_LSB  8
-};
-
-enum ath10k_htc_conn_svc_status {
-	ATH10K_HTC_CONN_SVC_STATUS_SUCCESS      = 0,
-	ATH10K_HTC_CONN_SVC_STATUS_NOT_FOUND    = 1,
-	ATH10K_HTC_CONN_SVC_STATUS_FAILED       = 2,
-	ATH10K_HTC_CONN_SVC_STATUS_NO_RESOURCES = 3,
-	ATH10K_HTC_CONN_SVC_STATUS_NO_MORE_EP   = 4
-};
-
-struct ath10k_ath10k_htc_msg_hdr {
-	__le16 message_id; /* @enum htc_message_id */
-} __packed;
-
-struct ath10k_htc_unknown {
-	u8 pad0;
-	u8 pad1;
-} __packed;
-
-struct ath10k_htc_ready {
-	__le16 credit_count;
-	__le16 credit_size;
-	u8 max_endpoints;
-	u8 pad0;
-} __packed;
-
-struct ath10k_htc_ready_extended {
-	struct ath10k_htc_ready base;
-	u8 htc_version; /* @enum ath10k_htc_version */
-	u8 max_msgs_per_htc_bundle;
-	u8 pad0;
-	u8 pad1;
-} __packed;
-
-struct ath10k_htc_conn_svc {
-	__le16 service_id;
-	__le16 flags; /* @enum ath10k_htc_conn_flags */
-	u8 pad0;
-	u8 pad1;
-} __packed;
-
-struct ath10k_htc_conn_svc_response {
-	__le16 service_id;
-	u8 status; /* @enum ath10k_htc_conn_svc_status */
-	u8 eid;
-	__le16 max_msg_size;
-} __packed;
-
-struct ath10k_htc_setup_complete_extended {
-	u8 pad0;
-	u8 pad1;
-	__le32 flags; /* @enum htc_setup_complete_flags */
-	u8 max_msgs_per_bundled_recv;
-	u8 pad2;
-	u8 pad3;
-	u8 pad4;
-} __packed;
-
-struct ath10k_htc_msg {
-	struct ath10k_ath10k_htc_msg_hdr hdr;
-	union {
-		/* host-to-target */
-		struct ath10k_htc_conn_svc connect_service;
-		struct ath10k_htc_ready ready;
-		struct ath10k_htc_ready_extended ready_ext;
-		struct ath10k_htc_unknown unknown;
-		struct ath10k_htc_setup_complete_extended setup_complete_ext;
-
-		/* target-to-host */
-		struct ath10k_htc_conn_svc_response connect_service_response;
-	};
-} __packed __aligned(4);
-
-enum ath10k_ath10k_htc_record_id {
-	ATH10K_HTC_RECORD_NULL    = 0,
-	ATH10K_HTC_RECORD_CREDITS = 1
-};
-
-struct ath10k_ath10k_htc_record_hdr {
-	u8 id; /* @enum ath10k_ath10k_htc_record_id */
-	u8 len;
-	u8 pad0;
-	u8 pad1;
-} __packed;
-
-struct ath10k_htc_credit_report {
-	u8 eid; /* @enum ath10k_htc_ep_id */
-	u8 credits;
-	u8 pad0;
-	u8 pad1;
-} __packed;
-
-struct ath10k_htc_record {
-	struct ath10k_ath10k_htc_record_hdr hdr;
-	union {
-		struct ath10k_htc_credit_report credit_report[0];
-		u8 pauload[0];
-	};
-} __packed __aligned(4);
-
-/*
- * note: the trailer offset is dynamic depending
- * on payload length. this is only a struct layout draft
- */
-struct ath10k_htc_frame {
-	struct ath10k_htc_hdr hdr;
-	union {
-		struct ath10k_htc_msg msg;
-		u8 payload[0];
-	};
-	struct ath10k_htc_record trailer[0];
-} __packed __aligned(4);
-
-#define ATH10K_NUM_CONTROL_TX_BUFFERS 2
-#define ATH10K_HTC_MAX_LEN 4096
-#define ATH10K_HTC_MAX_CTRL_MSG_LEN 256
-#define ATH10K_HTC_WAIT_TIMEOUT_HZ (1*HZ)
-#define ATH10K_HTC_CONTROL_BUFFER_SIZE (ATH10K_HTC_MAX_CTRL_MSG_LEN + sizeof(struct ath10k_htc_hdr))
-#define ATH10K_HTC_CONN_SVC_TIMEOUT_HZ (1*HZ)
-
-struct ath10k_htc_ep {
-	struct ath10k_htc *htc;
-	enum ath10k_htc_ep_id eid;
-	enum ath10k_htc_svc_id service_id;
-	struct ath10k_htc_ep_ops ep_ops;
-
-	int max_tx_queue_depth;
-	int max_ep_message_len;
-	u8 ul_pipe_id;
-	u8 dl_pipe_id;
-	int ul_is_polled; /* call HIF to get tx completions */
-	int dl_is_polled; /* call HIF to fetch rx (not implemented) */
-
-	struct sk_buff_head tx_queue;
-	int tx_queue_len;
-	bool tx_queue_stopped;
-
-	u8 seq_no; /* for debugging */
-	int tx_credits;
-	int tx_credit_size;
-	int tx_credits_per_max_message;
-	bool tx_credit_flow_enabled;
-
-	struct work_struct send_work;
-};
-
-struct ath10k_htc_svc_tx_credits {
-	u16 service_id;
-	u8  credit_allocation;
-};
-
-struct ath10k_htc {
-	struct ath10k *ar;
-	struct ath10k_htc_ep endpoint[ATH10K_HTC_EP_COUNT];
-
-	spinlock_t htc_tx_lock;
-
-	struct ath10k_htc_ops htc_ops;
-
-	u8 control_resp_buffer[ATH10K_HTC_MAX_CTRL_MSG_LEN];
-	int control_resp_len;
-
-	struct completion ctl_resp;
-
-	int total_transmit_credits;
-	struct ath10k_htc_svc_tx_credits service_tx_alloc[ATH10K_HTC_EP_COUNT];
-	int target_credit_size;
-
-	bool stopping;
-};
-
-#endif	/* _HTC_PRIV_H_ */
drivers/net/wireless/ath/ath10k/htc.c +1 -1
index 904e1c6..e76d434 100644
@@ -16,7 +16,7 @@
  */
 
 #include "core.h"
-#include "htc-priv.h"
+#include "hif.h"
 #include "debug.h"
 
 /********/
drivers/net/wireless/ath/ath10k/htc.h +252 -0

267 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 3/3 ath10k: rename htc_tx_lock

In reply to Michal Kazior

We can call it just tx_lock.

---
 drivers/net/wireless/ath/ath10k/htc.c |   40 ++++++++++++++++-----------------
 drivers/net/wireless/ath/ath10k/htc.h |    2 +-
 2 files changed, 21 insertions(+), 21 deletions(-)
drivers/net/wireless/ath/ath10k/htc.c +20 -20
index e76d434..2857a80 100644
@@ -124,7 +124,7 @@ static void ath10k_htc_notify_tx_completion(struct ath10k_htc_ep *ep,
 	ep->ep_ops.ep_tx_complete(ep->ep_ops.context, skb);
 }
 
-/* assumes htc_tx_lock is held */
+/* assumes tx_lock is held */
 static bool ath10k_htc_ep_need_credit_update(struct ath10k_htc_ep *ep)
 {
 	if (!ep->tx_credit_flow_enabled)
@@ -147,13 +147,13 @@ static int ath10k_htc_prepare_tx_skb(struct ath10k_htc_ep *ep,
 	hdr->eid = ep->eid;
 	hdr->len = __cpu_to_le16(skb->len - sizeof(*hdr));
 
-	spin_lock_bh(&ep->htc->htc_tx_lock);
+	spin_lock_bh(&ep->htc->tx_lock);
 	hdr->seq_no = ep->seq_no++;
 
 	if (ath10k_htc_ep_need_credit_update(ep))
 		hdr->flags |= ATH10K_HTC_FLAG_NEED_CREDIT_UPDATE;
 
-	spin_unlock_bh(&ep->htc->htc_tx_lock);
+	spin_unlock_bh(&ep->htc->tx_lock);
 
 	return 0;
 }
@@ -188,9 +188,9 @@ static int ath10k_htc_issue_skb(struct ath10k_htc *htc,
 err:
 	ath10k_warn("HTC issue failed: %d\n", ret);
 
-	spin_lock_bh(&htc->htc_tx_lock);
+	spin_lock_bh(&htc->tx_lock);
 	ep->tx_credits += skb_cb->htc.credits_used;
-	spin_unlock_bh(&htc->htc_tx_lock);
+	spin_unlock_bh(&htc->tx_lock);
 
 	skb_cb->is_aborted = true;
 	ath10k_htc_notify_tx_completion(ep, skb);
@@ -198,7 +198,7 @@ err:
 	return ret;
 }
 
-/* assumes htc_tx_lock is held */
+/* assumes tx_lock is held */
 static struct sk_buff *ath10k_htc_get_skb_credit_based(struct ath10k_htc *htc,
 						       struct ath10k_htc_ep *ep)
 {
@@ -255,7 +255,7 @@ static struct sk_buff *ath10k_htc_get_skb_credit_based(struct ath10k_htc *htc,
 	return skb;
 }
 
-/* assumes htc_tx_lock is held */
+/* assumes tx_lock is held */
 static struct sk_buff *ath10k_htc_get_skb(struct ath10k_htc *htc,
 					  struct ath10k_htc_ep *ep,
 					  int resources)
@@ -293,14 +293,14 @@ static void ath10k_htc_send_work(struct work_struct *work)
 		if (ep->ul_is_polled)
 			ath10k_htc_send_complete_check(ep, 0);
 
-		spin_lock_bh(&htc->htc_tx_lock);
+		spin_lock_bh(&htc->tx_lock);
 
 		if (ep->tx_credit_flow_enabled)
 			skb = ath10k_htc_get_skb_credit_based(htc, ep);
 		else
 			skb = ath10k_htc_get_skb(htc, ep, tx_resources);
 
-		spin_unlock_bh(&htc->htc_tx_lock);
+		spin_unlock_bh(&htc->tx_lock);
 
 		if (!skb)
 			break; /* tx_queue empty or out of resources */
@@ -322,10 +322,10 @@ int ath10k_htc_send(struct ath10k_htc *htc,
 
 	skb_push(skb, sizeof(struct ath10k_htc_hdr));
 
-	spin_lock_bh(&htc->htc_tx_lock);
+	spin_lock_bh(&htc->tx_lock);
 	skb_queue_tail(&ep->tx_queue, skb);
 	ath10k_htc_recalc_queue(ep, 1);
-	spin_unlock_bh(&htc->htc_tx_lock);
+	spin_unlock_bh(&htc->tx_lock);
 
 	queue_work(htc->ar->workqueue, &ep->send_work);
 	return 0;
@@ -343,9 +343,9 @@ static int ath10k_htc_tx_completion_handler(struct ath10k *ar,
 	ath10k_htc_notify_tx_completion(ep, skb);
 	/* the skb now belongs to the completion handler */
 
-	spin_lock_bh(&htc->htc_tx_lock);
+	spin_lock_bh(&htc->tx_lock);
 	stopping = htc->stopping;
-	spin_unlock_bh(&htc->htc_tx_lock);
+	spin_unlock_bh(&htc->tx_lock);
 
 	if (!ep->tx_credit_flow_enabled && !stopping)
 		/*
@@ -366,7 +366,7 @@ static void ath10k_htc_flush_endpoint_tx(struct ath10k_htc *htc,
 	struct sk_buff *skb;
 	struct ath10k_skb_cb *skb_cb;
 
-	spin_lock_bh(&htc->htc_tx_lock);
+	spin_lock_bh(&htc->tx_lock);
 	for (;;) {
 		skb = skb_dequeue(&ep->tx_queue);
 		if (!skb)
@@ -376,7 +376,7 @@ static void ath10k_htc_flush_endpoint_tx(struct ath10k_htc *htc,
 		skb_cb->is_aborted = true;
 		ath10k_htc_notify_tx_completion(ep, skb);
 	}
-	spin_unlock_bh(&htc->htc_tx_lock);
+	spin_unlock_bh(&htc->tx_lock);
 
 	cancel_work_sync(&ep->send_work);
 }
@@ -400,7 +400,7 @@ static void ath10k_htc_process_credit_report(struct ath10k_htc *htc,
 
 	n_reports = len / sizeof(*report);
 
-	spin_lock_bh(&htc->htc_tx_lock);
+	spin_lock_bh(&htc->tx_lock);
 	for (i = 0; i < n_reports; i++, report++) {
 		if (report->eid >= ATH10K_HTC_EP_COUNT)
 			break;
@@ -416,7 +416,7 @@ static void ath10k_htc_process_credit_report(struct ath10k_htc *htc,
 
 		total_credits += report->credits;
 	}
-	spin_unlock_bh(&htc->htc_tx_lock);
+	spin_unlock_bh(&htc->tx_lock);
 
 	ath10k_dbg(ATH10K_DBG_HTC, "report indicated %d credits total\n",
 		   total_credits);
@@ -958,9 +958,9 @@ void ath10k_htc_stop(struct ath10k_htc *htc)
 	int i;
 	struct ath10k_htc_ep *ep;
 
-	spin_lock_bh(&htc->htc_tx_lock);
+	spin_lock_bh(&htc->tx_lock);
 	htc->stopping = true;
-	spin_unlock_bh(&htc->htc_tx_lock);
+	spin_unlock_bh(&htc->tx_lock);
 
 	for (i = ATH10K_HTC_EP_0; i < ATH10K_HTC_EP_COUNT; i++) {
 		ep = &htc->endpoint[i];
@@ -986,7 +986,7 @@ struct ath10k_htc *ath10k_htc_create(struct ath10k *ar,
 		return NULL;
 	}
 
-	spin_lock_init(&htc->htc_tx_lock);
+	spin_lock_init(&htc->tx_lock);
 
 	memcpy(&htc->htc_ops, htc_ops, sizeof(struct ath10k_htc_ops));
 
drivers/net/wireless/ath/ath10k/htc.h +1 -1
index fba7e43..a9619e6 100644
@@ -339,7 +339,7 @@ struct ath10k_htc {
 	struct ath10k *ar;
 	struct ath10k_htc_ep endpoint[ATH10K_HTC_EP_COUNT];
 
-	spinlock_t htc_tx_lock;
+	spinlock_t tx_lock;
 
 	struct ath10k_htc_ops htc_ops;
 
Signature · 1 line
1.7.9.5
Applied
#4 lore raw

cover ath10k: htc cleanup

In reply to Michal Kazior
Quoted 10 lines · Michal Kazior

Patch #1 is quite big, but I wanted to avoid sending like 15 patches. I can send an unsquashed patchset if need be.

If my understanding is correct we should also rename htt and wmi structures and add ath10k_ prefix to them. If not, then we should probably drop this most of this patchset and add the prefix only to some selected structs.

Quoted 4 lines

Michal Kazior (3):
ath10k: add ath10k_ prefix to htc structs, defs, enums
ath10k: merge htc-priv.h into htc.h
ath10k: rename htc_tx_lock

Thanks, applied. Patch 1 had conflicts, please check.

Signature · 1 line
Kalle Valo