1*5113495bSYour Name /* 2*5113495bSYour Name * Copyright (c) 2014-2019 The Linux Foundation. All rights reserved. 3*5113495bSYour Name * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. 4*5113495bSYour Name * 5*5113495bSYour Name * Permission to use, copy, modify, and/or distribute this software for 6*5113495bSYour Name * any purpose with or without fee is hereby granted, provided that the 7*5113495bSYour Name * above copyright notice and this permission notice appear in all 8*5113495bSYour Name * copies. 9*5113495bSYour Name * 10*5113495bSYour Name * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 11*5113495bSYour Name * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 12*5113495bSYour Name * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 13*5113495bSYour Name * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 14*5113495bSYour Name * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 15*5113495bSYour Name * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 16*5113495bSYour Name * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17*5113495bSYour Name * PERFORMANCE OF THIS SOFTWARE. 18*5113495bSYour Name */ 19*5113495bSYour Name 20*5113495bSYour Name /*=========================================================================== 21*5113495bSYour Name \file wlan_nlink_common.h 22*5113495bSYour Name 23*5113495bSYour Name Exports and types for the Netlink Service interface. This header file contains 24*5113495bSYour Name message types and definitions that is shared between the user space service 25*5113495bSYour Name (e.g. logging service) and WLAN kernel module. 26*5113495bSYour Name 27*5113495bSYour Name ===========================================================================*/ 28*5113495bSYour Name 29*5113495bSYour Name #ifndef WLAN_NLINK_COMMON_H__ 30*5113495bSYour Name #define WLAN_NLINK_COMMON_H__ 31*5113495bSYour Name 32*5113495bSYour Name #include <linux/netlink.h> 33*5113495bSYour Name 34*5113495bSYour Name #ifdef __KERNEL__ 35*5113495bSYour Name #include <linux/if.h> 36*5113495bSYour Name #else 37*5113495bSYour Name #include <net/if.h> 38*5113495bSYour Name #endif 39*5113495bSYour Name 40*5113495bSYour Name /*--------------------------------------------------------------------------- 41*5113495bSYour Name * External Functions 42*5113495bSYour Name *-------------------------------------------------------------------------*/ 43*5113495bSYour Name 44*5113495bSYour Name /*--------------------------------------------------------------------------- 45*5113495bSYour Name * Preprocessor Definitions and Constants 46*5113495bSYour Name *-------------------------------------------------------------------------*/ 47*5113495bSYour Name #define WLAN_NL_MAX_PAYLOAD 5120 /* maximum size for netlink message */ 48*5113495bSYour Name #define WLAN_NLINK_PROTO_FAMILY NETLINK_USERSOCK 49*5113495bSYour Name #define WLAN_NLINK_MCAST_GRP_ID 0x01 50*5113495bSYour Name 51*5113495bSYour Name /*--------------------------------------------------------------------------- 52*5113495bSYour Name * Type Declarations 53*5113495bSYour Name *-------------------------------------------------------------------------*/ 54*5113495bSYour Name 55*5113495bSYour Name /* 56*5113495bSYour Name * The following enum defines the target service within WLAN driver for which the 57*5113495bSYour Name * message is intended for. Each service along with its counterpart 58*5113495bSYour Name * in the user space, define a set of messages they recognize. 59*5113495bSYour Name * Each of this message will have an header of type tAniMsgHdr defined below. 60*5113495bSYour Name * Each Netlink message to/from a kernel module will contain only one 61*5113495bSYour Name * message which is preceded by a tAniMsgHdr. The maximum size (in bytes) of 62*5113495bSYour Name * a netlink message is assumed to be MAX_PAYLOAD bytes. 63*5113495bSYour Name * 64*5113495bSYour Name * +------------+-------+----------+----------+ 65*5113495bSYour Name * |Netlink hdr | Align |tAniMsgHdr| msg body | 66*5113495bSYour Name * +------------+-------+----------|----------+ 67*5113495bSYour Name */ 68*5113495bSYour Name 69*5113495bSYour Name /* Message Types */ 70*5113495bSYour Name #define WLAN_SVC_FW_CRASHED_IND 0x100 71*5113495bSYour Name #define WLAN_SVC_LTE_COEX_IND 0x101 72*5113495bSYour Name #define WLAN_SVC_WLAN_AUTO_SHUTDOWN_IND 0x102 73*5113495bSYour Name #define WLAN_SVC_DFS_CAC_START_IND 0x103 74*5113495bSYour Name #define WLAN_SVC_DFS_CAC_END_IND 0x104 75*5113495bSYour Name #define WLAN_SVC_DFS_RADAR_DETECT_IND 0x105 76*5113495bSYour Name #define WLAN_SVC_WLAN_STATUS_IND 0x106 77*5113495bSYour Name #define WLAN_SVC_WLAN_VERSION_IND 0x107 78*5113495bSYour Name #define WLAN_SVC_DFS_ALL_CHANNEL_UNAVAIL_IND 0x108 79*5113495bSYour Name #define WLAN_SVC_WLAN_TP_IND 0x109 80*5113495bSYour Name #define WLAN_SVC_RPS_ENABLE_IND 0x10A 81*5113495bSYour Name #define WLAN_SVC_WLAN_TP_TX_IND 0x10B 82*5113495bSYour Name #define WLAN_SVC_WLAN_AUTO_SHUTDOWN_CANCEL_IND 0x10C 83*5113495bSYour Name #define WLAN_SVC_WLAN_RADIO_INDEX 0x10D 84*5113495bSYour Name #define WLAN_SVC_FW_SHUTDOWN_IND 0x10E 85*5113495bSYour Name #define WLAN_SVC_CORE_MINFREQ 0x10F 86*5113495bSYour Name #define WLAN_SVC_MAX_SSID_LEN 32 87*5113495bSYour Name #define WLAN_SVC_MAX_BSSID_LEN 6 88*5113495bSYour Name #define WLAN_SVC_MAX_STR_LEN 16 89*5113495bSYour Name #define WLAN_SVC_MAX_NUM_CHAN 128 90*5113495bSYour Name #define WLAN_SVC_COUNTRY_CODE_LEN 3 91*5113495bSYour Name 92*5113495bSYour Name #define ANI_NL_MSG_BASE 0x10 /* Some arbitrary base */ 93*5113495bSYour Name 94*5113495bSYour Name typedef enum eAniNlModuleTypes { 95*5113495bSYour Name ANI_NL_MSG_PUMAC = ANI_NL_MSG_BASE + 0x01, /* PTT Socket App */ 96*5113495bSYour Name ANI_NL_MSG_PTT = ANI_NL_MSG_BASE + 0x07, /* Quarky GUI */ 97*5113495bSYour Name WLAN_NL_MSG_OEM = ANI_NL_MSG_BASE + 0x09, 98*5113495bSYour Name WLAN_NL_MSG_SVC = ANI_NL_MSG_BASE + 0x0a, 99*5113495bSYour Name WLAN_NL_MSG_CNSS_DIAG = ANI_NL_MSG_BASE + 0x0B, /* Value needs to be 27 */ 100*5113495bSYour Name ANI_NL_MSG_LOG, 101*5113495bSYour Name WLAN_NL_MSG_SPECTRAL_SCAN, 102*5113495bSYour Name ANI_NL_MSG_MAX 103*5113495bSYour Name } tAniNlModTypes, tWlanNlModTypes; 104*5113495bSYour Name 105*5113495bSYour Name #define WLAN_NL_MSG_BASE ANI_NL_MSG_BASE 106*5113495bSYour Name #define WLAN_NL_MSG_MAX ANI_NL_MSG_MAX 107*5113495bSYour Name 108*5113495bSYour Name /* All Netlink messages must contain this header */ 109*5113495bSYour Name typedef struct sAniHdr { 110*5113495bSYour Name unsigned short type; 111*5113495bSYour Name unsigned short length; 112*5113495bSYour Name } tAniHdr, tAniMsgHdr; 113*5113495bSYour Name 114*5113495bSYour Name typedef struct sAniNlMsg { 115*5113495bSYour Name struct nlmsghdr nlh; /* Netlink Header */ 116*5113495bSYour Name int radio; /* unit number of the radio */ 117*5113495bSYour Name tAniHdr wmsg; /* Airgo Message Header */ 118*5113495bSYour Name } tAniNlHdr; 119*5113495bSYour Name 120*5113495bSYour Name struct radio_index_tlv { 121*5113495bSYour Name unsigned short type; 122*5113495bSYour Name unsigned short length; 123*5113495bSYour Name int radio; 124*5113495bSYour Name }; 125*5113495bSYour Name 126*5113495bSYour Name /** 127*5113495bSYour Name * struct svc_channel_info - Channel information 128*5113495bSYour Name * @chan_id: Channel ID 129*5113495bSYour Name * @reserved0: Reserved for padding and future use 130*5113495bSYour Name * @mhz: Primary 20 MHz channel frequency in MHz 131*5113495bSYour Name * @band_center_freq1: Center frequency 1 in MHz 132*5113495bSYour Name * @band_center_freq2: Center frequency 2 in MHz 133*5113495bSYour Name * @info: Channel info 134*5113495bSYour Name * @reg_info_1: Regulatory information field 1 which contains 135*5113495bSYour Name * MIN power, MAX power, reg power and reg class ID 136*5113495bSYour Name * @reg_info_2: Regulatory information field 2 which contains antennamax 137*5113495bSYour Name */ 138*5113495bSYour Name struct svc_channel_info { 139*5113495bSYour Name uint32_t chan_id; 140*5113495bSYour Name uint32_t reserved0; 141*5113495bSYour Name uint32_t mhz; 142*5113495bSYour Name uint32_t band_center_freq1; 143*5113495bSYour Name uint32_t band_center_freq2; 144*5113495bSYour Name uint32_t info; 145*5113495bSYour Name uint32_t reg_info_1; 146*5113495bSYour Name uint32_t reg_info_2; 147*5113495bSYour Name }; 148*5113495bSYour Name 149*5113495bSYour Name struct wlan_status_data { 150*5113495bSYour Name uint8_t lpss_support; 151*5113495bSYour Name uint8_t is_on; 152*5113495bSYour Name uint8_t vdev_id; 153*5113495bSYour Name uint8_t is_connected; 154*5113495bSYour Name int8_t rssi; 155*5113495bSYour Name uint8_t ssid_len; 156*5113495bSYour Name uint8_t country_code[WLAN_SVC_COUNTRY_CODE_LEN]; 157*5113495bSYour Name uint32_t vdev_mode; 158*5113495bSYour Name uint32_t freq; 159*5113495bSYour Name uint32_t numChannels; 160*5113495bSYour Name uint8_t channel_list[WLAN_SVC_MAX_NUM_CHAN]; 161*5113495bSYour Name uint8_t ssid[WLAN_SVC_MAX_SSID_LEN]; 162*5113495bSYour Name uint8_t bssid[WLAN_SVC_MAX_BSSID_LEN]; 163*5113495bSYour Name struct svc_channel_info channel_info[WLAN_SVC_MAX_NUM_CHAN]; 164*5113495bSYour Name }; 165*5113495bSYour Name 166*5113495bSYour Name struct wlan_version_data { 167*5113495bSYour Name uint32_t chip_id; 168*5113495bSYour Name char chip_name[WLAN_SVC_MAX_STR_LEN]; 169*5113495bSYour Name char chip_from[WLAN_SVC_MAX_STR_LEN]; 170*5113495bSYour Name char host_version[WLAN_SVC_MAX_STR_LEN]; 171*5113495bSYour Name char fw_version[WLAN_SVC_MAX_STR_LEN]; 172*5113495bSYour Name }; 173*5113495bSYour Name 174*5113495bSYour Name struct wlan_dfs_info { 175*5113495bSYour Name uint16_t channel; 176*5113495bSYour Name uint8_t country_code[WLAN_SVC_COUNTRY_CODE_LEN]; 177*5113495bSYour Name }; 178*5113495bSYour Name 179*5113495bSYour Name /* 180*5113495bSYour Name * Maximum number of queues supported by WLAN driver. Setting an upper 181*5113495bSYour Name * limit. Actual number of queues may be smaller than this value. 182*5113495bSYour Name */ 183*5113495bSYour Name #define WLAN_SVC_IFACE_NUM_QUEUES 6 184*5113495bSYour Name 185*5113495bSYour Name /** 186*5113495bSYour Name * struct wlan_rps_data - structure to send RPS info to cnss-daemon 187*5113495bSYour Name * @ifname: interface name for which the RPS data belongs to 188*5113495bSYour Name * @num_queues: number of rx queues for which RPS data is being sent 189*5113495bSYour Name * @cpu_map_list: array of cpu maps for different rx queues supported by 190*5113495bSYour Name * the wlan driver 191*5113495bSYour Name * 192*5113495bSYour Name * The structure specifies the format of data exchanged between wlan 193*5113495bSYour Name * driver and cnss-daemon. On receipt of the data, cnss-daemon is expected 194*5113495bSYour Name * to apply the 'cpu_map' for each rx queue belonging to the interface 'ifname' 195*5113495bSYour Name */ 196*5113495bSYour Name struct wlan_rps_data { 197*5113495bSYour Name char ifname[IFNAMSIZ]; 198*5113495bSYour Name uint16_t num_queues; 199*5113495bSYour Name uint16_t cpu_map_list[WLAN_SVC_IFACE_NUM_QUEUES]; 200*5113495bSYour Name }; 201*5113495bSYour Name 202*5113495bSYour Name /** 203*5113495bSYour Name * enum wlan_tp_level - indicates wlan throughput level 204*5113495bSYour Name * @WLAN_SVC_TP_NONE: used for initialization 205*5113495bSYour Name * @WLAN_SVC_TP_LOW: used to identify low throughput level 206*5113495bSYour Name * @WLAN_SVC_TP_MEDIUM: used to identify medium throughput level 207*5113495bSYour Name * @WLAN_SVC_TP_HIGH: used to identify high throughput level 208*5113495bSYour Name * 209*5113495bSYour Name * The different throughput levels are determined on the basis of # of tx and 210*5113495bSYour Name * rx packets and other threshold values. For example, if the # of total 211*5113495bSYour Name * packets sent or received by the driver is greater than 500 in the last 100ms 212*5113495bSYour Name * , the driver has a high throughput requirement. The driver may tweak certain 213*5113495bSYour Name * system parameters based on the throughput level. 214*5113495bSYour Name */ 215*5113495bSYour Name enum wlan_tp_level { 216*5113495bSYour Name WLAN_SVC_TP_NONE, 217*5113495bSYour Name WLAN_SVC_TP_LOW, 218*5113495bSYour Name WLAN_SVC_TP_MEDIUM, 219*5113495bSYour Name WLAN_SVC_TP_HIGH, 220*5113495bSYour Name }; 221*5113495bSYour Name 222*5113495bSYour Name /** 223*5113495bSYour Name * struct wlan_core_minfreq - msg to [re]set the min freq of a set of cores 224*5113495bSYour Name * @magic: signature token: 0xBABA 225*5113495bSYour Name * @reserved: unused for now 226*5113495bSYour Name * @coremask: bitmap of cores (16 bits) bit0=CORE0, bit1=CORE1, ... 227*5113495bSYour Name * coremask is ONLY valid for set command 228*5113495bSYour Name * valid values: 0xf0, or 0x0f 229*5113495bSYour Name * @freq: frequency in KH 230*5113495bSYour Name * > 0: "set to the given frequency" 231*5113495bSYour Name * == 0: "free; remove the lock" 232*5113495bSYour Name * 233*5113495bSYour Name * Msg structure passed by the driver to cnss-daemon. 234*5113495bSYour Name * 235*5113495bSYour Name * Semantical Alert: 236*5113495bSYour Name * There can be only one outstanding lock, even for different masks. 237*5113495bSYour Name */ 238*5113495bSYour Name #define WLAN_CORE_MINFREQ_MAGIC 0xBABA 239*5113495bSYour Name struct wlan_core_minfreq { 240*5113495bSYour Name uint16_t magic; 241*5113495bSYour Name uint16_t reserved; 242*5113495bSYour Name uint16_t coremask; 243*5113495bSYour Name uint16_t freq; 244*5113495bSYour Name }; 245*5113495bSYour Name 246*5113495bSYour Name /* Indication to enable TCP delayed ack in TPUT indication */ 247*5113495bSYour Name #define TCP_DEL_ACK_IND (1 << 0) 248*5113495bSYour Name #define TCP_DEL_ACK_IND_MASK 0x1 249*5113495bSYour Name /* Indication to enable TCP advance window scaling in TPUT indication */ 250*5113495bSYour Name #define TCP_ADV_WIN_SCL (1 << 1) 251*5113495bSYour Name #define TCP_ADV_WIN_SCL_MASK 0x2 252*5113495bSYour Name 253*5113495bSYour Name /* TCP limit output bytes for low and high TPUT */ 254*5113495bSYour Name #define TCP_LIMIT_OUTPUT_BYTES_LOW 506072 255*5113495bSYour Name #define TCP_LIMIT_OUTPUT_BYTES_HI 4048579 256*5113495bSYour Name 257*5113495bSYour Name /* TCP window scale for low and high TPUT */ 258*5113495bSYour Name #define WIN_SCALE_LOW 2 259*5113495bSYour Name #define WIN_SCALE_HI 1 260*5113495bSYour Name 261*5113495bSYour Name /* TCP DEL ACK value for low and high TPUT */ 262*5113495bSYour Name #define TCP_DEL_ACK_LOW 0 263*5113495bSYour Name #define TCP_DEL_ACK_HI 20 264*5113495bSYour Name 265*5113495bSYour Name /** 266*5113495bSYour Name * struct wlan_rx_tp_data - msg to TCP delayed ack and advance window scaling 267*5113495bSYour Name * @level: Throughput level. 268*5113495bSYour Name * @rx_tp_flags: Bit map of flags, for which this indcation will take 269*5113495bSYour Name * effect, bit map for TCP_ADV_WIN_SCL and TCP_DEL_ACK_IND. 270*5113495bSYour Name */ 271*5113495bSYour Name struct wlan_rx_tp_data { 272*5113495bSYour Name enum wlan_tp_level level; 273*5113495bSYour Name uint16_t rx_tp_flags; 274*5113495bSYour Name }; 275*5113495bSYour Name 276*5113495bSYour Name /** 277*5113495bSYour Name * struct wlan_tx_tp_data - msg to TCP for Tx Dir 278*5113495bSYour Name * @level: Throughput level. 279*5113495bSYour Name * @tcp_limit_output: Tcp limit output flag. 280*5113495bSYour Name * 281*5113495bSYour Name */ 282*5113495bSYour Name struct wlan_tx_tp_data { 283*5113495bSYour Name enum wlan_tp_level level; 284*5113495bSYour Name bool tcp_limit_output; 285*5113495bSYour Name }; 286*5113495bSYour Name 287*5113495bSYour Name #endif /* WLAN_NLINK_COMMON_H__ */ 288