From 3e6863fdee51367f0dd6d78aea1b65a817d0fb3a Mon Sep 17 00:00:00 2001 From: Surabhi Vishnoi Date: Wed, 19 May 2021 18:32:02 +0530 Subject: [PATCH] qcacmn: Add extension2 data to radiotap header There is a requirement to get sequence number and tid for tx data packets in packet capture mode. These fields are not received as part of WBM tx completion, but are obtained from FW in ppdu stats. As WBM tx completion and FW ppdu stats are two different events, the ppdu_stats of previously sent ppdu are filled in the radiotap header of current tx ppdu in packet capture mode. Enhance code to add required fields such as ppdu_id of tx current ppdu and ppdu_id, tid, start_seq, ba_bitmap of previously sent ppdu as extension2 to radiotap header. These fields will be added in radiotap header only when add_rtap_ext2 is set. Change-Id: I448a9c03a770b61ab802d855bc5f1a6587bd01b3 CRs-Fixed: 3004472 --- qdf/inc/qdf_nbuf.h | 23 +++++++++++++++++++++++ qdf/linux/src/qdf_nbuf.c | 25 ++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/qdf/inc/qdf_nbuf.h b/qdf/inc/qdf_nbuf.h index a4b99a00789e..05a67bb7b67e 100644 --- a/qdf/inc/qdf_nbuf.h +++ b/qdf/inc/qdf_nbuf.h @@ -254,6 +254,9 @@ * @tx_status: packet tx status * @tx_retry_cnt: tx retry count * @add_rtap_ext: add radio tap extension + * @start_seq: starting sequence number + * @ba_bitmap: 256 bit block ack bitmap + * @add_rtap_ext2: add radiotap extension2 */ struct mon_rx_status { uint64_t tsft; @@ -338,6 +341,9 @@ struct mon_rx_status { uint8_t tx_status; uint8_t tx_retry_cnt; bool add_rtap_ext; + uint16_t start_seq; + uint32_t ba_bitmap[8]; + bool add_rtap_ext2; }; /** @@ -434,6 +440,23 @@ struct qdf_radiotap_vendor_ns_ath { uint32_t ppdu_start_timestamp; } __attribute__((__packed__)); +/** + * struct qdf_radiotap_ext2 - radiotap ext2 fields + * ppdu_id: ppdu_id of current msdu + * prev_ppdu_id: ppdu_id of previous msdu + * tid: tid number of previous msdu + * start_seq: start sequence of previous msdu + * ba_bitmap: block ack bitmap of previous msdu + */ +struct qdf_radiotap_ext2 { + uint32_t ppdu_id; + uint32_t prev_ppdu_id; + uint16_t tid:8, + reserved:8; + uint16_t start_seq; + uint32_t ba_bitmap[8]; +} __attribute__((__packed__)); + #define QDF_MEM_FUNC_NAME_SIZE 48 /* Masks for HE SIG known fields in mon_rx_status structure */ diff --git a/qdf/linux/src/qdf_nbuf.c b/qdf/linux/src/qdf_nbuf.c index a5c9f0f3b82f..f7963e010eb7 100644 --- a/qdf/linux/src/qdf_nbuf.c +++ b/qdf/linux/src/qdf_nbuf.c @@ -4361,6 +4361,7 @@ qdf_nbuf_update_radiotap_he_mu_other_flags(struct mon_rx_status *rx_status, #define IEEE80211_RADIOTAP_TX_STATUS 0 #define IEEE80211_RADIOTAP_RETRY_COUNT 1 +#define IEEE80211_RADIOTAP_EXTENSION2 2 /** * This is the length for radiotap, combined length @@ -4384,6 +4385,8 @@ qdf_nbuf_update_radiotap_he_mu_other_flags(struct mon_rx_status *rx_status, * 4 bytes padding for alignment */ #define RADIOTAP_HEADER_EXT_LEN (2 * sizeof(uint32_t)) +#define RADIOTAP_HEADER_EXT2_LEN \ + (sizeof(struct qdf_radiotap_ext2)) #define RADIOTAP_HEADER_LEN (sizeof(struct ieee80211_radiotap_header) + \ RADIOTAP_FIXED_HEADER_LEN + \ RADIOTAP_HT_FLAGS_LEN + \ @@ -4393,7 +4396,8 @@ qdf_nbuf_update_radiotap_he_mu_other_flags(struct mon_rx_status *rx_status, RADIOTAP_HE_MU_FLAGS_LEN + \ RADIOTAP_HE_MU_OTHER_FLAGS_LEN + \ RADIOTAP_VENDOR_NS_LEN + \ - RADIOTAP_HEADER_EXT_LEN) + RADIOTAP_HEADER_EXT_LEN + \ + RADIOTAP_HEADER_EXT2_LEN) #define IEEE80211_RADIOTAP_HE 23 #define IEEE80211_RADIOTAP_HE_MU 24 @@ -4452,6 +4456,7 @@ unsigned int qdf_nbuf_update_radiotap(struct mon_rx_status *rx_status, uint32_t rtap_len = rtap_hdr_len; uint8_t length = rtap_len; struct qdf_radiotap_vendor_ns_ath *radiotap_vendor_ns_ath; + struct qdf_radiotap_ext2 *rtap_ext2; uint32_t *rtap_ext = NULL; /* Adding Extended Header space */ @@ -4657,6 +4662,24 @@ unsigned int qdf_nbuf_update_radiotap(struct mon_rx_status *rx_status, rtap_len += 1; } + /* Add Extension2 to Radiotap Header */ + if (rx_status->add_rtap_ext2) { + rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_EXT); + rtap_ext = (uint32_t *)&rthdr->it_present; + rtap_ext++; + *rtap_ext |= cpu_to_le32(1 << IEEE80211_RADIOTAP_EXTENSION2); + + rtap_ext2 = (struct qdf_radiotap_ext2 *)(rtap_buf + rtap_len); + rtap_ext2->ppdu_id = rx_status->ppdu_id; + rtap_ext2->prev_ppdu_id = rx_status->prev_ppdu_id; + rtap_ext2->tid = rx_status->tid; + rtap_ext2->start_seq = rx_status->start_seq; + qdf_mem_copy(rtap_ext2->ba_bitmap, + rx_status->ba_bitmap, 8 * (sizeof(uint32_t))); + + rtap_len += sizeof(*rtap_ext2); + } + rthdr->it_len = cpu_to_le16(rtap_len); rthdr->it_present = cpu_to_le32(rthdr->it_present);