Commit 8042e30a authored by Ripan Deuri's avatar Ripan Deuri Committed by Jeff Johnson
Browse files

wifi: ath12k: Rearrange DP fields in ath12k_hw_group struct



Introduce the ath12k_dp_hw_group struct within ath12k_hw_group to
encapsulate all Data Path fields, providing a baseline for future
extensions. Add this struct to the top of ath12k_hw_group to allow
optimal usage of cache lines for data path fields, as it is accessed
in multiple tight loops in the per-packet path.

Add cmn_def.h to define common macros shared between DP and other
modules.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

Signed-off-by: default avatarRipan Deuri <quic_rdeuri@quicinc.com>
Reviewed-by: default avatarVasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Reviewed-by: default avatarBaochen Qiang <baochen.qiang@oss.qualcomm.com>
Link: https://patch.msgid.link/20250930131005.2884253-4-quic_rdeuri@quicinc.com


Signed-off-by: default avatarJeff Johnson <jeff.johnson@oss.qualcomm.com>
parent 614c23e2
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: BSD-3-Clause-Clear */
/*
 * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
 */

#ifndef ATH12K_CMN_DEFS_H
#define ATH12K_CMN_DEFS_H

#define MAX_RADIOS 2
#define ATH12K_MAX_DEVICES 3
#define ATH12K_GROUP_MAX_RADIO (ATH12K_MAX_DEVICES * MAX_RADIOS)

#endif
+4 −0
Original line number Diff line number Diff line
@@ -1993,6 +1993,8 @@ static struct ath12k_hw_group *ath12k_core_hw_group_assign(struct ath12k_base *a
	ag->ab[ab->device_id] = ab;
	ab->ag = ag;

	ath12k_dp_cmn_hw_group_assign(ath12k_ab_to_dp(ab), ag);

	ath12k_dbg(ab, ATH12K_DBG_BOOT, "wsi group-id %d num-devices %d index %d",
		   ag->id, ag->num_devices, wsi->index);

@@ -2020,6 +2022,8 @@ void ath12k_core_hw_group_unassign(struct ath12k_base *ab)
		return;
	}

	ath12k_dp_cmn_hw_group_unassign(ath12k_ab_to_dp(ab), ag);

	ag->ab[device_id] = NULL;
	ab->ag = NULL;
	ab->device_id = ATH12K_INVALID_DEVICE_ID;
+6 −3
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@
#include "wow.h"
#include "debugfs_htt_stats.h"
#include "coredump.h"
#include "cmn_defs.h"

#define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK)

@@ -64,8 +65,6 @@
#define ATH12K_RECONFIGURE_TIMEOUT_HZ		(10 * HZ)
#define ATH12K_RECOVER_START_TIMEOUT_HZ		(20 * HZ)

#define ATH12K_MAX_DEVICES 3
#define ATH12K_GROUP_MAX_RADIO (ATH12K_MAX_DEVICES * MAX_RADIOS)
#define ATH12K_INVALID_GROUP_ID  0xFF
#define ATH12K_INVALID_DEVICE_ID 0xFF

@@ -980,6 +979,11 @@ struct ath12k_hw_link {
 * wiphy, protected with struct ath12k_hw_group::mutex.
 */
struct ath12k_hw_group {
	/* Keep dp_hw_grp as the first member to allow efficient
	 * usage of cache lines for DP fields
	 */
	struct ath12k_dp_hw_group dp_hw_grp;
	struct ath12k_hw_link hw_links[ATH12K_GROUP_MAX_RADIO];
	struct list_head list;
	u8 id;
	u8 num_devices;
@@ -1002,7 +1006,6 @@ struct ath12k_hw_group {
	bool mlo_capable;
	struct device_node *wsi_node[ATH12K_MAX_DEVICES];
	struct ath12k_mlo_memory mlo_mem;
	struct ath12k_hw_link hw_links[ATH12K_GROUP_MAX_RADIO];
	bool hw_link_id_init_done;
};

+24 −0
Original line number Diff line number Diff line
@@ -1685,3 +1685,27 @@ int ath12k_dp_cmn_device_init(struct ath12k_dp *dp)

	return 0;
}

void ath12k_dp_cmn_hw_group_unassign(struct ath12k_dp *dp,
				     struct ath12k_hw_group *ag)
{
	struct ath12k_dp_hw_group *dp_hw_grp = &ag->dp_hw_grp;

	lockdep_assert_held(&ag->mutex);

	dp_hw_grp->dp[dp->device_id] = NULL;

	dp->ag = NULL;
	dp->device_id = ATH12K_INVALID_DEVICE_ID;
}

void ath12k_dp_cmn_hw_group_assign(struct ath12k_dp *dp,
				   struct ath12k_hw_group *ag)
{
	struct ath12k_base *ab = dp->ab;
	struct ath12k_dp_hw_group *dp_hw_grp = &ag->dp_hw_grp;

	dp->ag = ag;
	dp->device_id = ab->device_id;
	dp_hw_grp->dp[dp->device_id] = dp;
}
+10 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
#include "wifi7/hal_rx.h"
#include "hw.h"
#include "dp_htt.h"
#include "dp_cmn.h"

#define MAX_RXDMA_PER_PDEV     2

@@ -426,6 +427,9 @@ struct ath12k_dp {
	struct ath12k_reo_q_addr_lut ml_reoq_lut;
	const struct ath12k_hw_params *hw_params;
	struct device *dev;

	struct ath12k_hw_group *ag;
	u8 device_id;
};

static inline void ath12k_dp_get_mac_addr(u32 addr_l32, u16 addr_h16, u8 *addr)
@@ -434,6 +438,12 @@ static inline void ath12k_dp_get_mac_addr(u32 addr_l32, u16 addr_h16, u8 *addr)
	memcpy(addr + 4, &addr_h16, ETH_ALEN - 4);
}

static inline struct ath12k_dp *
ath12k_dp_hw_grp_to_dp(struct ath12k_dp_hw_group *dp_hw_grp, u8 device_id)
{
	return dp_hw_grp->dp[device_id];
}

void ath12k_dp_vdev_tx_attach(struct ath12k *ar, struct ath12k_link_vif *arvif);
void ath12k_dp_cc_config(struct ath12k_base *ab);
void ath12k_dp_partner_cc_init(struct ath12k_base *ab);
Loading