1 /* 2 * Copyright (c) 2020-2021 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. 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 #ifndef _WLAN_PKT_CAPTURE_PUBLIC_STRUCTS_H_ 21 #define _WLAN_PKT_CAPTURE_PUBLIC_STRUCTS_H_ 22 23 #define PACKET_CAPTURE_DATA_MAX_FILTER BIT(18) 24 #define PACKET_CAPTURE_MGMT_MAX_FILTER BIT(5) 25 #define PACKET_CAPTURE_CTRL_MAX_FILTER BIT(3) 26 27 /** 28 * enum pkt_capture_mode - packet capture modes 29 * @PACKET_CAPTURE_MODE_DISABLE: packet capture mode disable 30 * @PACKET_CAPTURE_MODE_MGMT_ONLY: capture mgmt packets only 31 * @PACKET_CAPTURE_MODE_DATA_ONLY: capture data packets only 32 */ 33 enum pkt_capture_mode { 34 PACKET_CAPTURE_MODE_DISABLE = 0, 35 PACKET_CAPTURE_MODE_MGMT_ONLY = BIT(0), 36 PACKET_CAPTURE_MODE_DATA_ONLY = BIT(1), 37 }; 38 39 /** 40 * enum pkt_capture_config - packet capture config 41 * @PACKET_CAPTURE_CONFIG_TRIGGER_ENABLE: enable capture for trigger frames only 42 * @PACKET_CAPTURE_CONFIG_QOS_ENABLE: enable capture for qos frames only 43 * @PACKET_CAPTURE_CONFIG_BEACON_ENABLE: enable only connected BSSID 44 * beacons, when device in connected state 45 * @PACKET_CAPTURE_CONFIG_OFF_CHANNEL_BEACON_ENABLE: enable off channel 46 * beacons, when device in connected state 47 * @PACKET_CAPTURE_CONFIG_NO_BEACON_ENABLE: drop all beacons, when 48 * device in connected state 49 */ 50 enum pkt_capture_config { 51 PACKET_CAPTURE_CONFIG_TRIGGER_ENABLE = BIT(0), 52 PACKET_CAPTURE_CONFIG_QOS_ENABLE = BIT(1), 53 PACKET_CAPTURE_CONFIG_BEACON_ENABLE = BIT(2), 54 PACKET_CAPTURE_CONFIG_OFF_CHANNEL_BEACON_ENABLE = BIT(3), 55 PACKET_CAPTURE_CONFIG_NO_BEACON_ENABLE = BIT(4), 56 }; 57 58 /** 59 * struct mgmt_offload_event_params - Management offload event params 60 * @tsf_l32: The lower 32 bits of the TSF 61 * @chan_freq: channel frequency in MHz 62 * @rate_kbps: Rate kbps 63 * @rssi: combined RSSI, i.e. the sum of the snr + noise floor (dBm units) 64 * @buf_len: length of the frame in bytes 65 * @tx_status: 0: xmit ok 66 * 1: excessive retries 67 * 2: blocked by tx filtering 68 * 4: fifo underrun 69 * 8: swabort 70 * @buf: management frame buffer 71 * @tx_retry_cnt: tx retry count 72 */ 73 struct mgmt_offload_event_params { 74 uint32_t tsf_l32; 75 uint32_t chan_freq; 76 uint16_t rate_kbps; 77 uint32_t rssi; 78 uint32_t buf_len; 79 uint32_t tx_status; 80 uint8_t *buf; 81 uint8_t tx_retry_cnt; 82 }; 83 84 struct smu_event_params { 85 uint32_t vdev_id; 86 uint8_t rx_vht_sgi; 87 }; 88 89 /** 90 * struct pkt_capture_callbacks - callbacks to non-converged driver 91 * @get_rmf_status: callback to get rmf status 92 */ 93 struct pkt_capture_callbacks { 94 int (*get_rmf_status)(uint8_t vdev_id); 95 }; 96 97 /** 98 * struct wlan_pkt_capture_tx_ops - structure of tx operation function 99 * pointers for packet capture component 100 * @pkt_capture_send_mode: send packet capture mode 101 * @pkt_capture_send_config: send packet capture config 102 * @pkt_capture_send_beacon_interval: send beacon interval 103 * 104 */ 105 struct wlan_pkt_capture_tx_ops { 106 QDF_STATUS (*pkt_capture_send_mode)(struct wlan_objmgr_psoc *psoc, 107 uint8_t vdev_id, 108 enum pkt_capture_mode mode); 109 QDF_STATUS (*pkt_capture_send_config) 110 (struct wlan_objmgr_psoc *psoc, 111 uint8_t vdev_id, 112 enum pkt_capture_config config); 113 QDF_STATUS (*pkt_capture_send_beacon_interval) 114 (struct wlan_objmgr_psoc *psoc, 115 uint8_t vdev_id, 116 uint32_t nth_value); 117 }; 118 119 /** 120 * struct wlan_pkt_capture_rx_ops - structure of rx operation function 121 * pointers for packet capture component 122 * @pkt_capture_register_ev_handlers: register mgmt offload event 123 * @pkt_capture_unregister_ev_handlers: unregister mgmt offload event 124 * @pkt_capture_register_smart_monitor_event: register smu event 125 * @pkt_capture_unregister_smart_monitor_event: unregister smu event 126 */ 127 struct wlan_pkt_capture_rx_ops { 128 QDF_STATUS (*pkt_capture_register_ev_handlers) 129 (struct wlan_objmgr_psoc *psoc); 130 QDF_STATUS (*pkt_capture_unregister_ev_handlers) 131 (struct wlan_objmgr_psoc *psoc); 132 QDF_STATUS (*pkt_capture_register_smart_monitor_event) 133 (struct wlan_objmgr_psoc *psoc); 134 QDF_STATUS (*pkt_capture_unregister_smart_monitor_event) 135 (struct wlan_objmgr_psoc *psoc); 136 }; 137 138 /** 139 * enum pkt_capture_data_frame_type - Represent the various 140 * data types to be filtered in packet capture. 141 * @PKT_CAPTURE_DATA_FRAME_TYPE_ALL: 142 * @PKT_CAPTURE_DATA_FRAME_TYPE_ARP: 143 * @PKT_CAPTURE_DATA_FRAME_TYPE_DHCPV4: 144 * @PKT_CAPTURE_DATA_FRAME_TYPE_DHCPV6: 145 * @PKT_CAPTURE_DATA_FRAME_TYPE_EAPOL: 146 * @PKT_CAPTURE_DATA_FRAME_TYPE_DNSV4: 147 * @PKT_CAPTURE_DATA_FRAME_TYPE_DNSV6: 148 * @PKT_CAPTURE_DATA_FRAME_TYPE_TCP_SYN: 149 * @PKT_CAPTURE_DATA_FRAME_TYPE_TCP_SYNACK: 150 * @PKT_CAPTURE_DATA_FRAME_TYPE_TCP_FIN: 151 * @PKT_CAPTURE_DATA_FRAME_TYPE_TCP_FINACK: 152 * @PKT_CAPTURE_DATA_FRAME_TYPE_TCP_ACK: 153 * @PKT_CAPTURE_DATA_FRAME_TYPE_TCP_RST: 154 * @PKT_CAPTURE_DATA_FRAME_TYPE_ICMPV4: 155 * @PKT_CAPTURE_DATA_FRAME_TYPE_ICMPV6: 156 * @PKT_CAPTURE_DATA_FRAME_TYPE_RTP: 157 * @PKT_CAPTURE_DATA_FRAME_TYPE_SIP: 158 * @PKT_CAPTURE_DATA_FRAME_QOS_NULL: 159 */ 160 enum pkt_capture_data_frame_type { 161 PKT_CAPTURE_DATA_FRAME_TYPE_ALL = BIT(0), 162 /* valid only if PKT_CAPTURE_DATA_DATA_FRAME_TYPE_ALL is not set */ 163 PKT_CAPTURE_DATA_FRAME_TYPE_ARP = BIT(1), 164 PKT_CAPTURE_DATA_FRAME_TYPE_DHCPV4 = BIT(2), 165 PKT_CAPTURE_DATA_FRAME_TYPE_DHCPV6 = BIT(3), 166 PKT_CAPTURE_DATA_FRAME_TYPE_EAPOL = BIT(4), 167 PKT_CAPTURE_DATA_FRAME_TYPE_DNSV4 = BIT(5), 168 PKT_CAPTURE_DATA_FRAME_TYPE_DNSV6 = BIT(6), 169 PKT_CAPTURE_DATA_FRAME_TYPE_TCP_SYN = BIT(7), 170 PKT_CAPTURE_DATA_FRAME_TYPE_TCP_SYNACK = BIT(8), 171 PKT_CAPTURE_DATA_FRAME_TYPE_TCP_FIN = BIT(9), 172 PKT_CAPTURE_DATA_FRAME_TYPE_TCP_FINACK = BIT(10), 173 PKT_CAPTURE_DATA_FRAME_TYPE_TCP_ACK = BIT(11), 174 PKT_CAPTURE_DATA_FRAME_TYPE_TCP_RST = BIT(12), 175 PKT_CAPTURE_DATA_FRAME_TYPE_ICMPV4 = BIT(13), 176 PKT_CAPTURE_DATA_FRAME_TYPE_ICMPV6 = BIT(14), 177 PKT_CAPTURE_DATA_FRAME_TYPE_RTP = BIT(15), 178 PKT_CAPTURE_DATA_FRAME_TYPE_SIP = BIT(16), 179 PKT_CAPTURE_DATA_FRAME_QOS_NULL = BIT(17), 180 }; 181 182 /** 183 * enum pkt_capture_mgmt_frame_type - Represent the various 184 * mgmt types to be sent over the monitor interface. 185 * @PKT_CAPTURE_MGMT_FRAME_TYPE_ALL: All the MGMT Frames. 186 * @PKT_CAPTURE_MGMT_CONNECT_NO_BEACON: All the MGMT Frames 187 * except the Beacons. Valid only in the Connect state. 188 * @PKT_CAPTURE_MGMT_CONNECT_BEACON: Only the connected 189 * BSSID Beacons. Valid only in the Connect state. 190 * @PKT_CAPTURE_MGMT_CONNECT_SCAN_BEACON: Represents 191 * the Beacons obtained during the scan (off channel and connected channel) 192 * when in connected state. 193 */ 194 195 enum pkt_capture_mgmt_frame_type { 196 PKT_CAPTURE_MGMT_FRAME_TYPE_ALL = BIT(0), 197 /* valid only if PKT_CAPTURE_MGMT_FRAME_TYPE_ALL is not set */ 198 PKT_CAPTURE_MGMT_CONNECT_NO_BEACON = BIT(1), 199 PKT_CAPTURE_MGMT_CONNECT_BEACON = BIT(2), 200 PKT_CAPTURE_MGMT_CONNECT_SCAN_BEACON = BIT(3), 201 }; 202 203 /** 204 * enum pkt_capture_ctrl_frame_type - Represent the various 205 * ctrl types to be sent over the monitor interface. 206 * @PKT_CAPTURE_CTRL_FRAME_TYPE_ALL: All the ctrl Frames. 207 * @PKT_CAPTURE_CTRL_TRIGGER_FRAME: Trigger Frame. 208 */ 209 enum pkt_capture_ctrl_frame_type { 210 PKT_CAPTURE_CTRL_FRAME_TYPE_ALL = BIT(0), 211 /* valid only if PKT_CAPTURE_CTRL_FRAME_TYPE_ALL is not set */ 212 PKT_CAPTURE_CTRL_TRIGGER_FRAME = BIT(1), 213 }; 214 215 /** 216 * enum pkt_capture_attr_set_monitor_mode - Used by the 217 * vendor command QCA_NL80211_VENDOR_SUBCMD_SET_MONITOR_MODE to set the 218 * monitor mode. 219 * 220 * @PKT_CAPTURE_ATTR_SET_MONITOR_MODE_INVALID: Invalid value 221 * 222 * @PKT_CAPTURE_ATTR_SET_MONITOR_MODE_DATA_TX_FRAME_TYPE: u32 attribute, 223 * Represents the tx data packet type to be monitored (u32). These data packets 224 * are represented by enum pkt_capture_data_frame_type. 225 * 226 * @PKT_CAPTURE_ATTR_SET_MONITOR_MODE_DATA_RX_FRAME_TYPE: u32 attribute, 227 * Represents the tx data packet type to be monitored (u32). These data packets 228 * are represented by enum pkt_capture_data_frame_type. 229 * 230 * @PKT_CAPTURE_ATTR_SET_MONITOR_MODE_MGMT_TX_FRAME_TYPE: u32 attribute, 231 * Represents the tx data packet type to be monitored (u32). These mgmt packets 232 * are represented by enum pkt_capture_mgmt_frame_type. 233 * 234 * @PKT_CAPTURE_ATTR_SET_MONITOR_MODE_MGMT_RX_FRAME_TYPE: u32 attribute, 235 * Represents the tx data packet type to be monitored (u32). These mgmt packets 236 * are represented by enum pkt_capture_mgmt_frame_type. 237 * 238 * @PKT_CAPTURE_ATTR_SET_MONITOR_MODE_CTRL_TX_FRAME_TYPE: u32 attribute, 239 * Represents the tx data packet type to be monitored (u32). These ctrl packets 240 * are represented by enum pkt_capture_ctrl_frame_type. 241 * 242 * @PKT_CAPTURE_ATTR_SET_MONITOR_MODE_CTRL_RX_FRAME_TYPE: u32 attribute, 243 * Represents the tx data packet type to be monitored (u32). These ctrl packets 244 * are represented by enum pkt_capture_ctrl_frame_type. 245 * 246 * @PKT_CAPTURE_ATTR_SET_MONITOR_MODE_CONNECTED_BEACON_INTERVAL: u32 attribute, 247 * An interval only for the connected beacon interval, which expects that the 248 * connected BSSID's beacons shall be sent on the monitor interface only on this 249 * specific interval. 250 * 251 * @PKT_CAPTURE_ATTR_SET_MONITOR_MODE_AFTER_LAST: Internal use 252 * @PKT_CAPTURE_ATTR_SET_MONITOR_MODE_MAX: Value of last valid enumeration 253 */ 254 enum pkt_capture_attr_set_monitor_mode { 255 PKT_CAPTURE_ATTR_SET_MONITOR_MODE_INVALID = 0, 256 PKT_CAPTURE_ATTR_SET_MONITOR_MODE_DATA_TX_FRAME_TYPE = 1, 257 PKT_CAPTURE_ATTR_SET_MONITOR_MODE_DATA_RX_FRAME_TYPE = 2, 258 PKT_CAPTURE_ATTR_SET_MONITOR_MODE_MGMT_TX_FRAME_TYPE = 3, 259 PKT_CAPTURE_ATTR_SET_MONITOR_MODE_MGMT_RX_FRAME_TYPE = 4, 260 PKT_CAPTURE_ATTR_SET_MONITOR_MODE_CTRL_TX_FRAME_TYPE = 5, 261 PKT_CAPTURE_ATTR_SET_MONITOR_MODE_CTRL_RX_FRAME_TYPE = 6, 262 PKT_CAPTURE_ATTR_SET_MONITOR_MODE_CONNECTED_BEACON_INTERVAL = 7, 263 264 /* keep last */ 265 PKT_CAPTURE_ATTR_SET_MONITOR_MODE_AFTER_LAST, 266 PKT_CAPTURE_ATTR_SET_MONITOR_MODE_MAX = 267 PKT_CAPTURE_ATTR_SET_MONITOR_MODE_AFTER_LAST - 1, 268 269 }; 270 271 struct pkt_capture_frame_filter { 272 enum pkt_capture_data_frame_type data_tx_frame_filter; 273 enum pkt_capture_data_frame_type data_rx_frame_filter; 274 enum pkt_capture_mgmt_frame_type mgmt_tx_frame_filter; 275 enum pkt_capture_mgmt_frame_type mgmt_rx_frame_filter; 276 enum pkt_capture_ctrl_frame_type ctrl_tx_frame_filter; 277 enum pkt_capture_ctrl_frame_type ctrl_rx_frame_filter; 278 uint32_t connected_beacon_interval; 279 uint8_t vendor_attr_to_set; 280 }; 281 #endif /* _WLAN_PKT_CAPTURE_PUBLIC_STRUCTS_H_ */ 282