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