0042-wifi-ath11k-Add-tx-ack-signal-support-for-management.patch 4.9 KB

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