wlan_nlink_common.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. /*
  2. * Copyright (c) 2014-2017 The Linux Foundation. All rights reserved.
  3. *
  4. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  5. *
  6. *
  7. * Permission to use, copy, modify, and/or distribute this software for
  8. * any purpose with or without fee is hereby granted, provided that the
  9. * above copyright notice and this permission notice appear in all
  10. * copies.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  13. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  14. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  15. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  16. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  17. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  18. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  19. * PERFORMANCE OF THIS SOFTWARE.
  20. */
  21. /*
  22. * This file was originally distributed by Qualcomm Atheros, Inc.
  23. * under proprietary terms before Copyright ownership was assigned
  24. * to the Linux Foundation.
  25. */
  26. /*===========================================================================
  27. \file wlan_nlink_common.h
  28. Exports and types for the Netlink Service interface. This header file contains
  29. message types and definitions that is shared between the user space service
  30. (e.g. logging service) and WLAN kernel module.
  31. ===========================================================================*/
  32. #ifndef WLAN_NLINK_COMMON_H__
  33. #define WLAN_NLINK_COMMON_H__
  34. #include <linux/netlink.h>
  35. #include <linux/if.h>
  36. /*---------------------------------------------------------------------------
  37. * External Functions
  38. *-------------------------------------------------------------------------*/
  39. /*---------------------------------------------------------------------------
  40. * Preprocessor Definitions and Constants
  41. *-------------------------------------------------------------------------*/
  42. #define WLAN_NL_MAX_PAYLOAD 256 /* maximum size for netlink message */
  43. #define WLAN_NLINK_PROTO_FAMILY NETLINK_USERSOCK
  44. #define WLAN_NLINK_MCAST_GRP_ID 0x01
  45. /*---------------------------------------------------------------------------
  46. * Type Declarations
  47. *-------------------------------------------------------------------------*/
  48. /*
  49. * The following enum defines the target service within WLAN driver for which the
  50. * message is intended for. Each service along with its counterpart
  51. * in the user space, define a set of messages they recognize.
  52. * Each of this message will have an header of type tAniMsgHdr defined below.
  53. * Each Netlink message to/from a kernel module will contain only one
  54. * message which is preceded by a tAniMsgHdr. The maximun size (in bytes) of
  55. * a netlink message is assumed to be MAX_PAYLOAD bytes.
  56. *
  57. * +------------+-------+----------+----------+
  58. * |Netlink hdr | Align |tAniMsgHdr| msg body |
  59. * +------------+-------+----------|----------+
  60. */
  61. /* Message Types */
  62. #define WLAN_SVC_FW_CRASHED_IND 0x100
  63. #define WLAN_SVC_LTE_COEX_IND 0x101
  64. #define WLAN_SVC_WLAN_AUTO_SHUTDOWN_IND 0x102
  65. #define WLAN_SVC_DFS_CAC_START_IND 0x103
  66. #define WLAN_SVC_DFS_CAC_END_IND 0x104
  67. #define WLAN_SVC_DFS_RADAR_DETECT_IND 0x105
  68. #define WLAN_SVC_WLAN_STATUS_IND 0x106
  69. #define WLAN_SVC_WLAN_VERSION_IND 0x107
  70. #define WLAN_SVC_DFS_ALL_CHANNEL_UNAVAIL_IND 0x108
  71. #define WLAN_SVC_WLAN_TP_IND 0x109
  72. #define WLAN_SVC_RPS_ENABLE_IND 0x10A
  73. #define WLAN_SVC_WLAN_TP_TX_IND 0x10B
  74. #define WLAN_SVC_WLAN_AUTO_SHUTDOWN_CANCEL_IND 0x10C
  75. #define WLAN_SVC_WLAN_RADIO_INDEX 0x10D
  76. #define WLAN_SVC_FW_SHUTDOWN_IND 0x10E
  77. #define WLAN_SVC_MAX_SSID_LEN 32
  78. #define WLAN_SVC_MAX_BSSID_LEN 6
  79. #define WLAN_SVC_MAX_STR_LEN 16
  80. #define WLAN_SVC_MAX_NUM_CHAN 128
  81. #define WLAN_SVC_COUNTRY_CODE_LEN 3
  82. #define ANI_NL_MSG_BASE 0x10 /* Some arbitrary base */
  83. typedef enum eAniNlModuleTypes {
  84. ANI_NL_MSG_PUMAC = ANI_NL_MSG_BASE + 0x01, /* PTT Socket App */
  85. ANI_NL_MSG_PTT = ANI_NL_MSG_BASE + 0x07, /* Quarky GUI */
  86. WLAN_NL_MSG_OEM = ANI_NL_MSG_BASE + 0x09,
  87. WLAN_NL_MSG_SVC,
  88. WLAN_NL_MSG_CNSS_DIAG = ANI_NL_MSG_BASE + 0x0B, /* Value needs to be 27 */
  89. ANI_NL_MSG_LOG,
  90. ANI_NL_MSG_MAX
  91. } tAniNlModTypes, tWlanNlModTypes;
  92. #define WLAN_NL_MSG_BASE ANI_NL_MSG_BASE
  93. #define WLAN_NL_MSG_MAX ANI_NL_MSG_MAX
  94. /* All Netlink messages must contain this header */
  95. typedef struct sAniHdr {
  96. unsigned short type;
  97. unsigned short length;
  98. } tAniHdr, tAniMsgHdr;
  99. typedef struct sAniNlMsg {
  100. struct nlmsghdr nlh; /* Netlink Header */
  101. int radio; /* unit number of the radio */
  102. tAniHdr wmsg; /* Airgo Message Header */
  103. } tAniNlHdr;
  104. struct radio_index_tlv {
  105. unsigned short type;
  106. unsigned short length;
  107. int radio;
  108. };
  109. struct wlan_status_data {
  110. uint8_t lpss_support;
  111. uint8_t is_on;
  112. uint8_t vdev_id;
  113. uint8_t is_connected;
  114. int8_t rssi;
  115. uint8_t ssid_len;
  116. uint8_t country_code[WLAN_SVC_COUNTRY_CODE_LEN];
  117. uint32_t vdev_mode;
  118. uint32_t freq;
  119. uint32_t numChannels;
  120. uint8_t channel_list[WLAN_SVC_MAX_NUM_CHAN];
  121. uint8_t ssid[WLAN_SVC_MAX_SSID_LEN];
  122. uint8_t bssid[WLAN_SVC_MAX_BSSID_LEN];
  123. };
  124. struct wlan_version_data {
  125. uint32_t chip_id;
  126. char chip_name[WLAN_SVC_MAX_STR_LEN];
  127. char chip_from[WLAN_SVC_MAX_STR_LEN];
  128. char host_version[WLAN_SVC_MAX_STR_LEN];
  129. char fw_version[WLAN_SVC_MAX_STR_LEN];
  130. };
  131. struct wlan_dfs_info {
  132. uint16_t channel;
  133. uint8_t country_code[WLAN_SVC_COUNTRY_CODE_LEN];
  134. };
  135. /*
  136. * Maximim number of queues supported by WLAN driver. Setting an upper
  137. * limit. Actual number of queues may be smaller than this value.
  138. */
  139. #define WLAN_SVC_IFACE_NUM_QUEUES 6
  140. /**
  141. * struct wlan_rps_data - structure to send RPS info to cnss-daemon
  142. * @ifname: interface name for which the RPS data belongs to
  143. * @num_queues: number of rx queues for which RPS data is being sent
  144. * @cpu_map_list: array of cpu maps for different rx queues supported by
  145. * the wlan driver
  146. *
  147. * The structure specifies the format of data exchanged between wlan
  148. * driver and cnss-daemon. On receipt of the data, cnss-daemon is expected
  149. * to apply the 'cpu_map' for each rx queue belonging to the interface 'ifname'
  150. */
  151. struct wlan_rps_data {
  152. char ifname[IFNAMSIZ];
  153. uint16_t num_queues;
  154. uint16_t cpu_map_list[WLAN_SVC_IFACE_NUM_QUEUES];
  155. };
  156. /**
  157. * enum wlan_tp_level - indicates wlan throughput level
  158. * @WLAN_SVC_TP_NONE: used for initialization
  159. * @WLAN_SVC_TP_LOW: used to identify low throughput level
  160. * @WLAN_SVC_TP_MEDIUM: used to identify medium throughput level
  161. * @WLAN_SVC_TP_HIGH: used to identify high throughput level
  162. *
  163. * The different throughput levels are determined on the basis of # of tx and
  164. * rx packets and other threshold values. For example, if the # of total
  165. * packets sent or received by the driver is greater than 500 in the last 100ms
  166. * , the driver has a high throughput requirement. The driver may tweak certain
  167. * system parameters based on the throughput level.
  168. */
  169. enum wlan_tp_level {
  170. WLAN_SVC_TP_NONE,
  171. WLAN_SVC_TP_LOW,
  172. WLAN_SVC_TP_MEDIUM,
  173. WLAN_SVC_TP_HIGH,
  174. };
  175. #endif /* WLAN_NLINK_COMMON_H__ */