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