iwlagn: add statistic notification structure for WiFi/BT devices
[deliverable/linux.git] / drivers / net / wireless / iwlwifi / iwl-commands.h
index f4e59ae07f8e5a70c0d4e39ab57af34b64bf753d..4be90637b568bfc0a319e3f4056a0508c64f83b1 100644 (file)
@@ -95,8 +95,9 @@ enum {
 
        /* Multi-Station support */
        REPLY_ADD_STA = 0x18,
-       REPLY_REMOVE_STA = 0x19,        /* not used */
+       REPLY_REMOVE_STA = 0x19,
        REPLY_REMOVE_ALL_STA = 0x1a,    /* not used */
+       REPLY_TXFIFO_FLUSH = 0x1e,
 
        /* Security */
        REPLY_WEPKEY = 0x20,
@@ -106,7 +107,7 @@ enum {
        REPLY_TX = 0x1c,
        REPLY_RATE_SCALE = 0x47,        /* 3945 only */
        REPLY_LEDS_CMD = 0x48,
-       REPLY_TX_LINK_QUALITY_CMD = 0x4e, /* 4965 only */
+       REPLY_TX_LINK_QUALITY_CMD = 0x4e, /* for 4965 and up */
 
        /* WiMAX coexistence */
        COEX_PRIORITY_TABLE_CMD = 0x5a, /* for 5000 series and up */
@@ -512,8 +513,9 @@ struct iwl_init_alive_resp {
  *
  *     Entries without timestamps contain only event_id and data.
  *
+ *
  * 2)  error_event_table_ptr indicates base of the error log.  This contains
- *     information about any uCode error that occurs.  For 4965, the format
+ *     information about any uCode error that occurs.  For agn, the format
  *     of the error log is:
  *
  *     __le32 valid;        (nonzero) valid, (0) log is empty
@@ -529,6 +531,30 @@ struct iwl_init_alive_resp {
  *     __le32 bcon_time;    beacon timer
  *     __le32 tsf_low;      network timestamp function timer
  *     __le32 tsf_hi;       network timestamp function timer
+ *     __le32 gp1;          GP1 timer register
+ *     __le32 gp2;          GP2 timer register
+ *     __le32 gp3;          GP3 timer register
+ *     __le32 ucode_ver;    uCode version
+ *     __le32 hw_ver;       HW Silicon version
+ *     __le32 brd_ver;      HW board version
+ *     __le32 log_pc;       log program counter
+ *     __le32 frame_ptr;    frame pointer
+ *     __le32 stack_ptr;    stack pointer
+ *     __le32 hcmd;         last host command
+ *     __le32 isr0;         isr status register LMPM_NIC_ISR0: rxtx_flag
+ *     __le32 isr1;         isr status register LMPM_NIC_ISR1: host_flag
+ *     __le32 isr2;         isr status register LMPM_NIC_ISR2: enc_flag
+ *     __le32 isr3;         isr status register LMPM_NIC_ISR3: time_flag
+ *     __le32 isr4;         isr status register LMPM_NIC_ISR4: wico interrupt
+ *     __le32 isr_pref;     isr status register LMPM_NIC_PREF_STAT
+ *     __le32 wait_event;   wait event() caller address
+ *     __le32 l2p_control;  L2pControlField
+ *     __le32 l2p_duration; L2pDurationField
+ *     __le32 l2p_mhvalid;  L2pMhValidBits
+ *     __le32 l2p_addr_match; L2pAddrMatchStat
+ *     __le32 lmpm_pmg_sel; indicate which clocks are turned on (LMPM_PMG_SEL)
+ *     __le32 u_timestamp;  indicate when the date and time of the compilation
+ *     __le32 reserved;
  *
  * The Linux driver can print both logs to the system log when a uCode error
  * occurs.
@@ -927,14 +953,13 @@ struct iwl_qosparam_cmd {
 
 /* Special, dedicated locations within device's station table */
 #define        IWL_AP_ID               0
-#define IWL_MULTICAST_ID       1
 #define        IWL_STA_ID              2
 #define        IWL3945_BROADCAST_ID    24
 #define IWL3945_STATION_COUNT  25
 #define IWL4965_BROADCAST_ID   31
 #define        IWL4965_STATION_COUNT   32
-#define IWL5000_BROADCAST_ID   15
-#define        IWL5000_STATION_COUNT   16
+#define IWLAGN_BROADCAST_ID    15
+#define        IWLAGN_STATION_COUNT    16
 
 #define        IWL_STATION_COUNT       32      /* MAX(3945,4965)*/
 #define        IWL_INVALID_STATION     255
@@ -1185,6 +1210,43 @@ struct iwl_rem_sta_cmd {
        u8 reserved2[2];
 } __attribute__ ((packed));
 
+#define IWL_TX_FIFO_BK_MSK             cpu_to_le32(BIT(0))
+#define IWL_TX_FIFO_BE_MSK             cpu_to_le32(BIT(1))
+#define IWL_TX_FIFO_VI_MSK             cpu_to_le32(BIT(2))
+#define IWL_TX_FIFO_VO_MSK             cpu_to_le32(BIT(3))
+#define IWL_AGG_TX_QUEUE_MSK           cpu_to_le32(0xffc00)
+
+#define IWL_DROP_SINGLE                0
+#define IWL_DROP_SELECTED      1
+#define IWL_DROP_ALL           2
+
+/*
+ * REPLY_TXFIFO_FLUSH = 0x1e(command and response)
+ *
+ * When using full FIFO flush this command checks the scheduler HW block WR/RD
+ * pointers to check if all the frames were transferred by DMA into the
+ * relevant TX FIFO queue. Only when the DMA is finished and the queue is
+ * empty the command can finish.
+ * This command is used to flush the TXFIFO from transmit commands, it may
+ * operate on single or multiple queues, the command queue can't be flushed by
+ * this command. The command response is returned when all the queue flush
+ * operations are done. Each TX command flushed return response with the FLUSH
+ * status set in the TX response status. When FIFO flush operation is used,
+ * the flush operation ends when both the scheduler DMA done and TXFIFO empty
+ * are set.
+ *
+ * @fifo_control: bit mask for which queues to flush
+ * @flush_control: flush controls
+ *     0: Dump single MSDU
+ *     1: Dump multiple MSDU according to PS, INVALID STA, TTL, TID disable.
+ *     2: Dump all FIFO
+ */
+struct iwl_txfifo_flush_cmd {
+       __le32 fifo_control;
+       __le16 flush_control;
+       __le16 reserved;
+} __packed;
+
 /*
  * REPLY_WEP_KEY = 0x20
  */
@@ -1342,7 +1404,7 @@ struct iwl_rx_phy_res {
        __le16 reserved3;
 } __attribute__ ((packed));
 
-struct iwl4965_rx_mpdu_res_start {
+struct iwl_rx_mpdu_res_start {
        __le16 byte_count;
        __le16 reserved;
 } __attribute__ ((packed));
@@ -1375,18 +1437,27 @@ struct iwl4965_rx_mpdu_res_start {
 
 /* REPLY_TX Tx flags field */
 
-/* 1: Use RTS/CTS protocol or CTS-to-self if spec allows it
+/*
+ * 1: Use RTS/CTS protocol or CTS-to-self if spec allows it
  * before this frame. if CTS-to-self required check
- * RXON_FLG_SELF_CTS_EN status. */
-#define TX_CMD_FLG_RTS_CTS_MSK cpu_to_le32(1 << 0)
+ * RXON_FLG_SELF_CTS_EN status.
+ * unused in 3945/4965, used in 5000 series and after
+ */
+#define TX_CMD_FLG_PROT_REQUIRE_MSK cpu_to_le32(1 << 0)
 
-/* 1: Use Request-To-Send protocol before this frame.
- * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK. */
+/*
+ * 1: Use Request-To-Send protocol before this frame.
+ * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK.
+ * used in 3945/4965, unused in 5000 series and after
+ */
 #define TX_CMD_FLG_RTS_MSK cpu_to_le32(1 << 1)
 
-/* 1: Transmit Clear-To-Send to self before this frame.
+/*
+ * 1: Transmit Clear-To-Send to self before this frame.
  * Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames.
- * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK. */
+ * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK.
+ * used in 3945/4965, unused in 5000 series and after
+ */
 #define TX_CMD_FLG_CTS_MSK cpu_to_le32(1 << 2)
 
 /* 1: Expect ACK from receiving station
@@ -1406,8 +1477,11 @@ struct iwl4965_rx_mpdu_res_start {
  * Set when Txing a block-ack request frame.  Also set TX_CMD_FLG_ACK_MSK. */
 #define TX_CMD_FLG_IMM_BA_RSP_MASK  cpu_to_le32(1 << 6)
 
-/* 1: Frame requires full Tx-Op protection.
- * Set this if either RTS or CTS Tx Flag gets set. */
+/*
+ * 1: Frame requires full Tx-Op protection.
+ * Set this if either RTS or CTS Tx Flag gets set.
+ * used in 3945/4965, unused in 5000 series and after
+ */
 #define TX_CMD_FLG_FULL_TXOP_PROT_MSK cpu_to_le32(1 << 7)
 
 /* Tx antenna selection field; used only for 3945, reserved (0) for 4965.
@@ -1418,7 +1492,7 @@ struct iwl4965_rx_mpdu_res_start {
 
 /* 1: Ignore Bluetooth priority for this frame.
  * 0: Delay Tx until Bluetooth device is done (normal usage). */
-#define TX_CMD_FLG_BT_DIS_MSK cpu_to_le32(1 << 12)
+#define TX_CMD_FLG_IGNORE_BT cpu_to_le32(1 << 12)
 
 /* 1: uCode overrides sequence control field in MAC header.
  * 0: Driver provides sequence control field in MAC header.
@@ -1637,7 +1711,7 @@ struct iwl_tx_cmd {
        struct ieee80211_hdr hdr[0];
 } __attribute__ ((packed));
 
-/* TX command response is sent after *all* transmission attempts.
+/* TX command response is sent after *3945* transmission attempts.
  *
  * NOTES:
  *
@@ -1664,25 +1738,66 @@ struct iwl_tx_cmd {
  * command FIFO has been cleared.  The host must then deactivate the TX Abort
  * control line.  Receiving is still allowed in this case.
  */
+enum {
+       TX_3945_STATUS_SUCCESS = 0x01,
+       TX_3945_STATUS_DIRECT_DONE = 0x02,
+       TX_3945_STATUS_FAIL_SHORT_LIMIT = 0x82,
+       TX_3945_STATUS_FAIL_LONG_LIMIT = 0x83,
+       TX_3945_STATUS_FAIL_FIFO_UNDERRUN = 0x84,
+       TX_3945_STATUS_FAIL_MGMNT_ABORT = 0x85,
+       TX_3945_STATUS_FAIL_NEXT_FRAG = 0x86,
+       TX_3945_STATUS_FAIL_LIFE_EXPIRE = 0x87,
+       TX_3945_STATUS_FAIL_DEST_PS = 0x88,
+       TX_3945_STATUS_FAIL_ABORTED = 0x89,
+       TX_3945_STATUS_FAIL_BT_RETRY = 0x8a,
+       TX_3945_STATUS_FAIL_STA_INVALID = 0x8b,
+       TX_3945_STATUS_FAIL_FRAG_DROPPED = 0x8c,
+       TX_3945_STATUS_FAIL_TID_DISABLE = 0x8d,
+       TX_3945_STATUS_FAIL_FRAME_FLUSHED = 0x8e,
+       TX_3945_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f,
+       TX_3945_STATUS_FAIL_TX_LOCKED = 0x90,
+       TX_3945_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91,
+};
+
+/*
+ * TX command response is sent after *agn* transmission attempts.
+ *
+ * both postpone and abort status are expected behavior from uCode. there is
+ * no special operation required from driver; except for RFKILL_FLUSH,
+ * which required tx flush host command to flush all the tx frames in queues
+ */
 enum {
        TX_STATUS_SUCCESS = 0x01,
        TX_STATUS_DIRECT_DONE = 0x02,
+       /* postpone TX */
+       TX_STATUS_POSTPONE_DELAY = 0x40,
+       TX_STATUS_POSTPONE_FEW_BYTES = 0x41,
+       TX_STATUS_POSTPONE_BT_PRIO = 0x42,
+       TX_STATUS_POSTPONE_QUIET_PERIOD = 0x43,
+       TX_STATUS_POSTPONE_CALC_TTAK = 0x44,
+       /* abort TX */
+       TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY = 0x81,
        TX_STATUS_FAIL_SHORT_LIMIT = 0x82,
        TX_STATUS_FAIL_LONG_LIMIT = 0x83,
        TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84,
-       TX_STATUS_FAIL_MGMNT_ABORT = 0x85,
-       TX_STATUS_FAIL_NEXT_FRAG = 0x86,
+       TX_STATUS_FAIL_DRAIN_FLOW = 0x85,
+       TX_STATUS_FAIL_RFKILL_FLUSH = 0x86,
        TX_STATUS_FAIL_LIFE_EXPIRE = 0x87,
        TX_STATUS_FAIL_DEST_PS = 0x88,
-       TX_STATUS_FAIL_ABORTED = 0x89,
+       TX_STATUS_FAIL_HOST_ABORTED = 0x89,
        TX_STATUS_FAIL_BT_RETRY = 0x8a,
        TX_STATUS_FAIL_STA_INVALID = 0x8b,
        TX_STATUS_FAIL_FRAG_DROPPED = 0x8c,
        TX_STATUS_FAIL_TID_DISABLE = 0x8d,
-       TX_STATUS_FAIL_FRAME_FLUSHED = 0x8e,
+       TX_STATUS_FAIL_FIFO_FLUSHED = 0x8e,
        TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f,
-       TX_STATUS_FAIL_TX_LOCKED = 0x90,
-       TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91,
+       /* uCode drop due to FW drop request */
+       TX_STATUS_FAIL_FW_DROP = 0x90,
+       /*
+        * uCode drop due to station color mismatch
+        * between tx command and station table
+        */
+       TX_STATUS_FAIL_STA_COLOR_MISMATCH_DROP = 0x91,
 };
 
 #define        TX_PACKET_MODE_REGULAR          0x0000
@@ -1704,30 +1819,6 @@ enum {
        TX_ABORT_REQUIRED_MSK = 0x80000000,     /* bits 31:31 */
 };
 
-static inline u32 iwl_tx_status_to_mac80211(u32 status)
-{
-       status &= TX_STATUS_MSK;
-
-       switch (status) {
-       case TX_STATUS_SUCCESS:
-       case TX_STATUS_DIRECT_DONE:
-               return IEEE80211_TX_STAT_ACK;
-       case TX_STATUS_FAIL_DEST_PS:
-               return IEEE80211_TX_STAT_TX_FILTERED;
-       default:
-               return 0;
-       }
-}
-
-static inline bool iwl_is_tx_success(u32 status)
-{
-       status &= TX_STATUS_MSK;
-       return (status == TX_STATUS_SUCCESS) ||
-              (status == TX_STATUS_DIRECT_DONE);
-}
-
-
-
 /* *******************************
  * TX aggregation status
  ******************************* */
@@ -2626,7 +2717,6 @@ struct iwl_ssid_ie {
 #define IWL_GOOD_CRC_TH_NEVER          cpu_to_le16(0xffff)
 #define IWL_MAX_SCAN_SIZE 1024
 #define IWL_MAX_CMD_SIZE 4096
-#define IWL_MAX_PROBE_REQUEST          200
 
 /*
  * REPLY_SCAN_CMD = 0x80 (command)
@@ -2945,7 +3035,8 @@ struct iwl39_statistics_tx {
 struct statistics_dbg {
        __le32 burst_check;
        __le32 burst_count;
-       __le32 reserved[4];
+       __le32 wait_for_silence_timeout_cnt;
+       __le32 reserved[3];
 } __attribute__ ((packed));
 
 struct iwl39_statistics_div {
@@ -3036,6 +3127,13 @@ struct statistics_rx_non_phy {
        __le32 beacon_energy_c;
 } __attribute__ ((packed));
 
+struct statistics_rx_non_phy_bt {
+       struct statistics_rx_non_phy common;
+       /* additional stats for bt */
+       __le32 num_bt_kills;
+       __le32 reserved[2];
+} __attribute__ ((packed));
+
 struct statistics_rx {
        struct statistics_rx_phy ofdm;
        struct statistics_rx_phy cck;
@@ -3043,6 +3141,13 @@ struct statistics_rx {
        struct statistics_rx_ht_phy ofdm_ht;
 } __attribute__ ((packed));
 
+struct statistics_rx_bt {
+       struct statistics_rx_phy ofdm;
+       struct statistics_rx_phy cck;
+       struct statistics_rx_non_phy_bt general;
+       struct statistics_rx_ht_phy ofdm_ht;
+} __attribute__ ((packed));
+
 /**
  * struct statistics_tx_power - current tx power
  *
@@ -3086,6 +3191,11 @@ struct statistics_tx {
        __le32 cts_timeout_collision;
        __le32 ack_or_ba_timeout_collision;
        struct statistics_tx_non_phy_agg agg;
+       /*
+        * "tx_power" are optional parameters provided by uCode,
+        * 6000 series is the only device provide the information,
+        * Those are reserved fields for all the other devices
+        */
        struct statistics_tx_power tx_power;
        __le32 reserved1;
 } __attribute__ ((packed));
@@ -3100,7 +3210,7 @@ struct statistics_div {
        __le32 reserved2;
 } __attribute__ ((packed));
 
-struct statistics_general {
+struct statistics_general_common {
        __le32 temperature;   /* radio temperature */
        __le32 temperature_m; /* for 5000 and up, this is radio voltage */
        struct statistics_dbg dbg;
@@ -3116,6 +3226,30 @@ struct statistics_general {
         *  in order to get out of bad PHY status
         */
        __le32 num_of_sos_states;
+} __attribute__ ((packed));
+
+struct statistics_bt_activity {
+       /* Tx statistics */
+       __le32 hi_priority_tx_req_cnt;
+       __le32 hi_priority_tx_denied_cnt;
+       __le32 lo_priority_tx_req_cnt;
+       __le32 lo_priority_tx_denied_cnt;
+       /* Rx statistics */
+       __le32 hi_priority_rx_req_cnt;
+       __le32 hi_priority_rx_denied_cnt;
+       __le32 lo_priority_rx_req_cnt;
+       __le32 lo_priority_rx_denied_cnt;
+} __attribute__ ((packed));
+
+struct statistics_general {
+       struct statistics_general_common common;
+       __le32 reserved2;
+       __le32 reserved3;
+} __attribute__ ((packed));
+
+struct statistics_general_bt {
+       struct statistics_general_common common;
+       struct statistics_bt_activity activity;
        __le32 reserved2;
        __le32 reserved3;
 } __attribute__ ((packed));
@@ -3177,6 +3311,12 @@ struct iwl_notif_statistics {
        struct statistics_general general;
 } __attribute__ ((packed));
 
+struct iwl_bt_notif_statistics {
+       __le32 flag;
+       struct statistics_rx_bt rx;
+       struct statistics_tx tx;
+       struct statistics_general_bt general;
+} __attribute__ ((packed));
 
 /*
  * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command)
@@ -3395,6 +3535,41 @@ struct iwl_missed_beacon_notif {
 #define HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX          (9)
 #define HD_OFDM_ENERGY_TH_IN_INDEX                  (10)
 
+/*
+ * Additional table entries in enhance SENSITIVITY_CMD
+ */
+#define HD_INA_NON_SQUARE_DET_OFDM_INDEX               (11)
+#define HD_INA_NON_SQUARE_DET_CCK_INDEX                        (12)
+#define HD_CORR_11_INSTEAD_OF_CORR_9_EN_INDEX          (13)
+#define HD_OFDM_NON_SQUARE_DET_SLOPE_MRC_INDEX         (14)
+#define HD_OFDM_NON_SQUARE_DET_INTERCEPT_MRC_INDEX     (15)
+#define HD_OFDM_NON_SQUARE_DET_SLOPE_INDEX             (16)
+#define HD_OFDM_NON_SQUARE_DET_INTERCEPT_INDEX         (17)
+#define HD_CCK_NON_SQUARE_DET_SLOPE_MRC_INDEX          (18)
+#define HD_CCK_NON_SQUARE_DET_INTERCEPT_MRC_INDEX      (19)
+#define HD_CCK_NON_SQUARE_DET_SLOPE_INDEX              (20)
+#define HD_CCK_NON_SQUARE_DET_INTERCEPT_INDEX          (21)
+#define HD_RESERVED                                    (22)
+
+/* number of entries for enhanced tbl */
+#define ENHANCE_HD_TABLE_SIZE  (23)
+
+/* number of additional entries for enhanced tbl */
+#define ENHANCE_HD_TABLE_ENTRIES  (ENHANCE_HD_TABLE_SIZE - HD_TABLE_SIZE)
+
+#define HD_INA_NON_SQUARE_DET_OFDM_DATA                        cpu_to_le16(0)
+#define HD_INA_NON_SQUARE_DET_CCK_DATA                 cpu_to_le16(0)
+#define HD_CORR_11_INSTEAD_OF_CORR_9_EN_DATA           cpu_to_le16(0)
+#define HD_OFDM_NON_SQUARE_DET_SLOPE_MRC_DATA          cpu_to_le16(668)
+#define HD_OFDM_NON_SQUARE_DET_INTERCEPT_MRC_DATA      cpu_to_le16(4)
+#define HD_OFDM_NON_SQUARE_DET_SLOPE_DATA              cpu_to_le16(486)
+#define HD_OFDM_NON_SQUARE_DET_INTERCEPT_DATA          cpu_to_le16(37)
+#define HD_CCK_NON_SQUARE_DET_SLOPE_MRC_DATA           cpu_to_le16(853)
+#define HD_CCK_NON_SQUARE_DET_INTERCEPT_MRC_DATA       cpu_to_le16(4)
+#define HD_CCK_NON_SQUARE_DET_SLOPE_DATA               cpu_to_le16(476)
+#define HD_CCK_NON_SQUARE_DET_INTERCEPT_DATA           cpu_to_le16(99)
+
+
 /* Control field in struct iwl_sensitivity_cmd */
 #define SENSITIVITY_CMD_CONTROL_DEFAULT_TABLE  cpu_to_le16(0)
 #define SENSITIVITY_CMD_CONTROL_WORK_TABLE     cpu_to_le16(1)
@@ -3411,6 +3586,14 @@ struct iwl_sensitivity_cmd {
        __le16 table[HD_TABLE_SIZE];    /* use HD_* as index */
 } __attribute__ ((packed));
 
+/*
+ *
+ */
+struct iwl_enhance_sensitivity_cmd {
+       __le16 control;                 /* always use "1" */
+       __le16 enhance_table[ENHANCE_HD_TABLE_SIZE];    /* use HD_* as index */
+} __packed;
+
 
 /**
  * REPLY_PHY_CALIBRATION_CMD = 0xb0 (command, has simple generic response)
This page took 0.066468 seconds and 5 git commands to generate.