These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / net / wireless / iwlwifi / mvm / fw-api-scan.h
index d6cced4..3a657e4 100644 (file)
@@ -6,7 +6,7 @@
  * GPL LICENSE SUMMARY
  *
  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
- * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
+ * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -32,7 +32,7 @@
  * BSD LICENSE
  *
  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
- * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
+ * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -87,41 +87,6 @@ struct iwl_ssid_ie {
        u8 ssid[IEEE80211_MAX_SSID_LEN];
 } __packed; /* SCAN_DIRECT_SSID_IE_API_S_VER_1 */
 
-/* How many statistics are gathered for each channel */
-#define SCAN_RESULTS_STATISTICS 1
-
-/**
- * enum iwl_scan_complete_status - status codes for scan complete notifications
- * @SCAN_COMP_STATUS_OK:  scan completed successfully
- * @SCAN_COMP_STATUS_ABORT: scan was aborted by user
- * @SCAN_COMP_STATUS_ERR_SLEEP: sending null sleep packet failed
- * @SCAN_COMP_STATUS_ERR_CHAN_TIMEOUT: timeout before channel is ready
- * @SCAN_COMP_STATUS_ERR_PROBE: sending probe request failed
- * @SCAN_COMP_STATUS_ERR_WAKEUP: sending null wakeup packet failed
- * @SCAN_COMP_STATUS_ERR_ANTENNAS: invalid antennas chosen at scan command
- * @SCAN_COMP_STATUS_ERR_INTERNAL: internal error caused scan abort
- * @SCAN_COMP_STATUS_ERR_COEX: medium was lost ot WiMax
- * @SCAN_COMP_STATUS_P2P_ACTION_OK: P2P public action frame TX was successful
- *     (not an error!)
- * @SCAN_COMP_STATUS_ITERATION_END: indicates end of one repetition the driver
- *     asked for
- * @SCAN_COMP_STATUS_ERR_ALLOC_TE: scan could not allocate time events
-*/
-enum iwl_scan_complete_status {
-       SCAN_COMP_STATUS_OK = 0x1,
-       SCAN_COMP_STATUS_ABORT = 0x2,
-       SCAN_COMP_STATUS_ERR_SLEEP = 0x3,
-       SCAN_COMP_STATUS_ERR_CHAN_TIMEOUT = 0x4,
-       SCAN_COMP_STATUS_ERR_PROBE = 0x5,
-       SCAN_COMP_STATUS_ERR_WAKEUP = 0x6,
-       SCAN_COMP_STATUS_ERR_ANTENNAS = 0x7,
-       SCAN_COMP_STATUS_ERR_INTERNAL = 0x8,
-       SCAN_COMP_STATUS_ERR_COEX = 0x9,
-       SCAN_COMP_STATUS_P2P_ACTION_OK = 0xA,
-       SCAN_COMP_STATUS_ITERATION_END = 0x0B,
-       SCAN_COMP_STATUS_ERR_ALLOC_TE = 0x0C,
-};
-
 /* scan offload */
 #define IWL_SCAN_MAX_BLACKLIST_LEN     64
 #define IWL_SCAN_SHORT_BLACKLIST_LEN   16
