8d41657311a6d7b0e843e52cdee8d016130b1393
[openwrt/openwrt.git] /
1 From 01c6c9fccbd51c1d9eab0f5794b0271b026178df Mon Sep 17 00:00:00 2001
2 From: Abinaya Kalaiselvan <quic_akalaise@quicinc.com>
3 Date: Mon, 19 Dec 2022 11:08:44 +0530
4 Subject: [PATCH] wifi: ath11k: Add tx ack signal support for management
5 packets
6
7 Add support to notify tx ack signal values for management
8 packets to userspace through nl80211 interface.
9
10 Advertise NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT flag
11 to enable this feature and it will be used for data
12 packets as well.
13
14 Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
15
16 Signed-off-by: Abinaya Kalaiselvan <quic_akalaise@quicinc.com>
17 Signed-off-by: Maharaja Kennadyrajan <quic_mkenna@quicinc.com>
18 Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
19 Link: https://lore.kernel.org/r/20221219053844.4084486-1-quic_mkenna@quicinc.com
20 ---
21 drivers/net/wireless/ath/ath11k/hw.c | 1 +
22 drivers/net/wireless/ath/ath11k/mac.c | 5 +++++
23 drivers/net/wireless/ath/ath11k/wmi.c | 27 ++++++++++++++++-----------
24 drivers/net/wireless/ath/ath11k/wmi.h | 3 +++
25 4 files changed, 25 insertions(+), 11 deletions(-)
26
27 --- a/drivers/net/wireless/ath/ath11k/hw.c
28 +++ b/drivers/net/wireless/ath/ath11k/hw.c
29 @@ -201,6 +201,7 @@ static void ath11k_init_wmi_config_ipq80
30 config->twt_ap_pdev_count = ab->num_radios;
31 config->twt_ap_sta_count = 1000;
32 config->flag1 |= WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64;
33 + config->flag1 |= WMI_RSRC_CFG_FLAG1_ACK_RSSI;
34 }
35
36 static int ath11k_hw_mac_id_to_pdev_id_ipq8074(struct ath11k_hw_params *hw,
37 --- a/drivers/net/wireless/ath/ath11k/mac.c
38 +++ b/drivers/net/wireless/ath/ath11k/mac.c
39 @@ -9174,6 +9174,11 @@ static int __ath11k_mac_register(struct
40 goto err_free_if_combs;
41 }
42
43 + if (test_bit(WMI_TLV_SERVICE_TX_DATA_MGMT_ACK_RSSI,
44 + ar->ab->wmi_ab.svc_map))
45 + wiphy_ext_feature_set(ar->hw->wiphy,
46 + NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT);
47 +
48 ar->hw->queues = ATH11K_HW_MAX_QUEUES;
49 ar->hw->wiphy->tx_queue_len = ATH11K_QUEUE_LEN;
50 ar->hw->offchannel_tx_hw_queue = ATH11K_HW_MAX_QUEUES - 1;
51 --- a/drivers/net/wireless/ath/ath11k/wmi.c
52 +++ b/drivers/net/wireless/ath/ath11k/wmi.c
53 @@ -5229,8 +5229,8 @@ static int ath11k_pull_mgmt_rx_params_tl
54 return 0;
55 }
56
57 -static int wmi_process_mgmt_tx_comp(struct ath11k *ar, u32 desc_id,
58 - u32 status)
59 +static int wmi_process_mgmt_tx_comp(struct ath11k *ar,
60 + struct wmi_mgmt_tx_compl_event *tx_compl_param)
61 {
62 struct sk_buff *msdu;
63 struct ieee80211_tx_info *info;
64 @@ -5238,24 +5238,29 @@ static int wmi_process_mgmt_tx_comp(stru
65 int num_mgmt;
66
67 spin_lock_bh(&ar->txmgmt_idr_lock);
68 - msdu = idr_find(&ar->txmgmt_idr, desc_id);
69 + msdu = idr_find(&ar->txmgmt_idr, tx_compl_param->desc_id);
70
71 if (!msdu) {
72 ath11k_warn(ar->ab, "received mgmt tx compl for invalid msdu_id: %d\n",
73 - desc_id);
74 + tx_compl_param->desc_id);
75 spin_unlock_bh(&ar->txmgmt_idr_lock);
76 return -ENOENT;
77 }
78
79 - idr_remove(&ar->txmgmt_idr, desc_id);
80 + idr_remove(&ar->txmgmt_idr, tx_compl_param->desc_id);
81 spin_unlock_bh(&ar->txmgmt_idr_lock);
82
83 skb_cb = ATH11K_SKB_CB(msdu);
84 dma_unmap_single(ar->ab->dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE);
85
86 info = IEEE80211_SKB_CB(msdu);
87 - if ((!(info->flags & IEEE80211_TX_CTL_NO_ACK)) && !status)
88 + if ((!(info->flags & IEEE80211_TX_CTL_NO_ACK)) &&
89 + !tx_compl_param->status) {
90 info->flags |= IEEE80211_TX_STAT_ACK;
91 + if (test_bit(WMI_TLV_SERVICE_TX_DATA_MGMT_ACK_RSSI,
92 + ar->ab->wmi_ab.svc_map))
93 + info->status.ack_signal = tx_compl_param->ack_rssi;
94 + }
95
96 ieee80211_tx_status_irqsafe(ar->hw, msdu);
97
98 @@ -5267,7 +5272,7 @@ static int wmi_process_mgmt_tx_comp(stru
99
100 ath11k_dbg(ar->ab, ATH11K_DBG_WMI,
101 "wmi mgmt tx comp pending %d desc id %d\n",
102 - num_mgmt, desc_id);
103 + num_mgmt, tx_compl_param->desc_id);
104
105 if (!num_mgmt)
106 wake_up(&ar->txmgmt_empty_waitq);
107 @@ -5300,6 +5305,7 @@ static int ath11k_pull_mgmt_tx_compl_par
108 param->pdev_id = ev->pdev_id;
109 param->desc_id = ev->desc_id;
110 param->status = ev->status;
111 + param->ack_rssi = ev->ack_rssi;
112
113 kfree(tb);
114 return 0;
115 @@ -7070,13 +7076,12 @@ static void ath11k_mgmt_tx_compl_event(s
116 goto exit;
117 }
118
119 - wmi_process_mgmt_tx_comp(ar, tx_compl_param.desc_id,
120 - tx_compl_param.status);
121 + wmi_process_mgmt_tx_comp(ar, &tx_compl_param);
122
123 ath11k_dbg(ab, ATH11K_DBG_MGMT,
124 - "mgmt tx compl ev pdev_id %d, desc_id %d, status %d",
125 + "mgmt tx compl ev pdev_id %d, desc_id %d, status %d ack_rssi %d",
126 tx_compl_param.pdev_id, tx_compl_param.desc_id,
127 - tx_compl_param.status);
128 + tx_compl_param.status, tx_compl_param.ack_rssi);
129
130 exit:
131 rcu_read_unlock();
132 --- a/drivers/net/wireless/ath/ath11k/wmi.h
133 +++ b/drivers/net/wireless/ath/ath11k/wmi.h
134 @@ -2311,6 +2311,7 @@ struct wmi_init_cmd {
135 } __packed;
136
137 #define WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64 BIT(5)
138 +#define WMI_RSRC_CFG_FLAG1_ACK_RSSI BIT(18)
139
140 struct wmi_resource_config {
141 u32 tlv_header;
142 @@ -4550,6 +4551,8 @@ struct wmi_mgmt_tx_compl_event {
143 u32 desc_id;
144 u32 status;
145 u32 pdev_id;
146 + u32 ppdu_id;
147 + u32 ack_rssi;
148 } __packed;
149
150 struct wmi_scan_event {