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