qcacmn: Add support for tx flags for packet capture mode

Fill tx flags in radiotap header based on tx status for
tx packets capture in packet capture component.

Change-Id: I52da01a2c0677d32bfb05a1f3095a0e6df084fca
CRs-Fixed: 3132140
This commit is contained in:
Vulupala Shashank Reddy
2022-02-17 11:58:08 +05:30
committed by Madan Koyyalamudi
parent ec3bfd9dc9
commit f4a25a4af0
2 changed files with 55 additions and 0 deletions

View File

@@ -73,6 +73,10 @@
#define RADIOTAP_VHT_BW_80 4
#define RADIOTAP_VHT_BW_160 11
/* tx status */
#define RADIOTAP_TX_STATUS_FAIL 1
#define RADIOTAP_TX_STATUS_NOACK 2
/* channel number to freq conversion */
#define CHANNEL_NUM_14 14
#define CHANNEL_NUM_15 15
@@ -4959,6 +4963,41 @@ static unsigned int qdf_nbuf_update_radiotap_ampdu_flags(
(rx_status->rssi_comb + rx_status->chan_noise_floor)
#endif
/**
* qdf_nbuf_update_radiotap_tx_flags() - Update radiotap header tx flags
* @rx_status: Pointer to rx_status.
* @rtap_buf: Buf to which tx info has to be updated.
* @rtap_len: Current length of radiotap buffer
*
* Return: Length of radiotap after tx flags updated.
*/
static unsigned int qdf_nbuf_update_radiotap_tx_flags(
struct mon_rx_status *rx_status,
uint8_t *rtap_buf,
uint32_t rtap_len)
{
/*
* IEEE80211_RADIOTAP_TX_FLAGS u16
*/
uint16_t tx_flags = 0;
rtap_len = qdf_align(rtap_len, 2);
switch (rx_status->tx_status) {
case RADIOTAP_TX_STATUS_FAIL:
tx_flags |= IEEE80211_RADIOTAP_F_TX_FAIL;
break;
case RADIOTAP_TX_STATUS_NOACK:
tx_flags |= IEEE80211_RADIOTAP_F_TX_NOACK;
break;
}
put_unaligned_le16(tx_flags, &rtap_buf[rtap_len]);
rtap_len += 2;
return rtap_len;
}
/**
* qdf_nbuf_update_radiotap() - Update radiotap header from rx_status
* @rx_status: Pointer to rx_status.
@@ -5062,6 +5101,20 @@ unsigned int qdf_nbuf_update_radiotap(struct mon_rx_status *rx_status,
return 0;
}
/* update tx flags for pkt capture*/
if (rx_status->add_rtap_ext) {
rthdr->it_present |=
cpu_to_le32(1 << IEEE80211_RADIOTAP_TX_FLAGS);
rtap_len = qdf_nbuf_update_radiotap_tx_flags(rx_status,
rtap_buf,
rtap_len);
if ((rtap_len - length) > RADIOTAP_TX_FLAGS_LEN) {
qdf_print("length is greater than RADIOTAP_TX_FLAGS_LEN");
return 0;
}
}
if (rx_status->ht_flags) {
length = rtap_len;
/* IEEE80211_RADIOTAP_VHT u8, u8, u8 */