source: G950FXXS5DSI1
[GitHub/exynos8895/android_kernel_samsung_universal8895.git] / drivers / net / wireless / bcmdhd4361 / wl_android.h
CommitLineData
1cac41cb
MB
1/*
2 * Linux cfg80211 driver - Android related functions
3 *
4 * Copyright (C) 1999-2019, Broadcom.
5 *
6 * Unless you and Broadcom execute a separate written software license
7 * agreement governing use of this software, this software is licensed to you
8 * under the terms of the GNU General Public License version 2 (the "GPL"),
9 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
10 * following added to such license:
11 *
12 * As a special exception, the copyright holders of this software give you
13 * permission to link this software with independent modules, and to copy and
14 * distribute the resulting executable under terms of your choice, provided that
15 * you also meet, for each linked independent module, the terms and conditions of
16 * the license of that module. An independent module is a module which is not
17 * derived from this software. The special exception does not apply to any
18 * modifications of the software.
19 *
20 * Notwithstanding the above, under no circumstances may you combine this
21 * software in any way with any other Broadcom software provided under a license
22 * other than the GPL, without Broadcom's express prior written consent.
23 *
24 *
25 * <<Broadcom-WL-IPTag/Open:>>
26 *
5a068558 27 * $Id: wl_android.h 818247 2019-05-07 04:15:13Z $
1cac41cb
MB
28 */
29
30#include <linux/module.h>
31#include <linux/netdevice.h>
32#include <wldev_common.h>
33
34/* If any feature uses the Generic Netlink Interface, put it here to enable WL_GENL
35 * automatically
36 */
37#if defined(BT_WIFI_HANDOVER)
38#define WL_GENL
39#endif // endif
40
41#ifdef WL_GENL
42#include <net/genetlink.h>
43#endif // endif
44
45typedef struct _android_wifi_priv_cmd {
46 char *buf;
47 int used_len;
48 int total_len;
49} android_wifi_priv_cmd;
50
51#ifdef CONFIG_COMPAT
52typedef struct _compat_android_wifi_priv_cmd {
53 compat_caddr_t buf;
54 int used_len;
55 int total_len;
56} compat_android_wifi_priv_cmd;
57#endif /* CONFIG_COMPAT */
58
59/**
60 * Android platform dependent functions, feel free to add Android specific functions here
61 * (save the macros in dhd). Please do NOT declare functions that are NOT exposed to dhd
62 * or cfg, define them as static in wl_android.c
63 */
64
65/**
66 * wl_android_init will be called from module init function (dhd_module_init now), similarly
67 * wl_android_exit will be called from module exit function (dhd_module_cleanup now)
68 */
69int wl_android_init(void);
70int wl_android_exit(void);
71void wl_android_post_init(void);
72int wl_android_wifi_on(struct net_device *dev);
73int wl_android_wifi_off(struct net_device *dev, bool on_failure);
74int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr);
75int wl_handle_private_cmd(struct net_device *net, char *command, u32 cmd_len);
76
77#ifdef WL_GENL
78typedef struct bcm_event_hdr {
79 u16 event_type;
80 u16 len;
81} bcm_event_hdr_t;
82
83/* attributes (variables): the index in this enum is used as a reference for the type,
84 * userspace application has to indicate the corresponding type
85 * the policy is used for security considerations
86 */
87enum {
88 BCM_GENL_ATTR_UNSPEC,
89 BCM_GENL_ATTR_STRING,
90 BCM_GENL_ATTR_MSG,
91 __BCM_GENL_ATTR_MAX
92};
93#define BCM_GENL_ATTR_MAX (__BCM_GENL_ATTR_MAX - 1)
94
95/* commands: enumeration of all commands (functions),
96 * used by userspace application to identify command to be ececuted
97 */
98enum {
99 BCM_GENL_CMD_UNSPEC,
100 BCM_GENL_CMD_MSG,
101 __BCM_GENL_CMD_MAX
102};
103#define BCM_GENL_CMD_MAX (__BCM_GENL_CMD_MAX - 1)
104
105/* Enum values used by the BCM supplicant to identify the events */
106enum {
107 BCM_E_UNSPEC,
108 BCM_E_SVC_FOUND,
109 BCM_E_DEV_FOUND,
110 BCM_E_DEV_LOST,
111#ifdef BT_WIFI_HANDOVER
112 BCM_E_DEV_BT_WIFI_HO_REQ,
113#endif // endif
114 BCM_E_MAX
115};
116
117s32 wl_genl_send_msg(struct net_device *ndev, u32 event_type,
118 const u8 *string, u16 len, u8 *hdr, u16 hdrlen);
119#endif /* WL_GENL */
120s32 wl_netlink_send_msg(int pid, int type, int seq, const void *data, size_t size);
121
122/* hostap mac mode */
123#define MACLIST_MODE_DISABLED 0
124#define MACLIST_MODE_DENY 1
125#define MACLIST_MODE_ALLOW 2
126
127/* max number of assoc list */
128#define MAX_NUM_OF_ASSOCLIST 64
129
130/* Bandwidth */
131#define WL_CH_BANDWIDTH_20MHZ 20
132#define WL_CH_BANDWIDTH_40MHZ 40
133#define WL_CH_BANDWIDTH_80MHZ 80
134/* max number of mac filter list
135 * restrict max number to 10 as maximum cmd string size is 255
136 */
137#define MAX_NUM_MAC_FILT 10
138
139int wl_android_set_ap_mac_list(struct net_device *dev, int macmode, struct maclist *maclist);
5a068558
MB
140#ifdef WL_BCNRECV
141extern int wl_android_bcnrecv_config(struct net_device *ndev, char *data,
142 int total_len);
143extern int wl_android_bcnrecv_stop(struct net_device *ndev, uint reason);
144extern int wl_android_bcnrecv_resume(struct net_device *ndev);
145extern int wl_android_bcnrecv_suspend(struct net_device *ndev);
146extern int wl_android_bcnrecv_event(struct net_device *ndev,
147 uint attr_type, uint status, uint reason, uint8 *data, uint data_len);
148#endif /* WL_BCNRECV */