Path: blob/master/ALFA-W1F1/RTL8814AU/os_dep/linux/rtw_cfgvendor.h
1307 views
/******************************************************************************1*2* Copyright(c) 2007 - 2017 Realtek Corporation.3*4* This program is free software; you can redistribute it and/or modify it5* under the terms of version 2 of the GNU General Public License as6* published by the Free Software Foundation.7*8* This program is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for11* more details.12*13*****************************************************************************/1415#ifndef _RTW_CFGVENDOR_H_16#define _RTW_CFGVENDOR_H_1718#define OUI_GOOGLE 0x001A1119#define ATTRIBUTE_U32_LEN (NLA_HDRLEN + 4)20#define VENDOR_ID_OVERHEAD ATTRIBUTE_U32_LEN21#define VENDOR_SUBCMD_OVERHEAD ATTRIBUTE_U32_LEN22#define VENDOR_DATA_OVERHEAD (NLA_HDRLEN)2324#define SCAN_RESULTS_COMPLETE_FLAG_LEN ATTRIBUTE_U32_LEN25#define SCAN_INDEX_HDR_LEN (NLA_HDRLEN)26#define SCAN_ID_HDR_LEN ATTRIBUTE_U32_LEN27#define SCAN_FLAGS_HDR_LEN ATTRIBUTE_U32_LEN28#define GSCAN_NUM_RESULTS_HDR_LEN ATTRIBUTE_U32_LEN29#define GSCAN_RESULTS_HDR_LEN (NLA_HDRLEN)30#define GSCAN_BATCH_RESULT_HDR_LEN (SCAN_INDEX_HDR_LEN + SCAN_ID_HDR_LEN + \31SCAN_FLAGS_HDR_LEN + \32GSCAN_NUM_RESULTS_HDR_LEN + \33GSCAN_RESULTS_HDR_LEN)3435#define VENDOR_REPLY_OVERHEAD (VENDOR_ID_OVERHEAD + \36VENDOR_SUBCMD_OVERHEAD + \37VENDOR_DATA_OVERHEAD)38typedef enum {39/* don't use 0 as a valid subcommand */40VENDOR_NL80211_SUBCMD_UNSPECIFIED,4142/* define all vendor startup commands between 0x0 and 0x0FFF */43VENDOR_NL80211_SUBCMD_RANGE_START = 0x0001,44VENDOR_NL80211_SUBCMD_RANGE_END = 0x0FFF,4546/* define all GScan related commands between 0x1000 and 0x10FF */47ANDROID_NL80211_SUBCMD_GSCAN_RANGE_START = 0x1000,48ANDROID_NL80211_SUBCMD_GSCAN_RANGE_END = 0x10FF,4950/* define all NearbyDiscovery related commands between 0x1100 and 0x11FF */51ANDROID_NL80211_SUBCMD_NBD_RANGE_START = 0x1100,52ANDROID_NL80211_SUBCMD_NBD_RANGE_END = 0x11FF,5354/* define all RTT related commands between 0x1100 and 0x11FF */55ANDROID_NL80211_SUBCMD_RTT_RANGE_START = 0x1100,56ANDROID_NL80211_SUBCMD_RTT_RANGE_END = 0x11FF,5758ANDROID_NL80211_SUBCMD_LSTATS_RANGE_START = 0x1200,59ANDROID_NL80211_SUBCMD_LSTATS_RANGE_END = 0x12FF,6061/* define all Logger related commands between 0x1400 and 0x14FF */62ANDROID_NL80211_SUBCMD_DEBUG_RANGE_START = 0x1400,63ANDROID_NL80211_SUBCMD_DEBUG_RANGE_END = 0x14FF,6465/* define all wifi offload related commands between 0x1600 and 0x16FF */66ANDROID_NL80211_SUBCMD_WIFI_OFFLOAD_RANGE_START = 0x1600,67ANDROID_NL80211_SUBCMD_WIFI_OFFLOAD_RANGE_END = 0x16FF,6869/* define all NAN related commands between 0x1700 and 0x17FF */70ANDROID_NL80211_SUBCMD_NAN_RANGE_START = 0x1700,71ANDROID_NL80211_SUBCMD_NAN_RANGE_END = 0x17FF,7273/* define all Android Packet Filter related commands between 0x1800 and 0x18FF */74ANDROID_NL80211_SUBCMD_PKT_FILTER_RANGE_START = 0x1800,75ANDROID_NL80211_SUBCMD_PKT_FILTER_RANGE_END = 0x18FF,7677/* This is reserved for future usage */7879} ANDROID_VENDOR_SUB_COMMAND;8081enum rtw_vendor_subcmd {82GSCAN_SUBCMD_GET_CAPABILITIES = ANDROID_NL80211_SUBCMD_GSCAN_RANGE_START,8384GSCAN_SUBCMD_SET_CONFIG, /* 0x1001 */8586GSCAN_SUBCMD_SET_SCAN_CONFIG, /* 0x1002 */87GSCAN_SUBCMD_ENABLE_GSCAN, /* 0x1003 */88GSCAN_SUBCMD_GET_SCAN_RESULTS, /* 0x1004 */89GSCAN_SUBCMD_SCAN_RESULTS, /* 0x1005 */9091GSCAN_SUBCMD_SET_HOTLIST, /* 0x1006 */9293GSCAN_SUBCMD_SET_SIGNIFICANT_CHANGE_CONFIG, /* 0x1007 */94GSCAN_SUBCMD_ENABLE_FULL_SCAN_RESULTS, /* 0x1008 */95GSCAN_SUBCMD_GET_CHANNEL_LIST, /* 0x1009 */9697WIFI_SUBCMD_GET_FEATURE_SET, /* 0x100A */98WIFI_SUBCMD_GET_FEATURE_SET_MATRIX, /* 0x100B */99WIFI_SUBCMD_SET_PNO_RANDOM_MAC_OUI, /* 0x100C */100WIFI_SUBCMD_NODFS_SET, /* 0x100D */101WIFI_SUBCMD_SET_COUNTRY_CODE, /* 0x100E */102/* Add more sub commands here */103GSCAN_SUBCMD_SET_EPNO_SSID, /* 0x100F */104105WIFI_SUBCMD_SET_SSID_WHITE_LIST, /* 0x1010 */106WIFI_SUBCMD_SET_ROAM_PARAMS, /* 0x1011 */107WIFI_SUBCMD_ENABLE_LAZY_ROAM, /* 0x1012 */108WIFI_SUBCMD_SET_BSSID_PREF, /* 0x1013 */109WIFI_SUBCMD_SET_BSSID_BLACKLIST, /* 0x1014 */110111GSCAN_SUBCMD_ANQPO_CONFIG, /* 0x1015 */112WIFI_SUBCMD_SET_RSSI_MONITOR, /* 0x1016 */113WIFI_SUBCMD_CONFIG_ND_OFFLOAD, /* 0x1017 */114/* Add more sub commands here */115116GSCAN_SUBCMD_MAX,117118RTT_SUBCMD_SET_CONFIG = ANDROID_NL80211_SUBCMD_RTT_RANGE_START,119RTT_SUBCMD_CANCEL_CONFIG,120RTT_SUBCMD_GETCAPABILITY,121122APF_SUBCMD_GET_CAPABILITIES = ANDROID_NL80211_SUBCMD_PKT_FILTER_RANGE_START,123APF_SUBCMD_SET_FILTER,124125LOGGER_START_LOGGING = ANDROID_NL80211_SUBCMD_DEBUG_RANGE_START,126LOGGER_TRIGGER_MEM_DUMP,127LOGGER_GET_MEM_DUMP,128LOGGER_GET_VER,129LOGGER_GET_RING_STATUS,130LOGGER_GET_RING_DATA,131LOGGER_GET_FEATURE,132LOGGER_RESET_LOGGING,133LOGGER_TRIGGER_DRIVER_MEM_DUMP,134LOGGER_GET_DRIVER_MEM_DUMP,135LOGGER_START_PKT_FATE_MONITORING,136LOGGER_GET_TX_PKT_FATES,137LOGGER_GET_RX_PKT_FATES,138139VENDOR_SUBCMD_MAX140};141142enum gscan_attributes {143GSCAN_ATTRIBUTE_NUM_BUCKETS = 10,144GSCAN_ATTRIBUTE_BASE_PERIOD,145GSCAN_ATTRIBUTE_BUCKETS_BAND,146GSCAN_ATTRIBUTE_BUCKET_ID,147GSCAN_ATTRIBUTE_BUCKET_PERIOD,148GSCAN_ATTRIBUTE_BUCKET_NUM_CHANNELS,149GSCAN_ATTRIBUTE_BUCKET_CHANNELS,150GSCAN_ATTRIBUTE_NUM_AP_PER_SCAN,151GSCAN_ATTRIBUTE_REPORT_THRESHOLD,152GSCAN_ATTRIBUTE_NUM_SCANS_TO_CACHE,153GSCAN_ATTRIBUTE_BAND = GSCAN_ATTRIBUTE_BUCKETS_BAND,154155GSCAN_ATTRIBUTE_ENABLE_FEATURE = 20,156GSCAN_ATTRIBUTE_SCAN_RESULTS_COMPLETE,157GSCAN_ATTRIBUTE_FLUSH_FEATURE,158GSCAN_ATTRIBUTE_ENABLE_FULL_SCAN_RESULTS,159GSCAN_ATTRIBUTE_REPORT_EVENTS,160/* remaining reserved for additional attributes */161GSCAN_ATTRIBUTE_NUM_OF_RESULTS = 30,162GSCAN_ATTRIBUTE_FLUSH_RESULTS,163GSCAN_ATTRIBUTE_SCAN_RESULTS, /* flat array of wifi_scan_result */164GSCAN_ATTRIBUTE_SCAN_ID, /* indicates scan number */165GSCAN_ATTRIBUTE_SCAN_FLAGS, /* indicates if scan was aborted */166GSCAN_ATTRIBUTE_AP_FLAGS, /* flags on significant change event */167GSCAN_ATTRIBUTE_NUM_CHANNELS,168GSCAN_ATTRIBUTE_CHANNEL_LIST,169170/* remaining reserved for additional attributes */171172GSCAN_ATTRIBUTE_SSID = 40,173GSCAN_ATTRIBUTE_BSSID,174GSCAN_ATTRIBUTE_CHANNEL,175GSCAN_ATTRIBUTE_RSSI,176GSCAN_ATTRIBUTE_TIMESTAMP,177GSCAN_ATTRIBUTE_RTT,178GSCAN_ATTRIBUTE_RTTSD,179180/* remaining reserved for additional attributes */181182GSCAN_ATTRIBUTE_HOTLIST_BSSIDS = 50,183GSCAN_ATTRIBUTE_RSSI_LOW,184GSCAN_ATTRIBUTE_RSSI_HIGH,185GSCAN_ATTRIBUTE_HOSTLIST_BSSID_ELEM,186GSCAN_ATTRIBUTE_HOTLIST_FLUSH,187188/* remaining reserved for additional attributes */189GSCAN_ATTRIBUTE_RSSI_SAMPLE_SIZE = 60,190GSCAN_ATTRIBUTE_LOST_AP_SAMPLE_SIZE,191GSCAN_ATTRIBUTE_MIN_BREACHING,192GSCAN_ATTRIBUTE_SIGNIFICANT_CHANGE_BSSIDS,193GSCAN_ATTRIBUTE_SIGNIFICANT_CHANGE_FLUSH,194GSCAN_ATTRIBUTE_MAX195};196197enum gscan_bucket_attributes {198GSCAN_ATTRIBUTE_CH_BUCKET_1,199GSCAN_ATTRIBUTE_CH_BUCKET_2,200GSCAN_ATTRIBUTE_CH_BUCKET_3,201GSCAN_ATTRIBUTE_CH_BUCKET_4,202GSCAN_ATTRIBUTE_CH_BUCKET_5,203GSCAN_ATTRIBUTE_CH_BUCKET_6,204GSCAN_ATTRIBUTE_CH_BUCKET_7205};206207enum gscan_ch_attributes {208GSCAN_ATTRIBUTE_CH_ID_1,209GSCAN_ATTRIBUTE_CH_ID_2,210GSCAN_ATTRIBUTE_CH_ID_3,211GSCAN_ATTRIBUTE_CH_ID_4,212GSCAN_ATTRIBUTE_CH_ID_5,213GSCAN_ATTRIBUTE_CH_ID_6,214GSCAN_ATTRIBUTE_CH_ID_7215};216217enum wifi_rssi_monitor_attr {218RSSI_MONITOR_ATTRIBUTE_MAX_RSSI,219RSSI_MONITOR_ATTRIBUTE_MIN_RSSI,220RSSI_MONITOR_ATTRIBUTE_START,221};222223224enum rtt_attributes {225RTT_ATTRIBUTE_TARGET_CNT,226RTT_ATTRIBUTE_TARGET_INFO,227RTT_ATTRIBUTE_TARGET_MAC,228RTT_ATTRIBUTE_TARGET_TYPE,229RTT_ATTRIBUTE_TARGET_PEER,230RTT_ATTRIBUTE_TARGET_CHAN,231RTT_ATTRIBUTE_TARGET_MODE,232RTT_ATTRIBUTE_TARGET_INTERVAL,233RTT_ATTRIBUTE_TARGET_NUM_MEASUREMENT,234RTT_ATTRIBUTE_TARGET_NUM_PKT,235RTT_ATTRIBUTE_TARGET_NUM_RETRY236};237238enum logger_attributes {239LOGGER_ATTRIBUTE_GET_DRIVER,240LOGGER_ATTRIBUTE_GET_FW,241LOGGER_ATTRIBUTE_RING_ID,242LOGGER_ATTRIBUTE_RING_NAME,243LOGGER_ATTRIBUTE_RING_FLAGS,244LOGGER_ATTRIBUTE_LOG_LEVEL,245LOGGER_ATTRIBUTE_LOG_TIME_INTVAL,246LOGGER_ATTRIBUTE_LOG_MIN_DATA_SIZE,247LOGGER_ATTRIBUTE_FW_DUMP_LEN,248LOGGER_ATTRIBUTE_FW_DUMP_DATA,249LOGGERG_ATTRIBUTE_RING_DATA,250LOGGER_ATTRIBUTE_RING_STATUS,251LOGGER_ATTRIBUTE_RING_NUM252};253typedef enum rtw_vendor_event {254RTK_RESERVED1,255RTK_RESERVED2,256GSCAN_EVENT_SIGNIFICANT_CHANGE_RESULTS ,257GSCAN_EVENT_HOTLIST_RESULTS_FOUND,258GSCAN_EVENT_SCAN_RESULTS_AVAILABLE,259GSCAN_EVENT_FULL_SCAN_RESULTS,260RTT_EVENT_COMPLETE,261GSCAN_EVENT_COMPLETE_SCAN,262GSCAN_EVENT_HOTLIST_RESULTS_LOST,263GSCAN_EVENT_EPNO_EVENT,264GOOGLE_DEBUG_RING_EVENT,265GOOGLE_DEBUG_MEM_DUMP_EVENT,266GSCAN_EVENT_ANQPO_HOTSPOT_MATCH,267GOOGLE_RSSI_MONITOR_EVENT268} rtw_vendor_event_t;269270enum andr_wifi_feature_set_attr {271ANDR_WIFI_ATTRIBUTE_NUM_FEATURE_SET,272ANDR_WIFI_ATTRIBUTE_FEATURE_SET,273ANDR_WIFI_ATTRIBUTE_RANDOM_MAC_OUI,274ANDR_WIFI_ATTRIBUTE_NODFS_SET,275ANDR_WIFI_ATTRIBUTE_COUNTRY,276ANDR_WIFI_ATTRIBUTE_ND_OFFLOAD_VALUE277// Add more attribute here278};279280typedef enum rtw_vendor_gscan_attribute {281ATTR_START_GSCAN,282ATTR_STOP_GSCAN,283ATTR_SET_SCAN_BATCH_CFG_ID, /* set batch scan params */284ATTR_SET_SCAN_GEOFENCE_CFG_ID, /* set list of bssids to track */285ATTR_SET_SCAN_SIGNIFICANT_CFG_ID, /* set list of bssids, rssi threshold etc.. */286ATTR_SET_SCAN_CFG_ID, /* set common scan config params here */287ATTR_GET_GSCAN_CAPABILITIES_ID,288/* Add more sub commands here */289ATTR_GSCAN_MAX290} rtw_vendor_gscan_attribute_t;291292typedef enum gscan_batch_attribute {293ATTR_GSCAN_BATCH_BESTN,294ATTR_GSCAN_BATCH_MSCAN,295ATTR_GSCAN_BATCH_BUFFER_THRESHOLD296} gscan_batch_attribute_t;297298typedef enum gscan_geofence_attribute {299ATTR_GSCAN_NUM_HOTLIST_BSSID,300ATTR_GSCAN_HOTLIST_BSSID301} gscan_geofence_attribute_t;302303typedef enum gscan_complete_event {304WIFI_SCAN_BUFFER_FULL,305WIFI_SCAN_COMPLETE306} gscan_complete_event_t;307/* wifi_hal.h */308/* WiFi Common definitions */309typedef unsigned char byte;310typedef int wifi_request_id;311typedef int wifi_channel; // indicates channel frequency in MHz312typedef int wifi_rssi;313typedef byte mac_addr[6];314typedef byte oui[3];315typedef int64_t wifi_timestamp; // In microseconds (us)316typedef int64_t wifi_timespan; // In picoseconds (ps)317318struct wifi_info;319struct wifi_interface_info;320typedef struct wifi_info *wifi_handle;321typedef struct wifi_interface_info *wifi_interface_handle;322323/* channel operating width */324typedef enum {325WIFI_CHAN_WIDTH_20 = 0,326WIFI_CHAN_WIDTH_40 = 1,327WIFI_CHAN_WIDTH_80 = 2,328WIFI_CHAN_WIDTH_160 = 3,329WIFI_CHAN_WIDTH_80P80 = 4,330WIFI_CHAN_WIDTH_5 = 5,331WIFI_CHAN_WIDTH_10 = 6,332WIFI_CHAN_WIDTH_INVALID = -1333} wifi_channel_width;334335typedef int wifi_radio;336337typedef struct {338wifi_channel_width width;339int center_frequency0;340int center_frequency1;341int primary_frequency;342} wifi_channel_spec;343344typedef enum {345WIFI_SUCCESS = 0,346WIFI_ERROR_NONE = 0,347WIFI_ERROR_UNKNOWN = -1,348WIFI_ERROR_UNINITIALIZED = -2,349WIFI_ERROR_NOT_SUPPORTED = -3,350WIFI_ERROR_NOT_AVAILABLE = -4, // Not available right now, but try later351WIFI_ERROR_INVALID_ARGS = -5,352WIFI_ERROR_INVALID_REQUEST_ID = -6,353WIFI_ERROR_TIMED_OUT = -7,354WIFI_ERROR_TOO_MANY_REQUESTS = -8, // Too many instances of this request355WIFI_ERROR_OUT_OF_MEMORY = -9,356WIFI_ERROR_BUSY = -10,357} wifi_error;358359typedef int wifi_ring_buffer_id;360/* ring buffer params */361/**362* written_bytes and read_bytes implement a producer consumer API363* hence written_bytes >= read_bytes364* a modulo arithmetic of the buffer size has to be applied to those counters:365* actual offset into ring buffer = written_bytes % ring_buffer_byte_size366*367*/368typedef struct {369u8 name[32];370u32 flags;371wifi_ring_buffer_id ring_id; // unique integer representing the ring372u32 ring_buffer_byte_size; // total memory size allocated for the buffer373u32 verbose_level; // verbose level for ring buffer374u32 written_bytes; // number of bytes that was written to the buffer by driver,375// monotonously increasing integer376u32 read_bytes; // number of bytes that was read from the buffer by user land,377// monotonously increasing integer378u32 written_records; // number of records that was written to the buffer by driver,379// monotonously increasing integer380} wifi_ring_buffer_status;381382#ifdef CONFIG_RTW_CFGVEDNOR_LLSTATS383#define STATS_MAJOR_VERSION 1384#define STATS_MINOR_VERSION 0385#define STATS_MICRO_VERSION 0386387typedef enum {388WIFI_DISCONNECTED = 0,389WIFI_AUTHENTICATING = 1,390WIFI_ASSOCIATING = 2,391WIFI_ASSOCIATED = 3,392WIFI_EAPOL_STARTED = 4, // if done by firmware/driver393WIFI_EAPOL_COMPLETED = 5, // if done by firmware/driver394} wifi_connection_state;395396typedef enum {397WIFI_ROAMING_IDLE = 0,398WIFI_ROAMING_ACTIVE = 1,399} wifi_roam_state;400401typedef enum {402WIFI_INTERFACE_STA = 0,403WIFI_INTERFACE_SOFTAP = 1,404WIFI_INTERFACE_IBSS = 2,405WIFI_INTERFACE_P2P_CLIENT = 3,406WIFI_INTERFACE_P2P_GO = 4,407WIFI_INTERFACE_NAN = 5,408WIFI_INTERFACE_MESH = 6,409WIFI_INTERFACE_UNKNOWN = -1410} wifi_interface_mode;411412#define WIFI_CAPABILITY_QOS 0x00000001 // set for QOS association413#define WIFI_CAPABILITY_PROTECTED 0x00000002 // set for protected association (802.11 beacon frame control protected bit set)414#define WIFI_CAPABILITY_INTERWORKING 0x00000004 // set if 802.11 Extended Capabilities element interworking bit is set415#define WIFI_CAPABILITY_HS20 0x00000008 // set for HS20 association416#define WIFI_CAPABILITY_SSID_UTF8 0x00000010 // set is 802.11 Extended Capabilities element UTF-8 SSID bit is set417#define WIFI_CAPABILITY_COUNTRY 0x00000020 // set is 802.11 Country Element is present418419typedef struct {420wifi_interface_mode mode; // interface mode421u8 mac_addr[6]; // interface mac address (self)422wifi_connection_state state; // connection state (valid for STA, CLI only)423wifi_roam_state roaming; // roaming state424u32 capabilities; // WIFI_CAPABILITY_XXX (self)425u8 ssid[33]; // null terminated SSID426u8 bssid[6]; // bssid427u8 ap_country_str[3]; // country string advertised by AP428u8 country_str[3]; // country string for this association429} wifi_interface_link_layer_info;430431/* channel information */432typedef struct {433wifi_channel_width width; // channel width (20, 40, 80, 80+80, 160)434wifi_channel center_freq; // primary 20 MHz channel435wifi_channel center_freq0; // center frequency (MHz) first segment436wifi_channel center_freq1; // center frequency (MHz) second segment437} wifi_channel_info;438439/* wifi rate */440typedef struct {441u32 preamble :3; // 0: OFDM, 1:CCK, 2:HT 3:VHT 4..7 reserved442u32 nss :2; // 0:1x1, 1:2x2, 3:3x3, 4:4x4443u32 bw :3; // 0:20MHz, 1:40Mhz, 2:80Mhz, 3:160Mhz444u32 rateMcsIdx :8; // OFDM/CCK rate code would be as per ieee std in the units of 0.5mbps445// HT/VHT it would be mcs index446u32 reserved :16; // reserved447u32 bitrate; // units of 100 Kbps448} wifi_rate;449450/* channel statistics */451typedef struct {452wifi_channel_info channel; // channel453u32 on_time; // msecs the radio is awake (32 bits number accruing over time)454u32 cca_busy_time; // msecs the CCA register is busy (32 bits number accruing over time)455} wifi_channel_stat;456457// Max number of tx power levels. The actual number vary per device and is specified by |num_tx_levels|458#define RADIO_STAT_MAX_TX_LEVELS 256459460/* Internal radio statistics structure in the driver */461typedef struct {462wifi_radio radio; // wifi radio (if multiple radio supported)463u32 on_time; // msecs the radio is awake (32 bits number accruing over time)464u32 tx_time; // msecs the radio is transmitting (32 bits number accruing over time)465u32 rx_time; // msecs the radio is in active receive (32 bits number accruing over time)466u32 on_time_scan; // msecs the radio is awake due to all scan (32 bits number accruing over time)467u32 on_time_nbd; // msecs the radio is awake due to NAN (32 bits number accruing over time)468u32 on_time_gscan; // msecs the radio is awake due to G?scan (32 bits number accruing over time)469u32 on_time_roam_scan; // msecs the radio is awake due to roam?scan (32 bits number accruing over time)470u32 on_time_pno_scan; // msecs the radio is awake due to PNO scan (32 bits number accruing over time)471u32 on_time_hs20; // msecs the radio is awake due to HS2.0 scans and GAS exchange (32 bits number accruing over time)472u32 num_channels; // number of channels473wifi_channel_stat channels[]; // channel statistics474} wifi_radio_stat_internal;475476/**477* Packet statistics reporting by firmware is performed on MPDU basi (i.e. counters increase by 1 for each MPDU)478* As well, "data packet" in associated comments, shall be interpreted as 802.11 data packet,479* that is, 802.11 frame control subtype == 2 and excluding management and control frames.480*481* As an example, in the case of transmission of an MSDU fragmented in 16 MPDUs which are transmitted482* OTA in a 16 units long a-mpdu, for which a block ack is received with 5 bits set:483* tx_mpdu : shall increase by 5484* retries : shall increase by 16485* tx_ampdu : shall increase by 1486* data packet counters shall not increase regardless of the number of BAR potentially sent by device for this a-mpdu487* data packet counters shall not increase regardless of the number of BA received by device for this a-mpdu488*489* For each subsequent retransmission of the 11 remaining non ACK'ed mpdus490* (regardless of the fact that they are transmitted in a-mpdu or not)491* retries : shall increase by 1492*493* If no subsequent BA or ACK are received from AP, until packet lifetime expires for those 11 packet that were not ACK'ed494* mpdu_lost : shall increase by 11495*/496497/* per rate statistics */498typedef struct {499wifi_rate rate; // rate information500u32 tx_mpdu; // number of successfully transmitted data pkts (ACK rcvd)501u32 rx_mpdu; // number of received data pkts502u32 mpdu_lost; // number of data packet losses (no ACK)503u32 retries; // total number of data pkt retries504u32 retries_short; // number of short data pkt retries505u32 retries_long; // number of long data pkt retries506} wifi_rate_stat;507508/* access categories */509typedef enum {510WIFI_AC_VO = 0,511WIFI_AC_VI = 1,512WIFI_AC_BE = 2,513WIFI_AC_BK = 3,514WIFI_AC_MAX = 4,515} wifi_traffic_ac;516517/* wifi peer type */518typedef enum519{520WIFI_PEER_STA,521WIFI_PEER_AP,522WIFI_PEER_P2P_GO,523WIFI_PEER_P2P_CLIENT,524WIFI_PEER_NAN,525WIFI_PEER_TDLS,526WIFI_PEER_INVALID,527} wifi_peer_type;528529/* per peer statistics */530typedef struct {531wifi_peer_type type; // peer type (AP, TDLS, GO etc.)532u8 peer_mac_address[6]; // mac address533u32 capabilities; // peer WIFI_CAPABILITY_XXX534u32 num_rate; // number of rates535wifi_rate_stat rate_stats[]; // per rate statistics, number of entries = num_rate536} wifi_peer_info;537538/* Per access category statistics */539typedef struct {540wifi_traffic_ac ac; // access category (VI, VO, BE, BK)541u32 tx_mpdu; // number of successfully transmitted unicast data pkts (ACK rcvd)542u32 rx_mpdu; // number of received unicast data packets543u32 tx_mcast; // number of succesfully transmitted multicast data packets544// STA case: implies ACK received from AP for the unicast packet in which mcast pkt was sent545u32 rx_mcast; // number of received multicast data packets546u32 rx_ampdu; // number of received unicast a-mpdus; support of this counter is optional547u32 tx_ampdu; // number of transmitted unicast a-mpdus; support of this counter is optional548u32 mpdu_lost; // number of data pkt losses (no ACK)549u32 retries; // total number of data pkt retries550u32 retries_short; // number of short data pkt retries551u32 retries_long; // number of long data pkt retries552u32 contention_time_min; // data pkt min contention time (usecs)553u32 contention_time_max; // data pkt max contention time (usecs)554u32 contention_time_avg; // data pkt avg contention time (usecs)555u32 contention_num_samples; // num of data pkts used for contention statistics556} wifi_wmm_ac_stat;557558/* interface statistics */559typedef struct {560wifi_interface_handle iface; // wifi interface561wifi_interface_link_layer_info info; // current state of the interface562u32 beacon_rx; // access point beacon received count from connected AP563u64 average_tsf_offset; // average beacon offset encountered (beacon_TSF - TBTT)564// The average_tsf_offset field is used so as to calculate the565// typical beacon contention time on the channel as well may be566// used to debug beacon synchronization and related power consumption issue567u32 leaky_ap_detected; // indicate that this AP typically leaks packets beyond the driver guard time.568u32 leaky_ap_avg_num_frames_leaked; // average number of frame leaked by AP after frame with PM bit set was ACK'ed by AP569u32 leaky_ap_guard_time; // guard time currently in force (when implementing IEEE power management based on570// frame control PM bit), How long driver waits before shutting down the radio and571// after receiving an ACK for a data frame with PM bit set)572u32 mgmt_rx; // access point mgmt frames received count from connected AP (including Beacon)573u32 mgmt_action_rx; // action frames received count574u32 mgmt_action_tx; // action frames transmit count575wifi_rssi rssi_mgmt; // access Point Beacon and Management frames RSSI (averaged)576wifi_rssi rssi_data; // access Point Data Frames RSSI (averaged) from connected AP577wifi_rssi rssi_ack; // access Point ACK RSSI (averaged) from connected AP578wifi_wmm_ac_stat ac[WIFI_AC_MAX]; // per ac data packet statistics579u32 num_peers; // number of peers580wifi_peer_info peer_info[]; // per peer statistics581} wifi_iface_stat;582583/* configuration params */584typedef struct {585u32 mpdu_size_threshold; // threshold to classify the pkts as short or long586// packet size < mpdu_size_threshold => short587u32 aggressive_statistics_gathering; // set for field debug mode. Driver should collect all statistics regardless of performance impact.588} wifi_link_layer_params;589590#define RSSI_MONITOR_EVT_VERSION 1591typedef struct {592u8 version;593s8 cur_rssi;594mac_addr BSSID;595} rssi_monitor_evt;596597598/* wifi statistics bitmap */599#define WIFI_STATS_RADIO 0x00000001 // all radio statistics600#define WIFI_STATS_RADIO_CCA 0x00000002 // cca_busy_time (within radio statistics)601#define WIFI_STATS_RADIO_CHANNELS 0x00000004 // all channel statistics (within radio statistics)602#define WIFI_STATS_RADIO_SCAN 0x00000008 // all scan statistics (within radio statistics)603#define WIFI_STATS_IFACE 0x00000010 // all interface statistics604#define WIFI_STATS_IFACE_TXRATE 0x00000020 // all tx rate statistics (within interface statistics)605#define WIFI_STATS_IFACE_AC 0x00000040 // all ac statistics (within interface statistics)606#define WIFI_STATS_IFACE_CONTENTION 0x00000080 // all contention (min, max, avg) statistics (within ac statisctics)607608#endif /* CONFIG_RTW_CFGVEDNOR_LLSTATS */609610611#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) || defined(RTW_VENDOR_EXT_SUPPORT)612extern int rtw_cfgvendor_attach(struct wiphy *wiphy);613extern int rtw_cfgvendor_detach(struct wiphy *wiphy);614extern int rtw_cfgvendor_send_async_event(struct wiphy *wiphy,615struct net_device *dev, int event_id, const void *data, int len);616#if defined(GSCAN_SUPPORT) && 0617extern int rtw_cfgvendor_send_hotlist_event(struct wiphy *wiphy,618struct net_device *dev, void *data, int len, rtw_vendor_event_t event);619#endif620#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) || defined(RTW_VENDOR_EXT_SUPPORT) */621622#ifdef CONFIG_RTW_CFGVEDNOR_RSSIMONITOR623void rtw_cfgvendor_rssi_monitor_evt(_adapter *padapter);624#endif625626#ifdef CONFIG_RTW_CFGVENDOR_RANDOM_MAC_OUI627void rtw_hal_pno_random_gen_mac_addr(PADAPTER adapter);628void rtw_hal_set_hw_mac_addr(PADAPTER adapter, u8 *mac_addr);629#endif630631632#endif /* _RTW_CFGVENDOR_H_ */633634635