mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-07-19 12:07:00 +08:00

Update backports to the latest 6.6 point release. Signed-off-by: Robert Marko <robimarko@gmail.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
385 lines
14 KiB
Diff
385 lines
14 KiB
Diff
From 10c65f97b424fcee439463f933140df2a0022f98 Mon Sep 17 00:00:00 2001
|
|
From: Jeff Johnson <quic_jjohnson@quicinc.com>
|
|
Date: Mon, 9 Oct 2023 09:39:42 -0700
|
|
Subject: [PATCH] wifi: ath11k: Introduce and use ath11k_sta_to_arsta()
|
|
|
|
Currently, the logic to return an ath11k_sta pointer, given a
|
|
ieee80211_sta pointer, uses typecasting throughout the driver. In
|
|
general, conversion functions are preferable to typecasting since
|
|
using a conversion function allows the compiler to validate the types
|
|
of both the input and output parameters.
|
|
|
|
ath11k already defines a conversion function ath11k_vif_to_arvif() for
|
|
a similar conversion. So introduce ath11k_sta_to_arsta() for this use
|
|
case, and convert all of the existing typecasting to use this
|
|
function.
|
|
|
|
No functional changes, compile tested only.
|
|
|
|
Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
|
|
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
|
|
Link: https://lore.kernel.org/r/20231009-ath11k_sta_to_arsta-v1-1-1563e3a307e8@quicinc.com
|
|
---
|
|
drivers/net/wireless/ath/ath11k/core.h | 5 ++++
|
|
drivers/net/wireless/ath/ath11k/debugfs.c | 4 +--
|
|
drivers/net/wireless/ath/ath11k/debugfs_sta.c | 30 +++++++++----------
|
|
drivers/net/wireless/ath/ath11k/dp_rx.c | 8 ++---
|
|
drivers/net/wireless/ath/ath11k/dp_tx.c | 4 +--
|
|
drivers/net/wireless/ath/ath11k/mac.c | 18 +++++------
|
|
drivers/net/wireless/ath/ath11k/peer.c | 2 +-
|
|
drivers/net/wireless/ath/ath11k/wmi.c | 6 ++--
|
|
8 files changed, 41 insertions(+), 36 deletions(-)
|
|
|
|
--- a/drivers/net/wireless/ath/ath11k/core.h
|
|
+++ b/drivers/net/wireless/ath/ath11k/core.h
|
|
@@ -1223,6 +1223,11 @@ static inline struct ath11k_vif *ath11k_
|
|
return (struct ath11k_vif *)vif->drv_priv;
|
|
}
|
|
|
|
+static inline struct ath11k_sta *ath11k_sta_to_arsta(struct ieee80211_sta *sta)
|
|
+{
|
|
+ return (struct ath11k_sta *)sta->drv_priv;
|
|
+}
|
|
+
|
|
static inline struct ath11k *ath11k_ab_to_ar(struct ath11k_base *ab,
|
|
int mac_id)
|
|
{
|
|
--- a/drivers/net/wireless/ath/ath11k/debugfs.c
|
|
+++ b/drivers/net/wireless/ath/ath11k/debugfs.c
|
|
@@ -1459,7 +1459,7 @@ static void ath11k_reset_peer_ps_duratio
|
|
struct ieee80211_sta *sta)
|
|
{
|
|
struct ath11k *ar = data;
|
|
- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta);
|
|
|
|
spin_lock_bh(&ar->data_lock);
|
|
arsta->ps_total_duration = 0;
|
|
@@ -1510,7 +1510,7 @@ static void ath11k_peer_ps_state_disable
|
|
struct ieee80211_sta *sta)
|
|
{
|
|
struct ath11k *ar = data;
|
|
- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta);
|
|
|
|
spin_lock_bh(&ar->data_lock);
|
|
arsta->peer_ps_state = WMI_PEER_PS_STATE_DISABLED;
|
|
--- a/drivers/net/wireless/ath/ath11k/debugfs_sta.c
|
|
+++ b/drivers/net/wireless/ath/ath11k/debugfs_sta.c
|
|
@@ -136,7 +136,7 @@ static ssize_t ath11k_dbg_sta_dump_tx_st
|
|
size_t count, loff_t *ppos)
|
|
{
|
|
struct ieee80211_sta *sta = file->private_data;
|
|
- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta);
|
|
struct ath11k *ar = arsta->arvif->ar;
|
|
struct ath11k_htt_data_stats *stats;
|
|
static const char *str_name[ATH11K_STATS_TYPE_MAX] = {"succ", "fail",
|
|
@@ -243,7 +243,7 @@ static ssize_t ath11k_dbg_sta_dump_rx_st
|
|
size_t count, loff_t *ppos)
|
|
{
|
|
struct ieee80211_sta *sta = file->private_data;
|
|
- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta);
|
|
struct ath11k *ar = arsta->arvif->ar;
|
|
struct ath11k_rx_peer_stats *rx_stats = arsta->rx_stats;
|
|
int len = 0, i, retval = 0;
|
|
@@ -340,7 +340,7 @@ static int
|
|
ath11k_dbg_sta_open_htt_peer_stats(struct inode *inode, struct file *file)
|
|
{
|
|
struct ieee80211_sta *sta = inode->i_private;
|
|
- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta);
|
|
struct ath11k *ar = arsta->arvif->ar;
|
|
struct debug_htt_stats_req *stats_req;
|
|
int type = ar->debug.htt_stats.type;
|
|
@@ -376,7 +376,7 @@ static int
|
|
ath11k_dbg_sta_release_htt_peer_stats(struct inode *inode, struct file *file)
|
|
{
|
|
struct ieee80211_sta *sta = inode->i_private;
|
|
- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta);
|
|
struct ath11k *ar = arsta->arvif->ar;
|
|
|
|
mutex_lock(&ar->conf_mutex);
|
|
@@ -413,7 +413,7 @@ static ssize_t ath11k_dbg_sta_write_peer
|
|
size_t count, loff_t *ppos)
|
|
{
|
|
struct ieee80211_sta *sta = file->private_data;
|
|
- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta);
|
|
struct ath11k *ar = arsta->arvif->ar;
|
|
int ret, enable;
|
|
|
|
@@ -453,7 +453,7 @@ static ssize_t ath11k_dbg_sta_read_peer_
|
|
size_t count, loff_t *ppos)
|
|
{
|
|
struct ieee80211_sta *sta = file->private_data;
|
|
- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta);
|
|
struct ath11k *ar = arsta->arvif->ar;
|
|
char buf[32] = {0};
|
|
int len;
|
|
@@ -480,7 +480,7 @@ static ssize_t ath11k_dbg_sta_write_delb
|
|
size_t count, loff_t *ppos)
|
|
{
|
|
struct ieee80211_sta *sta = file->private_data;
|
|
- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta);
|
|
struct ath11k *ar = arsta->arvif->ar;
|
|
u32 tid, initiator, reason;
|
|
int ret;
|
|
@@ -531,7 +531,7 @@ static ssize_t ath11k_dbg_sta_write_addb
|
|
size_t count, loff_t *ppos)
|
|
{
|
|
struct ieee80211_sta *sta = file->private_data;
|
|
- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta);
|
|
struct ath11k *ar = arsta->arvif->ar;
|
|
u32 tid, status;
|
|
int ret;
|
|
@@ -581,7 +581,7 @@ static ssize_t ath11k_dbg_sta_write_addb
|
|
size_t count, loff_t *ppos)
|
|
{
|
|
struct ieee80211_sta *sta = file->private_data;
|
|
- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta);
|
|
struct ath11k *ar = arsta->arvif->ar;
|
|
u32 tid, buf_size;
|
|
int ret;
|
|
@@ -632,7 +632,7 @@ static ssize_t ath11k_dbg_sta_read_aggr_
|
|
size_t count, loff_t *ppos)
|
|
{
|
|
struct ieee80211_sta *sta = file->private_data;
|
|
- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta);
|
|
struct ath11k *ar = arsta->arvif->ar;
|
|
char buf[64];
|
|
int len = 0;
|
|
@@ -652,7 +652,7 @@ static ssize_t ath11k_dbg_sta_write_aggr
|
|
size_t count, loff_t *ppos)
|
|
{
|
|
struct ieee80211_sta *sta = file->private_data;
|
|
- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta);
|
|
struct ath11k *ar = arsta->arvif->ar;
|
|
u32 aggr_mode;
|
|
int ret;
|
|
@@ -697,7 +697,7 @@ ath11k_write_htt_peer_stats_reset(struct
|
|
size_t count, loff_t *ppos)
|
|
{
|
|
struct ieee80211_sta *sta = file->private_data;
|
|
- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta);
|
|
struct ath11k *ar = arsta->arvif->ar;
|
|
struct htt_ext_stats_cfg_params cfg_params = { 0 };
|
|
int ret;
|
|
@@ -756,7 +756,7 @@ static ssize_t ath11k_dbg_sta_read_peer_
|
|
size_t count, loff_t *ppos)
|
|
{
|
|
struct ieee80211_sta *sta = file->private_data;
|
|
- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta);
|
|
struct ath11k *ar = arsta->arvif->ar;
|
|
char buf[20];
|
|
int len;
|
|
@@ -783,7 +783,7 @@ static ssize_t ath11k_dbg_sta_read_curre
|
|
loff_t *ppos)
|
|
{
|
|
struct ieee80211_sta *sta = file->private_data;
|
|
- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta);
|
|
struct ath11k *ar = arsta->arvif->ar;
|
|
u64 time_since_station_in_power_save;
|
|
char buf[20];
|
|
@@ -817,7 +817,7 @@ static ssize_t ath11k_dbg_sta_read_total
|
|
size_t count, loff_t *ppos)
|
|
{
|
|
struct ieee80211_sta *sta = file->private_data;
|
|
- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta);
|
|
struct ath11k *ar = arsta->arvif->ar;
|
|
char buf[20];
|
|
u64 power_save_duration;
|
|
--- a/drivers/net/wireless/ath/ath11k/dp_rx.c
|
|
+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c
|
|
@@ -1099,7 +1099,7 @@ int ath11k_dp_rx_ampdu_start(struct ath1
|
|
struct ieee80211_ampdu_params *params)
|
|
{
|
|
struct ath11k_base *ab = ar->ab;
|
|
- struct ath11k_sta *arsta = (void *)params->sta->drv_priv;
|
|
+ struct ath11k_sta *arsta = ath11k_sta_to_arsta(params->sta);
|
|
int vdev_id = arsta->arvif->vdev_id;
|
|
int ret;
|
|
|
|
@@ -1117,7 +1117,7 @@ int ath11k_dp_rx_ampdu_stop(struct ath11
|
|
{
|
|
struct ath11k_base *ab = ar->ab;
|
|
struct ath11k_peer *peer;
|
|
- struct ath11k_sta *arsta = (void *)params->sta->drv_priv;
|
|
+ struct ath11k_sta *arsta = ath11k_sta_to_arsta(params->sta);
|
|
int vdev_id = arsta->arvif->vdev_id;
|
|
dma_addr_t paddr;
|
|
bool active;
|
|
@@ -1456,7 +1456,7 @@ ath11k_update_per_peer_tx_stats(struct a
|
|
}
|
|
|
|
sta = peer->sta;
|
|
- arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ arsta = ath11k_sta_to_arsta(sta);
|
|
|
|
memset(&arsta->txrate, 0, sizeof(arsta->txrate));
|
|
|
|
@@ -5248,7 +5248,7 @@ int ath11k_dp_rx_process_mon_status(stru
|
|
goto next_skb;
|
|
}
|
|
|
|
- arsta = (struct ath11k_sta *)peer->sta->drv_priv;
|
|
+ arsta = ath11k_sta_to_arsta(peer->sta);
|
|
ath11k_dp_rx_update_peer_stats(arsta, ppdu_info);
|
|
|
|
if (ath11k_debugfs_is_pktlog_peer_valid(ar, peer->addr))
|
|
--- a/drivers/net/wireless/ath/ath11k/dp_tx.c
|
|
+++ b/drivers/net/wireless/ath/ath11k/dp_tx.c
|
|
@@ -467,7 +467,7 @@ void ath11k_dp_tx_update_txcompl(struct
|
|
}
|
|
|
|
sta = peer->sta;
|
|
- arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ arsta = ath11k_sta_to_arsta(sta);
|
|
|
|
memset(&arsta->txrate, 0, sizeof(arsta->txrate));
|
|
pkt_type = FIELD_GET(HAL_TX_RATE_STATS_INFO0_PKT_TYPE,
|
|
@@ -627,7 +627,7 @@ static void ath11k_dp_tx_complete_msdu(s
|
|
ieee80211_free_txskb(ar->hw, msdu);
|
|
return;
|
|
}
|
|
- arsta = (struct ath11k_sta *)peer->sta->drv_priv;
|
|
+ arsta = ath11k_sta_to_arsta(peer->sta);
|
|
status.sta = peer->sta;
|
|
status.skb = msdu;
|
|
status.info = info;
|
|
--- a/drivers/net/wireless/ath/ath11k/mac.c
|
|
+++ b/drivers/net/wireless/ath/ath11k/mac.c
|
|
@@ -2832,7 +2832,7 @@ static void ath11k_peer_assoc_prepare(st
|
|
|
|
lockdep_assert_held(&ar->conf_mutex);
|
|
|
|
- arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ arsta = ath11k_sta_to_arsta(sta);
|
|
|
|
memset(arg, 0, sizeof(*arg));
|
|
|
|
@@ -4313,7 +4313,7 @@ static int ath11k_mac_op_set_key(struct
|
|
ath11k_warn(ab, "peer %pM disappeared!\n", peer_addr);
|
|
|
|
if (sta) {
|
|
- arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ arsta = ath11k_sta_to_arsta(sta);
|
|
|
|
switch (key->cipher) {
|
|
case WLAN_CIPHER_SUITE_TKIP:
|
|
@@ -4904,7 +4904,7 @@ static int ath11k_mac_station_add(struct
|
|
{
|
|
struct ath11k_base *ab = ar->ab;
|
|
struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
|
|
- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta);
|
|
struct peer_create_params peer_param;
|
|
int ret;
|
|
|
|
@@ -5028,7 +5028,7 @@ static int ath11k_mac_op_sta_state(struc
|
|
{
|
|
struct ath11k *ar = hw->priv;
|
|
struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
|
|
- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta);
|
|
struct ath11k_peer *peer;
|
|
int ret = 0;
|
|
|
|
@@ -5194,7 +5194,7 @@ static void ath11k_mac_op_sta_set_4addr(
|
|
struct ieee80211_sta *sta, bool enabled)
|
|
{
|
|
struct ath11k *ar = hw->priv;
|
|
- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta);
|
|
|
|
if (enabled && !arsta->use_4addr_set) {
|
|
ieee80211_queue_work(ar->hw, &arsta->set_4addr_wk);
|
|
@@ -5208,7 +5208,7 @@ static void ath11k_mac_op_sta_rc_update(
|
|
u32 changed)
|
|
{
|
|
struct ath11k *ar = hw->priv;
|
|
- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta);
|
|
struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
|
|
struct ath11k_peer *peer;
|
|
u32 bw, smps;
|
|
@@ -6201,7 +6201,7 @@ static void ath11k_mac_op_tx(struct ieee
|
|
}
|
|
|
|
if (control->sta)
|
|
- arsta = (struct ath11k_sta *)control->sta->drv_priv;
|
|
+ arsta = ath11k_sta_to_arsta(control->sta);
|
|
|
|
ret = ath11k_dp_tx(ar, arvif, arsta, skb);
|
|
if (unlikely(ret)) {
|
|
@@ -8233,7 +8233,7 @@ static void ath11k_mac_set_bitrate_mask_
|
|
struct ieee80211_sta *sta)
|
|
{
|
|
struct ath11k_vif *arvif = data;
|
|
- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta);
|
|
struct ath11k *ar = arvif->ar;
|
|
|
|
spin_lock_bh(&ar->data_lock);
|
|
@@ -8637,7 +8637,7 @@ static void ath11k_mac_op_sta_statistics
|
|
struct ieee80211_sta *sta,
|
|
struct station_info *sinfo)
|
|
{
|
|
- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta);
|
|
struct ath11k *ar = arsta->arvif->ar;
|
|
s8 signal;
|
|
bool db2dbm = test_bit(WMI_TLV_SERVICE_HW_DB2DBM_CONVERSION_SUPPORT,
|
|
--- a/drivers/net/wireless/ath/ath11k/peer.c
|
|
+++ b/drivers/net/wireless/ath/ath11k/peer.c
|
|
@@ -446,7 +446,7 @@ int ath11k_peer_create(struct ath11k *ar
|
|
peer->sec_type_grp = HAL_ENCRYPT_TYPE_OPEN;
|
|
|
|
if (sta) {
|
|
- arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ arsta = ath11k_sta_to_arsta(sta);
|
|
arsta->tcl_metadata |= FIELD_PREP(HTT_TCL_META_DATA_TYPE, 0) |
|
|
FIELD_PREP(HTT_TCL_META_DATA_PEER_ID,
|
|
peer->peer_id);
|
|
--- a/drivers/net/wireless/ath/ath11k/wmi.c
|
|
+++ b/drivers/net/wireless/ath/ath11k/wmi.c
|
|
@@ -6453,7 +6453,7 @@ static int ath11k_wmi_tlv_rssi_chain_par
|
|
goto exit;
|
|
}
|
|
|
|
- arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ arsta = ath11k_sta_to_arsta(sta);
|
|
|
|
BUILD_BUG_ON(ARRAY_SIZE(arsta->chain_signal) >
|
|
ARRAY_SIZE(stats_rssi->rssi_avg_beacon));
|
|
@@ -6541,7 +6541,7 @@ static int ath11k_wmi_tlv_fw_stats_data_
|
|
arvif->bssid,
|
|
NULL);
|
|
if (sta) {
|
|
- arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ arsta = ath11k_sta_to_arsta(sta);
|
|
arsta->rssi_beacon = src->beacon_snr;
|
|
ath11k_dbg(ab, ATH11K_DBG_WMI,
|
|
"stats vdev id %d snr %d\n",
|
|
@@ -7468,7 +7468,7 @@ static void ath11k_wmi_event_peer_sta_ps
|
|
goto exit;
|
|
}
|
|
|
|
- arsta = (struct ath11k_sta *)sta->drv_priv;
|
|
+ arsta = ath11k_sta_to_arsta(sta);
|
|
|
|
spin_lock_bh(&ar->data_lock);
|
|
|