1 /****************************************************************************** 2 * 3 * Copyright(c) 2007 - 2019 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 #ifndef __RTW_AP_H_ 16 #define __RTW_AP_H_ 17 18 19 #ifdef CONFIG_AP_MODE 20 21 /* external function */ 22 extern void rtw_indicate_sta_assoc_event(_adapter *padapter, struct sta_info *psta); 23 extern void rtw_indicate_sta_disassoc_event(_adapter *padapter, struct sta_info *psta); 24 25 26 void init_mlme_ap_info(_adapter *padapter); 27 void free_mlme_ap_info(_adapter *padapter); 28 u8 rtw_set_tim_ie(u8 dtim_cnt, u8 dtim_period 29 , const u8 *tim_bmp, u8 tim_bmp_len, u8 *tim_ie); 30 /* void update_BCNTIM(_adapter *padapter); */ 31 void rtw_add_bcn_ie(_adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index, u8 *data, u8 len); 32 void rtw_remove_bcn_ie(_adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index); 33 void rtw_remove_bcn_ie_ex(_adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index, u8* pindex_ex, u8 index_ex_len); 34 void _update_beacon(_adapter *padapter, u8 ie_id, u8 *oui, u8 tx, u8 flags, const char *tag); 35 #define rtw_update_beacon(adapter, ie_id, oui, tx, flags) _update_beacon((adapter), (ie_id), (oui), (tx), (flags), __func__) 36 /*rtw_update_beacon - (flags) can set to normal enqueue (0) and RTW_CMDF_WAIT_ACK enqueue. 37 (flags) = RTW_CMDF_DIRECTLY is not currently implemented, it will do normal enqueue.*/ 38 39 void expire_timeout_chk(_adapter *padapter); 40 void update_sta_info_apmode(_adapter *padapter, struct sta_info *psta); 41 void rtw_start_bss_hdl_after_chbw_decided(_adapter *adapter); 42 void start_bss_network(_adapter *padapter, struct createbss_parm *parm); 43 int rtw_check_beacon_data(_adapter *padapter, u8 *pbuf, int len); 44 void rtw_ap_restore_network(_adapter *padapter); 45 46 #if CONFIG_RTW_MACADDR_ACL 47 void rtw_macaddr_acl_init(_adapter *adapter, u8 period); 48 void rtw_macaddr_acl_deinit(_adapter *adapter, u8 period); 49 void rtw_macaddr_acl_clear(_adapter *adapter, u8 period); 50 void rtw_set_macaddr_acl(_adapter *adapter, u8 period, int mode); 51 int rtw_acl_add_sta(_adapter *adapter, u8 period, const u8 *addr); 52 int rtw_acl_remove_sta(_adapter *adapter, u8 period, const u8 *addr); 53 #endif /* CONFIG_RTW_MACADDR_ACL */ 54 55 u8 rtw_ap_set_sta_key(_adapter *adapter, const u8 *addr, u8 alg, const u8 *key, u8 keyid, u8 gk); 56 u8 rtw_ap_set_pairwise_key(_adapter *padapter, struct sta_info *psta); 57 int rtw_ap_set_group_key(_adapter *padapter, u8 *key, u8 alg, int keyid); 58 int rtw_ap_set_wep_key(_adapter *padapter, u8 *key, u8 keylen, int keyid, u8 set_tx); 59 60 #ifdef CONFIG_NATIVEAP_MLME 61 void associated_clients_update(_adapter *padapter, u8 updated, u32 sta_info_type); 62 void bss_cap_update_on_sta_join(_adapter *padapter, struct sta_info *psta); 63 u8 bss_cap_update_on_sta_leave(_adapter *padapter, struct sta_info *psta); 64 void sta_info_update(_adapter *padapter, struct sta_info *psta); 65 u8 ap_free_sta(_adapter *padapter, struct sta_info *psta, bool active, u16 reason, bool enqueue, u8 disassoc); 66 int rtw_sta_flush(_adapter *padapter, bool enqueue); 67 int rtw_ap_inform_ch_switch(_adapter *padapter, u8 new_ch, u8 ch_offset); 68 void start_ap_mode(_adapter *padapter); 69 void stop_ap_mode(_adapter *padapter); 70 #endif 71 72 void rtw_ap_update_clients_rainfo(struct _ADAPTER *a, enum phl_cmd_type flag); 73 void rtw_ap_update_bss_chbw(_adapter *adapter, WLAN_BSSID_EX *bss, u8 ch, u8 bw, u8 offset); 74 u8 rtw_ap_chbw_decision(_adapter *adapter, u8 ifbmp, u8 excl_ifbmp 75 , s16 req_ch, s8 req_bw, s8 req_offset, struct rtw_chan_def *chdef); 76 77 #ifdef CONFIG_AUTO_AP_MODE 78 void rtw_auto_ap_rx_msg_dump(_adapter *padapter, union recv_frame *precv_frame, u8 *ehdr_pos); 79 extern void rtw_start_auto_ap(_adapter *adapter); 80 #endif /* CONFIG_AUTO_AP_MODE */ 81 82 void rtw_ap_parse_sta_capability(_adapter *adapter, struct sta_info *sta, u8 *cap); 83 u16 rtw_ap_parse_sta_supported_rates(_adapter *adapter, struct sta_info *sta, u8 *tlv_ies, u16 tlv_ies_len); 84 u16 rtw_ap_parse_sta_security_ie(_adapter *adapter, struct sta_info *sta, struct rtw_ieee802_11_elems *elems); 85 void rtw_ap_parse_sta_wmm_ie(_adapter *adapter, struct sta_info *sta, u8 *tlv_ies, u16 tlv_ies_len); 86 void rtw_ap_parse_sta_ht_ie(_adapter *adapter, struct sta_info *sta, struct rtw_ieee802_11_elems *elems); 87 void rtw_ap_parse_sta_vht_ie(_adapter *adapter, struct sta_info *sta, struct rtw_ieee802_11_elems *elems); 88 void rtw_ap_parse_sta_he_ie(_adapter *adapter, struct sta_info *sta, struct rtw_ieee802_11_elems *elems); 89 void rtw_ap_parse_sta_multi_ap_ie(_adapter *adapter, struct sta_info *sta, u8 *ies, int ies_len); 90 91 92 void rtw_core_ap_start(_adapter *padapter, struct createbss_parm *parm); 93 void rtw_core_ap_swch_start(_adapter *padapter, struct createbss_parm *parm); 94 95 /* b2u flags */ 96 #define RTW_AP_B2U_ALL BIT0 97 #define RTW_AP_B2U_GA_UCAST BIT1 /* WDS group addressed unicast frame, forward only */ 98 #define RTW_AP_B2U_BCAST BIT2 99 #define RTW_AP_B2U_IP_MCAST BIT3 100 101 #define rtw_ap_src_b2u_policy_chk(flags, da) ( \ 102 (flags & RTW_AP_B2U_ALL) \ 103 || ((flags & RTW_AP_B2U_BCAST) && is_broadcast_mac_addr(da)) \ 104 || ((flags & RTW_AP_B2U_IP_MCAST) && (IP_MCAST_MAC(da) || ICMPV6_MCAST_MAC(da))) \ 105 ) 106 107 #define rtw_ap_fwd_b2u_policy_chk(flags, da, gaucst) ( \ 108 (flags & RTW_AP_B2U_ALL) \ 109 || ((flags & RTW_AP_B2U_GA_UCAST) && gaucst) \ 110 || ((flags & RTW_AP_B2U_BCAST) && is_broadcast_mac_addr(da)) \ 111 || ((flags & RTW_AP_B2U_IP_MCAST) && (IP_MCAST_MAC(da) || ICMPV6_MCAST_MAC(da))) \ 112 ) 113 114 void dump_ap_b2u_flags(void *sel, _adapter *adapter); 115 116 int rtw_ap_addr_resolve(_adapter *adapter, u16 os_qid, struct xmit_frame *xframe, struct sk_buff *pkt, _list *f_list); 117 int rtw_ap_rx_data_validate_hdr(_adapter *adapter, union recv_frame *rframe, struct sta_info **sta); 118 int rtw_ap_rx_msdu_act_check(union recv_frame *rframe 119 , const u8 *da, const u8 *sa 120 , u8 *msdu, enum rtw_rx_llc_hdl llc_hdl 121 , struct xmit_frame **fwd_frame, _list *f_list); 122 123 #ifdef CONFIG_BMC_TX_RATE_SELECT 124 void rtw_update_bmc_sta_tx_rate(_adapter *adapter); 125 #endif 126 127 void rtw_process_ht_action_smps(_adapter *padapter, u8 *ta, u8 ctrl_field); 128 void rtw_process_public_act_bsscoex(_adapter *padapter, u8 *pframe, uint frame_len); 129 #ifdef CONFIG_80211N_HT 130 int rtw_ht_operation_update(_adapter *padapter); 131 #endif /* CONFIG_80211N_HT */ 132 u8 rtw_ap_sta_states_check(_adapter *adapter); 133 134 void rtw_ap_set_sta_wmode(_adapter *padapter, struct sta_info *sta); 135 136 #if defined(CONFIG_RTW_ACS) && defined(WKARD_ACS) 137 void rtw_acs_start(_adapter *padapter); 138 void rtw_acs_stop(_adapter *padapter); 139 #endif /* defined(CONFIG_RTW_ACS) && defined(WKARD_ACS) */ 140 void rtw_ap_set_edca(_adapter *padapter, enum rtw_ac ac, u32 param); 141 142 #ifdef CONFIG_AP_CMD_DISPR 143 144 #define CMD_APSTART_ACQUIRE BIT0 145 #define CMD_APSTOP_ACQUIRE BIT1 146 #define CMD_APSTOP_STARTED BIT2 147 148 enum rtw_phl_status rtw_ap_start_cmd(struct cmd_obj *p); 149 enum rtw_phl_status rtw_ap_stop_cmd(struct cmd_obj *p); 150 enum rtw_phl_status rtw_free_bcn_entry(struct _ADAPTER *padapter); 151 152 #endif 153 #endif /* end of CONFIG_AP_MODE */ 154 #endif /*__RTW_AP_H_*/ 155