| .. | .. |
|---|
| 1 | | -/* SPDX-License-Identifier: GPL-2.0 */ |
|---|
| 2 | 1 | /* |
|---|
| 3 | 2 | * Linux cfg80211 driver - Android related functions |
|---|
| 4 | 3 | * |
|---|
| 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 | + * |
|---|
| 7 | 8 | * Unless you and Broadcom execute a separate written software license |
|---|
| 8 | 9 | * agreement governing use of this software, this software is licensed to you |
|---|
| 9 | 10 | * under the terms of the GNU General Public License version 2 (the "GPL"), |
|---|
| 10 | 11 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the |
|---|
| 11 | 12 | * following added to such license: |
|---|
| 12 | | - * |
|---|
| 13 | + * |
|---|
| 13 | 14 | * As a special exception, the copyright holders of this software give you |
|---|
| 14 | 15 | * permission to link this software with independent modules, and to copy and |
|---|
| 15 | 16 | * distribute the resulting executable under terms of your choice, provided that |
|---|
| .. | .. |
|---|
| 17 | 18 | * the license of that module. An independent module is a module which is not |
|---|
| 18 | 19 | * derived from this software. The special exception does not apply to any |
|---|
| 19 | 20 | * modifications of the software. |
|---|
| 20 | | - * |
|---|
| 21 | + * |
|---|
| 21 | 22 | * Notwithstanding the above, under no circumstances may you combine this |
|---|
| 22 | 23 | * software in any way with any other Broadcom software provided under a license |
|---|
| 23 | 24 | * other than the GPL, without Broadcom's express prior written consent. |
|---|
| .. | .. |
|---|
| 25 | 26 | * |
|---|
| 26 | 27 | * <<Broadcom-WL-IPTag/Open:>> |
|---|
| 27 | 28 | * |
|---|
| 28 | | - * $Id: wl_android.h 587146 2015-09-18 03:50:09Z $ |
|---|
| 29 | + * $Id: wl_android.h 794110 2018-12-12 05:03:21Z $ |
|---|
| 29 | 30 | */ |
|---|
| 30 | 31 | |
|---|
| 31 | 32 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 35 | 36 | /* If any feature uses the Generic Netlink Interface, put it here to enable WL_GENL |
|---|
| 36 | 37 | * automatically |
|---|
| 37 | 38 | */ |
|---|
| 38 | | -#if defined(BT_WIFI_HANDOVER) || defined(WL_NAN) |
|---|
| 39 | +#if defined(BT_WIFI_HANDOVER) |
|---|
| 39 | 40 | #define WL_GENL |
|---|
| 40 | | -#endif |
|---|
| 41 | +#endif // endif |
|---|
| 41 | 42 | |
|---|
| 42 | | - |
|---|
| 43 | +#ifdef WL_GENL |
|---|
| 44 | +#include <net/genetlink.h> |
|---|
| 45 | +#endif // endif |
|---|
| 43 | 46 | |
|---|
| 44 | 47 | typedef struct _android_wifi_priv_cmd { |
|---|
| 45 | 48 | char *buf; |
|---|
| 46 | 49 | int used_len; |
|---|
| 47 | 50 | int total_len; |
|---|
| 48 | 51 | } android_wifi_priv_cmd; |
|---|
| 49 | | - |
|---|
| 50 | | -#ifdef CONFIG_COMPAT |
|---|
| 51 | | -typedef struct _compat_android_wifi_priv_cmd { |
|---|
| 52 | | - compat_caddr_t buf; |
|---|
| 53 | | - int used_len; |
|---|
| 54 | | - int total_len; |
|---|
| 55 | | -} compat_android_wifi_priv_cmd; |
|---|
| 56 | | -#endif /* CONFIG_COMPAT */ |
|---|
| 57 | 52 | |
|---|
| 58 | 53 | /** |
|---|
| 59 | 54 | * Android platform dependent functions, feel free to add Android specific functions here |
|---|
| .. | .. |
|---|
| 70 | 65 | void wl_android_post_init(void); |
|---|
| 71 | 66 | int wl_android_wifi_on(struct net_device *dev); |
|---|
| 72 | 67 | int wl_android_wifi_off(struct net_device *dev, bool on_failure); |
|---|
| 73 | | -int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd); |
|---|
| 68 | +int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr); |
|---|
| 74 | 69 | int wl_handle_private_cmd(struct net_device *net, char *command, u32 cmd_len); |
|---|
| 75 | 70 | |
|---|
| 76 | | -s32 wl_netlink_send_msg(int pid, int type, int seq, void *data, size_t size); |
|---|
| 71 | +#ifdef WL_GENL |
|---|
| 72 | +typedef struct bcm_event_hdr { |
|---|
| 73 | + u16 event_type; |
|---|
| 74 | + u16 len; |
|---|
| 75 | +} bcm_event_hdr_t; |
|---|
| 76 | + |
|---|
| 77 | +/* attributes (variables): the index in this enum is used as a reference for the type, |
|---|
| 78 | + * userspace application has to indicate the corresponding type |
|---|
| 79 | + * the policy is used for security considerations |
|---|
| 80 | + */ |
|---|
| 81 | +enum { |
|---|
| 82 | + BCM_GENL_ATTR_UNSPEC, |
|---|
| 83 | + BCM_GENL_ATTR_STRING, |
|---|
| 84 | + BCM_GENL_ATTR_MSG, |
|---|
| 85 | + __BCM_GENL_ATTR_MAX |
|---|
| 86 | +}; |
|---|
| 87 | +#define BCM_GENL_ATTR_MAX (__BCM_GENL_ATTR_MAX - 1) |
|---|
| 88 | + |
|---|
| 89 | +/* commands: enumeration of all commands (functions), |
|---|
| 90 | + * used by userspace application to identify command to be ececuted |
|---|
| 91 | + */ |
|---|
| 92 | +enum { |
|---|
| 93 | + BCM_GENL_CMD_UNSPEC, |
|---|
| 94 | + BCM_GENL_CMD_MSG, |
|---|
| 95 | + __BCM_GENL_CMD_MAX |
|---|
| 96 | +}; |
|---|
| 97 | +#define BCM_GENL_CMD_MAX (__BCM_GENL_CMD_MAX - 1) |
|---|
| 98 | + |
|---|
| 99 | +/* Enum values used by the BCM supplicant to identify the events */ |
|---|
| 100 | +enum { |
|---|
| 101 | + BCM_E_UNSPEC, |
|---|
| 102 | + BCM_E_SVC_FOUND, |
|---|
| 103 | + BCM_E_DEV_FOUND, |
|---|
| 104 | + BCM_E_DEV_LOST, |
|---|
| 105 | +#ifdef BT_WIFI_HANDOVER |
|---|
| 106 | + BCM_E_DEV_BT_WIFI_HO_REQ, |
|---|
| 107 | +#endif // endif |
|---|
| 108 | + BCM_E_MAX |
|---|
| 109 | +}; |
|---|
| 110 | + |
|---|
| 111 | +s32 wl_genl_send_msg(struct net_device *ndev, u32 event_type, |
|---|
| 112 | + const u8 *string, u16 len, u8 *hdr, u16 hdrlen); |
|---|
| 113 | +#endif /* WL_GENL */ |
|---|
| 114 | +s32 wl_netlink_send_msg(int pid, int type, int seq, const void *data, size_t size); |
|---|
| 77 | 115 | |
|---|
| 78 | 116 | /* hostap mac mode */ |
|---|
| 79 | 117 | #define MACLIST_MODE_DISABLED 0 |
|---|
| .. | .. |
|---|
| 93 | 131 | #define MAX_NUM_MAC_FILT 10 |
|---|
| 94 | 132 | |
|---|
| 95 | 133 | int wl_android_set_ap_mac_list(struct net_device *dev, int macmode, struct maclist *maclist); |
|---|
| 134 | +#ifdef WL_BCNRECV |
|---|
| 135 | +extern int wl_android_bcnrecv_config(struct net_device *ndev, char *data, |
|---|
| 136 | + int total_len); |
|---|
| 137 | +extern int wl_android_bcnrecv_stop(struct net_device *ndev, uint reason); |
|---|
| 138 | +extern int wl_android_bcnrecv_resume(struct net_device *ndev); |
|---|
| 139 | +extern int wl_android_bcnrecv_suspend(struct net_device *ndev); |
|---|
| 140 | +extern int wl_android_bcnrecv_event(struct net_device *ndev, |
|---|
| 141 | + uint attr_type, uint status, uint reason, uint8 *data, uint data_len); |
|---|
| 142 | +#endif /* WL_BCNRECV */ |
|---|
| 143 | +#ifdef WL_CAC_TS |
|---|
| 144 | +#define TSPEC_UPLINK_DIRECTION (0 << 5) /* uplink direction traffic stream */ |
|---|
| 145 | +#define TSPEC_DOWNLINK_DIRECTION (1 << 5) /* downlink direction traffic stream */ |
|---|
| 146 | +#define TSPEC_BI_DIRECTION (3 << 5) /* bi direction traffic stream */ |
|---|
| 147 | +#define TSPEC_EDCA_ACCESS (1 << 7) /* EDCA access policy */ |
|---|
| 148 | +#define TSPEC_UAPSD_PSB (1 << 2) /* U-APSD power saving behavior */ |
|---|
| 149 | +#define TSPEC_TSINFO_TID_SHIFT 1 /* TID Shift */ |
|---|
| 150 | +#define TSPEC_TSINFO_PRIO_SHIFT 3 /* PRIO Shift */ |
|---|
| 151 | +#define TSPEC_MAX_ACCESS_CATEGORY 3 |
|---|
| 152 | +#define TSPEC_MAX_USER_PRIO 7 |
|---|
| 153 | +#define TSPEC_MAX_DIALOG_TOKEN 255 |
|---|
| 154 | +#define TSPEC_MAX_SURPLUS_BW 12410 |
|---|
| 155 | +#define TSPEC_MIN_SURPLUS_BW 11210 |
|---|
| 156 | +#define TSPEC_MAX_MSDU_SIZE 1520 |
|---|
| 157 | +#define TSPEC_DEF_MEAN_DATA_RATE 120000 |
|---|
| 158 | +#define TSPEC_DEF_MIN_PHY_RATE 6000000 |
|---|
| 159 | +#define TSPEC_DEF_DIALOG_TOKEN 7 |
|---|
| 160 | +#endif /* WL_CAC_TS */ |
|---|