wl_android.h 5.6 KB

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