qcacld-3.0: Add support to include ACK status and tx retry count

Extend radiotap header to append ACK status and tx retry count
for packets sent to virtual mon interface.

Change-Id: If110a7de736c3efc0d477617089669104c6f1690
CRs-Fixed: 2627707
This commit is contained in:
Vulupala Shashank Reddy
2020-02-20 14:47:03 +05:30
committed by nshrivas
parent 239d58974a
commit af204caea6
14 changed files with 143 additions and 20 deletions

View File

@@ -61,6 +61,7 @@ enum pkt_capture_data_process_type {
* @pkt_format: Frame format
* @bssid: bssid
* @pdev: pdev handle
* @tx_retry_cnt: tx retry count
*
* Return: none
*/
@@ -68,8 +69,9 @@ void pkt_capture_datapkt_process(
uint8_t vdev_id,
qdf_nbuf_t mon_buf_list,
enum pkt_capture_data_process_type type,
uint8_t tid, uint8_t status, bool pkt_format,
uint8_t *bssid, htt_pdev_handle pdev);
uint8_t tid, uint8_t status, bool pktformat,
uint8_t *bssid, htt_pdev_handle pdev,
uint8_t tx_retry_cnt);
/**
* pkt_capture_msdu_process_pkts() - process data rx pkts
* @bssid: bssid
@@ -118,6 +120,20 @@ void pkt_capture_offload_deliver_indication_handler(
/**
* pkt_capture_tx_hdr_elem_t - tx packets header struture to
* be used to update radiotap header for packet capture mode
* @timestamp: timestamp
* @preamble: preamble
* @mcs: MCS
* @rate: rate
* @rssi_comb: rssi in dBm
* @nss: if nss 1 means 1ss and 2 means 2ss
* @bw: BW (0=>20MHz, 1=>40MHz, 2=>80MHz, 3=>160MHz)
* @stbc: STBC
* @sgi: SGI
* @ldpc: LDPC
* @beamformed: beamformed
* @dir: direction rx: 0 and tx: 1
* @status: tx status
* @tx_retry_cnt: tx retry count
*/
struct pkt_capture_tx_hdr_elem_t {
uint32_t timestamp;
@@ -133,6 +149,7 @@ struct pkt_capture_tx_hdr_elem_t {
bool beamformed;
bool dir; /* rx:0 , tx:1 */
uint8_t status; /* tx status */
uint8_t tx_retry_cnt;
};
/**

View File

@@ -52,6 +52,20 @@
#define PKT_CAPTURE_ENTER() pkt_capture_debug("enter")
#define PKT_CAPTURE_EXIT() pkt_capture_debug("exit")
/**
* enum pkt_capture_tx_status - packet capture tx status
* @pktcapture_tx_status_ok: successfully sent + acked
* @pktcapture_tx_status_discard: discard - not sent
* @pktcapture_tx_status_no_ack: no_ack - sent, but no ack
*
* This enum has tx status types for packet capture mode
*/
enum pkt_capture_tx_status {
pkt_capture_tx_status_ok,
pkt_capture_tx_status_discard,
pkt_capture_tx_status_no_ack,
};
/**
* pkt_capture_get_vdev() - Get pkt capture objmgr vdev.
*

View File

@@ -91,4 +91,14 @@ pkt_capture_mgmt_tx_completion(struct wlan_objmgr_pdev *pdev,
*/
QDF_STATUS pkt_capture_mgmt_rx_ops(struct wlan_objmgr_psoc *psoc,
bool is_register);
/**
* pkt_capture_mgmt_status_map() - map Tx status for MGMT packets
* with packet capture Tx status
* @status: Tx status
*
* Return: pkt_capture_tx_status enum
*/
enum pkt_capture_tx_status
pkt_capture_mgmt_status_map(uint8_t status);
#endif

View File

@@ -42,7 +42,8 @@ typedef void (*pkt_capture_mon_thread_cb)(
void *context, void *ppdev, void *monpkt,
uint8_t vdev_id, uint8_t tid,
uint8_t status, bool pkt_format,
uint8_t *bssid);
uint8_t *bssid,
uint8_t tx_retry_cnt);
/*
* struct pkt_capture_mon_pkt - mon packet wrapper for mon data from TXRX
@@ -55,6 +56,7 @@ typedef void (*pkt_capture_mon_thread_cb)(
* @status: Tx packet status
* @pkt_format: Mon packet format, 0 = 802.3 format , 1 = 802.11 format
* @bssid: bssid
* @tx_retry_cnt: tx retry count
* @callback: Mon callback
*/
struct pkt_capture_mon_pkt {
@@ -67,6 +69,7 @@ struct pkt_capture_mon_pkt {
uint8_t status;
bool pkt_format;
uint8_t bssid[QDF_MAC_ADDR_SIZE];
uint8_t tx_retry_cnt;
pkt_capture_mon_thread_cb callback;
};

View File

@@ -26,9 +26,37 @@
#include <enet.h>
#include <wlan_reg_services_api.h>
#include <cds_ieee80211_common.h>
#include <ol_txrx_htt_api.h>
#define RESERVE_BYTES (100)
/**
* pkt_capture_txrx_status_map() - map Tx status for data packets
* with packet capture Tx status
* @status: Tx status
*
* Return: pkt_capture_tx_status enum
*/
static enum pkt_capture_tx_status
pkt_capture_txrx_status_map(uint8_t status)
{
enum pkt_capture_tx_status tx_status;
switch (status) {
case htt_tx_status_ok:
tx_status = pkt_capture_tx_status_ok;
break;
case htt_tx_status_no_ack:
tx_status = pkt_capture_tx_status_no_ack;
break;
default:
tx_status = pkt_capture_tx_status_discard;
break;
}
return tx_status;
}
/**
* pkt_capture_get_tx_rate() - get tx rate for tx packet
* @preamble_type: preamble type
@@ -211,6 +239,9 @@ pkt_capture_update_tx_status(
tx_status->chan_flags = channel_flags;
tx_status->ant_signal_db = pktcapture_hdr->rssi_comb;
tx_status->rssi_comb = pktcapture_hdr->rssi_comb;
tx_status->tx_status = pktcapture_hdr->status;
tx_status->tx_retry_cnt = pktcapture_hdr->tx_retry_cnt;
tx_status->add_rtap_ext = true;
}
/**
@@ -381,7 +412,7 @@ void pkt_capture_msdu_process_pkts(
vdev_id, pktcapture_msdu,
TXRX_PROCESS_TYPE_DATA_RX, 0, 0,
TXRX_PKTCAPTURE_PKT_FORMAT_8023,
bssid, pdev);
bssid, pdev, 0);
}
/**
@@ -395,6 +426,7 @@ void pkt_capture_msdu_process_pkts(
* @status: Tx status
* @pkt_format: Frame format
* @bssid: bssid
* @tx_retry_cnt: tx retry count
*
* Return: none
*/
@@ -403,7 +435,7 @@ pkt_capture_rx_data_cb(
void *context, void *ppdev, void *nbuf_list,
uint8_t vdev_id, uint8_t tid,
uint8_t status, bool pkt_format,
uint8_t *bssid)
uint8_t *bssid, uint8_t tx_retry_cnt)
{
struct pkt_capture_vdev_priv *vdev_priv;
qdf_nbuf_t buf_list = (qdf_nbuf_t)nbuf_list;
@@ -471,6 +503,9 @@ pkt_capture_rx_data_cb(
/* need to update this to fill rx_status*/
htt_rx_mon_get_rx_status(pdev, rx_desc, &rx_status);
rx_status.chan_noise_floor = NORMALIZED_TO_NOISE_FLOOR;
rx_status.tx_status = status;
rx_status.tx_retry_cnt = tx_retry_cnt;
rx_status.add_rtap_ext = true;
/* clear IEEE80211_RADIOTAP_F_FCS flag*/
rx_status.rtap_flags &= ~(BIT(4));
@@ -519,6 +554,7 @@ free_buf:
* @pktformat: Frame format
* @bssid: bssid
* @pdev: pdev handle
* @tx_retry_cnt: tx retry count
*
* Return: none
*/
@@ -526,7 +562,7 @@ static void
pkt_capture_tx_data_cb(
void *context, void *ppdev, void *nbuf_list, uint8_t vdev_id,
uint8_t tid, uint8_t status, bool pkt_format,
uint8_t *bssid)
uint8_t *bssid, uint8_t tx_retry_cnt)
{
qdf_nbuf_t msdu, next_buf;
struct pkt_capture_vdev_priv *vdev_priv;
@@ -577,6 +613,8 @@ pkt_capture_tx_data_cb(
pktcapture_hdr.sgi = cmpl_desc->sgi;
pktcapture_hdr.ldpc = cmpl_desc->ldpc;
pktcapture_hdr.beamformed = cmpl_desc->beamformed;
pktcapture_hdr.status = status;
pktcapture_hdr.tx_retry_cnt = tx_retry_cnt;
qdf_nbuf_pull_head(
msdu,
@@ -688,13 +726,15 @@ void pkt_capture_datapkt_process(
qdf_nbuf_t mon_buf_list,
enum pkt_capture_data_process_type type,
uint8_t tid, uint8_t status, bool pkt_format,
uint8_t *bssid, htt_pdev_handle pdev)
uint8_t *bssid, htt_pdev_handle pdev,
uint8_t tx_retry_cnt)
{
uint8_t drop_count;
struct pkt_capture_mon_pkt *pkt;
pkt_capture_mon_thread_cb callback = NULL;
struct wlan_objmgr_vdev *vdev;
status = pkt_capture_txrx_status_map(status);
vdev = pkt_capture_get_vdev();
if (!vdev)
goto drop_rx_buf;
@@ -724,6 +764,7 @@ void pkt_capture_datapkt_process(
pkt->status = status;
pkt->pkt_format = pkt_format;
qdf_mem_copy(pkt->bssid, bssid, QDF_MAC_ADDR_SIZE);
pkt->tx_retry_cnt = tx_retry_cnt;
pkt_capture_indicate_monpkt(vdev, pkt);
return;
@@ -834,5 +875,6 @@ void pkt_capture_offload_deliver_indication_handler(
pkt_capture_datapkt_process(
vdev_id,
netbuf, TXRX_PROCESS_TYPE_DATA_TX,
tid, status, pkt_format, bssid, pdev);
tid, status, pkt_format, bssid, pdev,
offload_deliver_msg->tx_retry_cnt);
}

View File

@@ -31,6 +31,26 @@
#include "wlan_utility.h"
#include "cds_ieee80211_common.h"
enum pkt_capture_tx_status
pkt_capture_mgmt_status_map(uint8_t status)
{
enum pkt_capture_tx_status tx_status;
switch (status) {
case WMI_MGMT_TX_COMP_TYPE_COMPLETE_OK:
tx_status = pkt_capture_tx_status_ok;
break;
case WMI_MGMT_TX_COMP_TYPE_COMPLETE_NO_ACK:
tx_status = pkt_capture_tx_status_no_ack;
break;
default:
tx_status = pkt_capture_tx_status_discard;
break;
}
return tx_status;
}
/**
* pkt_capture_mgmtpkt_cb() - callback to process management packets
* for pkt capture mode
@@ -40,13 +60,14 @@
* @tid: tid number
* @status: Tx status
* @pkt_format: Frame format
* @tx_retry_cnt: tx retry count
*
* Return: none
*/
static void
pkt_capture_mgmtpkt_cb(void *context, void *ppdev, void *nbuf_list,
uint8_t vdev_id, uint8_t tid, uint8_t status,
bool pkt_format, uint8_t *bssid)
bool pkt_format, uint8_t *bssid, uint8_t tx_retry_cnt)
{
struct pkt_capture_vdev_priv *vdev_priv;
struct wlan_objmgr_psoc *psoc = context;
@@ -230,6 +251,9 @@ pkt_capture_process_mgmt_tx_data(struct wlan_objmgr_pdev *pdev,
IEEE80211_CHAN_2GHZ : IEEE80211_CHAN_5GHZ);
txrx_status.chan_flags = channel_flags;
txrx_status.rate = ((txrx_status.rate == 6 /* Mbps */) ? 0x0c : 0x02);
txrx_status.tx_status = status;
txrx_status.tx_retry_cnt = params->tx_retry_cnt;
txrx_status.add_rtap_ext = true;
wh = (struct ieee80211_frame *)qdf_nbuf_data(nbuf);
wh->i_fc[1] &= ~IEEE80211_FC1_WEP;
@@ -319,7 +343,9 @@ pkt_capture_mgmt_tx_completion(struct wlan_objmgr_pdev *pdev,
qdf_mem_copy(qdf_nbuf_data(wbuf), qdf_nbuf_data(nbuf), nbuf_len);
if (QDF_STATUS_SUCCESS !=
pkt_capture_process_mgmt_tx_data(pdev, params, wbuf, status))
pkt_capture_process_mgmt_tx_data(
pdev, params, wbuf,
pkt_capture_mgmt_status_map(status)))
qdf_nbuf_free(wbuf);
}
@@ -375,6 +401,7 @@ pkt_capture_mgmt_rx_data_cb(struct wlan_objmgr_psoc *psoc,
IEEE80211_CHAN_2GHZ : IEEE80211_CHAN_5GHZ);
txrx_status.chan_flags = channel_flags;
txrx_status.rate = ((txrx_status.rate == 6 /* Mbps */) ? 0x0c : 0x02);
txrx_status.add_rtap_ext = true;
wh = (struct ieee80211_frame *)qdf_nbuf_data(nbuf);
wh->i_fc[1] &= ~IEEE80211_FC1_WEP;

View File

@@ -210,7 +210,8 @@ pkt_capture_process_from_queue(struct pkt_capture_mon_context *mon_ctx)
vdev_id = pkt->vdev_id;
tid = pkt->tid;
pkt->callback(pkt->context, pkt->pdev, pkt->monpkt, vdev_id,
tid, pkt->status, pkt->pkt_format, pkt->bssid);
tid, pkt->status, pkt->pkt_format, pkt->bssid,
pkt->tx_retry_cnt);
pkt_capture_free_mon_pkt(mon_ctx, pkt);
spin_lock_bh(&mon_ctx->mon_queue_lock);
}

View File

@@ -46,6 +46,7 @@ enum pkt_capture_mode {
* 4: fifo underrun
* 8: swabort
* @buf: management frame buffer
* @tx_retry_cnt: tx retry count
*/
struct mgmt_offload_event_params {
uint32_t tsf_l32;
@@ -55,5 +56,6 @@ struct mgmt_offload_event_params {
uint32_t buf_len;
uint32_t tx_status;
uint8_t *buf;
uint8_t tx_retry_cnt;
};
#endif /* _WLAN_PKT_CAPTURE_PUBLIC_STRUCTS_H_ */

View File

@@ -243,6 +243,7 @@ struct htt_tx_data_hdr_information *ucfg_pkt_capture_tx_get_txcomplete_data_hdr(
* @pktformat: Frame format
* @bssid: bssid
* @pdev: pdev handle
* @tx_retry_cnt: tx retry count
*
* Return: none
*/
@@ -251,7 +252,8 @@ void ucfg_pkt_capture_tx_completion_process(
qdf_nbuf_t mon_buf_list,
enum pkt_capture_data_process_type type,
uint8_t tid, uint8_t status, bool pkt_format,
uint8_t *bssid, htt_pdev_handle pdev);
uint8_t *bssid, htt_pdev_handle pdev,
uint8_t tx_retry_cnt);
/**
* ucfg_pkt_capture_record_channel() - Update Channel Information
@@ -381,8 +383,8 @@ ucfg_pkt_capture_tx_completion_process(
qdf_nbuf_t mon_buf_list,
enum pkt_capture_data_process_type type,
uint8_t tid, uint8_t status, bool pkt_format,
uint8_t *bssid, htt_pdev_handle pdev)
uint8_t *bssid, htt_pdev_handle pdev,
uint8_t tx_retry_cnt)
{
}

View File

@@ -203,7 +203,9 @@ ucfg_pkt_capture_process_mgmt_tx_data(struct wlan_objmgr_pdev *pdev,
qdf_nbuf_t nbuf,
uint8_t status)
{
return pkt_capture_process_mgmt_tx_data(pdev, params, nbuf, status);
return pkt_capture_process_mgmt_tx_data(
pdev, params, nbuf,
pkt_capture_mgmt_status_map(status));
}
void
@@ -323,12 +325,14 @@ ucfg_pkt_capture_tx_completion_process(
qdf_nbuf_t mon_buf_list,
enum pkt_capture_data_process_type type,
uint8_t tid, uint8_t status, bool pkt_format,
uint8_t *bssid, htt_pdev_handle pdev)
uint8_t *bssid, htt_pdev_handle pdev,
uint8_t tx_retry_cnt)
{
pkt_capture_datapkt_process(
vdev_id,
mon_buf_list, TXRX_PROCESS_TYPE_DATA_TX_COMPL,
tid, status, pkt_format, bssid, pdev);
tid, status, pkt_format, bssid, pdev,
tx_retry_cnt);
}
void ucfg_pkt_capture_record_channel(struct wlan_objmgr_vdev *vdev)

View File

@@ -1644,7 +1644,7 @@ ol_rx_in_order_indication_handler(ol_txrx_pdev_handle pdev,
/* Packet Capture Mode */
if ((ucfg_pkt_capture_get_mode((void *)soc->psoc) &
if ((ucfg_pkt_capture_get_pktcap_mode((void *)soc->psoc) &
PKT_CAPTURE_MODE_DATA_ONLY)) {
offloaded_pkt = ucfg_pkt_capture_rx_offloaded_pkt(rx_ind_msg);
if (peer) {

View File

@@ -780,7 +780,7 @@ ol_rx_defrag(ol_txrx_pdev_handle pdev,
/* Packet Capture Mode */
if ((ucfg_pkt_capture_get_mode((void *)soc->psoc) &
if ((ucfg_pkt_capture_get_pktcap_mode((void *)soc->psoc) &
PKT_CAPTURE_MODE_DATA_ONLY)) {
if (peer) {
if (peer->vdev) {

View File

@@ -736,7 +736,7 @@ ol_tx_pkt_capture_tx_completion_process(
netbuf, pkt_type,
tid, status,
TXRX_PKTCAPTURE_PKT_FORMAT_8023, bssid,
pdev->htt_pdev);
pdev->htt_pdev, payload_hdr->tx_retry_cnt);
}
#else
static void

View File

@@ -2656,6 +2656,7 @@ static void wma_extract_mgmt_offload_event_params(
params->rssi = hdr->rssi;
params->buf_len = hdr->buf_len;
params->tx_status = hdr->tx_status;
params->tx_retry_cnt = hdr->tx_retry_cnt;
}
/**