1 /** @file mlan_uap.h
2  *
3  *  @brief This file contains related macros, enum, and struct
4  *  of uap functionalities
5  *
6  *  Copyright 2008-2024 NXP
7  *
8  *  SPDX-License-Identifier: BSD-3-Clause
9  *
10  */
11 
12 /********************************************************
13 Change log:
14     02/05/2009: initial version
15 ********************************************************/
16 
17 #ifndef _MLAN_UAP_H_
18 #define _MLAN_UAP_H_
19 
20 #ifdef BIG_ENDIAN_SUPPORT
21 /** Convert TxPD to little endian format from CPU format */
22 #define uap_endian_convert_TxPD(x)                                 \
23     {                                                              \
24         (x)->tx_pkt_length = wlan_cpu_to_le16((x)->tx_pkt_length); \
25         (x)->tx_pkt_offset = wlan_cpu_to_le16((x)->tx_pkt_offset); \
26         (x)->tx_pkt_type   = wlan_cpu_to_le16((x)->tx_pkt_type);   \
27         (x)->tx_control    = wlan_cpu_to_le32((x)->tx_control);    \
28     }
29 
30 /** Convert RxPD from little endian format to CPU format */
31 #define uap_endian_convert_RxPD(x)                                 \
32     {                                                              \
33         (x)->rx_pkt_length = wlan_le16_to_cpu((x)->rx_pkt_length); \
34         (x)->rx_pkt_offset = wlan_le16_to_cpu((x)->rx_pkt_offset); \
35         (x)->rx_pkt_type   = wlan_le16_to_cpu((x)->rx_pkt_type);   \
36         (x)->seq_num       = wlan_le16_to_cpu((x)->seq_num);       \
37     }
38 #else
39 /** Convert TxPD to little endian format from CPU format */
40 #define uap_endian_convert_TxPD(x) \
41     do                             \
42     {                              \
43     } while (0)
44 /** Convert RxPD from little endian format to CPU format */
45 #define uap_endian_convert_RxPD(x) \
46     do                             \
47     {                              \
48     } while (0)
49 #endif /* BIG_ENDIAN_SUPPORT */
50 
51 /** Guard mlan_private access when uAP disabled */
52 #if UAP_SUPPORT
53 #define CHECK_BSS_TYPE(id, rvl)
54 #define CHECK_BSS_TYPE_RET_VOID(id)
55 #else
56 #define CHECK_BSS_TYPE(id, rvl) \
57     if ((int)(id) > MLAN_BSS_ROLE_STA) \
58         return (rvl)
59 #define CHECK_BSS_TYPE_RET_VOID(id) \
60     if ((int)(id) > MLAN_BSS_ROLE_STA) \
61         return
62 #endif
63 
64 /** Band config 5GHz */
65 #define UAP_BAND_CONFIG_5GHZ 0x01
66 
67 /** Packet forwarding to be done by FW or host */
68 #define PKT_FWD_FW_BIT 0x01U
69 /** Intra-BSS broadcast packet forwarding allow bit */
70 #define PKT_FWD_INTRA_BCAST 0x02
71 /** Intra-BSS unicast packet forwarding allow bit */
72 #define PKT_FWD_INTRA_UCAST 0x04
73 /** Inter-BSS unicast packet forwarding allow bit */
74 #define PKT_FWD_INTER_UCAST 0x08
75 /** Intra-BSS unicast packet */
76 #define PKT_INTRA_UCAST 0x01
77 /** Inter-BSS unicast packet */
78 #define PKT_INTER_UCAST 0x02
79 /** Enable Host PKT forwarding */
80 #define PKT_FWD_ENABLE_BIT 0x01U
81 
82 #if UAP_SUPPORT
83 mlan_status wlan_ops_uap_ioctl(t_void *adapter, pmlan_ioctl_req pioctl_req);
84 
85 mlan_status wlan_ops_uap_prepare_cmd(IN t_void *priv,
86                                      IN t_u16 cmd_no,
87                                      IN t_u16 cmd_action,
88                                      IN t_u32 cmd_oid,
89                                      IN t_void *pioctl_buf,
90                                      IN t_void *pdata_buf,
91                                      IN t_void *pcmd_buf);
92 
93 int wifi_uap_enable_11d_support(void);
94 
95 int wifi_uap_group_rekey_timer_getset(uint8_t action, uint32_t *group_rekey_timer);
96 
97 int wifi_uap_mcbc_rate_getset(uint8_t action, uint16_t *mcbc_rate);
98 
99 int wifi_uap_tx_power_getset(uint8_t action, uint8_t *tx_power_dbm);
100 
101 int wifi_set_uap_max_clients(unsigned int *max_sta_num);
102 
103 int wifi_get_uap_max_clients(unsigned int *max_sta_num);
104 
105 void wifi_uap_set_ecsa(void);
106 
107 int wifi_uap_ctrl_deauth(bool enable);
108 
109 void wifi_uap_set_hidden_ssid(const t_u8 bcast_ssid_ctl);
110 
111 void wifi_uap_set_htcapinfo(const t_u16 ht_cap_info);
112 
113 void wifi_uap_set_beacon_period(const t_u16 beacon_period);
114 
115 #else
wlan_ops_uap_ioctl(t_void * adapter,pmlan_ioctl_req pioctl_req)116 static inline mlan_status wlan_ops_uap_ioctl(t_void *adapter, pmlan_ioctl_req pioctl_req)
117 {
118     (void)PRINTF("wlan_ops_uap_ioctl UAP not supported %s:%d\r\n", __func__, __LINE__);
119     return MLAN_STATUS_FAILURE;
120 }
121 #endif /* UAP_SUPPORT */
122 
123 #endif /* _MLAN_UAP_H_ */
124