1*5113495bSYour Name /* 2*5113495bSYour Name * Copyright (c) 2012-2014, 2016-2018, 2020 The Linux Foundation. 3*5113495bSYour Name * All rights reserved. 4*5113495bSYour Name * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. 5*5113495bSYour Name * 6*5113495bSYour Name * Permission to use, copy, modify, and/or distribute this software for 7*5113495bSYour Name * any purpose with or without fee is hereby granted, provided that the 8*5113495bSYour Name * above copyright notice and this permission notice appear in all 9*5113495bSYour Name * copies. 10*5113495bSYour Name * 11*5113495bSYour Name * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 12*5113495bSYour Name * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 13*5113495bSYour Name * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 14*5113495bSYour Name * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 15*5113495bSYour Name * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 16*5113495bSYour Name * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 17*5113495bSYour Name * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 18*5113495bSYour Name * PERFORMANCE OF THIS SOFTWARE. 19*5113495bSYour Name */ 20*5113495bSYour Name 21*5113495bSYour Name /* 22*5113495bSYour Name * The file is used to define structures that are shared between 23*5113495bSYour Name * kernel space and user space pktlog application. 24*5113495bSYour Name */ 25*5113495bSYour Name 26*5113495bSYour Name #ifndef _PKTLOG_AC_API_ 27*5113495bSYour Name #define _PKTLOG_AC_API_ 28*5113495bSYour Name #if defined(CONNECTIVITY_PKTLOG) || !defined(REMOVE_PKT_LOG) 29*5113495bSYour Name 30*5113495bSYour Name struct hif_opaque_softc; 31*5113495bSYour Name /** 32*5113495bSYour Name * typedef hif_opaque_softc_handle - opaque handle for hif_opaque_softc 33*5113495bSYour Name */ 34*5113495bSYour Name typedef struct hif_opaque_softc * hif_opaque_softc_handle; 35*5113495bSYour Name 36*5113495bSYour Name enum pktlog_callback_regtype { 37*5113495bSYour Name PKTLOG_DEFAULT_CALLBACK_REGISTRATION, 38*5113495bSYour Name PKTLOG_LITE_CALLBACK_REGISTRATION 39*5113495bSYour Name }; 40*5113495bSYour Name 41*5113495bSYour Name struct net_device; 42*5113495bSYour Name /** 43*5113495bSYour Name * typedef net_device_handle - opaque handle to linux net device object 44*5113495bSYour Name */ 45*5113495bSYour Name typedef struct net_device * net_device_handle; 46*5113495bSYour Name 47*5113495bSYour Name struct pktlog_dev_t; 48*5113495bSYour Name 49*5113495bSYour Name void pktlog_sethandle(struct pktlog_dev_t **pl_handle, 50*5113495bSYour Name hif_opaque_softc_handle scn); 51*5113495bSYour Name void pktlog_set_pdev_id(struct pktlog_dev_t *pl_dev, uint8_t pdev_id); 52*5113495bSYour Name 53*5113495bSYour Name void *get_txrx_context(void); 54*5113495bSYour Name 55*5113495bSYour Name struct pktlog_dev_t *get_pktlog_handle(void); 56*5113495bSYour Name void pktlog_set_callback_regtype(enum pktlog_callback_regtype callback_type); 57*5113495bSYour Name 58*5113495bSYour Name /* Packet log state information */ 59*5113495bSYour Name #ifndef _PKTLOG_INFO 60*5113495bSYour Name #define _PKTLOG_INFO 61*5113495bSYour Name 62*5113495bSYour Name /** 63*5113495bSYour Name * enum ath_pktlog_state - pktlog status 64*5113495bSYour Name * @PKTLOG_OPR_IN_PROGRESS : pktlog command in progress 65*5113495bSYour Name * @PKTLOG_OPR_IN_PROGRESS_READ_START: pktlog read is issued 66*5113495bSYour Name * @PKTLOG_OPR_IN_PROGRESS_READ_START_PKTLOG_DISABLED: 67*5113495bSYour Name * as part of pktlog read, pktlog is disabled 68*5113495bSYour Name * @PKTLOG_OPR_IN_PROGRESS_READ_COMPLETE: 69*5113495bSYour Name * as part of read, till pktlog read is complete 70*5113495bSYour Name * @PKTLOG_OPR_IN_PROGRESS_CLEARBUFF_COMPLETE: 71*5113495bSYour Name * as part of read, pktlog clear buffer is done 72*5113495bSYour Name * @PKTLOG_OPR_NOT_IN_PROGRESS: no pktlog command in progress 73*5113495bSYour Name */ 74*5113495bSYour Name enum ath_pktlog_state { 75*5113495bSYour Name PKTLOG_OPR_IN_PROGRESS = 0, 76*5113495bSYour Name PKTLOG_OPR_IN_PROGRESS_READ_START, 77*5113495bSYour Name PKTLOG_OPR_IN_PROGRESS_READ_START_PKTLOG_DISABLED, 78*5113495bSYour Name PKTLOG_OPR_IN_PROGRESS_READ_COMPLETE, 79*5113495bSYour Name PKTLOG_OPR_IN_PROGRESS_CLEARBUFF_COMPLETE, 80*5113495bSYour Name PKTLOG_OPR_NOT_IN_PROGRESS 81*5113495bSYour Name }; 82*5113495bSYour Name 83*5113495bSYour Name struct ath_pktlog_info { 84*5113495bSYour Name struct ath_pktlog_buf *buf; 85*5113495bSYour Name uint32_t log_state; 86*5113495bSYour Name uint32_t saved_state; 87*5113495bSYour Name uint32_t options; 88*5113495bSYour Name /* Initial saved state: It will save the log state in pktlog 89*5113495bSYour Name * open and used in pktlog release after 90*5113495bSYour Name * pktlog read is complete. 91*5113495bSYour Name */ 92*5113495bSYour Name uint32_t init_saved_state; 93*5113495bSYour Name enum ath_pktlog_state curr_pkt_state; 94*5113495bSYour Name 95*5113495bSYour Name /* Size of buffer in bytes */ 96*5113495bSYour Name int32_t buf_size; 97*5113495bSYour Name qdf_spinlock_t log_lock; 98*5113495bSYour Name struct mutex pktlog_mutex; 99*5113495bSYour Name 100*5113495bSYour Name /* Threshold of TCP SACK packets for triggered stop */ 101*5113495bSYour Name int sack_thr; 102*5113495bSYour Name 103*5113495bSYour Name /* # of tail packets to log after triggered stop */ 104*5113495bSYour Name int tail_length; 105*5113495bSYour Name 106*5113495bSYour Name /* throuput threshold in bytes for triggered stop */ 107*5113495bSYour Name uint32_t thruput_thresh; 108*5113495bSYour Name 109*5113495bSYour Name /* (aggregated or single) packet size in bytes */ 110*5113495bSYour Name uint32_t pktlen; 111*5113495bSYour Name 112*5113495bSYour Name /* a temporary variable for counting TX throughput only */ 113*5113495bSYour Name /* PER threshold for triggered stop, 10 for 10%, range [1, 99] */ 114*5113495bSYour Name uint32_t per_thresh; 115*5113495bSYour Name 116*5113495bSYour Name /* Phyerr threshold for triggered stop */ 117*5113495bSYour Name uint32_t phyerr_thresh; 118*5113495bSYour Name 119*5113495bSYour Name /* time period for counting trigger parameters, in millisecond */ 120*5113495bSYour Name uint32_t trigger_interval; 121*5113495bSYour Name uint32_t start_time_thruput; 122*5113495bSYour Name uint32_t start_time_per; 123*5113495bSYour Name }; 124*5113495bSYour Name #endif /* _PKTLOG_INFO */ 125*5113495bSYour Name #else /* REMOVE_PKT_LOG */ 126*5113495bSYour Name typedef void *pktlog_dev_handle; 127*5113495bSYour Name #define pktlog_set_pdev_id(pl_dev, pdev_id) \ 128*5113495bSYour Name do { \ 129*5113495bSYour Name (void)pl_dev; \ 130*5113495bSYour Name (void)pdev_id; \ 131*5113495bSYour Name } while (0) 132*5113495bSYour Name 133*5113495bSYour Name #define pktlog_sethandle(pl_handle, scn) \ 134*5113495bSYour Name do { \ 135*5113495bSYour Name (void)pl_handle; \ 136*5113495bSYour Name (void)scn; \ 137*5113495bSYour Name } while (0) 138*5113495bSYour Name 139*5113495bSYour Name #define ol_pl_set_name(dev) \ 140*5113495bSYour Name do { \ 141*5113495bSYour Name (void)scn; \ 142*5113495bSYour Name (void)dev; \ 143*5113495bSYour Name } while (0) 144*5113495bSYour Name 145*5113495bSYour Name #endif /* REMOVE_PKT_LOG */ 146*5113495bSYour Name #endif /* _PKTLOG_AC_API_ */ 147