1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /****************************************************************************** 3 * 4 * Copyright(c) 2007 - 2017 Realtek Corporation. 5 * 6 * This program is free software; you can redistribute it and/or modify it 7 * under the terms of version 2 of the GNU General Public License as 8 * published by the Free Software Foundation. 9 * 10 * This program is distributed in the hope that it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 * more details. 14 * 15 *****************************************************************************/ 16 17 #ifndef __RTW_RM_H_ 18 #define __RTW_RM_H_ 19 20 u8 rm_post_event_hdl(_adapter *padapter, u8 *pbuf); 21 22 #define RM_TIMER_NUM 32 23 #define RM_ALL_MEAS BIT(1) 24 #define RM_ID_FOR_ALL(aid) ((aid<<16)|RM_ALL_MEAS) 25 26 #define RM_CAP_ARG(x) ((u8 *)(x))[4], ((u8 *)(x))[3], ((u8 *)(x))[2], ((u8 *)(x))[1], ((u8 *)(x))[0] 27 #define RM_CAP_FMT "%02x %02x%02x %02x%02x" 28 29 /* remember to modify rm_event_name() when adding new event */ 30 enum RM_EV_ID { 31 RM_EV_state_in, 32 RM_EV_busy_timer_expire, 33 RM_EV_delay_timer_expire, 34 RM_EV_meas_timer_expire, 35 RM_EV_retry_timer_expire, 36 RM_EV_repeat_delay_expire, 37 RM_EV_request_timer_expire, 38 RM_EV_wait_report, 39 RM_EV_start_meas, 40 RM_EV_survey_done, 41 RM_EV_recv_rep, 42 RM_EV_cancel, 43 RM_EV_state_out, 44 RM_EV_max 45 }; 46 47 struct rm_event { 48 u32 rmid; 49 enum RM_EV_ID evid; 50 _list list; 51 }; 52 53 #ifdef CONFIG_RTW_80211K 54 55 struct rm_clock { 56 struct rm_obj *prm; 57 ATOMIC_T counter; 58 enum RM_EV_ID evid; 59 }; 60 61 struct rm_priv { 62 u8 enable; 63 _queue ev_queue; 64 _queue rm_queue; 65 _timer rm_timer; 66 67 struct rm_clock clock[RM_TIMER_NUM]; 68 u8 rm_en_cap_def[5]; 69 u8 rm_en_cap_assoc[5]; 70 71 u8 meas_token; 72 /* rm debug */ 73 void *prm_sel; 74 }; 75 76 #define MAX_CH_NUM_IN_OP_CLASS 11 77 typedef struct _RT_OPERATING_CLASS { 78 int global_op_class; 79 int Len; 80 u8 Channel[MAX_CH_NUM_IN_OP_CLASS]; 81 } RT_OPERATING_CLASS, *PRT_OPERATING_CLASS; 82 83 int rtw_init_rm(_adapter *padapter); 84 int rtw_free_rm_priv(_adapter *padapter); 85 86 unsigned int rm_on_action(_adapter *padapter, union recv_frame *precv_frame); 87 void RM_IE_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE); 88 void rtw_ap_parse_sta_rm_en_cap(_adapter *padapter, 89 struct sta_info *psta, struct rtw_ieee802_11_elems *elems); 90 91 int rm_post_event(_adapter *padapter, u32 rmid, enum RM_EV_ID evid); 92 void rm_handler(_adapter *padapter, struct rm_event *pev); 93 94 u8 rm_add_nb_req(_adapter *padapter, struct sta_info *psta); 95 96 /* from ioctl */ 97 int rm_send_bcn_reqs(_adapter *padapter, u8 *sta_addr, u8 op_class, u8 ch, 98 u16 measure_duration, u8 measure_mode, u8 *bssid, u8 *ssid, 99 u8 reporting_detail, 100 u8 n_ap_ch_rpt, struct _RT_OPERATING_CLASS *rpt, 101 u8 n_elem_id, u8 *elem_id_list); 102 void indicate_beacon_report(u8 *sta_addr, 103 u8 n_measure_rpt, u32 elem_len, u8 *elem); 104 105 #endif /*CONFIG_RTW_80211K */ 106 #endif /* __RTW_RM_H_ */ 107