Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit edb8236d authored by Michal Kazior's avatar Michal Kazior Committed by Kalle Valo
Browse files

ath10k: embed HTT struct inside ath10k



This reduces number of allocations and simplifies
memory managemnt.

Signed-off-by: default avatarMichal Kazior <michal.kazior@tieto.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent cd003fad
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -556,9 +556,9 @@ int ath10k_core_register(struct ath10k *ar)
	if (status)
		goto err_wmi_detach;

	ar->htt = ath10k_htt_attach(ar);
	if (!ar->htt) {
		status = -ENOMEM;
	status = ath10k_htt_attach(ar);
	if (status) {
		ath10k_err("could not attach htt (%d)\n", status);
		goto err_wmi_detach;
	}

@@ -585,7 +585,7 @@ int ath10k_core_register(struct ath10k *ar)
		goto err_disconnect_htc;
	}

	status = ath10k_htt_attach_target(ar->htt);
	status = ath10k_htt_attach_target(&ar->htt);
	if (status)
		goto err_disconnect_htc;

@@ -606,7 +606,7 @@ int ath10k_core_register(struct ath10k *ar)
err_disconnect_htc:
	ath10k_htc_stop(&ar->htc);
err_htt_detach:
	ath10k_htt_detach(ar->htt);
	ath10k_htt_detach(&ar->htt);
err_wmi_detach:
	ath10k_wmi_detach(ar);
err:
@@ -621,7 +621,7 @@ void ath10k_core_unregister(struct ath10k *ar)
	 * unhappy about callback failures. */
	ath10k_mac_unregister(ar);
	ath10k_htc_stop(&ar->htc);
	ath10k_htt_detach(ar->htt);
	ath10k_htt_detach(&ar->htt);
	ath10k_wmi_detach(ar);
}
EXPORT_SYMBOL(ath10k_core_unregister);
+3 −4
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include <linux/types.h>
#include <linux/pci.h>

#include "htt.h"
#include "htc.h"
#include "hw.h"
#include "targaddrs.h"
@@ -273,15 +274,13 @@ struct ath10k {
		const struct ath10k_hif_ops *ops;
	} hif;

	struct ath10k_wmi wmi;

	wait_queue_head_t event_queue;
	bool is_target_paused;

	struct ath10k_bmi bmi;
	struct ath10k_wmi wmi;
	struct ath10k_htc htc;

	struct ath10k_htt *htt;
	struct ath10k_htt htt;

	struct ath10k_hw_params {
		u32 id;
+13 −12
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
 */

#include <linux/slab.h>
#include <linux/if_ether.h>

#include "htt.h"
#include "core.h"
@@ -47,15 +48,11 @@ static int ath10k_htt_htc_attach(struct ath10k_htt *htt)
	return 0;
}

struct ath10k_htt *ath10k_htt_attach(struct ath10k *ar)
int ath10k_htt_attach(struct ath10k *ar)
{
	struct ath10k_htt *htt;
	struct ath10k_htt *htt = &ar->htt;
	int ret;

	htt = kzalloc(sizeof(*htt), GFP_KERNEL);
	if (!htt)
		return NULL;

	htt->ar = ar;
	htt->max_throughput_mbps = 800;

@@ -65,8 +62,11 @@ struct ath10k_htt *ath10k_htt_attach(struct ath10k *ar)
	 * since ath10k_htt_rx_attach involves sending a rx ring configure
	 * message to the target.
	 */
	if (ath10k_htt_htc_attach(htt))
	ret = ath10k_htt_htc_attach(htt);
	if (ret) {
		ath10k_err("could not attach htt htc (%d)\n", ret);
		goto err_htc_attach;
	}

	ret = ath10k_htt_tx_attach(htt);
	if (ret) {
@@ -74,8 +74,11 @@ struct ath10k_htt *ath10k_htt_attach(struct ath10k *ar)
		goto err_htc_attach;
	}

	if (ath10k_htt_rx_attach(htt))
	ret = ath10k_htt_rx_attach(htt);
	if (ret) {
		ath10k_err("could not attach htt rx (%d)\n", ret);
		goto err_rx_attach;
	}

	/*
	 * Prefetch enough data to satisfy target
@@ -89,13 +92,12 @@ struct ath10k_htt *ath10k_htt_attach(struct ath10k *ar)
		8 + /* llc snap */
		2; /* ip4 dscp or ip6 priority */

	return htt;
	return 0;

err_rx_attach:
	ath10k_htt_tx_detach(htt);
err_htc_attach:
	kfree(htt);
	return NULL;
	return ret;
}

#define HTT_TARGET_VERSION_TIMEOUT_HZ (3*HZ)
@@ -148,5 +150,4 @@ void ath10k_htt_detach(struct ath10k_htt *htt)
{
	ath10k_htt_rx_detach(htt);
	ath10k_htt_tx_detach(htt);
	kfree(htt);
}
+1 −2
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@

#include <linux/bug.h>

#include "core.h"
#include "htc.h"
#include "rx_desc.h"

@@ -1317,7 +1316,7 @@ struct htt_rx_desc {
#define HTT_LOG2_MAX_CACHE_LINE_SIZE 7	/* 2^7 = 128 */
#define HTT_MAX_CACHE_LINE_SIZE_MASK ((1 << HTT_LOG2_MAX_CACHE_LINE_SIZE) - 1)

struct ath10k_htt *ath10k_htt_attach(struct ath10k *ar);
int ath10k_htt_attach(struct ath10k *ar);
int ath10k_htt_attach_target(struct ath10k_htt *htt);
void ath10k_htt_detach(struct ath10k_htt *htt);

+2 −1
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include "core.h"
#include "htc.h"
#include "htt.h"
#include "txrx.h"
@@ -1036,7 +1037,7 @@ static void ath10k_htt_rx_frag_handler(struct ath10k_htt *htt,

void ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb)
{
	struct ath10k_htt *htt = ar->htt;
	struct ath10k_htt *htt = &ar->htt;
	struct htt_resp *resp = (struct htt_resp *)skb->data;

	/* confirm alignment */
Loading