Skip to content

Commit 6257c70

Browse files
Pradeep Kumar Chitrapukvalo
authored andcommitted
wifi: ath11k: fix tx status reporting in encap offload mode
ieee80211_tx_status() treats packets in 802.11 frame format and tries to extract sta address from packet header. When tx encap offload is enabled, this becomes invalid operation. Hence, switch to using ieee80211_tx_status_ext() after filling in station address for handling both 802.11 and 802.3 frames. Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com> Link: https://lore.kernel.org/r/20230403195738.25367-2-quic_pradeepc@quicinc.com
1 parent 20487cc commit 6257c70

3 files changed

Lines changed: 37 additions & 1 deletion

File tree

drivers/net/wireless/ath/ath11k/dp.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,16 @@ struct ath11k_dp {
303303

304304
#define HTT_TX_WBM_COMP_STATUS_OFFSET 8
305305

306+
#define HTT_INVALID_PEER_ID 0xffff
307+
306308
/* HTT tx completion is overlaid in wbm_release_ring */
307309
#define HTT_TX_WBM_COMP_INFO0_STATUS GENMASK(12, 9)
308310
#define HTT_TX_WBM_COMP_INFO0_REINJECT_REASON GENMASK(16, 13)
309311
#define HTT_TX_WBM_COMP_INFO0_REINJECT_REASON GENMASK(16, 13)
310312

311313
#define HTT_TX_WBM_COMP_INFO1_ACK_RSSI GENMASK(31, 24)
314+
#define HTT_TX_WBM_COMP_INFO2_SW_PEER_ID GENMASK(15, 0)
315+
#define HTT_TX_WBM_COMP_INFO2_VALID BIT(21)
312316

313317
struct htt_tx_wbm_completion {
314318
u32 info0;

drivers/net/wireless/ath/ath11k/dp_tx.c

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,12 @@ ath11k_dp_tx_htt_tx_complete_buf(struct ath11k_base *ab,
316316
struct dp_tx_ring *tx_ring,
317317
struct ath11k_dp_htt_wbm_tx_status *ts)
318318
{
319+
struct ieee80211_tx_status status = { 0 };
319320
struct sk_buff *msdu;
320321
struct ieee80211_tx_info *info;
321322
struct ath11k_skb_cb *skb_cb;
322323
struct ath11k *ar;
324+
struct ath11k_peer *peer;
323325

324326
spin_lock(&tx_ring->tx_idr_lock);
325327
msdu = idr_remove(&tx_ring->txbuf_idr, ts->msdu_id);
@@ -341,6 +343,11 @@ ath11k_dp_tx_htt_tx_complete_buf(struct ath11k_base *ab,
341343

342344
dma_unmap_single(ab->dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE);
343345

346+
if (!skb_cb->vif) {
347+
dev_kfree_skb_any(msdu);
348+
return;
349+
}
350+
344351
memset(&info->status, 0, sizeof(info->status));
345352

346353
if (ts->acked) {
@@ -355,7 +362,23 @@ ath11k_dp_tx_htt_tx_complete_buf(struct ath11k_base *ab,
355362
}
356363
}
357364

358-
ieee80211_tx_status(ar->hw, msdu);
365+
spin_lock_bh(&ab->base_lock);
366+
peer = ath11k_peer_find_by_id(ab, ts->peer_id);
367+
if (!peer || !peer->sta) {
368+
ath11k_dbg(ab, ATH11K_DBG_DATA,
369+
"dp_tx: failed to find the peer with peer_id %d\n",
370+
ts->peer_id);
371+
spin_unlock_bh(&ab->base_lock);
372+
dev_kfree_skb_any(msdu);
373+
return;
374+
}
375+
spin_unlock_bh(&ab->base_lock);
376+
377+
status.sta = peer->sta;
378+
status.info = info;
379+
status.skb = msdu;
380+
381+
ieee80211_tx_status_ext(ar->hw, &status);
359382
}
360383

361384
static void
@@ -379,7 +402,15 @@ ath11k_dp_tx_process_htt_tx_complete(struct ath11k_base *ab,
379402
ts.msdu_id = msdu_id;
380403
ts.ack_rssi = FIELD_GET(HTT_TX_WBM_COMP_INFO1_ACK_RSSI,
381404
status_desc->info1);
405+
406+
if (FIELD_GET(HTT_TX_WBM_COMP_INFO2_VALID, status_desc->info2))
407+
ts.peer_id = FIELD_GET(HTT_TX_WBM_COMP_INFO2_SW_PEER_ID,
408+
status_desc->info2);
409+
else
410+
ts.peer_id = HTT_INVALID_PEER_ID;
411+
382412
ath11k_dp_tx_htt_tx_complete_buf(ab, tx_ring, &ts);
413+
383414
break;
384415
case HAL_WBM_REL_HTT_TX_COMP_STATUS_REINJ:
385416
case HAL_WBM_REL_HTT_TX_COMP_STATUS_INSPECT:

drivers/net/wireless/ath/ath11k/dp_tx.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ struct ath11k_dp_htt_wbm_tx_status {
1313
u32 msdu_id;
1414
bool acked;
1515
int ack_rssi;
16+
u16 peer_id;
1617
};
1718

1819
void ath11k_dp_tx_update_txcompl(struct ath11k *ar, struct hal_tx_status *ts);

0 commit comments

Comments
 (0)