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