123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566 |
- /*
- * Copyright (c) 2013-2019 The Linux Foundation. All rights reserved.
- *
- * Permission to use, copy, modify, and/or distribute this software for
- * any purpose with or without fee is hereby granted, provided that the
- * above copyright notice and this permission notice appear in all
- * copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
- * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
- /*
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
- #ifndef REMOVE_PKT_LOG
- #include "ol_txrx_types.h"
- #include "ol_htt_tx_api.h"
- #include "ol_tx_desc.h"
- #include "qdf_mem.h"
- #include "htt.h"
- #include "htt_internal.h"
- #include "pktlog_ac_i.h"
- #include "wma_api.h"
- #include "wlan_logging_sock_svc.h"
- #define TX_DESC_ID_LOW_MASK 0xffff
- #define TX_DESC_ID_LOW_SHIFT 0
- #define TX_DESC_ID_HIGH_MASK 0xffff0000
- #define TX_DESC_ID_HIGH_SHIFT 16
- #ifdef PKTLOG_HAS_SPECIFIC_DATA
- static inline void
- pktlog_hdr_set_specific_data(struct ath_pktlog_hdr *log_hdr,
- uint32_t type_specific_data)
- {
- log_hdr->type_specific_data = type_specific_data;
- }
- static inline uint32_t
- pktlog_hdr_get_specific_data(struct ath_pktlog_hdr *log_hdr)
- {
- return log_hdr->type_specific_data;
- }
- static inline void
- pktlog_arg_set_specific_data(struct ath_pktlog_arg *plarg,
- uint32_t type_specific_data)
- {
- plarg->type_specific_data = type_specific_data;
- }
- static inline uint32_t
- pktlog_arg_get_specific_data(struct ath_pktlog_arg *plarg)
- {
- return plarg->type_specific_data;
- }
- #else
- static inline void
- pktlog_hdr_set_specific_data(struct ath_pktlog_hdr *log_hdr,
- uint32_t type_specific_data)
- {
- }
- static inline uint32_t
- pktlog_hdr_get_specific_data(struct ath_pktlog_hdr *log_hdr)
- {
- return 0;
- }
- static inline void
- pktlog_arg_set_specific_data(struct ath_pktlog_arg *plarg,
- uint32_t type_specific_data)
- {
- }
- static inline uint32_t
- pktlog_arg_get_specific_data(struct ath_pktlog_arg *plarg)
- {
- return 0;
- }
- #endif
- void pktlog_getbuf_intsafe(struct ath_pktlog_arg *plarg)
- {
- struct ath_pktlog_buf *log_buf;
- int32_t buf_size;
- struct ath_pktlog_hdr *log_hdr;
- int32_t cur_wr_offset;
- char *log_ptr;
- struct ath_pktlog_info *pl_info;
- uint16_t log_type;
- size_t log_size;
- uint32_t flags;
- #ifdef HELIUMPLUS
- uint8_t mac_id;
- #endif
- if (!plarg) {
- printk("Invalid parg in %s\n", __func__);
- return;
- }
- pl_info = plarg->pl_info;
- #ifdef HELIUMPLUS
- mac_id = plarg->macId;
- log_type = plarg->log_type;
- #else
- log_type = plarg->log_type;
- #endif
- log_size = plarg->log_size;
- log_buf = pl_info->buf;
- flags = plarg->flags;
- if (!log_buf) {
- printk("Invalid log_buf in %s\n", __func__);
- return;
- }
- buf_size = pl_info->buf_size;
- cur_wr_offset = log_buf->wr_offset;
- /* Move read offset to the next entry if there is a buffer overlap */
- if (log_buf->rd_offset >= 0) {
- if ((cur_wr_offset <= log_buf->rd_offset)
- && (cur_wr_offset + sizeof(struct ath_pktlog_hdr)) >
- log_buf->rd_offset) {
- PKTLOG_MOV_RD_IDX(log_buf->rd_offset, log_buf,
- buf_size);
- }
- } else {
- log_buf->rd_offset = cur_wr_offset;
- }
- log_hdr = (struct ath_pktlog_hdr *)(log_buf->log_data + cur_wr_offset);
- log_hdr->flags = flags;
- #ifdef HELIUMPLUS
- log_hdr->macId = mac_id;
- log_hdr->log_type = log_type;
- #else
- log_hdr->log_type = log_type;
- #endif
- log_hdr->size = (uint16_t) log_size;
- log_hdr->missed_cnt = plarg->missed_cnt;
- log_hdr->timestamp = plarg->timestamp;
- pktlog_hdr_set_specific_data(log_hdr,
- pktlog_arg_get_specific_data(plarg));
- cur_wr_offset += sizeof(*log_hdr);
- if ((buf_size - cur_wr_offset) < log_size) {
- while ((cur_wr_offset <= log_buf->rd_offset)
- && (log_buf->rd_offset < buf_size)) {
- PKTLOG_MOV_RD_IDX(log_buf->rd_offset, log_buf,
- buf_size);
- }
- cur_wr_offset = 0;
- }
- while ((cur_wr_offset <= log_buf->rd_offset)
- && (cur_wr_offset + log_size) > log_buf->rd_offset) {
- PKTLOG_MOV_RD_IDX(log_buf->rd_offset, log_buf, buf_size);
- }
- log_ptr = &(log_buf->log_data[cur_wr_offset]);
- cur_wr_offset += log_hdr->size;
- log_buf->wr_offset = ((buf_size - cur_wr_offset) >=
- sizeof(struct ath_pktlog_hdr)) ? cur_wr_offset :
- 0;
- plarg->buf = log_ptr;
- }
- char *pktlog_getbuf(struct pktlog_dev_t *pl_dev,
- struct ath_pktlog_info *pl_info,
- size_t log_size, struct ath_pktlog_hdr *pl_hdr)
- {
- struct ath_pktlog_arg plarg = { 0, };
- uint8_t flags = 0;
- plarg.pl_info = pl_info;
- #ifdef HELIUMPLUS
- plarg.macId = pl_hdr->macId;
- plarg.log_type = pl_hdr->log_type;
- #else
- plarg.log_type = pl_hdr->log_type;
- #endif
- plarg.log_size = log_size;
- plarg.flags = pl_hdr->flags;
- plarg.missed_cnt = pl_hdr->missed_cnt;
- plarg.timestamp = pl_hdr->timestamp;
- pktlog_arg_set_specific_data(&plarg,
- pktlog_hdr_get_specific_data(pl_hdr));
- if (flags & PHFLAGS_INTERRUPT_CONTEXT) {
- /*
- * We are already in interrupt context, no need to make it
- * intsafe. call the function directly.
- */
- pktlog_getbuf_intsafe(&plarg);
- } else {
- PKTLOG_LOCK(pl_info);
- pktlog_getbuf_intsafe(&plarg);
- PKTLOG_UNLOCK(pl_info);
- }
- return plarg.buf;
- }
- static struct txctl_frm_hdr frm_hdr;
- #ifndef HELIUMPLUS
- static void process_ieee_hdr(void *data)
- {
- uint8_t dir;
- struct ieee80211_frame *wh = (struct ieee80211_frame *)(data);
- frm_hdr.framectrl = *(uint16_t *) (wh->i_fc);
- frm_hdr.seqctrl = *(uint16_t *) (wh->i_seq);
- dir = (wh->i_fc[1] & IEEE80211_FC1_DIR_MASK);
- if (dir == IEEE80211_FC1_DIR_TODS) {
- frm_hdr.bssid_tail =
- (wh->i_addr1[QDF_MAC_ADDR_SIZE - 2] << 8) | (wh->
- i_addr1
- [QDF_MAC_ADDR_SIZE
- - 1]);
- frm_hdr.sa_tail =
- (wh->i_addr2[QDF_MAC_ADDR_SIZE - 2] << 8) | (wh->
- i_addr2
- [QDF_MAC_ADDR_SIZE
- - 1]);
- frm_hdr.da_tail =
- (wh->i_addr3[QDF_MAC_ADDR_SIZE - 2] << 8) | (wh->
- i_addr3
- [QDF_MAC_ADDR_SIZE
- - 1]);
- } else if (dir == IEEE80211_FC1_DIR_FROMDS) {
- frm_hdr.bssid_tail =
- (wh->i_addr2[QDF_MAC_ADDR_SIZE - 2] << 8) | (wh->
- i_addr2
- [QDF_MAC_ADDR_SIZE
- - 1]);
- frm_hdr.sa_tail =
- (wh->i_addr3[QDF_MAC_ADDR_SIZE - 2] << 8) | (wh->
- i_addr3
- [QDF_MAC_ADDR_SIZE
- - 1]);
- frm_hdr.da_tail =
- (wh->i_addr1[QDF_MAC_ADDR_SIZE - 2] << 8) | (wh->
- i_addr1
- [QDF_MAC_ADDR_SIZE
- - 1]);
- } else {
- frm_hdr.bssid_tail =
- (wh->i_addr3[QDF_MAC_ADDR_SIZE - 2] << 8) | (wh->
- i_addr3
- [QDF_MAC_ADDR_SIZE
- - 1]);
- frm_hdr.sa_tail =
- (wh->i_addr2[QDF_MAC_ADDR_SIZE - 2] << 8) | (wh->
- i_addr2
- [QDF_MAC_ADDR_SIZE
- - 1]);
- frm_hdr.da_tail =
- (wh->i_addr1[QDF_MAC_ADDR_SIZE - 2] << 8) | (wh->
- i_addr1
- [QDF_MAC_ADDR_SIZE
- - 1]);
- }
- }
- /**
- * fill_ieee80211_hdr_data() - fill ieee802.11 data header
- * @txrx_pdev: txrx pdev
- * @pl_msdu_info: msdu info
- * @data: data received from event
- *
- * Return: none
- */
- /* TODO: Platform specific function */
- static void
- fill_ieee80211_hdr_data(struct cdp_pdev *pdev,
- struct ath_pktlog_msdu_info *pl_msdu_info, void *data)
- {
- uint32_t i;
- uint32_t *htt_tx_desc;
- struct ol_tx_desc_t *tx_desc;
- uint8_t msdu_id_offset = MSDU_ID_INFO_ID_OFFSET;
- uint16_t tx_desc_id;
- uint32_t *msdu_id_info = (uint32_t *)
- ((void *)data + sizeof(struct ath_pktlog_hdr));
- uint32_t *msdu_id = (uint32_t *) ((char *)msdu_id_info +
- msdu_id_offset);
- uint8_t *addr, *vap_addr;
- uint8_t vdev_id;
- qdf_nbuf_t netbuf;
- uint32_t len;
- struct ol_txrx_pdev_t *txrx_pdev = (struct ol_txrx_pdev_t *)pdev;
- pl_msdu_info->num_msdu = *msdu_id_info;
- pl_msdu_info->priv_size = sizeof(uint32_t) *
- pl_msdu_info->num_msdu + sizeof(uint32_t);
- if (pl_msdu_info->num_msdu > MAX_PKT_INFO_MSDU_ID) {
- QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
- "%s: Invalid num_msdu count",
- __func__);
- qdf_assert(0);
- return;
- }
- for (i = 0; i < pl_msdu_info->num_msdu; i++) {
- /*
- * Handle big endianness
- * Increment msdu_id once after retrieving
- * lower 16 bits and uppper 16 bits
- */
- if (!(i % 2)) {
- tx_desc_id = ((*msdu_id & TX_DESC_ID_LOW_MASK)
- >> TX_DESC_ID_LOW_SHIFT);
- } else {
- tx_desc_id = ((*msdu_id & TX_DESC_ID_HIGH_MASK)
- >> TX_DESC_ID_HIGH_SHIFT);
- msdu_id += 1;
- }
- if (tx_desc_id >= txrx_pdev->tx_desc.pool_size) {
- QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG,
- "%s: drop due to invalid msdu id = %x",
- __func__, tx_desc_id);
- return;
- }
- tx_desc = ol_tx_desc_find(txrx_pdev, tx_desc_id);
- qdf_assert(tx_desc);
- netbuf = tx_desc->netbuf;
- htt_tx_desc = (uint32_t *) tx_desc->htt_tx_desc;
- qdf_assert(htt_tx_desc);
- qdf_nbuf_peek_header(netbuf, &addr, &len);
- if (len < (2 * QDF_MAC_ADDR_SIZE)) {
- qdf_print("TX frame does not have a valid address");
- return;
- }
- /* Adding header information for the TX data frames */
- vdev_id = (uint8_t) (*(htt_tx_desc +
- HTT_TX_VDEV_ID_WORD) >>
- HTT_TX_VDEV_ID_SHIFT) &
- HTT_TX_VDEV_ID_MASK;
- vap_addr = wma_get_vdev_address_by_vdev_id(vdev_id);
- frm_hdr.da_tail = (addr[QDF_MAC_ADDR_SIZE - 2] << 8) |
- (addr[QDF_MAC_ADDR_SIZE - 1]);
- frm_hdr.sa_tail =
- (addr[2 * QDF_MAC_ADDR_SIZE - 2] << 8) |
- (addr[2 * QDF_MAC_ADDR_SIZE - 1]);
- if (vap_addr) {
- frm_hdr.bssid_tail =
- (vap_addr[QDF_MAC_ADDR_SIZE - 2] << 8) |
- (vap_addr[QDF_MAC_ADDR_SIZE - 1]);
- } else {
- frm_hdr.bssid_tail = 0x0000;
- }
- pl_msdu_info->priv.msdu_len[i] = *(htt_tx_desc +
- HTT_TX_MSDU_LEN_DWORD)
- & HTT_TX_MSDU_LEN_MASK;
- /*
- * Add more information per MSDU
- * e.g., protocol information
- */
- }
- }
- #endif
- #ifdef HELIUMPLUS
- A_STATUS process_tx_info(struct cdp_pdev *txrx_pdev, void *data)
- {
- /*
- * Must include to process different types
- * TX_CTL, TX_STATUS, TX_MSDU_ID, TX_FRM_HDR
- */
- struct pktlog_dev_t *pl_dev = get_pktlog_handle();
- struct ath_pktlog_hdr pl_hdr;
- struct ath_pktlog_info *pl_info;
- uint32_t *pl_tgt_hdr;
- struct ol_fw_data *fw_data;
- uint32_t len;
- if (!txrx_pdev) {
- printk("Invalid pdev in %s\n", __func__);
- return A_ERROR;
- }
- if (!pl_dev) {
- qdf_nofl_err("Invalid pktlog handle in %s", __func__);
- qdf_assert(pl_dev);
- return A_ERROR;
- }
- qdf_assert(data);
- fw_data = (struct ol_fw_data *)data;
- len = fw_data->len;
- if (len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_FLAGS_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_MISSED_CNT_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_LOG_TYPE_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_MAC_ID_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_SIZE_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_TYPE_SPECIFIC_DATA_OFFSET + 1))) {
- qdf_print("Invalid msdu len in %s", __func__);
- qdf_assert(0);
- return A_ERROR;
- }
- pl_tgt_hdr = (uint32_t *)fw_data->data;
- /*
- * Makes the short words (16 bits) portable b/w little endian
- * and big endian
- */
- pl_hdr.flags = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_FLAGS_OFFSET) &
- ATH_PKTLOG_HDR_FLAGS_MASK) >>
- ATH_PKTLOG_HDR_FLAGS_SHIFT;
- pl_hdr.flags |= PKTLOG_HDR_SIZE_16;
- pl_hdr.missed_cnt = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_MISSED_CNT_OFFSET) &
- ATH_PKTLOG_HDR_MISSED_CNT_MASK) >>
- ATH_PKTLOG_HDR_MISSED_CNT_SHIFT;
- pl_hdr.log_type = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_LOG_TYPE_OFFSET) &
- ATH_PKTLOG_HDR_LOG_TYPE_MASK) >>
- ATH_PKTLOG_HDR_LOG_TYPE_SHIFT;
- pl_hdr.macId = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_MAC_ID_OFFSET) &
- ATH_PKTLOG_HDR_MAC_ID_MASK) >>
- ATH_PKTLOG_HDR_MAC_ID_SHIFT;
- pl_hdr.size = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_SIZE_OFFSET) &
- ATH_PKTLOG_HDR_SIZE_MASK) >> ATH_PKTLOG_HDR_SIZE_SHIFT;
- pl_hdr.timestamp = *(pl_tgt_hdr + ATH_PKTLOG_HDR_TIMESTAMP_OFFSET);
- pl_hdr.type_specific_data =
- *(pl_tgt_hdr + ATH_PKTLOG_HDR_TYPE_SPECIFIC_DATA_OFFSET);
- pl_info = pl_dev->pl_info;
- if (sizeof(struct ath_pktlog_hdr) + pl_hdr.size > len) {
- qdf_assert(0);
- return A_ERROR;
- }
- if (pl_hdr.log_type == PKTLOG_TYPE_TX_CTRL) {
- size_t log_size = sizeof(frm_hdr) + pl_hdr.size;
- void *txdesc_hdr_ctl = (void *)
- pktlog_getbuf(pl_dev, pl_info, log_size, &pl_hdr);
- qdf_assert(txdesc_hdr_ctl);
- qdf_assert(pl_hdr.size < (370 * sizeof(u_int32_t)));
- qdf_mem_copy(txdesc_hdr_ctl, &frm_hdr, sizeof(frm_hdr));
- qdf_mem_copy((char *)txdesc_hdr_ctl + sizeof(frm_hdr),
- ((void *)fw_data->data +
- sizeof(struct ath_pktlog_hdr)),
- pl_hdr.size);
- pl_hdr.size = log_size;
- cds_pkt_stats_to_logger_thread(&pl_hdr, NULL,
- txdesc_hdr_ctl);
- }
- if (pl_hdr.log_type == PKTLOG_TYPE_TX_STAT) {
- struct ath_pktlog_tx_status txstat_log;
- size_t log_size = pl_hdr.size;
- txstat_log.ds_status = (void *)
- pktlog_getbuf(pl_dev, pl_info,
- log_size, &pl_hdr);
- qdf_assert(txstat_log.ds_status);
- qdf_mem_copy(txstat_log.ds_status,
- ((void *)fw_data->data +
- sizeof(struct ath_pktlog_hdr)),
- pl_hdr.size);
- /* TODO: MCL specific API */
- cds_pkt_stats_to_logger_thread(&pl_hdr, NULL,
- txstat_log.ds_status);
- }
- return A_OK;
- }
- #else
- A_STATUS process_tx_info(struct cdp_pdev *txrx_pdev, void *data)
- {
- /*
- * Must include to process different types
- * TX_CTL, TX_STATUS, TX_MSDU_ID, TX_FRM_HDR
- */
- struct pktlog_dev_t *pl_dev = get_pktlog_handle();
- struct ath_pktlog_hdr pl_hdr;
- struct ath_pktlog_info *pl_info;
- uint32_t *pl_tgt_hdr;
- struct ol_fw_data *fw_data;
- uint32_t len;
- if (!txrx_pdev) {
- qdf_print("Invalid pdev in %s", __func__);
- return A_ERROR;
- }
- if (!pl_dev) {
- qdf_nofl_err("Invalid pktlog handle in %s", __func__);
- qdf_assert(pl_dev);
- return A_ERROR;
- }
- qdf_assert(data);
- fw_data = (struct ol_fw_data *)data;
- len = fw_data->len;
- if (len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_FLAGS_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_MISSED_CNT_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_LOG_TYPE_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_SIZE_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_TYPE_SPECIFIC_DATA_OFFSET + 1))) {
- qdf_print("Invalid msdu len in %s", __func__);
- qdf_assert(0);
- return A_ERROR;
- }
- pl_tgt_hdr = (uint32_t *)fw_data->data;
- /*
- * Makes the short words (16 bits) portable b/w little endian
- * and big endian
- */
- pl_hdr.flags = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_FLAGS_OFFSET) &
- ATH_PKTLOG_HDR_FLAGS_MASK) >>
- ATH_PKTLOG_HDR_FLAGS_SHIFT;
- pl_hdr.missed_cnt = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_MISSED_CNT_OFFSET) &
- ATH_PKTLOG_HDR_MISSED_CNT_MASK) >>
- ATH_PKTLOG_HDR_MISSED_CNT_SHIFT;
- pl_hdr.log_type = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_LOG_TYPE_OFFSET) &
- ATH_PKTLOG_HDR_LOG_TYPE_MASK) >>
- ATH_PKTLOG_HDR_LOG_TYPE_SHIFT;
- pl_hdr.size = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_SIZE_OFFSET) &
- ATH_PKTLOG_HDR_SIZE_MASK) >> ATH_PKTLOG_HDR_SIZE_SHIFT;
- pl_hdr.timestamp = *(pl_tgt_hdr + ATH_PKTLOG_HDR_TIMESTAMP_OFFSET);
- pktlog_hdr_set_specific_data(&pl_hdr,
- *(pl_tgt_hdr +
- ATH_PKTLOG_HDR_TYPE_SPECIFIC_DATA_OFFSET));
- pl_info = pl_dev->pl_info;
- if (pl_hdr.log_type == PKTLOG_TYPE_TX_FRM_HDR) {
- /* Valid only for the TX CTL */
- process_ieee_hdr(fw_data->data + sizeof(pl_hdr));
- }
- if (pl_hdr.log_type == PKTLOG_TYPE_TX_VIRT_ADDR) {
- uint32_t desc_id = (uint32_t) *((uint32_t *)(fw_data->data +
- sizeof(pl_hdr)));
- uint32_t vdev_id = desc_id;
- /* if the pkt log msg is for the bcn frame the vdev id
- * is piggybacked in desc_id and the MSB of the desc ID
- * would be set to FF
- */
- #define BCN_DESC_ID 0xFF
- if ((desc_id >> 24) == BCN_DESC_ID) {
- void *data;
- uint32_t buf_size;
- vdev_id &= 0x00FFFFFF;
- /* TODO: MCL specific API */
- data = wma_get_beacon_buffer_by_vdev_id(vdev_id,
- &buf_size);
- if (data) {
- /* TODO: platform specific API */
- process_ieee_hdr(data);
- qdf_mem_free(data);
- }
- } else {
- /*
- * TODO: get the hdr content for mgmt frames from
- * Tx mgmt desc pool
- */
- }
- }
- if (pl_hdr.log_type == PKTLOG_TYPE_TX_CTRL) {
- struct ath_pktlog_txctl txctl_log;
- size_t log_size = sizeof(txctl_log.priv);
- txctl_log.txdesc_hdr_ctl = (void *)pktlog_getbuf(pl_dev,
- pl_info,
- log_size,
- &pl_hdr);
- if (!txctl_log.txdesc_hdr_ctl) {
- printk
- ("failed to get buf for txctl_log.txdesc_hdr_ctl\n");
- return A_ERROR;
- }
- /*
- * frm hdr is currently Valid only for local frames
- * Add capability to include the fmr hdr for remote frames
- */
- txctl_log.priv.frm_hdr = frm_hdr;
- qdf_assert(txctl_log.priv.txdesc_ctl);
- qdf_assert(pl_hdr.size < sizeof(txctl_log.priv.txdesc_ctl));
- pl_hdr.size = (pl_hdr.size > sizeof(txctl_log.priv.txdesc_ctl))
- ? sizeof(txctl_log.priv.txdesc_ctl) :
- pl_hdr.size;
- if (sizeof(struct ath_pktlog_hdr) + pl_hdr.size > len) {
- qdf_assert(0);
- return A_ERROR;
- }
- qdf_mem_copy((void *)&txctl_log.priv.txdesc_ctl,
- ((void *)fw_data->data +
- sizeof(struct ath_pktlog_hdr)),
- pl_hdr.size);
- qdf_assert(txctl_log.txdesc_hdr_ctl);
- qdf_mem_copy(txctl_log.txdesc_hdr_ctl, &txctl_log.priv,
- sizeof(txctl_log.priv));
- pl_hdr.size = log_size;
- cds_pkt_stats_to_logger_thread(&pl_hdr, NULL,
- txctl_log.txdesc_hdr_ctl);
- /* Add Protocol information and HT specific information */
- }
- if (pl_hdr.log_type == PKTLOG_TYPE_TX_STAT) {
- struct ath_pktlog_tx_status txstat_log;
- size_t log_size = pl_hdr.size;
- txstat_log.ds_status = (void *)
- pktlog_getbuf(pl_dev, pl_info, log_size, &pl_hdr);
- qdf_assert(txstat_log.ds_status);
- qdf_mem_copy(txstat_log.ds_status,
- ((void *)fw_data->data +
- sizeof(struct ath_pktlog_hdr)),
- pl_hdr.size);
- cds_pkt_stats_to_logger_thread(&pl_hdr, NULL,
- txstat_log.ds_status);
- }
- if (pl_hdr.log_type == PKTLOG_TYPE_TX_MSDU_ID) {
- struct ath_pktlog_msdu_info pl_msdu_info;
- size_t log_size;
- qdf_mem_zero(&pl_msdu_info, sizeof(pl_msdu_info));
- log_size = sizeof(pl_msdu_info.priv);
- if (pl_dev->mt_pktlog_enabled == false)
- fill_ieee80211_hdr_data(txrx_pdev,
- &pl_msdu_info, fw_data->data);
- pl_msdu_info.ath_msdu_info = pktlog_getbuf(pl_dev, pl_info,
- log_size, &pl_hdr);
- qdf_mem_copy((void *)&pl_msdu_info.priv.msdu_id_info,
- ((void *)fw_data->data +
- sizeof(struct ath_pktlog_hdr)),
- sizeof(pl_msdu_info.priv.msdu_id_info));
- qdf_mem_copy(pl_msdu_info.ath_msdu_info, &pl_msdu_info.priv,
- sizeof(pl_msdu_info.priv));
- cds_pkt_stats_to_logger_thread(&pl_hdr, NULL,
- pl_msdu_info.ath_msdu_info);
- }
- return A_OK;
- }
- #endif
- /**
- * process_offload_pktlog() - Process full pktlog events
- * pdev: abstract pdev handle
- * data: pktlog buffer
- *
- * Return: zero on success, non-zero on failure
- */
- A_STATUS
- process_offload_pktlog(struct cdp_pdev *pdev, void *data)
- {
- struct pktlog_dev_t *pl_dev = get_pktlog_handle();
- struct ath_pktlog_info *pl_info;
- struct ath_pktlog_hdr pl_hdr;
- uint32_t *pl_tgt_hdr;
- void *txdesc_hdr_ctl = NULL;
- size_t log_size = 0;
- size_t tmp_log_size = 0;
- if (!pl_dev) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
- "Invalid context in %s\n", __func__);
- return A_ERROR;
- }
- if (!data) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
- "Invalid data in %s\n", __func__);
- return A_ERROR;
- }
- pl_tgt_hdr = (uint32_t *)data;
- pl_hdr.flags = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_FLAGS_OFFSET) &
- ATH_PKTLOG_HDR_FLAGS_MASK) >>
- ATH_PKTLOG_HDR_FLAGS_SHIFT;
- pl_hdr.missed_cnt = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_MISSED_CNT_OFFSET) &
- ATH_PKTLOG_HDR_MISSED_CNT_MASK) >>
- ATH_PKTLOG_HDR_MISSED_CNT_SHIFT;
- pl_hdr.log_type = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_LOG_TYPE_OFFSET) &
- ATH_PKTLOG_HDR_LOG_TYPE_MASK) >>
- ATH_PKTLOG_HDR_LOG_TYPE_SHIFT;
- pl_hdr.size = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_SIZE_OFFSET) &
- ATH_PKTLOG_HDR_SIZE_MASK) >> ATH_PKTLOG_HDR_SIZE_SHIFT;
- pl_hdr.timestamp = *(pl_tgt_hdr + ATH_PKTLOG_HDR_TIMESTAMP_OFFSET);
- pktlog_hdr_set_specific_data(&pl_hdr,
- *(pl_tgt_hdr +
- ATH_PKTLOG_HDR_TYPE_SPECIFIC_DATA_OFFSET));
- if (pl_hdr.size > MAX_PKTLOG_RECV_BUF_SIZE) {
- pl_dev->invalid_packets++;
- return A_ERROR;
- }
- /*
- * Must include to process different types
- * TX_CTL, TX_STATUS, TX_MSDU_ID, TX_FRM_HDR
- */
- pl_info = pl_dev->pl_info;
- tmp_log_size = sizeof(frm_hdr) + pl_hdr.size;
- log_size = pl_hdr.size;
- txdesc_hdr_ctl =
- (void *)pktlog_getbuf(pl_dev, pl_info, log_size, &pl_hdr);
- if (!txdesc_hdr_ctl) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
- "Failed to allocate pktlog descriptor");
- return A_NO_MEMORY;
- }
- qdf_assert(txdesc_hdr_ctl);
- qdf_assert(pl_hdr->size < PKTLOG_MAX_TX_WORDS * sizeof(u_int32_t));
- qdf_mem_copy(txdesc_hdr_ctl,
- ((void *)data + sizeof(struct ath_pktlog_hdr)),
- pl_hdr.size);
- cds_pkt_stats_to_logger_thread(&pl_hdr, NULL, txdesc_hdr_ctl);
- return A_OK;
- }
- /* TODO: hardware dependent function */
- A_STATUS process_rx_info_remote(void *pdev, void *data)
- {
- struct pktlog_dev_t *pl_dev = get_pktlog_handle();
- struct ath_pktlog_info *pl_info;
- struct htt_host_rx_desc_base *rx_desc;
- struct ath_pktlog_hdr pl_hdr;
- struct ath_pktlog_rx_info rxstat_log;
- size_t log_size;
- struct ol_rx_remote_data *r_data = (struct ol_rx_remote_data *)data;
- qdf_nbuf_t msdu;
- if (!pdev || !r_data || !pl_dev) {
- qdf_print("%s: Invalid handle", __func__);
- return A_ERROR;
- }
- pl_info = pl_dev->pl_info;
- msdu = r_data->msdu;
- while (msdu) {
- rx_desc =
- (struct htt_host_rx_desc_base *)(qdf_nbuf_data(msdu)) - 1;
- log_size =
- sizeof(*rx_desc) - sizeof(struct htt_host_fw_desc_base);
- /*
- * Construct the pktlog header pl_hdr
- * Because desc is DMA'd to the host memory
- */
- pl_hdr.flags = (1 << PKTLOG_FLG_FRM_TYPE_REMOTE_S);
- pl_hdr.missed_cnt = 0;
- #if defined(HELIUMPLUS)
- pl_hdr.macId = r_data->mac_id;
- pl_hdr.log_type = PKTLOG_TYPE_RX_STAT;
- pl_hdr.flags |= PKTLOG_HDR_SIZE_16;
- #else
- pl_hdr.log_type = PKTLOG_TYPE_RX_STAT;
- #endif
- pl_hdr.size = sizeof(*rx_desc) -
- sizeof(struct htt_host_fw_desc_base);
- #if defined(HELIUMPLUS)
- pl_hdr.timestamp =
- rx_desc->ppdu_end.rx_pkt_end.phy_timestamp_1_lower_32;
- pl_hdr.type_specific_data = 0xDEADAA;
- #else
- pl_hdr.timestamp = rx_desc->ppdu_end.tsf_timestamp;
- #endif /* !defined(HELIUMPLUS) */
- pktlog_hdr_set_specific_data(&pl_hdr, 0xDEADAA);
- rxstat_log.rx_desc = (void *)pktlog_getbuf(pl_dev, pl_info,
- log_size, &pl_hdr);
- qdf_mem_copy(rxstat_log.rx_desc, (void *)rx_desc +
- sizeof(struct htt_host_fw_desc_base), pl_hdr.size);
- cds_pkt_stats_to_logger_thread(&pl_hdr, NULL,
- rxstat_log.rx_desc);
- msdu = qdf_nbuf_next(msdu);
- }
- return A_OK;
- }
- #ifdef HELIUMPLUS
- A_STATUS process_rx_info(void *pdev, void *data)
- {
- struct pktlog_dev_t *pl_dev = get_pktlog_handle();
- struct ath_pktlog_info *pl_info;
- struct ath_pktlog_rx_info rxstat_log;
- struct ath_pktlog_hdr pl_hdr;
- size_t log_size;
- uint32_t *pl_tgt_hdr;
- struct ol_fw_data *fw_data;
- uint32_t len;
- if (!pdev) {
- printk("Invalid pdev in %s", __func__);
- return A_ERROR;
- }
- pl_dev = ((struct ol_txrx_pdev_t *)pdev)->pl_dev;
- if (!pl_dev) {
- printk("Invalid pl_dev in %s", __func__);
- return A_ERROR;
- }
- fw_data = (struct ol_fw_data *)data;
- len = fw_data->len;
- if (len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_FLAGS_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_MISSED_CNT_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_LOG_TYPE_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_MAC_ID_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_SIZE_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_TYPE_SPECIFIC_DATA_OFFSET + 1))) {
- qdf_print("Invalid msdu len in %s", __func__);
- qdf_assert(0);
- return A_ERROR;
- }
- pl_info = pl_dev->pl_info;
- pl_tgt_hdr = (uint32_t *)fw_data->data;
- qdf_mem_zero(&pl_hdr, sizeof(pl_hdr));
- pl_hdr.flags = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_FLAGS_OFFSET) &
- ATH_PKTLOG_HDR_FLAGS_MASK) >>
- ATH_PKTLOG_HDR_FLAGS_SHIFT;
- pl_hdr.missed_cnt = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_MISSED_CNT_OFFSET) &
- ATH_PKTLOG_HDR_MISSED_CNT_MASK) >>
- ATH_PKTLOG_HDR_MISSED_CNT_SHIFT;
- pl_hdr.log_type = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_LOG_TYPE_OFFSET) &
- ATH_PKTLOG_HDR_LOG_TYPE_MASK) >>
- ATH_PKTLOG_HDR_LOG_TYPE_SHIFT;
- pl_hdr.macId = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_MAC_ID_OFFSET) &
- ATH_PKTLOG_HDR_MAC_ID_MASK) >>
- ATH_PKTLOG_HDR_MAC_ID_SHIFT;
- pl_hdr.flags |= PKTLOG_HDR_SIZE_16;
- pl_hdr.size = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_SIZE_OFFSET) &
- ATH_PKTLOG_HDR_SIZE_MASK) >> ATH_PKTLOG_HDR_SIZE_SHIFT;
- pl_hdr.timestamp = *(pl_tgt_hdr + ATH_PKTLOG_HDR_TIMESTAMP_OFFSET);
- if (sizeof(struct ath_pktlog_hdr) + pl_hdr.size > len) {
- qdf_assert(0);
- return A_ERROR;
- }
- log_size = pl_hdr.size;
- rxstat_log.rx_desc = (void *)pktlog_getbuf(pl_dev, pl_info,
- log_size, &pl_hdr);
- qdf_mem_copy(rxstat_log.rx_desc,
- (void *)fw_data->data + sizeof(struct ath_pktlog_hdr),
- pl_hdr.size);
- cds_pkt_stats_to_logger_thread(&pl_hdr, NULL, rxstat_log.rx_desc);
- return A_OK;
- }
- #else
- A_STATUS process_rx_info(void *pdev, void *data)
- {
- struct pktlog_dev_t *pl_dev = get_pktlog_handle();
- struct ath_pktlog_info *pl_info;
- struct ath_pktlog_rx_info rxstat_log;
- struct ath_pktlog_hdr pl_hdr;
- size_t log_size;
- uint32_t *pl_tgt_hdr;
- struct ol_fw_data *fw_data;
- uint32_t len;
- if (!pdev) {
- printk("Invalid pdev in %s", __func__);
- return A_ERROR;
- }
- pl_dev = ((struct ol_txrx_pdev_t *)pdev)->pl_dev;
- if (!pl_dev) {
- printk("Invalid pl_dev in %s", __func__);
- return A_ERROR;
- }
- fw_data = (struct ol_fw_data *)data;
- len = fw_data->len;
- if (len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_FLAGS_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_MISSED_CNT_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_LOG_TYPE_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_SIZE_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_TYPE_SPECIFIC_DATA_OFFSET + 1))) {
- qdf_print("Invalid msdu len in %s", __func__);
- qdf_assert(0);
- return A_ERROR;
- }
- pl_info = pl_dev->pl_info;
- pl_tgt_hdr = (uint32_t *)fw_data->data;
- qdf_mem_zero(&pl_hdr, sizeof(pl_hdr));
- pl_hdr.flags = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_FLAGS_OFFSET) &
- ATH_PKTLOG_HDR_FLAGS_MASK) >>
- ATH_PKTLOG_HDR_FLAGS_SHIFT;
- pl_hdr.missed_cnt = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_MISSED_CNT_OFFSET) &
- ATH_PKTLOG_HDR_MISSED_CNT_MASK) >>
- ATH_PKTLOG_HDR_MISSED_CNT_SHIFT;
- pl_hdr.log_type = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_LOG_TYPE_OFFSET) &
- ATH_PKTLOG_HDR_LOG_TYPE_MASK) >>
- ATH_PKTLOG_HDR_LOG_TYPE_SHIFT;
- pl_hdr.size = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_SIZE_OFFSET) &
- ATH_PKTLOG_HDR_SIZE_MASK) >> ATH_PKTLOG_HDR_SIZE_SHIFT;
- pl_hdr.timestamp = *(pl_tgt_hdr + ATH_PKTLOG_HDR_TIMESTAMP_OFFSET);
- if (sizeof(struct ath_pktlog_hdr) + pl_hdr.size > len) {
- qdf_assert(0);
- return A_ERROR;
- }
- log_size = pl_hdr.size;
- rxstat_log.rx_desc = (void *)pktlog_getbuf(pl_dev, pl_info,
- log_size, &pl_hdr);
- qdf_mem_copy(rxstat_log.rx_desc,
- (void *)fw_data->data + sizeof(struct ath_pktlog_hdr),
- pl_hdr.size);
- cds_pkt_stats_to_logger_thread(&pl_hdr, NULL, rxstat_log.rx_desc);
- return A_OK;
- }
- #endif
- #ifdef HELIUMPLUS
- A_STATUS process_rate_find(void *pdev, void *data)
- {
- struct pktlog_dev_t *pl_dev = get_pktlog_handle();
- struct ath_pktlog_hdr pl_hdr;
- struct ath_pktlog_info *pl_info;
- size_t log_size;
- uint32_t len;
- struct ol_fw_data *fw_data;
- /*
- * Will be uncommented when the rate control find
- * for pktlog is implemented in the firmware.
- * Currently derived from the TX PPDU status
- */
- struct ath_pktlog_rc_find rcf_log;
- uint32_t *pl_tgt_hdr;
- if (!pdev || !data || !pl_dev) {
- qdf_print("%s: Invalid handle", __func__);
- return A_ERROR;
- }
- fw_data = (struct ol_fw_data *)data;
- len = fw_data->len;
- if (len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_FLAGS_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_MISSED_CNT_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_LOG_TYPE_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_MAC_ID_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_SIZE_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_TYPE_SPECIFIC_DATA_OFFSET + 1))) {
- qdf_print("Invalid msdu len in %s", __func__);
- qdf_assert(0);
- return A_ERROR;
- }
- pl_tgt_hdr = (uint32_t *)fw_data->data;
- /*
- * Makes the short words (16 bits) portable b/w little endian
- * and big endian
- */
- qdf_mem_zero(&pl_hdr, sizeof(pl_hdr));
- pl_hdr.flags = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_FLAGS_OFFSET) &
- ATH_PKTLOG_HDR_FLAGS_MASK) >>
- ATH_PKTLOG_HDR_FLAGS_SHIFT;
- pl_hdr.missed_cnt = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_MISSED_CNT_OFFSET) &
- ATH_PKTLOG_HDR_MISSED_CNT_MASK) >>
- ATH_PKTLOG_HDR_MISSED_CNT_SHIFT;
- pl_hdr.log_type = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_LOG_TYPE_OFFSET) &
- ATH_PKTLOG_HDR_LOG_TYPE_MASK) >>
- ATH_PKTLOG_HDR_LOG_TYPE_SHIFT;
- pl_hdr.macId = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_MAC_ID_OFFSET) &
- ATH_PKTLOG_HDR_MAC_ID_MASK) >>
- ATH_PKTLOG_HDR_MAC_ID_SHIFT;
- pl_hdr.flags |= PKTLOG_HDR_SIZE_16;
- pl_hdr.size = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_SIZE_OFFSET) &
- ATH_PKTLOG_HDR_SIZE_MASK) >> ATH_PKTLOG_HDR_SIZE_SHIFT;
- pl_hdr.timestamp = *(pl_tgt_hdr + ATH_PKTLOG_HDR_TIMESTAMP_OFFSET);
- pl_info = pl_dev->pl_info;
- log_size = pl_hdr.size;
- rcf_log.rcFind = (void *)pktlog_getbuf(pl_dev, pl_info,
- log_size, &pl_hdr);
- if (sizeof(struct ath_pktlog_hdr) + pl_hdr.size > len) {
- qdf_assert(0);
- return A_ERROR;
- }
- qdf_mem_copy(rcf_log.rcFind,
- ((char *)fw_data->data + sizeof(struct ath_pktlog_hdr)),
- pl_hdr.size);
- cds_pkt_stats_to_logger_thread(&pl_hdr, NULL, rcf_log.rcFind);
- return A_OK;
- }
- #else
- A_STATUS process_rate_find(void *pdev, void *data)
- {
- struct pktlog_dev_t *pl_dev = get_pktlog_handle();
- struct ath_pktlog_hdr pl_hdr;
- struct ath_pktlog_info *pl_info;
- size_t log_size;
- uint32_t len;
- struct ol_fw_data *fw_data;
- /*
- * Will be uncommented when the rate control find
- * for pktlog is implemented in the firmware.
- * Currently derived from the TX PPDU status
- */
- struct ath_pktlog_rc_find rcf_log;
- uint32_t *pl_tgt_hdr;
- if (!pdev || !data || !pl_dev) {
- qdf_print("%s: Invalid handle", __func__);
- return A_ERROR;
- }
- fw_data = (struct ol_fw_data *)data;
- len = fw_data->len;
- if (len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_FLAGS_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_MISSED_CNT_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_LOG_TYPE_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_SIZE_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_TYPE_SPECIFIC_DATA_OFFSET + 1))) {
- qdf_print("Invalid msdu len in %s", __func__);
- qdf_assert(0);
- return A_ERROR;
- }
- pl_tgt_hdr = (uint32_t *)fw_data->data;
- /*
- * Makes the short words (16 bits) portable b/w little endian
- * and big endian
- */
- qdf_mem_zero(&pl_hdr, sizeof(pl_hdr));
- pl_hdr.flags = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_FLAGS_OFFSET) &
- ATH_PKTLOG_HDR_FLAGS_MASK) >>
- ATH_PKTLOG_HDR_FLAGS_SHIFT;
- pl_hdr.missed_cnt = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_MISSED_CNT_OFFSET) &
- ATH_PKTLOG_HDR_MISSED_CNT_MASK) >>
- ATH_PKTLOG_HDR_MISSED_CNT_SHIFT;
- pl_hdr.log_type = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_LOG_TYPE_OFFSET) &
- ATH_PKTLOG_HDR_LOG_TYPE_MASK) >>
- ATH_PKTLOG_HDR_LOG_TYPE_SHIFT;
- pl_hdr.size = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_SIZE_OFFSET) &
- ATH_PKTLOG_HDR_SIZE_MASK) >> ATH_PKTLOG_HDR_SIZE_SHIFT;
- pl_hdr.timestamp = *(pl_tgt_hdr + ATH_PKTLOG_HDR_TIMESTAMP_OFFSET);
- pl_info = pl_dev->pl_info;
- log_size = pl_hdr.size;
- rcf_log.rcFind = (void *)pktlog_getbuf(pl_dev, pl_info,
- log_size, &pl_hdr);
- if (sizeof(struct ath_pktlog_hdr) + pl_hdr.size > len) {
- qdf_assert(0);
- return A_ERROR;
- }
- qdf_mem_copy(rcf_log.rcFind,
- ((char *)fw_data->data + sizeof(struct ath_pktlog_hdr)),
- pl_hdr.size);
- cds_pkt_stats_to_logger_thread(&pl_hdr, NULL, rcf_log.rcFind);
- return A_OK;
- }
- #endif
- #ifdef HELIUMPLUS
- A_STATUS process_sw_event(void *pdev, void *data)
- {
- struct pktlog_dev_t *pl_dev = get_pktlog_handle();
- struct ath_pktlog_hdr pl_hdr;
- struct ath_pktlog_info *pl_info;
- size_t log_size;
- uint32_t len;
- struct ol_fw_data *fw_data;
- /*
- * Will be uncommented when the rate control find
- * for pktlog is implemented in the firmware.
- * Currently derived from the TX PPDU status
- */
- struct ath_pktlog_sw_event sw_event;
- uint32_t *pl_tgt_hdr;
- if (!pdev) {
- qdf_print("Invalid pdev in %s", __func__);
- return A_ERROR;
- }
- if (!data) {
- qdf_print("Invalid data in %s", __func__);
- return A_ERROR;
- }
- if (!pl_dev) {
- qdf_print("Invalid pl_dev in %s", __func__);
- return A_ERROR;
- }
- fw_data = (struct ol_fw_data *)data;
- len = fw_data->len;
- if (len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_FLAGS_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_MISSED_CNT_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_LOG_TYPE_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_MAC_ID_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_SIZE_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_TYPE_SPECIFIC_DATA_OFFSET + 1))) {
- qdf_print("Invalid msdu len in %s", __func__);
- qdf_assert(0);
- return A_ERROR;
- }
- pl_tgt_hdr = (uint32_t *)fw_data->data;
- /*
- * Makes the short words (16 bits) portable b/w little endian
- * and big endian
- */
- pl_hdr.flags = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_FLAGS_OFFSET) &
- ATH_PKTLOG_HDR_FLAGS_MASK) >>
- ATH_PKTLOG_HDR_FLAGS_SHIFT;
- pl_hdr.missed_cnt = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_MISSED_CNT_OFFSET) &
- ATH_PKTLOG_HDR_MISSED_CNT_MASK) >>
- ATH_PKTLOG_HDR_MISSED_CNT_SHIFT;
- pl_hdr.log_type = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_LOG_TYPE_OFFSET) &
- ATH_PKTLOG_HDR_LOG_TYPE_MASK) >>
- ATH_PKTLOG_HDR_LOG_TYPE_SHIFT;
- pl_hdr.macId = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_MAC_ID_OFFSET) &
- ATH_PKTLOG_HDR_MAC_ID_MASK) >>
- ATH_PKTLOG_HDR_MAC_ID_SHIFT;
- pl_hdr.size = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_SIZE_OFFSET) &
- ATH_PKTLOG_HDR_SIZE_MASK) >> ATH_PKTLOG_HDR_SIZE_SHIFT;
- pl_hdr.timestamp = *(pl_tgt_hdr + ATH_PKTLOG_HDR_TIMESTAMP_OFFSET);
- pl_hdr.type_specific_data =
- *(pl_tgt_hdr + ATH_PKTLOG_HDR_TYPE_SPECIFIC_DATA_OFFSET);
- pl_info = pl_dev->pl_info;
- log_size = pl_hdr.size;
- sw_event.sw_event = (void *)pktlog_getbuf(pl_dev, pl_info,
- log_size, &pl_hdr);
- if (sizeof(struct ath_pktlog_hdr) + pl_hdr.size > len) {
- qdf_assert(0);
- return A_ERROR;
- }
- qdf_mem_copy(sw_event.sw_event,
- ((char *)fw_data->data + sizeof(struct ath_pktlog_hdr)),
- pl_hdr.size);
- cds_pkt_stats_to_logger_thread(&pl_hdr, NULL, sw_event.sw_event);
- return A_OK;
- }
- #else
- A_STATUS process_sw_event(void *pdev, void *data)
- {
- struct pktlog_dev_t *pl_dev = get_pktlog_handle();
- struct ath_pktlog_hdr pl_hdr;
- struct ath_pktlog_info *pl_info;
- size_t log_size;
- uint32_t len;
- struct ol_fw_data *fw_data;
- /*
- * Will be uncommented when the rate control find
- * for pktlog is implemented in the firmware.
- * Currently derived from the TX PPDU status
- */
- struct ath_pktlog_sw_event sw_event;
- uint32_t *pl_tgt_hdr;
- if (!pdev) {
- qdf_print("Invalid pdev in %s", __func__);
- return A_ERROR;
- }
- if (!data) {
- qdf_print("Invalid data in %s", __func__);
- return A_ERROR;
- }
- if (!pl_dev) {
- qdf_print("Invalid pl_dev in %s", __func__);
- return A_ERROR;
- }
- fw_data = (struct ol_fw_data *)data;
- len = fw_data->len;
- if (len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_FLAGS_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_MISSED_CNT_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_LOG_TYPE_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_SIZE_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_TYPE_SPECIFIC_DATA_OFFSET + 1))) {
- qdf_print("Invalid msdu len in %s", __func__);
- qdf_assert(0);
- return A_ERROR;
- }
- pl_tgt_hdr = (uint32_t *)fw_data->data;
- /*
- * Makes the short words (16 bits) portable b/w little endian
- * and big endian
- */
- pl_hdr.flags = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_FLAGS_OFFSET) &
- ATH_PKTLOG_HDR_FLAGS_MASK) >>
- ATH_PKTLOG_HDR_FLAGS_SHIFT;
- pl_hdr.missed_cnt = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_MISSED_CNT_OFFSET) &
- ATH_PKTLOG_HDR_MISSED_CNT_MASK) >>
- ATH_PKTLOG_HDR_MISSED_CNT_SHIFT;
- pl_hdr.log_type = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_LOG_TYPE_OFFSET) &
- ATH_PKTLOG_HDR_LOG_TYPE_MASK) >>
- ATH_PKTLOG_HDR_LOG_TYPE_SHIFT;
- pl_hdr.size = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_SIZE_OFFSET) &
- ATH_PKTLOG_HDR_SIZE_MASK) >> ATH_PKTLOG_HDR_SIZE_SHIFT;
- pl_hdr.timestamp = *(pl_tgt_hdr + ATH_PKTLOG_HDR_TIMESTAMP_OFFSET);
- pktlog_hdr_set_specific_data(&pl_hdr,
- *(pl_tgt_hdr +
- ATH_PKTLOG_HDR_TYPE_SPECIFIC_DATA_OFFSET));
- pl_info = pl_dev->pl_info;
- log_size = pl_hdr.size;
- sw_event.sw_event = (void *)pktlog_getbuf(pl_dev, pl_info,
- log_size, &pl_hdr);
- if (sizeof(struct ath_pktlog_hdr) + pl_hdr.size > len) {
- qdf_assert(0);
- return A_ERROR;
- }
- qdf_mem_copy(sw_event.sw_event,
- ((char *)fw_data->data + sizeof(struct ath_pktlog_hdr)),
- pl_hdr.size);
- cds_pkt_stats_to_logger_thread(&pl_hdr, NULL, sw_event.sw_event);
- return A_OK;
- }
- #endif
- #ifdef HELIUMPLUS
- A_STATUS process_rate_update(void *pdev, void *data)
- {
- struct pktlog_dev_t *pl_dev = get_pktlog_handle();
- struct ath_pktlog_hdr pl_hdr;
- size_t log_size;
- struct ath_pktlog_info *pl_info;
- struct ath_pktlog_rc_update rcu_log;
- uint32_t *pl_tgt_hdr;
- struct ol_fw_data *fw_data;
- uint32_t len;
- if (!pdev || !data || !pl_dev) {
- qdf_print("%s: Invalid handle", __func__);
- return A_ERROR;
- }
- fw_data = (struct ol_fw_data *)data;
- len = fw_data->len;
- if (len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_FLAGS_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_MISSED_CNT_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_LOG_TYPE_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_MAC_ID_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_SIZE_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_TYPE_SPECIFIC_DATA_OFFSET + 1))) {
- qdf_print("Invalid msdu len in %s", __func__);
- qdf_assert(0);
- return A_ERROR;
- }
- pl_tgt_hdr = (uint32_t *)fw_data->data;
- /*
- * Makes the short words (16 bits) portable b/w little endian
- * and big endian
- */
- qdf_mem_zero(&pl_hdr, sizeof(pl_hdr));
- pl_hdr.flags = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_FLAGS_OFFSET) &
- ATH_PKTLOG_HDR_FLAGS_MASK) >>
- ATH_PKTLOG_HDR_FLAGS_SHIFT;
- pl_hdr.missed_cnt = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_MISSED_CNT_OFFSET) &
- ATH_PKTLOG_HDR_MISSED_CNT_MASK) >>
- ATH_PKTLOG_HDR_MISSED_CNT_SHIFT;
- pl_hdr.log_type = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_LOG_TYPE_OFFSET) &
- ATH_PKTLOG_HDR_LOG_TYPE_MASK) >>
- ATH_PKTLOG_HDR_LOG_TYPE_SHIFT;
- pl_hdr.macId = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_MAC_ID_OFFSET) &
- ATH_PKTLOG_HDR_MAC_ID_MASK) >>
- ATH_PKTLOG_HDR_MAC_ID_SHIFT;
- pl_hdr.flags |= PKTLOG_HDR_SIZE_16;
- pl_hdr.size = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_SIZE_OFFSET) &
- ATH_PKTLOG_HDR_SIZE_MASK) >> ATH_PKTLOG_HDR_SIZE_SHIFT;
- pl_hdr.timestamp = *(pl_tgt_hdr + ATH_PKTLOG_HDR_TIMESTAMP_OFFSET);
- log_size = pl_hdr.size;
- pl_info = pl_dev->pl_info;
- /*
- * Will be uncommented when the rate control update
- * for pktlog is implemented in the firmware.
- * Currently derived from the TX PPDU status
- */
- rcu_log.txRateCtrl = (void *)pktlog_getbuf(pl_dev, pl_info,
- log_size, &pl_hdr);
- if (sizeof(struct ath_pktlog_hdr) + pl_hdr.size > len) {
- qdf_assert(0);
- return A_ERROR;
- }
- qdf_mem_copy(rcu_log.txRateCtrl,
- ((char *)fw_data->data +
- sizeof(struct ath_pktlog_hdr)),
- pl_hdr.size);
- cds_pkt_stats_to_logger_thread(&pl_hdr, NULL, rcu_log.txRateCtrl);
- return A_OK;
- }
- #else
- A_STATUS process_rate_update(void *pdev, void *data)
- {
- struct pktlog_dev_t *pl_dev = get_pktlog_handle();
- struct ath_pktlog_hdr pl_hdr;
- size_t log_size;
- struct ath_pktlog_info *pl_info;
- struct ath_pktlog_rc_update rcu_log;
- uint32_t *pl_tgt_hdr;
- struct ol_fw_data *fw_data;
- uint32_t len;
- if (!pdev || !data || !pl_dev) {
- qdf_print("%s: Invalid handle", __func__);
- return A_ERROR;
- }
- fw_data = (struct ol_fw_data *)data;
- len = fw_data->len;
- if (len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_FLAGS_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_MISSED_CNT_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_LOG_TYPE_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_SIZE_OFFSET + 1)) ||
- len < (sizeof(uint32_t) *
- (ATH_PKTLOG_HDR_TYPE_SPECIFIC_DATA_OFFSET + 1))) {
- qdf_print("Invalid msdu len in %s", __func__);
- qdf_assert(0);
- return A_ERROR;
- }
- pl_tgt_hdr = (uint32_t *)fw_data->data;
- /*
- * Makes the short words (16 bits) portable b/w little endian
- * and big endian
- */
- qdf_mem_zero(&pl_hdr, sizeof(pl_hdr));
- pl_hdr.flags = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_FLAGS_OFFSET) &
- ATH_PKTLOG_HDR_FLAGS_MASK) >>
- ATH_PKTLOG_HDR_FLAGS_SHIFT;
- pl_hdr.missed_cnt = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_MISSED_CNT_OFFSET) &
- ATH_PKTLOG_HDR_MISSED_CNT_MASK) >>
- ATH_PKTLOG_HDR_MISSED_CNT_SHIFT;
- pl_hdr.log_type = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_LOG_TYPE_OFFSET) &
- ATH_PKTLOG_HDR_LOG_TYPE_MASK) >>
- ATH_PKTLOG_HDR_LOG_TYPE_SHIFT;
- pl_hdr.size = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_SIZE_OFFSET) &
- ATH_PKTLOG_HDR_SIZE_MASK) >> ATH_PKTLOG_HDR_SIZE_SHIFT;
- pl_hdr.timestamp = *(pl_tgt_hdr + ATH_PKTLOG_HDR_TIMESTAMP_OFFSET);
- log_size = pl_hdr.size;
- pl_info = pl_dev->pl_info;
- /*
- * Will be uncommented when the rate control update
- * for pktlog is implemented in the firmware.
- * Currently derived from the TX PPDU status
- */
- rcu_log.txRateCtrl = (void *)pktlog_getbuf(pl_dev, pl_info,
- log_size, &pl_hdr);
- if (sizeof(struct ath_pktlog_hdr) + pl_hdr.size > len) {
- qdf_assert(0);
- return A_ERROR;
- }
- qdf_mem_copy(rcu_log.txRateCtrl,
- ((char *)fw_data->data +
- sizeof(struct ath_pktlog_hdr)),
- pl_hdr.size);
- cds_pkt_stats_to_logger_thread(&pl_hdr, NULL, rcu_log.txRateCtrl);
- return A_OK;
- }
- #endif
- #if defined(QCA_WIFI_QCA6290) || defined(QCA_WIFI_QCA6390) || \
- defined(QCA_WIFI_QCA6490)
- int process_rx_desc_remote(void *pdev, void *data)
- {
- struct pktlog_dev_t *pl_dev = get_pktlog_handle();
- struct ath_pktlog_hdr pl_hdr;
- struct ath_pktlog_rx_info rxstat_log;
- size_t log_size;
- struct ath_pktlog_info *pl_info;
- qdf_nbuf_t log_nbuf = (qdf_nbuf_t)data;
- if (!pl_dev) {
- qdf_err("Pktlog handle is NULL");
- return -EINVAL;
- }
- pl_info = pl_dev->pl_info;
- qdf_mem_zero(&pl_hdr, sizeof(pl_hdr));
- pl_hdr.flags = (1 << PKTLOG_FLG_FRM_TYPE_REMOTE_S);
- pl_hdr.missed_cnt = 0;
- pl_hdr.log_type = PKTLOG_TYPE_RX_STATBUF;
- pl_hdr.size = qdf_nbuf_len(log_nbuf);
- pl_hdr.timestamp = 0;
- log_size = pl_hdr.size;
- rxstat_log.rx_desc = (void *)pktlog_getbuf(pl_dev, pl_info,
- log_size, &pl_hdr);
- if (!rxstat_log.rx_desc) {
- QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_DEBUG,
- "%s: Rx descriptor is NULL", __func__);
- return -EINVAL;
- }
- qdf_mem_copy(rxstat_log.rx_desc, qdf_nbuf_data(log_nbuf), pl_hdr.size);
- cds_pkt_stats_to_logger_thread(&pl_hdr, NULL,
- rxstat_log.rx_desc);
- return 0;
- }
- int
- process_pktlog_lite(void *context, void *log_data, uint16_t log_type)
- {
- struct pktlog_dev_t *pl_dev = get_pktlog_handle();
- struct ath_pktlog_info *pl_info;
- struct ath_pktlog_hdr pl_hdr;
- struct ath_pktlog_rx_info rxstat_log;
- size_t log_size;
- qdf_nbuf_t log_nbuf = (qdf_nbuf_t)log_data;
- if (!pl_dev) {
- qdf_err("Pktlog handle is NULL");
- return -EINVAL;
- }
- pl_info = pl_dev->pl_info;
- qdf_mem_zero(&pl_hdr, sizeof(pl_hdr));
- pl_hdr.flags = (1 << PKTLOG_FLG_FRM_TYPE_REMOTE_S);
- pl_hdr.missed_cnt = 0;
- pl_hdr.log_type = log_type;
- pl_hdr.size = qdf_nbuf_len(log_nbuf);
- pl_hdr.timestamp = 0;
- log_size = pl_hdr.size;
- rxstat_log.rx_desc = (void *)pktlog_getbuf(pl_dev, pl_info,
- log_size, &pl_hdr);
- if (!rxstat_log.rx_desc) {
- QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_DEBUG,
- "%s: Rx descriptor is NULL", __func__);
- return -EINVAL;
- }
- qdf_mem_copy(rxstat_log.rx_desc, qdf_nbuf_data(log_nbuf), pl_hdr.size);
- cds_pkt_stats_to_logger_thread(&pl_hdr, NULL, rxstat_log.rx_desc);
- return 0;
- }
- #else
- int process_rx_desc_remote(void *pdev, void *data)
- {
- return 0;
- }
- int
- process_pktlog_lite(void *context, void *log_data, uint16_t log_type)
- {
- return 0;
- }
- #endif
- #endif /*REMOVE_PKT_LOG */
|