hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/net/wireless/rockchip_wlan/cywdhd/bcmdhd/wl_cfgp2p.h
....@@ -1,15 +1,16 @@
1
-/* SPDX-License-Identifier: GPL-2.0 */
21 /*
32 * Linux cfgp2p driver
43 *
5
- * Copyright (C) 1999-2019, Broadcom Corporation
6
- *
4
+ * Portions of this code are copyright (c) 2022 Cypress Semiconductor Corporation
5
+ *
6
+ * Copyright (C) 1999-2017, Broadcom Corporation
7
+ *
78 * Unless you and Broadcom execute a separate written software license
89 * agreement governing use of this software, this software is licensed to you
910 * under the terms of the GNU General Public License version 2 (the "GPL"),
1011 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
1112 * following added to such license:
12
- *
13
+ *
1314 * As a special exception, the copyright holders of this software give you
1415 * permission to link this software with independent modules, and to copy and
1516 * distribute the resulting executable under terms of your choice, provided that
....@@ -17,7 +18,7 @@
1718 * the license of that module. An independent module is a module which is not
1819 * derived from this software. The special exception does not apply to any
1920 * modifications of the software.
20
- *
21
+ *
2122 * Notwithstanding the above, under no circumstances may you combine this
2223 * software in any way with any other Broadcom software provided under a license
2324 * other than the GPL, without Broadcom's express prior written consent.
....@@ -25,12 +26,12 @@
2526 *
2627 * <<Broadcom-WL-IPTag/Open:>>
2728 *
28
- * $Id: wl_cfgp2p.h 709309 2019-01-17 09:04:00Z $
29
+ * $Id: wl_cfgp2p.h 794110 2018-12-12 05:03:21Z $
2930 */
3031 #ifndef _wl_cfgp2p_h_
3132 #define _wl_cfgp2p_h_
32
-#include <proto/802.11.h>
33
-#include <proto/p2p.h>
33
+#include <802.11.h>
34
+#include <p2p.h>
3435
3536 struct bcm_cfg80211;
3637 extern u32 wl_dbg_level;
....@@ -41,27 +42,27 @@
4142 * saved_ie[] array of structures which in turn contains a bsscfg index field.
4243 */
4344 typedef enum {
44
- P2PAPI_BSSCFG_PRIMARY, /* maps to driver's primary bsscfg */
45
- P2PAPI_BSSCFG_DEVICE, /* maps to driver's P2P device discovery bsscfg */
46
- P2PAPI_BSSCFG_CONNECTION1, /* maps to driver's P2P connection bsscfg */
45
+ P2PAPI_BSSCFG_PRIMARY, /**< maps to driver's primary bsscfg */
46
+ P2PAPI_BSSCFG_DEVICE, /**< maps to driver's P2P device discovery bsscfg */
47
+ P2PAPI_BSSCFG_CONNECTION1, /**< maps to driver's P2P connection bsscfg */
4748 P2PAPI_BSSCFG_CONNECTION2,
4849 P2PAPI_BSSCFG_MAX
4950 } p2p_bsscfg_type_t;
5051
5152 typedef enum {
5253 P2P_SCAN_PURPOSE_MIN,
53
- P2P_SCAN_SOCIAL_CHANNEL, /* scan for social channel */
54
- P2P_SCAN_AFX_PEER_NORMAL, /* scan for action frame search */
55
- P2P_SCAN_AFX_PEER_REDUCED, /* scan for action frame search with short time */
56
- P2P_SCAN_DURING_CONNECTED, /* scan during connected status */
57
- P2P_SCAN_CONNECT_TRY, /* scan for connecting */
58
- P2P_SCAN_NORMAL, /* scan during not-connected status */
54
+ P2P_SCAN_SOCIAL_CHANNEL, /**< scan for social channel */
55
+ P2P_SCAN_AFX_PEER_NORMAL, /**< scan for action frame search */
56
+ P2P_SCAN_AFX_PEER_REDUCED, /**< scan for action frame search with short time */
57
+ P2P_SCAN_DURING_CONNECTED, /**< scan during connected status */
58
+ P2P_SCAN_CONNECT_TRY, /**< scan for connecting */
59
+ P2P_SCAN_NORMAL, /**< scan during not-connected status */
5960 P2P_SCAN_PURPOSE_MAX
6061 } p2p_scan_purpose_t;
6162
62
-/* vendor ies max buffer length for probe response or beacon */
63
+/** vendor ies max buffer length for probe response or beacon */
6364 #define VNDR_IES_MAX_BUF_LEN 1400
64
-/* normal vendor ies buffer length */
65
+/** normal vendor ies buffer length */
6566 #define VNDR_IES_BUF_LEN 512
6667
6768 struct p2p_bss {
....@@ -72,25 +73,24 @@
7273 };
7374
7475 struct p2p_info {
75
- bool on; /* p2p on/off switch */
76
+ bool on; /**< p2p on/off switch */
7677 bool scan;
7778 int16 search_state;
7879 s8 vir_ifname[IFNAMSIZ];
7980 unsigned long status;
8081 struct p2p_bss bss[P2PAPI_BSSCFG_MAX];
81
- struct timer_list listen_timer;
82
+ timer_list_compat_t listen_timer;
8283 wl_p2p_sched_t noa;
8384 wl_p2p_ops_t ops;
8485 wlc_ssid_t ssid;
8586 s8 p2p_go_count;
86
- struct bcm_cfg80211 *cfg;
8787 };
8888
89
-#define MAX_VNDR_IE_NUMBER 5
89
+#define MAX_VNDR_IE_NUMBER 10
9090
9191 struct parsed_vndr_ie_info {
92
- char *ie_ptr;
93
- u32 ie_len; /* total length including id & length field */
92
+ const char *ie_ptr;
93
+ u32 ie_len; /**< total length including id & length field */
9494 vndr_ie_t vndrie;
9595 };
9696
....@@ -115,7 +115,6 @@
115115 WLP2P_STATUS_DISC_IN_PROGRESS
116116 };
117117
118
-
119118 #define wl_to_p2p_bss_ndev(cfg, type) ((cfg)->p2p->bss[type].dev)
120119 #define wl_to_p2p_bss_bssidx(cfg, type) ((cfg)->p2p->bss[type].bssidx)
121120 #define wl_to_p2p_bss_macaddr(cfg, type) &((cfg)->p2p->bss[type].mac_addr)
....@@ -137,9 +136,44 @@
137136 /* dword align allocation */
138137 #define WLC_IOCTL_MAXLEN 8192
139138
139
+#ifdef CUSTOMER_HW4_DEBUG
140
+#define CFGP2P_ERROR_TEXT "CFGP2P-INFO2) "
141
+#else
140142 #define CFGP2P_ERROR_TEXT "CFGP2P-ERROR) "
143
+#endif /* CUSTOMER_HW4_DEBUG */
141144
142
-
145
+#ifdef DHD_LOG_DUMP
146
+#define CFGP2P_ERR(args) \
147
+ do { \
148
+ if (wl_dbg_level & WL_DBG_ERR) { \
149
+ printk(KERN_INFO CFGP2P_ERROR_TEXT "%s : ", __func__); \
150
+ printk args; \
151
+ DHD_LOG_DUMP_WRITE("[%s] %s: ", \
152
+ dhd_log_dump_get_timestamp(), __func__); \
153
+ DHD_LOG_DUMP_WRITE args; \
154
+ } \
155
+ } while (0)
156
+#define CFGP2P_INFO(args) \
157
+ do { \
158
+ if (wl_dbg_level & WL_DBG_INFO) { \
159
+ printk(KERN_INFO "CFGP2P-INFO) %s : ", __func__); \
160
+ printk args; \
161
+ DHD_LOG_DUMP_WRITE("[%s] %s: ", \
162
+ dhd_log_dump_get_timestamp(), __func__); \
163
+ DHD_LOG_DUMP_WRITE args; \
164
+ } \
165
+ } while (0)
166
+#define CFGP2P_ACTION(args) \
167
+ do { \
168
+ if (wl_dbg_level & WL_DBG_P2P_ACTION) { \
169
+ printk(KERN_DEBUG "CFGP2P-ACTION) %s :", __func__); \
170
+ printk args; \
171
+ DHD_LOG_DUMP_WRITE("[%s] %s: ", \
172
+ dhd_log_dump_get_timestamp(), __func__); \
173
+ DHD_LOG_DUMP_WRITE args; \
174
+ } \
175
+ } while (0)
176
+#else
143177 #define CFGP2P_ERR(args) \
144178 do { \
145179 if (wl_dbg_level & WL_DBG_ERR) { \
....@@ -154,6 +188,15 @@
154188 printk args; \
155189 } \
156190 } while (0)
191
+#define CFGP2P_ACTION(args) \
192
+ do { \
193
+ if (wl_dbg_level & WL_DBG_P2P_ACTION) { \
194
+ printk(KERN_DEBUG "CFGP2P-ACTION) %s :", __func__); \
195
+ printk args; \
196
+ } \
197
+ } while (0)
198
+#endif /* DHD_LOG_DUMP */
199
+
157200 #define CFGP2P_DBG(args) \
158201 do { \
159202 if (wl_dbg_level & WL_DBG_DBG) { \
....@@ -162,41 +205,23 @@
162205 } \
163206 } while (0)
164207
165
-#define CFGP2P_ACTION(args) \
166
- do { \
167
- if (wl_dbg_level & WL_DBG_P2P_ACTION) { \
168
- printk(KERN_DEBUG "CFGP2P-ACTION) %s :", __func__); \
169
- printk args; \
170
- } \
171
- } while (0)
172
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
173208 #define INIT_TIMER(timer, func, duration, extra_delay) \
174209 do { \
175
- timer_setup(timer, func, 0); \
176
- timer->expires = jiffies + msecs_to_jiffies(duration + extra_delay); \
210
+ init_timer_compat(timer, func, cfg); \
211
+ timer_expires(timer) = jiffies + msecs_to_jiffies(duration + extra_delay); \
177212 add_timer(timer); \
178213 } while (0);
179
-#else
180
-#define INIT_TIMER(timer, func, duration, extra_delay) \
181
- do { \
182
- init_timer(timer); \
183
- timer->function = func; \
184
- timer->expires = jiffies + msecs_to_jiffies(duration + extra_delay); \
185
- timer->data = (unsigned long) cfg; \
186
- add_timer(timer); \
187
- } while (0);
188
-#endif
189214
190215 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) && !defined(WL_CFG80211_P2P_DEV_IF)
191216 #define WL_CFG80211_P2P_DEV_IF
192217
193218 #ifdef WL_ENABLE_P2P_IF
194219 #undef WL_ENABLE_P2P_IF
195
-#endif
220
+#endif // endif
196221
197222 #ifdef WL_SUPPORT_BACKPORTED_KPATCHES
198223 #undef WL_SUPPORT_BACKPORTED_KPATCHES
199
-#endif
224
+#endif // endif
200225 #else
201226 #ifdef WLP2P
202227 #ifndef WL_ENABLE_P2P_IF
....@@ -207,6 +232,9 @@
207232 #endif /* (LINUX_VERSION >= VERSION(3, 8, 0)) */
208233
209234 #ifndef WL_CFG80211_P2P_DEV_IF
235
+#ifdef WL_NEWCFG_PRIVCMD_SUPPORT
236
+#undef WL_NEWCFG_PRIVCMD_SUPPORT
237
+#endif // endif
210238 #endif /* WL_CFG80211_P2P_DEV_IF */
211239
212240 #if defined(WL_ENABLE_P2P_IF) && (defined(WL_CFG80211_P2P_DEV_IF) || \
....@@ -228,11 +256,7 @@
228256 #define P2P_ECSA_CNT 50
229257
230258 extern void
231
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
232
-wl_cfgp2p_listen_expired(struct timer_list *t);
233
-#else
234259 wl_cfgp2p_listen_expired(unsigned long data);
235
-#endif
236260 extern bool
237261 wl_cfgp2p_is_pub_action(void *frame, u32 frame_len);
238262 extern bool
....@@ -285,17 +309,17 @@
285309 wl_cfgp2p_act_frm_search(struct bcm_cfg80211 *cfg, struct net_device *ndev,
286310 s32 bssidx, s32 channel, struct ether_addr *tx_dst_addr);
287311
288
-extern wpa_ie_fixed_t *
289
-wl_cfgp2p_find_wpaie(u8 *parse, u32 len);
312
+extern const wpa_ie_fixed_t *
313
+wl_cfgp2p_find_wpaie(const u8 *parse, u32 len);
290314
291
-extern wpa_ie_fixed_t *
292
-wl_cfgp2p_find_wpsie(u8 *parse, u32 len);
315
+extern const wpa_ie_fixed_t *
316
+wl_cfgp2p_find_wpsie(const u8 *parse, u32 len);
293317
294318 extern wifi_p2p_ie_t *
295
-wl_cfgp2p_find_p2pie(u8 *parse, u32 len);
319
+wl_cfgp2p_find_p2pie(const u8 *parse, u32 len);
296320
297
-extern wifi_wfd_ie_t *
298
-wl_cfgp2p_find_wfdie(u8 *parse, u32 len);
321
+extern const wifi_wfd_ie_t *
322
+wl_cfgp2p_find_wfdie(const u8 *parse, u32 len);
299323 extern s32
300324 wl_cfgp2p_set_management_ie(struct bcm_cfg80211 *cfg, struct net_device *ndev, s32 bssidx,
301325 s32 pktflag, const u8 *vndr_ie, u32 vndr_ie_len);
....@@ -306,7 +330,6 @@
306330 wl_cfgp2p_find_ndev(struct bcm_cfg80211 *cfg, s32 bssidx);
307331 extern s32
308332 wl_cfgp2p_find_type(struct bcm_cfg80211 *cfg, s32 bssidx, s32 *type);
309
-
310333
311334 extern s32
312335 wl_cfgp2p_listen_complete(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev,
....@@ -330,12 +353,6 @@
330353
331354 extern void
332355 wl_cfg80211_change_ifaddr(u8* buf, struct ether_addr *p2p_int_addr, u8 element_id);
333
-extern bool
334
-wl_cfgp2p_bss_isup(struct net_device *ndev, int bsscfg_idx);
335
-
336
-extern s32
337
-wl_cfgp2p_bss(struct bcm_cfg80211 *cfg, struct net_device *ndev, s32 bsscfg_idx, s32 up);
338
-
339356
340357 extern s32
341358 wl_cfgp2p_supported(struct bcm_cfg80211 *cfg, struct net_device *ndev);
....@@ -355,13 +372,16 @@
355372 extern s32
356373 wl_cfgp2p_set_p2p_ecsa(struct bcm_cfg80211 *cfg, struct net_device *ndev, char* buf, int len);
357374
358
-extern u8 *
359
-wl_cfgp2p_retreive_p2pattrib(void *buf, u8 element_id);
375
+extern s32
376
+wl_cfgp2p_increase_p2p_bw(struct bcm_cfg80211 *cfg, struct net_device *ndev, char* buf, int len);
360377
361
-extern u8*
362
-wl_cfgp2p_find_attrib_in_all_p2p_Ies(u8 *parse, u32 len, u32 attrib);
378
+extern const u8 *
379
+wl_cfgp2p_retreive_p2pattrib(const void *buf, u8 element_id);
363380
364
-extern u8 *
381
+extern const u8*
382
+wl_cfgp2p_find_attrib_in_all_p2p_Ies(const u8 *parse, u32 len, u32 attrib);
383
+
384
+extern const u8 *
365385 wl_cfgp2p_retreive_p2p_dev_addr(wl_bss_info_t *bi, u32 bi_length);
366386
367387 extern s32
....@@ -375,7 +395,7 @@
375395
376396 extern u32
377397 wl_cfgp2p_vndr_ie(struct bcm_cfg80211 *cfg, u8 *iebuf, s32 pktflag,
378
- s8 *oui, s32 ie_id, s8 *data, s32 datalen, const s8* add_del_cmd);
398
+ s8 *oui, s32 ie_id, const s8 *data, s32 datalen, const s8* add_del_cmd);
379399
380400 extern int wl_cfgp2p_get_conn_idx(struct bcm_cfg80211 *cfg);
381401
....@@ -419,6 +439,7 @@
419439 #define WL_P2P_WILDCARD_SSID_LEN 7
420440 #define WL_P2P_INTERFACE_PREFIX "p2p"
421441 #define WL_P2P_TEMP_CHAN 11
442
+#define WL_P2P_TEMP_CHAN_5G 36
422443 #define WL_P2P_AF_STATUS_OFFSET 9
423444
424445 /* If the provision discovery is for JOIN operations,