xref: /freebsd/contrib/wpa/src/common/hw_features_common.h (revision a90b9d0159070121c221b966469c3e36d912bf82)
15b9c547cSRui Paulo /*
25b9c547cSRui Paulo  * Common hostapd/wpa_supplicant HW features
35b9c547cSRui Paulo  * Copyright (c) 2002-2013, Jouni Malinen <j@w1.fi>
45b9c547cSRui Paulo  * Copyright (c) 2015, Qualcomm Atheros, Inc.
55b9c547cSRui Paulo  *
65b9c547cSRui Paulo  * This software may be distributed under the terms of the BSD license.
75b9c547cSRui Paulo  * See README for more details.
85b9c547cSRui Paulo  */
95b9c547cSRui Paulo 
105b9c547cSRui Paulo #ifndef HW_FEATURES_COMMON_H
115b9c547cSRui Paulo #define HW_FEATURES_COMMON_H
125b9c547cSRui Paulo 
135b9c547cSRui Paulo #include "drivers/driver.h"
145b9c547cSRui Paulo 
155b9c547cSRui Paulo struct hostapd_channel_data * hw_get_channel_chan(struct hostapd_hw_modes *mode,
165b9c547cSRui Paulo 						  int chan, int *freq);
17c1d255d3SCy Schubert struct hostapd_channel_data *
18c1d255d3SCy Schubert hw_mode_get_channel(struct hostapd_hw_modes *mode, int freq, int *chan);
19c1d255d3SCy Schubert 
20c1d255d3SCy Schubert struct hostapd_channel_data *
21c1d255d3SCy Schubert hw_get_channel_freq(enum hostapd_hw_mode mode, int freq, int *chan,
22c1d255d3SCy Schubert 		    struct hostapd_hw_modes *hw_features, int num_hw_features);
235b9c547cSRui Paulo 
245b9c547cSRui Paulo int hw_get_freq(struct hostapd_hw_modes *mode, int chan);
25c1d255d3SCy Schubert int hw_get_chan(enum hostapd_hw_mode mode, int freq,
26c1d255d3SCy Schubert 		struct hostapd_hw_modes *hw_features, int num_hw_features);
275b9c547cSRui Paulo 
28c1d255d3SCy Schubert int allowed_ht40_channel_pair(enum hostapd_hw_mode mode,
29c1d255d3SCy Schubert 			      struct hostapd_channel_data *p_chan,
30c1d255d3SCy Schubert 			      struct hostapd_channel_data *s_chan);
315b9c547cSRui Paulo void get_pri_sec_chan(struct wpa_scan_res *bss, int *pri_chan, int *sec_chan);
32c1d255d3SCy Schubert int check_40mhz_5g(struct wpa_scan_results *scan_res,
33c1d255d3SCy Schubert 		   struct hostapd_channel_data *pri_chan,
34c1d255d3SCy Schubert 		   struct hostapd_channel_data *sec_chan);
355b9c547cSRui Paulo int check_40mhz_2g4(struct hostapd_hw_modes *mode,
365b9c547cSRui Paulo 		    struct wpa_scan_results *scan_res, int pri_chan,
375b9c547cSRui Paulo 		    int sec_chan);
38*a90b9d01SCy Schubert void punct_update_legacy_bw(u16 bitmap, u8 pri_chan,
39*a90b9d01SCy Schubert 			    enum oper_chan_width *width, u8 *seg0, u8 *seg1);
405b9c547cSRui Paulo int hostapd_set_freq_params(struct hostapd_freq_params *data,
415b9c547cSRui Paulo 			    enum hostapd_hw_mode mode,
42c1d255d3SCy Schubert 			    int freq, int channel, int edmg, u8 edmg_channel,
43c1d255d3SCy Schubert 			    int ht_enabled,
44206b73d0SCy Schubert 			    int vht_enabled, int he_enabled,
45*a90b9d01SCy Schubert 			    bool eht_enabled, int sec_channel_offset,
46*a90b9d01SCy Schubert 			    enum oper_chan_width oper_chwidth,
47*a90b9d01SCy Schubert 			    int center_segment0,
48206b73d0SCy Schubert 			    int center_segment1, u32 vht_caps,
49*a90b9d01SCy Schubert 			    struct he_capabilities *he_caps,
50*a90b9d01SCy Schubert 			    struct eht_capabilities *eht_cap,
51*a90b9d01SCy Schubert 			    u16 punct_bitmap);
5285732ac8SCy Schubert void set_disable_ht40(struct ieee80211_ht_capabilities *htcaps,
5385732ac8SCy Schubert 		      int disabled);
5485732ac8SCy Schubert int ieee80211ac_cap_check(u32 hw, u32 conf);
555b9c547cSRui Paulo 
564bc52338SCy Schubert u32 num_chan_to_bw(int num_chans);
574bc52338SCy Schubert int chan_bw_allowed(const struct hostapd_channel_data *chan, u32 bw,
584bc52338SCy Schubert 		    int ht40_plus, int pri);
594bc52338SCy Schubert int chan_pri_allowed(const struct hostapd_channel_data *chan);
60*a90b9d01SCy Schubert bool is_punct_bitmap_valid(u16 bw, u16 pri_ch_bit_pos, u16 punct_bitmap);
614bc52338SCy Schubert 
625b9c547cSRui Paulo #endif /* HW_FEATURES_COMMON_H */
63