1 /* 2 * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 */ 16 17 /** 18 * DOC: contains dcs structure definations 19 */ 20 21 #ifndef _WLAN_DCS_PUBLIC_STRUCTS_H_ 22 #define _WLAN_DCS_PUBLIC_STRUCTS_H_ 23 24 /** 25 * enum wlan_host_dcs_type - types of DCS interference events 26 * @WLAN_HOST_DCS_NONE: invalid type 27 * @WLAN_HOST_DCS_CWIM: continuous wave interference 28 * @WLAN_HOST_DCS_WLANIM: wlan interference stats 29 * @WLAN_HOST_DCS_AWGNIM: additive white Gaussian noise (awgn) interference 30 */ 31 enum wlan_host_dcs_type { 32 WLAN_HOST_DCS_NONE = 0, /* 0x0 */ 33 WLAN_HOST_DCS_CWIM = BIT(0), /* 0x1 */ 34 WLAN_HOST_DCS_WLANIM = BIT(1), /* 0x2 */ 35 WLAN_HOST_DCS_AWGNIM = BIT(2), /* 0x4 */ 36 }; 37 38 /** 39 * struct wlan_host_dcs_interference_param - dcs interference parameters 40 * @interference_type: type of DCS interference 41 * @uint32_t pdev_id: pdev id 42 */ 43 struct wlan_host_dcs_interference_param { 44 uint32_t interference_type; 45 uint32_t pdev_id; 46 }; 47 48 /** 49 * struct wlan_host_dcs_mib_stats - WLAN IM stats from target to host 50 * @listen_time: 51 * @reg_tx_frame_cnt: 52 * @reg_rx_frame_cnt: 53 * @reg_rxclr_cnt: 54 * @reg_cycle_cnt: delta cycle count 55 * @reg_rxclr_ext_cnt: 56 * @reg_ofdm_phyerr_cnt: 57 * @reg_cck_phyerr_cnt: CCK err count since last reset, read from register 58 */ 59 struct wlan_host_dcs_mib_stats { 60 int32_t listen_time; 61 uint32_t reg_tx_frame_cnt; 62 uint32_t reg_rx_frame_cnt; 63 uint32_t reg_rxclr_cnt; 64 uint32_t reg_cycle_cnt; 65 uint32_t reg_rxclr_ext_cnt; 66 uint32_t reg_ofdm_phyerr_cnt; 67 uint32_t reg_cck_phyerr_cnt; 68 }; 69 70 /** 71 * struct wlan_host_dcs_im_tgt_stats - DCS IM target stats 72 * @reg_tsf32: current running TSF from the TSF-1 73 * @last_ack_rssi: known last frame rssi, in case of multiple stations, if 74 * and at different ranges, this would not gaurantee that 75 * this is the least rssi. 76 * @tx_waste_time: sum of all the failed durations in the last 77 * one second interval. 78 * @rx_time: count how many times the hal_rxerr_phy is marked, in this 79 * time period 80 * @phyerr_cnt: 81 * @mib_stats: collected mib stats as explained in mib structure 82 * @chan_nf: Channel noise floor (units are in dBm) 83 * @my_bss_rx_cycle_count: BSS rx cycle count 84 * @reg_rxclr_ext40_cnt: extension channel 40Mhz rxclear count 85 * @reg_rxclr_ext80_cnt: extension channel 80Mhz rxclear count 86 */ 87 struct wlan_host_dcs_im_tgt_stats { 88 uint32_t reg_tsf32; 89 uint32_t last_ack_rssi; 90 uint32_t tx_waste_time; 91 uint32_t rx_time; 92 uint32_t phyerr_cnt; 93 struct wlan_host_dcs_mib_stats mib_stats; 94 uint32_t chan_nf; 95 uint32_t my_bss_rx_cycle_count; 96 uint32_t reg_rxclr_ext40_cnt; 97 uint32_t reg_rxclr_ext80_cnt; 98 }; 99 100 /** 101 * struct wlan_host_dcs_im_user_stats - DCS IM stats requested by userspace 102 * @max_rssi: max rssi of the bss traffic 103 * @min_rssi: min rssi of the bss traffic 104 * @cycle_count: cycle count 105 * @rxclr_count: rx clear count 106 * @rx_frame_count: rx frame count 107 * @my_bss_rx_cycle_count: BSS rx cycle count 108 */ 109 struct wlan_host_dcs_im_user_stats { 110 uint32_t max_rssi; 111 uint32_t min_rssi; 112 uint32_t cycle_count; 113 uint32_t rxclr_count; 114 uint32_t rx_frame_count; 115 uint32_t my_bss_rx_cycle_count; 116 }; 117 118 /** 119 * struct wlan_host_dcs_awgn_info - DCS AWGN info 120 * @channel_width: Channel width, enum phy_ch_width 121 * @center_freq: Center frequency of primary channel 122 * @center_freq0: Center frequency of segment 1 123 * @center_freq1: Center frequency of segment 2 124 * @chan_bw_intf_bitmap: Per-20MHz interference bitmap, each bit 125 * indicates 20MHz in which interference is seen, e.g. 126 * bit0 - primary 20MHz, bit1 - secondary 20MHz, 127 * bit2 - secondary 40MHz Lower, bit3 - secondary 40MHz Upper 128 */ 129 struct wlan_host_dcs_awgn_info { 130 enum phy_ch_width channel_width; 131 qdf_freq_t center_freq; 132 qdf_freq_t center_freq0; 133 qdf_freq_t center_freq1; 134 uint32_t chan_bw_intf_bitmap; 135 }; 136 137 /** 138 * struct wlan_host_dcs_event - define dcs event 139 * @wlan_stat: wlan interference target statistics 140 * @dcs_param: dcs event param 141 * @awgn_info: awgn info 142 */ 143 struct wlan_host_dcs_event { 144 struct wlan_host_dcs_im_tgt_stats wlan_stat; 145 struct wlan_host_dcs_interference_param dcs_param; 146 struct wlan_host_dcs_awgn_info awgn_info; 147 }; 148 #endif 149