diff --git a/components/pkt_capture/core/inc/wlan_pkt_capture_data_txrx.h b/components/pkt_capture/core/inc/wlan_pkt_capture_data_txrx.h index b1fa1568aa70..2b9b63258efa 100644 --- a/components/pkt_capture/core/inc/wlan_pkt_capture_data_txrx.h +++ b/components/pkt_capture/core/inc/wlan_pkt_capture_data_txrx.h @@ -176,6 +176,8 @@ struct pkt_capture_tx_hdr_elem_t { bool dir; /* rx:0 , tx:1 */ uint8_t status; /* tx status */ uint8_t tx_retry_cnt; + uint16_t framectrl; + uint16_t seqno; }; /** diff --git a/components/pkt_capture/core/src/wlan_pkt_capture_data_txrx.c b/components/pkt_capture/core/src/wlan_pkt_capture_data_txrx.c index 57c28c373675..45cd7d5ec23f 100644 --- a/components/pkt_capture/core/src/wlan_pkt_capture_data_txrx.c +++ b/components/pkt_capture/core/src/wlan_pkt_capture_data_txrx.c @@ -1202,8 +1202,9 @@ pkt_capture_tx_data_cb( struct wlan_objmgr_vdev *vdev = context; struct pkt_capture_cb_context *cb_ctx; uint8_t drop_count; - struct htt_tx_data_hdr_information *cmpl_desc = NULL; + struct pkt_capture_tx_hdr_elem_t *ptr_pktcapture_hdr = NULL; struct pkt_capture_tx_hdr_elem_t pktcapture_hdr = {0}; + uint32_t txcap_hdr_size = sizeof(struct pkt_capture_tx_hdr_elem_t); struct ethernet_hdr_t *eth_hdr; struct llc_snap_hdr_t *llc_hdr; struct ieee80211_frame *wh; @@ -1232,26 +1233,14 @@ pkt_capture_tx_data_cb( next_buf = qdf_nbuf_queue_next(msdu); qdf_nbuf_set_next(msdu, NULL); /* Add NULL terminator */ - cmpl_desc = (struct htt_tx_data_hdr_information *) + ptr_pktcapture_hdr = (struct pkt_capture_tx_hdr_elem_t *) (qdf_nbuf_data(msdu)); - pktcapture_hdr.timestamp = cmpl_desc->phy_timestamp_l32; - pktcapture_hdr.preamble = cmpl_desc->preamble; - pktcapture_hdr.mcs = cmpl_desc->mcs; - pktcapture_hdr.bw = cmpl_desc->bw; - pktcapture_hdr.nss = cmpl_desc->nss; - pktcapture_hdr.rssi_comb = cmpl_desc->rssi; - pktcapture_hdr.rate = cmpl_desc->rate; - pktcapture_hdr.stbc = cmpl_desc->stbc; - pktcapture_hdr.sgi = cmpl_desc->sgi; - pktcapture_hdr.ldpc = cmpl_desc->ldpc; - pktcapture_hdr.beamformed = cmpl_desc->beamformed; + qdf_mem_copy(&pktcapture_hdr, ptr_pktcapture_hdr, + txcap_hdr_size); pktcapture_hdr.status = status; - pktcapture_hdr.tx_retry_cnt = tx_retry_cnt; - qdf_nbuf_pull_head( - msdu, - sizeof(struct htt_tx_data_hdr_information)); + qdf_nbuf_pull_head(msdu, txcap_hdr_size); if (pkt_format == TXRX_PKTCAPTURE_PKT_FORMAT_8023) { eth_hdr = (struct ethernet_hdr_t *)qdf_nbuf_data(msdu); @@ -1279,10 +1268,10 @@ pkt_capture_tx_data_cb( qdf_mem_copy(wh->i_addr3, eth_hdr->dest_addr, QDF_MAC_ADDR_SIZE); - seq_no = cmpl_desc->seqno; + seq_no = pktcapture_hdr.seqno; seq_no = (seq_no << IEEE80211_SEQ_SEQ_SHIFT) & IEEE80211_SEQ_SEQ_MASK; - fc_ctrl = cmpl_desc->framectrl; + fc_ctrl = pktcapture_hdr.framectrl; qdf_mem_copy(wh->i_fc, &fc_ctrl, sizeof(fc_ctrl)); qdf_mem_copy(wh->i_seq, &seq_no, sizeof(seq_no)); @@ -1513,7 +1502,6 @@ void pkt_capture_offload_deliver_indication_handler( offload_deliver_msg->tx_retry_cnt); } #else -#define FRAME_CTRL_TYPE_DATA 0x0008 void pkt_capture_offload_deliver_indication_handler( void *msg, uint8_t vdev_id, uint8_t *bssid, void *soc) @@ -1523,16 +1511,33 @@ void pkt_capture_offload_deliver_indication_handler( uint8_t status; uint8_t tid = 0; bool pkt_format; - u_int32_t *msg_word = (u_int32_t *)msg; u_int8_t *buf = (u_int8_t *)msg; - struct htt_tx_data_hdr_information *txhdr; struct htt_tx_offload_deliver_ind_hdr_t *offload_deliver_msg; - struct htt_tx_data_hdr_information *cmpl_desc = NULL; + + struct pkt_capture_tx_hdr_elem_t *ptr_pktcapture_hdr; + struct pkt_capture_tx_hdr_elem_t pktcapture_hdr = {0}; + uint32_t txcap_hdr_size = sizeof(struct pkt_capture_tx_hdr_elem_t); offload_deliver_msg = (struct htt_tx_offload_deliver_ind_hdr_t *)msg; - txhdr = (struct htt_tx_data_hdr_information *) - (msg_word + 1); + pktcapture_hdr.timestamp = offload_deliver_msg->phy_timestamp_l32; + pktcapture_hdr.preamble = offload_deliver_msg->preamble; + pktcapture_hdr.mcs = offload_deliver_msg->mcs; + pktcapture_hdr.bw = offload_deliver_msg->bw; + pktcapture_hdr.nss = offload_deliver_msg->nss; + pktcapture_hdr.rssi_comb = offload_deliver_msg->rssi; + pktcapture_hdr.rate = offload_deliver_msg->rate; + pktcapture_hdr.stbc = offload_deliver_msg->stbc; + pktcapture_hdr.sgi = offload_deliver_msg->sgi; + pktcapture_hdr.ldpc = offload_deliver_msg->ldpc; + /* Beamformed not available */ + pktcapture_hdr.beamformed = 0; + pktcapture_hdr.framectrl = offload_deliver_msg->framectrl; + pktcapture_hdr.tx_retry_cnt = offload_deliver_msg->tx_retry_cnt; + pktcapture_hdr.seqno = offload_deliver_msg->seqno; + tid = offload_deliver_msg->tid_num; + status = offload_deliver_msg->status; + pkt_format = offload_deliver_msg->format; nbuf_len = offload_deliver_msg->tx_mpdu_bytes; @@ -1549,22 +1554,11 @@ void pkt_capture_offload_deliver_indication_handler( buf + sizeof(struct htt_tx_offload_deliver_ind_hdr_t), nbuf_len); - qdf_nbuf_push_head( - netbuf, - sizeof(struct htt_tx_data_hdr_information)); + qdf_nbuf_push_head(netbuf, txcap_hdr_size); - qdf_mem_copy(qdf_nbuf_data(netbuf), txhdr, - sizeof(struct htt_tx_data_hdr_information)); - - status = offload_deliver_msg->status; - pkt_format = offload_deliver_msg->format; - tid = offload_deliver_msg->tid_num; - - cmpl_desc = (struct htt_tx_data_hdr_information *) - (qdf_nbuf_data(netbuf)); - - /* filling packet type as data, as framectrl is not available */ - cmpl_desc->framectrl = FRAME_CTRL_TYPE_DATA; + ptr_pktcapture_hdr = + (struct pkt_capture_tx_hdr_elem_t *)qdf_nbuf_data(netbuf); + qdf_mem_copy(ptr_pktcapture_hdr, &pktcapture_hdr, txcap_hdr_size); pkt_capture_datapkt_process( vdev_id, diff --git a/components/pkt_capture/core/src/wlan_pkt_capture_main.c b/components/pkt_capture/core/src/wlan_pkt_capture_main.c index 9fe6a7ebf971..80162a16b9f8 100644 --- a/components/pkt_capture/core/src/wlan_pkt_capture_main.c +++ b/components/pkt_capture/core/src/wlan_pkt_capture_main.c @@ -31,6 +31,7 @@ #include "target_if_pkt_capture.h" #include "cdp_txrx_ctrl.h" #include "wlan_pkt_capture_tgt_api.h" +#include static struct wlan_objmgr_vdev *gp_pkt_capture_vdev; @@ -128,44 +129,49 @@ void pkt_capture_callback(void *soc, enum WDI_EVENT event, void *log_data, { uint8_t bssid[QDF_MAC_ADDR_SIZE]; uint8_t tid = 0, tx_retry_cnt = 0; - struct htt_tx_data_hdr_information cmpl_desc; - struct htt_tx_data_hdr_information *ptr_cmpl_desc; - struct hal_tx_completion_status ppdu_hdr = {0}; - uint32_t txcap_hdr_size = sizeof(struct htt_tx_data_hdr_information); struct dp_soc *psoc = soc; switch (event) { case WDI_EVENT_PKT_CAPTURE_TX_DATA: { + struct pkt_capture_tx_hdr_elem_t *ptr_pktcapture_hdr; + struct pkt_capture_tx_hdr_elem_t pktcapture_hdr = {0}; + struct hal_tx_completion_status tx_comp_status = {0}; + uint32_t txcap_hdr_size = + sizeof(struct pkt_capture_tx_hdr_elem_t); + struct dp_tx_desc_s *desc = log_data; qdf_nbuf_t netbuf; int nbuf_len; - hal_tx_comp_get_status(&desc->comp, &ppdu_hdr, psoc->hal_soc); + hal_tx_comp_get_status(&desc->comp, &tx_comp_status, + psoc->hal_soc); if (!(pkt_capture_get_pktcap_mode_v2() & PKT_CAPTURE_MODE_DATA_ONLY)) { return; } - cmpl_desc.phy_timestamp_l32 = ppdu_hdr.tsf; - cmpl_desc.preamble = ppdu_hdr.pkt_type; - cmpl_desc.mcs = ppdu_hdr.mcs; - cmpl_desc.bw = ppdu_hdr.bw; - /* nss is not updated */ - cmpl_desc.nss = 0; - cmpl_desc.rssi = ppdu_hdr.ack_frame_rssi; - /* rate is not updated */ - cmpl_desc.rate = 0; - cmpl_desc.stbc = ppdu_hdr.stbc; - cmpl_desc.sgi = ppdu_hdr.sgi; - cmpl_desc.ldpc = ppdu_hdr.ldpc; - /* beamformed is not updated */ - cmpl_desc.beamformed = 0; - cmpl_desc.framectrl = 0x0008; - cmpl_desc.tx_retry_cnt = ppdu_hdr.transmit_cnt; - tid = ppdu_hdr.tid; - status = ppdu_hdr.status; - tx_retry_cnt = ppdu_hdr.transmit_cnt; + pktcapture_hdr.timestamp = tx_comp_status.tsf; + pktcapture_hdr.preamble = tx_comp_status.pkt_type; + pktcapture_hdr.mcs = tx_comp_status.mcs; + pktcapture_hdr.bw = tx_comp_status.bw; + /* nss not available */ + pktcapture_hdr.nss = 0; + pktcapture_hdr.rssi_comb = tx_comp_status.ack_frame_rssi; + /* rate not available */ + pktcapture_hdr.rate = 0; + pktcapture_hdr.stbc = tx_comp_status.stbc; + pktcapture_hdr.sgi = tx_comp_status.sgi; + pktcapture_hdr.ldpc = tx_comp_status.ldpc; + /* Beamformed not available */ + pktcapture_hdr.beamformed = 0; + pktcapture_hdr.framectrl = IEEE80211_FC0_TYPE_DATA | + (IEEE80211_FC1_DIR_TODS << 8); + pktcapture_hdr.tx_retry_cnt = tx_comp_status.transmit_cnt; + /* seqno not available */ + pktcapture_hdr.seqno = 0; + tid = tx_comp_status.tid; + status = tx_comp_status.status; nbuf_len = qdf_nbuf_len(desc->nbuf); netbuf = qdf_nbuf_alloc(NULL, @@ -198,9 +204,10 @@ void pkt_capture_callback(void *soc, enum WDI_EVENT event, void *log_data, return; } - ptr_cmpl_desc = - (struct htt_tx_data_hdr_information *)qdf_nbuf_data(netbuf); - qdf_mem_copy(ptr_cmpl_desc, &cmpl_desc, txcap_hdr_size); + ptr_pktcapture_hdr = + (struct pkt_capture_tx_hdr_elem_t *)qdf_nbuf_data(netbuf); + qdf_mem_copy(ptr_pktcapture_hdr, &pktcapture_hdr, + txcap_hdr_size); pkt_capture_datapkt_process( vdev_id, netbuf, TXRX_PROCESS_TYPE_DATA_TX_COMPL,