aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath
diff options
context:
space:
mode:
authorAbhishek Ambure <aambure@codeaurora.org>2019-02-25 04:45:48 -0500
committerKalle Valo <kvalo@codeaurora.org>2019-02-26 07:58:06 -0500
commit6ddc3860a5668808bacbfcb1f1bf50d5d7ad1956 (patch)
tree84e33dff0a2e2e4390a4aff6aeecea3dc82f78e3 /drivers/net/wireless/ath
parent4b816f170b1fe4c2024d530c0d56990413f9ceec (diff)
ath10k: add support for ack rssi value of data tx packets
In WCN3990, WMI_TLV_SERVICE_TX_DATA_MGMT_ACK_RSSI service Indicates that the firmware has the capability to send the RSSI value of the ACK for all data and management packets transmitted. If WMI_RSRC_CFG_FLAG_TX_ACK_RSSI is set in host capability then firmware sends RSSI value in "data" tx completion event. Host extracts ack rssi values of data packets from their tx completion event. Tested HW: WCN3990 Tested FW: WLAN.HL.2.0-01617-QCAHLSWMTPLZ-1 Signed-off-by: Abhishek Ambure <aambure@codeaurora.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/ath')
-rw-r--r--drivers/net/wireless/ath/ath10k/htt.h86
-rw-r--r--drivers/net/wireless/ath/ath10k/htt_rx.c12
-rw-r--r--drivers/net/wireless/ath/ath10k/hw.c32
-rw-r--r--drivers/net/wireless/ath/ath10k/hw.h22
4 files changed, 146 insertions, 6 deletions
diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h
index fef716aa8f3a..4cee5492abc8 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -578,6 +578,10 @@ struct htt_mgmt_tx_completion {
578#define HTT_TX_CMPL_FLAG_PA_PRESENT BIT(2) 578#define HTT_TX_CMPL_FLAG_PA_PRESENT BIT(2)
579#define HTT_TX_CMPL_FLAG_PPDU_DURATION_PRESENT BIT(3) 579#define HTT_TX_CMPL_FLAG_PPDU_DURATION_PRESENT BIT(3)
580 580
581#define HTT_TX_DATA_RSSI_ENABLE_WCN3990 BIT(3)
582#define HTT_TX_DATA_APPEND_RETRIES BIT(0)
583#define HTT_TX_DATA_APPEND_TIMESTAMP BIT(1)
584
581struct htt_rx_indication_hdr { 585struct htt_rx_indication_hdr {
582 u8 info0; /* %HTT_RX_INDICATION_INFO0_ */ 586 u8 info0; /* %HTT_RX_INDICATION_INFO0_ */
583 __le16 peer_id; 587 __le16 peer_id;
@@ -852,6 +856,88 @@ enum htt_data_tx_flags {
852 856
853#define HTT_TX_COMPL_INV_MSDU_ID 0xFFFF 857#define HTT_TX_COMPL_INV_MSDU_ID 0xFFFF
854 858
859struct htt_append_retries {
860 __le16 msdu_id;
861 u8 tx_retries;
862 u8 flag;
863} __packed;
864
865struct htt_data_tx_completion_ext {
866 struct htt_append_retries a_retries;
867 __le32 t_stamp;
868 __le16 msdus_rssi[0];
869} __packed;
870
871/**
872 * @brief target -> host TX completion indication message definition
873 *
874 * @details
875 * The following diagram shows the format of the TX completion indication sent
876 * from the target to the host
877 *
878 * |31 28|27|26|25|24|23 16| 15 |14 11|10 8|7 0|
879 * |-------------------------------------------------------------|
880 * header: |rsvd |A2|TP|A1|A0| num | t_i| tid |status| msg_type |
881 * |-------------------------------------------------------------|
882 * payload: | MSDU1 ID | MSDU0 ID |
883 * |-------------------------------------------------------------|
884 * : MSDU3 ID : MSDU2 ID :
885 * |-------------------------------------------------------------|
886 * | struct htt_tx_compl_ind_append_retries |
887 * |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -|
888 * | struct htt_tx_compl_ind_append_tx_tstamp |
889 * |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -|
890 * | MSDU1 ACK RSSI | MSDU0 ACK RSSI |
891 * |-------------------------------------------------------------|
892 * : MSDU3 ACK RSSI : MSDU2 ACK RSSI :
893 * |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -|
894 * -msg_type
895 * Bits 7:0
896 * Purpose: identifies this as HTT TX completion indication
897 * -status
898 * Bits 10:8
899 * Purpose: the TX completion status of payload fragmentations descriptors
900 * Value: could be HTT_TX_COMPL_IND_STAT_OK or HTT_TX_COMPL_IND_STAT_DISCARD
901 * -tid
902 * Bits 14:11
903 * Purpose: the tid associated with those fragmentation descriptors. It is
904 * valid or not, depending on the tid_invalid bit.
905 * Value: 0 to 15
906 * -tid_invalid
907 * Bits 15:15
908 * Purpose: this bit indicates whether the tid field is valid or not
909 * Value: 0 indicates valid, 1 indicates invalid
910 * -num
911 * Bits 23:16
912 * Purpose: the number of payload in this indication
913 * Value: 1 to 255
914 * -A0 = append
915 * Bits 24:24
916 * Purpose: append the struct htt_tx_compl_ind_append_retries which contains
917 * the number of tx retries for one MSDU at the end of this message
918 * Value: 0 indicates no appending, 1 indicates appending
919 * -A1 = append1
920 * Bits 25:25
921 * Purpose: Append the struct htt_tx_compl_ind_append_tx_tstamp which
922 * contains the timestamp info for each TX msdu id in payload.
923 * Value: 0 indicates no appending, 1 indicates appending
924 * -TP = MSDU tx power presence
925 * Bits 26:26
926 * Purpose: Indicate whether the TX_COMPL_IND includes a tx power report
927 * for each MSDU referenced by the TX_COMPL_IND message.
928 * The order of the per-MSDU tx power reports matches the order
929 * of the MSDU IDs.
930 * Value: 0 indicates not appending, 1 indicates appending
931 * -A2 = append2
932 * Bits 27:27
933 * Purpose: Indicate whether data ACK RSSI is appended for each MSDU in
934 * TX_COMP_IND message. The order of the per-MSDU ACK RSSI report
935 * matches the order of the MSDU IDs.
936 * The ACK RSSI values are valid when status is COMPLETE_OK (and
937 * this append2 bit is set).
938 * Value: 0 indicates not appending, 1 indicates appending
939 */
940
855struct htt_data_tx_completion { 941struct htt_data_tx_completion {
856 union { 942 union {
857 u8 flags; 943 u8 flags;
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 4fc885617de1..b3d76263417e 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -2210,7 +2210,7 @@ static void ath10k_htt_rx_tx_compl_ind(struct ath10k *ar,
2210 __le16 msdu_id, *msdus; 2210 __le16 msdu_id, *msdus;
2211 bool rssi_enabled = false; 2211 bool rssi_enabled = false;
2212 u8 msdu_count = 0, num_airtime_records, tid; 2212 u8 msdu_count = 0, num_airtime_records, tid;
2213 int i; 2213 int i, htt_pad = 0;
2214 struct htt_data_tx_compl_ppdu_dur *ppdu_info; 2214 struct htt_data_tx_compl_ppdu_dur *ppdu_info;
2215 struct ath10k_peer *peer; 2215 struct ath10k_peer *peer;
2216 u16 ppdu_info_offset = 0, peer_id; 2216 u16 ppdu_info_offset = 0, peer_id;
@@ -2239,9 +2239,11 @@ static void ath10k_htt_rx_tx_compl_ind(struct ath10k *ar,
2239 2239
2240 msdu_count = resp->data_tx_completion.num_msdus; 2240 msdu_count = resp->data_tx_completion.num_msdus;
2241 msdus = resp->data_tx_completion.msdus; 2241 msdus = resp->data_tx_completion.msdus;
2242 rssi_enabled = ath10k_is_rssi_enable(&ar->hw_params, resp);
2242 2243
2243 if (resp->data_tx_completion.flags2 & HTT_TX_CMPL_FLAG_DATA_RSSI) 2244 if (rssi_enabled)
2244 rssi_enabled = true; 2245 htt_pad = ath10k_tx_data_rssi_get_pad_bytes(&ar->hw_params,
2246 resp);
2245 2247
2246 for (i = 0; i < msdu_count; i++) { 2248 for (i = 0; i < msdu_count; i++) {
2247 msdu_id = msdus[i]; 2249 msdu_id = msdus[i];
@@ -2253,10 +2255,10 @@ static void ath10k_htt_rx_tx_compl_ind(struct ath10k *ar,
2253 * last msdu id with 0xffff 2255 * last msdu id with 0xffff
2254 */ 2256 */
2255 if (msdu_count & 0x01) { 2257 if (msdu_count & 0x01) {
2256 msdu_id = msdus[msdu_count + i + 1]; 2258 msdu_id = msdus[msdu_count + i + 1 + htt_pad];
2257 tx_done.ack_rssi = __le16_to_cpu(msdu_id); 2259 tx_done.ack_rssi = __le16_to_cpu(msdu_id);
2258 } else { 2260 } else {
2259 msdu_id = msdus[msdu_count + i]; 2261 msdu_id = msdus[msdu_count + i + htt_pad];
2260 tx_done.ack_rssi = __le16_to_cpu(msdu_id); 2262 tx_done.ack_rssi = __le16_to_cpu(msdu_id);
2261 } 2263 }
2262 } 2264 }
diff --git a/drivers/net/wireless/ath/ath10k/hw.c b/drivers/net/wireless/ath/ath10k/hw.c
index eeaee8e41b28..ad082b7d7643 100644
--- a/drivers/net/wireless/ath/ath10k/hw.c
+++ b/drivers/net/wireless/ath/ath10k/hw.c
@@ -1100,6 +1100,32 @@ int ath10k_hw_diag_fast_download(struct ath10k *ar,
1100 return ret; 1100 return ret;
1101} 1101}
1102 1102
1103static int ath10k_htt_tx_rssi_enable(struct htt_resp *resp)
1104{
1105 return (resp->data_tx_completion.flags2 & HTT_TX_CMPL_FLAG_DATA_RSSI);
1106}
1107
1108static int ath10k_htt_tx_rssi_enable_wcn3990(struct htt_resp *resp)
1109{
1110 return (resp->data_tx_completion.flags2 &
1111 HTT_TX_DATA_RSSI_ENABLE_WCN3990);
1112}
1113
1114static int ath10k_get_htt_tx_data_rssi_pad(struct htt_resp *resp)
1115{
1116 struct htt_data_tx_completion_ext extd;
1117 int pad_bytes = 0;
1118
1119 if (resp->data_tx_completion.flags2 & HTT_TX_DATA_APPEND_RETRIES)
1120 pad_bytes += sizeof(extd.a_retries) /
1121 sizeof(extd.msdus_rssi[0]);
1122
1123 if (resp->data_tx_completion.flags2 & HTT_TX_DATA_APPEND_TIMESTAMP)
1124 pad_bytes += sizeof(extd.t_stamp) / sizeof(extd.msdus_rssi[0]);
1125
1126 return pad_bytes;
1127}
1128
1103const struct ath10k_hw_ops qca988x_ops = { 1129const struct ath10k_hw_ops qca988x_ops = {
1104 .set_coverage_class = ath10k_hw_qca988x_set_coverage_class, 1130 .set_coverage_class = ath10k_hw_qca988x_set_coverage_class,
1105}; 1131};
@@ -1124,6 +1150,10 @@ const struct ath10k_hw_ops qca99x0_ops = {
1124const struct ath10k_hw_ops qca6174_ops = { 1150const struct ath10k_hw_ops qca6174_ops = {
1125 .set_coverage_class = ath10k_hw_qca988x_set_coverage_class, 1151 .set_coverage_class = ath10k_hw_qca988x_set_coverage_class,
1126 .enable_pll_clk = ath10k_hw_qca6174_enable_pll_clock, 1152 .enable_pll_clk = ath10k_hw_qca6174_enable_pll_clock,
1153 .is_rssi_enable = ath10k_htt_tx_rssi_enable,
1127}; 1154};
1128 1155
1129const struct ath10k_hw_ops wcn3990_ops = {}; 1156const struct ath10k_hw_ops wcn3990_ops = {
1157 .tx_data_rssi_pad_bytes = ath10k_get_htt_tx_data_rssi_pad,
1158 .is_rssi_enable = ath10k_htt_tx_rssi_enable_wcn3990,
1159};
diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h
index de7dc01bf51d..97ca42c4e3b4 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -609,6 +609,8 @@ struct ath10k_hw_params {
609}; 609};
610 610
611struct htt_rx_desc; 611struct htt_rx_desc;
612struct htt_resp;
613struct htt_data_tx_completion_ext;
612 614
613/* Defines needed for Rx descriptor abstraction */ 615/* Defines needed for Rx descriptor abstraction */
614struct ath10k_hw_ops { 616struct ath10k_hw_ops {
@@ -616,6 +618,8 @@ struct ath10k_hw_ops {
616 void (*set_coverage_class)(struct ath10k *ar, s16 value); 618 void (*set_coverage_class)(struct ath10k *ar, s16 value);
617 int (*enable_pll_clk)(struct ath10k *ar); 619 int (*enable_pll_clk)(struct ath10k *ar);
618 bool (*rx_desc_get_msdu_limit_error)(struct htt_rx_desc *rxd); 620 bool (*rx_desc_get_msdu_limit_error)(struct htt_rx_desc *rxd);
621 int (*tx_data_rssi_pad_bytes)(struct htt_resp *htt);
622 int (*is_rssi_enable)(struct htt_resp *resp);
619}; 623};
620 624
621extern const struct ath10k_hw_ops qca988x_ops; 625extern const struct ath10k_hw_ops qca988x_ops;
@@ -643,6 +647,24 @@ ath10k_rx_desc_msdu_limit_error(struct ath10k_hw_params *hw,
643 return false; 647 return false;
644} 648}
645 649
650static inline int
651ath10k_tx_data_rssi_get_pad_bytes(struct ath10k_hw_params *hw,
652 struct htt_resp *htt)
653{
654 if (hw->hw_ops->tx_data_rssi_pad_bytes)
655 return hw->hw_ops->tx_data_rssi_pad_bytes(htt);
656 return 0;
657}
658
659static inline int
660ath10k_is_rssi_enable(struct ath10k_hw_params *hw,
661 struct htt_resp *resp)
662{
663 if (hw->hw_ops->is_rssi_enable)
664 return hw->hw_ops->is_rssi_enable(resp);
665 return 0;
666}
667
646/* Target specific defines for MAIN firmware */ 668/* Target specific defines for MAIN firmware */
647#define TARGET_NUM_VDEVS 8 669#define TARGET_NUM_VDEVS 8
648#define TARGET_NUM_PEER_AST 2 670#define TARGET_NUM_PEER_AST 2