@@ -136,6 +101,7 @@ enum iwl_scan_complete_status {
 
 #define IWL_FULL_SCAN_MULTIPLIER 5
 #define IWL_FAST_SCHED_SCAN_ITERATIONS 3
+#define IWL_MAX_SCHED_SCAN_PLANS 2
 
 enum scan_framework_client {
        SCAN_CLIENT_SCHED_SCAN          = BIT(0),
@@ -143,71 +109,6 @@ enum scan_framework_client {
        SCAN_CLIENT_ASSET_TRACKING      = BIT(2),
 };
 
-/**
- * struct iwl_scan_offload_cmd - SCAN_REQUEST_FIXED_PART_API_S_VER_6
- * @scan_flags:                see enum iwl_scan_flags
- * @channel_count:     channels in channel list
- * @quiet_time:                dwell time, in milliseconds, on quiet channel
- * @quiet_plcp_th:     quiet channel num of packets threshold
- * @good_CRC_th:       passive to active promotion threshold
- * @rx_chain:          RXON rx chain.
- * @max_out_time:      max TUs to be out of associated channel
- * @suspend_time:      pause scan this TUs when returning to service channel
- * @flags:             RXON flags
- * @filter_flags:      RXONfilter
- * @tx_cmd:            tx command for active scan; for 2GHz and for 5GHz.
- * @direct_scan:       list of SSIDs for directed active scan
- * @scan_type:         see enum iwl_scan_type.
- * @rep_count:         repetition count for each scheduled scan iteration.
- */
-struct iwl_scan_offload_cmd {
-       __le16 len;
-       u8 scan_flags;
-       u8 channel_count;
-       __le16 quiet_time;
-       __le16 quiet_plcp_th;
-       __le16 good_CRC_th;
-       __le16 rx_chain;
-       __le32 max_out_time;
-       __le32 suspend_time;
-       /* RX_ON_FLAGS_API_S_VER_1 */
-       __le32 flags;
-       __le32 filter_flags;
-       struct iwl_tx_cmd tx_cmd[2];
-       /* SCAN_DIRECT_SSID_IE_API_S_VER_1 */
-       struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
-       __le32 scan_type;
-       __le32 rep_count;
-} __packed;
-
-enum iwl_scan_offload_channel_flags {
-       IWL_SCAN_OFFLOAD_CHANNEL_ACTIVE         = BIT(0),
-       IWL_SCAN_OFFLOAD_CHANNEL_NARROW         = BIT(22),
-       IWL_SCAN_OFFLOAD_CHANNEL_FULL           = BIT(24),
-       IWL_SCAN_OFFLOAD_CHANNEL_PARTIAL        = BIT(25),
-};
-
-/* channel configuration for struct iwl_scan_offload_cfg. Each channels needs:
- * __le32 type:        bitmap; bits 1-20 are for directed scan to i'th ssid and
- *     see enum iwl_scan_offload_channel_flags.
- * __le16 channel_number: channel number 1-13 etc.
- * __le16 iter_count: repetition count for the channel.
- * __le32 iter_interval: interval between two iterations on one channel.
- * u8 active_dwell.
- * u8 passive_dwell.
- */
-#define IWL_SCAN_CHAN_SIZE 14
-
-/**
- * iwl_scan_offload_cfg - SCAN_OFFLOAD_CONFIG_API_S
- * @scan_cmd:          scan command fixed part
- * @data:              scan channel configuration and probe request frames
- */
-struct iwl_scan_offload_cfg {
-       struct iwl_scan_offload_cmd scan_cmd;
-       u8 data[0];
-} __packed;
-
 /**
  * iwl_scan_offload_blacklist - SCAN_OFFLOAD_BLACKLIST_S
  * @ssid:              MAC address to filter out
@@ -274,50 +175,18 @@ struct iwl_scan_offload_profile_cfg {
 } __packed;
 
 /**
- * iwl_scan_offload_schedule - schedule of scan offload
+ * iwl_scan_schedule_lmac - schedule of scan offload
  * @delay:             delay between iterations, in seconds.
  * @iterations:                num of scan iterations
  * @full_scan_mul:     number of partial scans before each full scan
  */
-struct iwl_scan_offload_schedule {
+struct iwl_scan_schedule_lmac {
        __le16 delay;
        u8 iterations;
        u8 full_scan_mul;
-} __packed;
-
-/*
- * iwl_scan_offload_flags
- *
- * IWL_SCAN_OFFLOAD_FLAG_PASS_ALL: pass all results - no filtering.
- * IWL_SCAN_OFFLOAD_FLAG_CACHED_CHANNEL: add cached channels to partial scan.
- * IWL_SCAN_OFFLOAD_FLAG_EBS_QUICK_MODE: EBS duration is 100mSec - typical
- *     beacon period. Finding channel activity in this mode is not guaranteed.
- * IWL_SCAN_OFFLOAD_FLAG_EBS_ACCURATE_MODE: EBS duration is 200mSec.
- *     Assuming beacon period is 100ms finding channel activity is guaranteed.
- */
-enum iwl_scan_offload_flags {
-       IWL_SCAN_OFFLOAD_FLAG_PASS_ALL          = BIT(0),
-       IWL_SCAN_OFFLOAD_FLAG_CACHED_CHANNEL    = BIT(2),
-       IWL_SCAN_OFFLOAD_FLAG_EBS_QUICK_MODE    = BIT(5),
-       IWL_SCAN_OFFLOAD_FLAG_EBS_ACCURATE_MODE = BIT(6),
-};
+} __packed; /* SCAN_SCHEDULE_API_S */
 
-/**
- * iwl_scan_offload_req - scan offload request command
- * @flags:             bitmap - enum iwl_scan_offload_flags.
- * @watchdog:          maximum scan duration in TU.
- * @delay:             delay in seconds before first iteration.
- * @schedule_line:     scan offload schedule, for fast and regular scan.
- */
-struct iwl_scan_offload_req {
-       __le16 flags;
-       __le16 watchdog;
-       __le16 delay;
-       __le16 reserved;
-       struct iwl_scan_offload_schedule schedule_line[2];
-} __packed;
-
-enum iwl_scan_offload_compleate_status {
+enum iwl_scan_offload_complete_status {
        IWL_SCAN_OFFLOAD_COMPLETED      = 1,
        IWL_SCAN_OFFLOAD_ABORTED        = 2,
 };
@@ -326,37 +195,9 @@ enum iwl_scan_ebs_status {
        IWL_SCAN_EBS_SUCCESS,
        IWL_SCAN_EBS_FAILED,
        IWL_SCAN_EBS_CHAN_NOT_FOUND,
+       IWL_SCAN_EBS_INACTIVE,
 };
 
-/**
- * iwl_scan_offload_complete - SCAN_OFFLOAD_COMPLETE_NTF_API_S_VER_1
- * @last_schedule_line:                last schedule line executed (fast or regular)
- * @last_schedule_iteration:   last scan iteration executed before scan abort
- * @status:                    enum iwl_scan_offload_compleate_status
- * @ebs_status: last EBS status, see IWL_SCAN_EBS_*
- */
-struct iwl_scan_offload_complete {
-       u8 last_schedule_line;
-       u8 last_schedule_iteration;
-       u8 status;
-       u8 ebs_status;
-} __packed;
-
-/**
- * iwl_sched_scan_results - SCAN_OFFLOAD_MATCH_FOUND_NTF_API_S_VER_1
- * @ssid_bitmap:       SSIDs indexes found in this iteration
- * @client_bitmap:     clients that are active and wait for this notification
- */
-struct iwl_sched_scan_results {
-       __le16 ssid_bitmap;
-       u8 client_bitmap;
-       u8 reserved;
-};
-
-/* Unified LMAC scan API */
-
-#define IWL_MVM_BASIC_PASSIVE_DWELL 110
-
 /**
  * iwl_scan_req_tx_cmd - SCAN_REQ_TX_CMD_API_S
  * @tx_flags: combination of TX_CMD_FLG_*
@@ -463,8 +304,19 @@ enum iwl_scan_priority {
        IWL_SCAN_PRIORITY_HIGH,
 };
 
+enum iwl_scan_priority_ext {
+       IWL_SCAN_PRIORITY_EXT_0_LOWEST,
+       IWL_SCAN_PRIORITY_EXT_1,
+       IWL_SCAN_PRIORITY_EXT_2,
+       IWL_SCAN_PRIORITY_EXT_3,
+       IWL_SCAN_PRIORITY_EXT_4,
+       IWL_SCAN_PRIORITY_EXT_5,
+       IWL_SCAN_PRIORITY_EXT_6,
+       IWL_SCAN_PRIORITY_EXT_7_HIGHEST,
+};
+
 /**
- * iwl_scan_req_unified_lmac - SCAN_REQUEST_CMD_API_S_VER_1
+ * iwl_scan_req_lmac - SCAN_REQUEST_CMD_API_S_VER_1
  * @reserved1: for alignment and future use
  * @channel_num: num of channels to scan
  * @active-dwell: dwell time for active channels
@@ -487,7 +339,7 @@ enum iwl_scan_priority {
  * @channel_opt: channel optimization options, for full and partial scan
  * @data: channel configuration and probe request packet.
  */
-struct iwl_scan_req_unified_lmac {
+struct iwl_scan_req_lmac {
        /* SCAN_REQUEST_FIXED_PART_API_S_VER_7 */
        __le32 reserved1;
        u8 n_channels;
@@ -508,7 +360,7 @@ struct iwl_scan_req_unified_lmac {
        /* SCAN_REQ_PERIODIC_PARAMS_API_S */
        __le32 iter_num;
        __le32 delay;
-       struct iwl_scan_offload_schedule schedule[2];
+       struct iwl_scan_schedule_lmac schedule[IWL_MAX_SCHED_SCAN_PLANS];
        struct iwl_scan_channel_opt channel_opt[2];
        u8 data[];
 } __packed;
@@ -570,19 +422,11 @@ struct iwl_periodic_scan_complete {
 
 /* UMAC Scan API */
 
-/**
- * struct iwl_mvm_umac_cmd_hdr - Command header for UMAC commands
- * @size:      size of the command (not including header)
- * @reserved0: for future use and alignment
- * @ver:       API version number
+/* The maximum of either of these cannot exceed 8, because we use an
+ * 8-bit mask (see IWL_MVM_SCAN_MASK in mvm.h).
  */
-struct iwl_mvm_umac_cmd_hdr {
-       __le16 size;
-       u8 reserved0;
-       u8 ver;
-} __packed;
-
-#define IWL_MVM_MAX_SIMULTANEOUS_SCANS 8
+#define IWL_MVM_MAX_UMAC_SCANS 8
+#define IWL_MVM_MAX_LMAC_SCANS 1
 
 enum scan_config_flags {
        SCAN_CONFIG_FLAG_ACTIVATE                       = BIT(0),
@@ -637,7 +481,6 @@ enum iwl_channel_flags {
 
 /**
  * struct iwl_scan_config
- * @hdr: umac command header
  * @flags:                     enum scan_config_flags
  * @tx_chains:                 valid_tx antenna - ANT_* definitions
  * @rx_chains:                 valid_rx antenna - ANT_* definitions
@@ -655,7 +498,6 @@ enum iwl_channel_flags {
  * @channel_array:             default supported channels
  */
 struct iwl_scan_config {
-       struct iwl_mvm_umac_cmd_hdr hdr;
        __le32 flags;
        __le32 tx_chains;
        __le32 rx_chains;
@@ -676,7 +518,8 @@ struct iwl_scan_config {
  * iwl_umac_scan_flags
  *@IWL_UMAC_SCAN_FLAG_PREEMPTIVE: scan process triggered by this scan request
  *     can be preempted by other scan requests with higher priority.
- *     The low priority scan is aborted.
+ *     The low priority scan will be resumed when the higher proirity scan is
+ *     completed.
  *@IWL_UMAC_SCAN_FLAG_START_NOTIF: notification will be sent to the driver
  *     when scan starts.
  */
@@ -740,7 +583,7 @@ struct iwl_scan_umac_schedule {
  */
 struct iwl_scan_req_umac_tail {
        /* SCAN_PERIODIC_PARAMS_API_S_VER_1 */
-       struct iwl_scan_umac_schedule schedule[2];
+       struct iwl_scan_umac_schedule schedule[IWL_MAX_SCHED_SCAN_PLANS];
        __le16 delay;
        __le16 reserved;
        /* SCAN_PROBE_PARAMS_API_S_VER_1 */
@@ -750,7 +593,6 @@ struct iwl_scan_req_umac_tail {
 
 /**
  * struct iwl_scan_req_umac
- * @hdr: umac command header
  * @flags: &enum iwl_umac_scan_flags
  * @uid: scan id, &enum iwl_umac_scan_uid_offsets
  * @ooc_priority: out of channel priority - &enum iwl_scan_priority
@@ -769,7 +611,6 @@ struct iwl_scan_req_umac_tail {
  *     &struct iwl_scan_req_umac_tail
  */
 struct iwl_scan_req_umac {
-       struct iwl_mvm_umac_cmd_hdr hdr;
        __le32 flags;
        __le32 uid;
        __le32 ooc_priority;
@@ -791,12 +632,10 @@ struct iwl_scan_req_umac {
 
 /**
  * struct iwl_umac_scan_abort
- * @hdr: umac command header
  * @uid: scan id, &enum iwl_umac_scan_uid_offsets
  * @flags: reserved
  */
 struct iwl_umac_scan_abort {
-       struct iwl_mvm_umac_cmd_hdr hdr;
        __le32 uid;
        __le32 flags;
 } __packed; /* SCAN_ABORT_CMD_UMAC_API_S_VER_1 */
@@ -865,4 +704,27 @@ struct iwl_scan_offload_profiles_query {
        struct iwl_scan_offload_profile_match matches[IWL_SCAN_MAX_PROFILES];
 } __packed; /* SCAN_OFFLOAD_PROFILES_QUERY_RSP_S_VER_2 */
 
+/**
+ * struct iwl_umac_scan_iter_complete_notif - notifies end of scanning iteration
+ * @uid: scan id, &enum iwl_umac_scan_uid_offsets
+ * @scanned_channels: number of channels scanned and number of valid elements in
+ *     results array
+ * @status: one of SCAN_COMP_STATUS_*
+ * @bt_status: BT on/off status
+ * @last_channel: last channel that was scanned
+ * @tsf_low: TSF timer (lower half) in usecs
+ * @tsf_high: TSF timer (higher half) in usecs
+ * @results: array of scan results, only "scanned_channels" of them are valid
+ */
+struct iwl_umac_scan_iter_complete_notif {
+       __le32 uid;
+       u8 scanned_channels;
+       u8 status;
+       u8 bt_status;
+       u8 last_channel;
+       __le32 tsf_low;
+       __le32 tsf_high;
+       struct iwl_scan_results_notif results[];
+} __packed; /* SCAN_ITER_COMPLETE_NTF_UMAC_API_S_VER_1 */
+
 #endif