ath11k: add HE radiotap header support
v10 cover ath11k: add HE radiotap header support
This series address review comments from previous revision:
https://patchwork.kernel.org/project/linux-wireless/list/?series=328291&state=%2A&archive=both
Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.4.0.1-01725-QCAHKSWPL_SILICONZ-1
changes in v10:
- rebase
changes in v9:
- maintain rate_info in local
changes in v8:
- move ieee80211_tx_status_ext out of spin lock
changes in v7:
- use generic radiotap HE fields from
include/net/ieee80211_radiotap.h
- fix converting gi and ltf enums to match nl80211 enums when updating radiotap headers.
- fix sparse warnings
Pradeep Kumar Chitrapu (3):
ath11k: switch to using ieee80211_tx_status_ext()
ath11k: decode HE status tlv
ath11k: translate HE status to radiotap format
drivers/net/wireless/ath/ath11k/dp_rx.c | 111 ++++- drivers/net/wireless/ath/ath11k/dp_tx.c | 32 +- drivers/net/wireless/ath/ath11k/hal_desc.h | 1 + drivers/net/wireless/ath/ath11k/hal_rx.c | 471 ++++++++++++++++++--- drivers/net/wireless/ath/ath11k/hal_rx.h | 135 +++++- 5 files changed, 670 insertions(+), 80 deletions(-)
Signature · 7 lines
2.17.1 -- ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
PATCH v10 1/3 ath11k: switch to using ieee80211_tx_status_ext()
This allows us to pass HE rates down into the stack.
--- drivers/net/wireless/ath/ath11k/dp_tx.c | 32 +++++++++++++++++++++---- 1 file changed, 27 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath11k/dp_tx.c +27 -5
@@ -519,9 +519,13 @@ static void ath11k_dp_tx_complete_msdu(struct ath11k *ar,struct sk_buff *msdu, struct hal_tx_status *ts) { + struct ieee80211_tx_status status = { 0 };struct ath11k_base *ab = ar->ab;struct ieee80211_tx_info *info;struct ath11k_skb_cb *skb_cb; +struct ath11k_peer *peer; +struct ath11k_sta *arsta; +struct rate_info rate;if (WARN_ON_ONCE (ts->buf_rel_source !=HAL_WBM_REL_SRC_MODULE_TQM )) {/* Must not happen */
@@ -584,12 +588,30 @@ static void ath11k_dp_tx_complete_msdu(struct ath11k *ar,ath11k_dp_tx_cache_peer_stats (ar, msdu, ts); } -/* NOTE: Tx rate status reporting. Tx completion status does not have -* necessary information (for example nss) to build the tx rate. -* Might end up reporting it out-of-band from HTT stats. -*/ +spin_lock_bh (&ab->base_lock); + peer =ath11k_peer_find_by_id (ab, ts->peer_id); +if (!peer || !peer->sta) { +ath11k_dbg (ab,ATH11K_DBG_DATA , +"dp_tx: failed to find the peer with peer_id %d\n" , + ts->peer_id); +spin_unlock_bh (&ab->base_lock); +dev_kfree_skb_any (msdu); + goto exit; + } + arsta = (struct ath11k_sta *)peer->sta->drv_priv; + status.sta = peer->sta; + status.skb = msdu; + status.info = info; + rate = arsta->last_txrate; + status.rate = &rate; -ieee80211_tx_status (ar->hw, msdu); +spin_unlock_bh (&ab->base_lock); +rcu_read_unlock (); + +ieee80211_tx_status_ext (ar->hw, &status); +return ; +exit: +rcu_read_unlock (); } static inline void ath11k_dp_tx_status_parse(struct ath11k_base *ab,
Signature · 7 lines
2.17.1 -- ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
Re: [PATCH v10 1/3] ath11k: switch to using ieee80211_tx_status_ext()
Quoted 52 lines · Pradeep Kumar Chitrapu
This allows us to pass HE rates down into the stack.
Co-developed-by Miles Hu <[email protected]>Signed-off-by Miles Hu <[email protected]>Signed-off-by John Crispin <[email protected]>Signed-off-by Pradeep Kumar Chitrapu <[email protected]>--- drivers/net/wireless/ath/ath11k/dp_tx.c | 32 +++++++++++++++++++++---- 1 file changed, 27 insertions(+), 5 deletions(-)drivers/net/wireless/ath/ath11k/dp_tx.c +20
-4@@ -519,9 +519,13 @@ static void ath11k_dp_tx_complete_msdu(struct ath11k *ar,struct sk_buff *msdu, struct hal_tx_status *ts) { + struct ieee80211_tx_status status = { 0 };struct ath11k_base *ab = ar->ab;struct ieee80211_tx_info *info;struct ath11k_skb_cb *skb_cb; +struct ath11k_peer *peer; +struct ath11k_sta *arsta; +struct rate_info rate;if (WARN_ON_ONCE (ts->buf_rel_source !=HAL_WBM_REL_SRC_MODULE_TQM )) {/* Must not happen */ @@ -584,12 +588,30 @@ static void ath11k_dp_tx_complete_msdu(struct ath11k *ar,ath11k_dp_tx_cache_peer_stats (ar, msdu, ts); } -/* NOTE: Tx rate status reporting. Tx completion status does not have -* necessary information (for example nss) to build the tx rate. -* Might end up reporting it out-of-band from HTT stats. -*/ +spin_lock_bh (&ab->base_lock); + peer =ath11k_peer_find_by_id (ab, ts->peer_id); +if (!peer || !peer->sta) { +ath11k_dbg (ab,ATH11K_DBG_DATA , +"dp_tx: failed to find the peer with peer_id %d\n" , + ts->peer_id); +spin_unlock_bh (&ab->base_lock); +dev_kfree_skb_any (msdu); + goto exit; + } + arsta = (struct ath11k_sta *)peer->sta->drv_priv; + status.sta = peer->sta; + status.skb = msdu; + status.info = info; + rate = arsta->last_txrate; + status.rate = &rate;
drivers/net/wireless/ath/ath11k/dp_tx.c static void ath11k_dp_tx_complete_msdu(struct ath11k *ar, · line 615
Quoted 10 lines
drivers/net/wireless/ath/ath11k/dp_tx.c +7
-1-ieee80211_tx_status (ar->hw, msdu); +spin_unlock_bh (&ab->base_lock); +rcu_read_unlock (); + +ieee80211_tx_status_ext (ar->hw, &status); +return ; +exit: +rcu_read_unlock (); }
This patch gives a warning:
drivers/net/wireless/ath/ath11k/dp_tx.c:600:9: warning: context imbalance in 'ath11k_dp_tx_complete_msdu' - unexpected unlock
I don't understand why there's rcu_read_unlock() so in the pending branch I removed both of the calls and also the exit label.
Please check my changes.
Signature · 8 lines
https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches -- ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
Re: [PATCH v10 1/3] ath11k: switch to using ieee80211_tx_status_ext()
In reply to Pradeep Kumar ChitrapuQuoted 7 lines · Pradeep Kumar Chitrapu
This allows us to pass HE rates down into the stack.
Co-developed-by Miles Hu <[email protected]>Signed-off-by Miles Hu <[email protected]>Signed-off-by John Crispin <[email protected]>Signed-off-by Pradeep Kumar Chitrapu <[email protected]>Signed-off-by Kalle Valo <[email protected]>
3 patches applied to ath-next branch of ath.git, thanks.
94739d45c388 ath11k: switch to using ieee80211_tx_status_ext() 01d2f285e3e5 ath11k: decode HE status tlv ab0a9ef605cf ath11k: translate HE status to radiotap format
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
PATCH v10 2/3 ath11k: decode HE status tlv
In reply to Pradeep Kumar ChitrapuAdd new bitmasks and macro definitions required for parsing HE status tlvs. Decode HE status tlvs, which will used in dumping ppdu stats as well as updating radiotap headers.
--- drivers/net/wireless/ath/ath11k/dp_rx.c | 96 ++++++++++++--- drivers/net/wireless/ath/ath11k/hal_desc.h | 1 + drivers/net/wireless/ath/ath11k/hal_rx.h | 135 ++++++++++++++++++++- 3 files changed, 213 insertions(+), 19 deletions(-)
drivers/net/wireless/ath/ath11k/dp_rx.c +81 -15
@@ -4807,7 +4807,6 @@ ath11k_dp_rx_mon_merg_msdus(struct ath11k *ar, {struct ath11k_base *ab = ar->ab;struct sk_buff *msdu, *prev_buf; -u32 wifi_hdr_len;struct hal_rx_desc *rx_desc;char *hdr_desc;u8 *dest, decap_format;
@@ -4849,38 +4848,27 @@ ath11k_dp_rx_mon_merg_msdus(struct ath11k *ar,skb_trim (prev_buf, prev_buf->len -HAL_RX_FCS_LEN ); }else if (decap_format ==DP_RX_DECAP_TYPE_NATIVE_WIFI ) { -__le16 qos_field;u8 qos_pkt =0 ; rx_desc = (struct hal_rx_desc *)head_msdu->data; hdr_desc =ath11k_dp_rxdesc_get_80211hdr (ab, rx_desc);/* Base size */ - wifi_hdr_len =sizeof (struct ieee80211_hdr_3addr ); wh = (struct ieee80211_hdr_3addr *)hdr_desc;if (ieee80211_is_data_qos (wh->frame_control)) { -struct ieee80211_qos_hdr *qwh = - (struct ieee80211_qos_hdr *)hdr_desc; - - qos_field = qwh->qos_ctrl; qos_pkt =1 ; } msdu = head_msdu;while (msdu) { - rx_desc = (struct hal_rx_desc *)msdu->data; - hdr_desc =ath11k_dp_rxdesc_get_80211hdr (ab, rx_desc); - +ath11k_dp_rx_msdus_set_payload (ar, msdu);if (qos_pkt) { dest =skb_push (msdu,sizeof (__le16));if (!dest) goto err_merge_fail; -memcpy (dest, hdr_desc, wifi_hdr_len); -memcpy (dest + wifi_hdr_len, - (u8 *)&qos_field,sizeof (__le16)); +memcpy (dest, hdr_desc,sizeof (struct ieee80211_qos_hdr )); } -ath11k_dp_rx_msdus_set_payload (ar, msdu); prev_buf = msdu; msdu = msdu->next; }
@@ -4904,8 +4892,83 @@ ath11k_dp_rx_mon_merg_msdus(struct ath11k *ar,return NULL ; } +static void +ath11k_dp_rx_update_radiotap_he (struct hal_rx_mon_ppdu_info *rx_status, +u8 *rtap_buf) +{ +u32 rtap_len =0 ; + +put_unaligned_le16 (rx_status->he_data1, &rtap_buf[rtap_len]); + rtap_len +=2 ; + +put_unaligned_le16 (rx_status->he_data2, &rtap_buf[rtap_len]); + rtap_len +=2 ; + +put_unaligned_le16 (rx_status->he_data3, &rtap_buf[rtap_len]); + rtap_len +=2 ; + +put_unaligned_le16 (rx_status->he_data4, &rtap_buf[rtap_len]); + rtap_len +=2 ; + +put_unaligned_le16 (rx_status->he_data5, &rtap_buf[rtap_len]); + rtap_len +=2 ; + +put_unaligned_le16 (rx_status->he_data6, &rtap_buf[rtap_len]); +} + +static void +ath11k_dp_rx_update_radiotap_he_mu (struct hal_rx_mon_ppdu_info *rx_status, +u8 *rtap_buf) +{ +u32 rtap_len =0 ; + +put_unaligned_le16 (rx_status->he_flags1, &rtap_buf[rtap_len]); + rtap_len +=2 ; + +put_unaligned_le16 (rx_status->he_flags2, &rtap_buf[rtap_len]); + rtap_len +=2 ; + + rtap_buf[rtap_len] = rx_status->he_RU[0 ]; + rtap_len +=1 ; + + rtap_buf[rtap_len] = rx_status->he_RU[1 ]; + rtap_len +=1 ; + + rtap_buf[rtap_len] = rx_status->he_RU[2 ]; + rtap_len +=1 ; + + rtap_buf[rtap_len] = rx_status->he_RU[3 ]; +} + +static void ath11k_update_radiotap (struct hal_rx_mon_ppdu_info *ppduinfo, +struct sk_buff *mon_skb, +struct ieee80211_rx_status *rxs) +{ +u8 *ptr =NULL ; + +if (ppduinfo->he_mu_flags) { + rxs->flag |=RX_FLAG_RADIOTAP_HE_MU ; + rxs->encoding =RX_ENC_HE ; + ptr =skb_push (mon_skb,sizeof (struct ieee80211_radiotap_he_mu )); +ath11k_dp_rx_update_radiotap_he_mu (ppduinfo, ptr); + } +if (ppduinfo->he_flags) { + rxs->flag |=RX_FLAG_RADIOTAP_HE ; + rxs->encoding =RX_ENC_HE ; + ptr =skb_push (mon_skb,sizeof (struct ieee80211_radiotap_he )); +ath11k_dp_rx_update_radiotap_he (ppduinfo, ptr); + } + + rxs->flag |=RX_FLAG_MACTIME_START ; + rxs->signal = ppduinfo->rssi_comb +ATH11K_DEFAULT_NOISE_FLOOR ; + rxs->nss = ppduinfo->nss; + + rxs->mactime = ppduinfo->tsft; +} +static int ath11k_dp_rx_mon_deliver (struct ath11k *ar,u32 mac_id,struct sk_buff *head_msdu, +struct hal_rx_mon_ppdu_info *ppduinfo,struct sk_buff *tail_msdu,struct napi_struct *napi) {
@@ -4940,7 +5003,7 @@ static int ath11k_dp_rx_mon_deliver(struct ath11k *ar, u32 mac_id, }else { rxs->flag |=RX_FLAG_ALLOW_SAME_PN ; } - rxs->flag |=RX_FLAG_ONLY_MONITOR ; +ath11k_update_radiotap (ppduinfo, mon_skb, rxs);ath11k_dp_rx_deliver_msdu (ar, napi, mon_skb, rxs); mon_skb = skb_next;
@@ -5045,6 +5108,7 @@ static void ath11k_dp_rx_mon_dest_process(struct ath11k *ar, int mac_id, }if (head_msdu && tail_msdu) {ath11k_dp_rx_mon_deliver (ar, dp->mac_id, head_msdu, + &pmon->mon_ppdu_info, tail_msdu, napi); rx_mon_stats->dest_mpdu_done++; }
@@ -5114,6 +5178,7 @@ int ath11k_dp_rx_process_mon_status(struct ath11k_base *ab, int mac_id,if (log_type !=ATH11K_PKTLOG_TYPE_INVALID )trace_ath11k_htt_rxdesc (ar, skb->data, log_type, rx_buf_sz); +memset (ppdu_info,0 ,sizeof (struct hal_rx_mon_ppdu_info )); hal_status =ath11k_hal_rx_parse_mon_status (ab, ppdu_info, skb); if (test_bit(ATH11K_FLAG_MONITOR_STARTED, &ar->monitor_flags) &&
@@ -5374,6 +5439,7 @@ static int ath11k_dp_rx_full_mon_deliver_ppdu(struct ath11k *ar, tail_msdu = mon_mpdu->tail;if (head_msdu && tail_msdu) { ret =ath11k_dp_rx_mon_deliver (ar, mac_id, head_msdu, + &pmon->mon_ppdu_info, tail_msdu, napi); rx_mon_stats->dest_mpdu_done++;ath11k_dbg (ar->ab,ATH11K_DBG_DATA ,"full mon: deliver ppdu\n" );
drivers/net/wireless/ath/ath11k/hal_desc.h +1 -0
@@ -474,6 +474,7 @@ enum hal_tlv_tag {#define HAL_TLV_HDR_TAG GENMASK(9, 1)#define HAL_TLV_HDR_LEN GENMASK(25, 10) +#define HAL_TLV_USR_ID GENMASK(31, 26)#define HAL_TLV_ALIGN 4
drivers/net/wireless/ath/ath11k/hal_rx.h +131 -4
213 lines not on this page · raw message
Signature · 7 lines
2.17.1 -- ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
Re: [PATCH v10 2/3] ath11k: decode HE status tlv
Quoted 8 lines · Pradeep Kumar Chitrapu
Add new bitmasks and macro definitions required for parsing HE status tlvs. Decode HE status tlvs, which will used in dumping ppdu stats as well as updating radiotap headers.
Co-developed-by Miles Hu <[email protected]>Signed-off-by Miles Hu <[email protected]>Signed-off-by Pradeep Kumar Chitrapu <[email protected]>Signed-off-by Kalle Valo <[email protected]>
This had a new warning:
drivers/net/wireless/ath/ath11k/dp_rx.c:4859: braces {} are not necessary for single statement blocks
Fixed in the pending branch.
Signature · 9 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches -- ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
PATCH v10 3/3 ath11k: translate HE status to radiotap format
In reply to Pradeep Kumar ChitrapuTranslate HE status to radiotap format. This uses HE radiotap definitions from include/net/ieee80211_radiotap.h.
--- drivers/net/wireless/ath/ath11k/dp_rx.c | 31 +- drivers/net/wireless/ath/ath11k/hal_rx.c | 471 ++++++++++++++++++++--- 2 files changed, 438 insertions(+), 64 deletions(-)
drivers/net/wireless/ath/ath11k/dp_rx.c +23 -8
@@ -4940,29 +4940,44 @@ ath11k_dp_rx_update_radiotap_he_mu(struct hal_rx_mon_ppdu_info *rx_status, rtap_buf[rtap_len] = rx_status->he_RU[3 ]; } -static void ath11k_update_radiotap (struct hal_rx_mon_ppdu_info *ppduinfo, +static void ath11k_update_radiotap (struct ath11k *ar, +struct hal_rx_mon_ppdu_info *ppduinfo,struct sk_buff *mon_skb,struct ieee80211_rx_status *rxs) { +struct ieee80211_supported_band *sband;u8 *ptr =NULL ; + rxs->flag |=RX_FLAG_MACTIME_START ; + rxs->signal = ppduinfo->rssi_comb +ATH11K_DEFAULT_NOISE_FLOOR ; + +if (ppduinfo->nss) + rxs->nss = ppduinfo->nss; +if (ppduinfo->he_mu_flags) { rxs->flag |=RX_FLAG_RADIOTAP_HE_MU ; rxs->encoding =RX_ENC_HE ; ptr =skb_push (mon_skb,sizeof (struct ieee80211_radiotap_he_mu ));ath11k_dp_rx_update_radiotap_he_mu (ppduinfo, ptr); - } -if (ppduinfo->he_flags) { + }else if (ppduinfo->he_flags) { rxs->flag |=RX_FLAG_RADIOTAP_HE ; rxs->encoding =RX_ENC_HE ; ptr =skb_push (mon_skb,sizeof (struct ieee80211_radiotap_he ));ath11k_dp_rx_update_radiotap_he (ppduinfo, ptr); + rxs->rate_idx = ppduinfo->rate; + }else if (ppduinfo->vht_flags) { + rxs->encoding =RX_ENC_VHT ; + rxs->rate_idx = ppduinfo->rate; + }else if (ppduinfo->ht_flags) { + rxs->encoding =RX_ENC_HT ; + rxs->rate_idx = ppduinfo->rate; + }else { + rxs->encoding =RX_ENC_LEGACY ; + sband = &ar->mac.sbands[rxs->band]; + rxs->rate_idx =ath11k_mac_hw_rate_to_idx (sband, ppduinfo->rate, + ppduinfo->cck_flag); } - rxs->flag |=RX_FLAG_MACTIME_START ; - rxs->signal = ppduinfo->rssi_comb +ATH11K_DEFAULT_NOISE_FLOOR ; - rxs->nss = ppduinfo->nss; - rxs->mactime = ppduinfo->tsft; }
@@ -5003,7 +5018,7 @@ static int ath11k_dp_rx_mon_deliver(struct ath11k *ar, u32 mac_id, }else { rxs->flag |=RX_FLAG_ALLOW_SAME_PN ; } -ath11k_update_radiotap (ppduinfo, mon_skb, rxs); +ath11k_update_radiotap (ar, ppduinfo, mon_skb, rxs);ath11k_dp_rx_deliver_msdu (ar, napi, mon_skb, rxs); mon_skb = skb_next;
drivers/net/wireless/ath/ath11k/hal_rx.c +415 -56
591 lines not on this page · raw message
Signature · 7 lines
2.17.1 -- ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k