blob: 7259990b0e21e1f7ab02f910975371d1231d6a5a [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Manikandan Mohan5b1980a2016-05-06 12:41:18 -07002 * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
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/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28/*===========================================================================
29 \file wlan_nlink_common.h
30
31 Exports and types for the Netlink Service interface. This header file contains
32 message types and definitions that is shared between the user space service
33 (e.g. logging service) and WLAN kernel module.
34
35 ===========================================================================*/
36
37#ifndef WLAN_NLINK_COMMON_H__
38#define WLAN_NLINK_COMMON_H__
39
40#include <linux/netlink.h>
Nirav Shahbd36b062016-07-18 11:12:59 +053041#include <linux/if.h>
42
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080043
44/*---------------------------------------------------------------------------
45 * External Functions
46 *-------------------------------------------------------------------------*/
47
48/*---------------------------------------------------------------------------
49 * Preprocessor Definitions and Constants
50 *-------------------------------------------------------------------------*/
51#define WLAN_NL_MAX_PAYLOAD 256 /* maximum size for netlink message */
52#define WLAN_NLINK_PROTO_FAMILY NETLINK_USERSOCK
53#define WLAN_NLINK_MCAST_GRP_ID 0x01
54
55/*---------------------------------------------------------------------------
56 * Type Declarations
57 *-------------------------------------------------------------------------*/
58
59/*
60 * The following enum defines the target service within WLAN driver for which the
61 * message is intended for. Each service along with its counterpart
62 * in the user space, define a set of messages they recognize.
63 * Each of this message will have an header of type tAniMsgHdr defined below.
64 * Each Netlink message to/from a kernel module will contain only one
65 * message which is preceded by a tAniMsgHdr. The maximun size (in bytes) of
66 * a netlink message is assumed to be MAX_PAYLOAD bytes.
67 *
68 * +------------+-------+----------+----------+
69 * |Netlink hdr | Align |tAniMsgHdr| msg body |
70 * +------------+-------+----------|----------+
71 */
72
73/* Message Types */
74#define WLAN_SVC_FW_CRASHED_IND 0x100
75#define WLAN_SVC_LTE_COEX_IND 0x101
76#define WLAN_SVC_WLAN_AUTO_SHUTDOWN_IND 0x102
77#define WLAN_SVC_DFS_CAC_START_IND 0x103
78#define WLAN_SVC_DFS_CAC_END_IND 0x104
79#define WLAN_SVC_DFS_RADAR_DETECT_IND 0x105
80#define WLAN_SVC_WLAN_STATUS_IND 0x106
81#define WLAN_SVC_WLAN_VERSION_IND 0x107
82#define WLAN_SVC_DFS_ALL_CHANNEL_UNAVAIL_IND 0x108
83#define WLAN_SVC_WLAN_TP_IND 0x109
Nirav Shahbd36b062016-07-18 11:12:59 +053084#define WLAN_SVC_RPS_ENABLE_IND 0x10A
Mohit Khannae71e2262015-11-10 09:37:24 -080085#define WLAN_SVC_WLAN_TP_TX_IND 0x10B
Manikandan Mohan5b1980a2016-05-06 12:41:18 -070086#define WLAN_SVC_WLAN_AUTO_SHUTDOWN_CANCEL_IND 0x10C
Kondabattini, Ganesh96ac37b2016-09-02 23:12:15 +053087#define WLAN_SVC_WLAN_RADIO_INDEX 0x10D
Komal Seelam78ff65a2016-08-18 15:25:24 +053088#define WLAN_SVC_FW_SHUTDOWN_IND 0x10E
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080089#define WLAN_SVC_MAX_SSID_LEN 32
90#define WLAN_SVC_MAX_BSSID_LEN 6
91#define WLAN_SVC_MAX_STR_LEN 16
92#define WLAN_SVC_MAX_NUM_CHAN 128
93#define WLAN_SVC_COUNTRY_CODE_LEN 3
94
95#define ANI_NL_MSG_BASE 0x10 /* Some arbitrary base */
96
97typedef enum eAniNlModuleTypes {
98 ANI_NL_MSG_PUMAC = ANI_NL_MSG_BASE + 0x01, /* PTT Socket App */
99 ANI_NL_MSG_PTT = ANI_NL_MSG_BASE + 0x07, /* Quarky GUI */
100 WLAN_NL_MSG_OEM = ANI_NL_MSG_BASE + 0x09,
101 WLAN_NL_MSG_SVC,
102 WLAN_NL_MSG_CNSS_DIAG = ANI_NL_MSG_BASE + 0x0B, /* Value needs to be 27 */
103 ANI_NL_MSG_LOG,
104 ANI_NL_MSG_MAX
105} tAniNlModTypes, tWlanNlModTypes;
106
107#define WLAN_NL_MSG_BASE ANI_NL_MSG_BASE
108#define WLAN_NL_MSG_MAX ANI_NL_MSG_MAX
109
110/* All Netlink messages must contain this header */
111typedef struct sAniHdr {
112 unsigned short type;
113 unsigned short length;
114} tAniHdr, tAniMsgHdr;
115
Ryan Hsuceddceb2016-04-28 10:20:14 -0700116typedef struct sAniNlMsg {
117 struct nlmsghdr nlh; /* Netlink Header */
118 int radio; /* unit number of the radio */
119 tAniHdr wmsg; /* Airgo Message Header */
120} tAniNlHdr;
121
Kondabattini, Ganesh96ac37b2016-09-02 23:12:15 +0530122struct radio_index_tlv {
123 unsigned short type;
124 unsigned short length;
125 int radio;
126};
127
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800128struct wlan_status_data {
129 uint8_t lpss_support;
130 uint8_t is_on;
131 uint8_t vdev_id;
132 uint8_t is_connected;
133 int8_t rssi;
134 uint8_t ssid_len;
135 uint8_t country_code[WLAN_SVC_COUNTRY_CODE_LEN];
136 uint32_t vdev_mode;
137 uint32_t freq;
138 uint32_t numChannels;
139 uint8_t channel_list[WLAN_SVC_MAX_NUM_CHAN];
140 uint8_t ssid[WLAN_SVC_MAX_SSID_LEN];
141 uint8_t bssid[WLAN_SVC_MAX_BSSID_LEN];
142};
143
144struct wlan_version_data {
145 uint32_t chip_id;
146 char chip_name[WLAN_SVC_MAX_STR_LEN];
147 char chip_from[WLAN_SVC_MAX_STR_LEN];
148 char host_version[WLAN_SVC_MAX_STR_LEN];
149 char fw_version[WLAN_SVC_MAX_STR_LEN];
150};
151
152struct wlan_dfs_info {
153 uint16_t channel;
154 uint8_t country_code[WLAN_SVC_COUNTRY_CODE_LEN];
155};
156
Nirav Shahbd36b062016-07-18 11:12:59 +0530157/*
158 * Maximim number of queues supported by WLAN driver. Setting an upper
159 * limit. Actual number of queues may be smaller than this value.
160 */
161#define WLAN_SVC_IFACE_NUM_QUEUES 6
162
163/**
164 * struct wlan_rps_data - structure to send RPS info to cnss-daemon
165 * @ifname: interface name for which the RPS data belongs to
166 * @num_queues: number of rx queues for which RPS data is being sent
167 * @cpu_map_list: array of cpu maps for different rx queues supported by
168 * the wlan driver
169 *
170 * The structure specifies the format of data exchanged between wlan
171 * driver and cnss-daemon. On receipt of the data, cnss-daemon is expected
172 * to apply the 'cpu_map' for each rx queue belonging to the interface 'ifname'
173 */
174struct wlan_rps_data {
175 char ifname[IFNAMSIZ];
176 uint16_t num_queues;
177 uint16_t cpu_map_list[WLAN_SVC_IFACE_NUM_QUEUES];
178};
179
Mohit Khannae71e2262015-11-10 09:37:24 -0800180/**
181 * enum wlan_tp_level - indicates wlan throughput level
182 * @WLAN_SVC_TP_NONE: used for initialization
183 * @WLAN_SVC_TP_LOW: used to identify low throughput level
184 * @WLAN_SVC_TP_MEDIUM: used to identify medium throughput level
185 * @WLAN_SVC_TP_HIGH: used to identify high throughput level
186 *
187 * The different throughput levels are determined on the basis of # of tx and
188 * rx packets and other threshold values. For example, if the # of total
189 * packets sent or received by the driver is greater than 500 in the last 100ms
190 * , the driver has a high throughput requirement. The driver may tweak certain
191 * system parameters based on the throughput level.
192 */
193enum wlan_tp_level {
194 WLAN_SVC_TP_NONE,
195 WLAN_SVC_TP_LOW,
196 WLAN_SVC_TP_MEDIUM,
197 WLAN_SVC_TP_HIGH,
198};
199
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800200#endif /* WLAN_NLINK_COMMON_H__ */