ath10k: move wmi_op_version to struct ath10k_fw_file
[cascardo/linux.git] / drivers / net / wireless / ath / ath10k / core.h
index a62b62a..7d709f8 100644 (file)
@@ -44,8 +44,8 @@
 
 #define ATH10K_SCAN_ID 0
 #define WMI_READY_TIMEOUT (5 * HZ)
-#define ATH10K_FLUSH_TIMEOUT_HZ (5*HZ)
-#define ATH10K_CONNECTION_LOSS_HZ (3*HZ)
+#define ATH10K_FLUSH_TIMEOUT_HZ (5 * HZ)
+#define ATH10K_CONNECTION_LOSS_HZ (3 * HZ)
 #define ATH10K_NUM_CHANS 39
 
 /* Antenna noise floor */
@@ -98,6 +98,7 @@ struct ath10k_skb_cb {
        u8 eid;
        u16 msdu_id;
        struct ieee80211_vif *vif;
+       struct ieee80211_txq *txq;
 } __packed;
 
 struct ath10k_skb_rxcb {
@@ -138,7 +139,6 @@ struct ath10k_mem_chunk {
 };
 
 struct ath10k_wmi {
-       enum ath10k_fw_wmi_op_version op_version;
        enum ath10k_htc_ep_id eid;
        struct completion service_ready;
        struct completion unified_ready;
@@ -297,6 +297,9 @@ struct ath10k_dfs_stats {
 
 struct ath10k_peer {
        struct list_head list;
+       struct ieee80211_vif *vif;
+       struct ieee80211_sta *sta;
+
        int vdev_id;
        u8 addr[ETH_ALEN];
        DECLARE_BITMAP(peer_ids, ATH10K_MAX_NUM_PEER_IDS);
@@ -305,6 +308,12 @@ struct ath10k_peer {
        struct ieee80211_key_conf *keys[WMI_MAX_KEY_INDEX + 1];
 };
 
+struct ath10k_txq {
+       struct list_head list;
+       unsigned long num_fw_queued;
+       unsigned long num_push_allowed;
+};
+
 struct ath10k_sta {
        struct ath10k_vif *arvif;
 
@@ -313,6 +322,7 @@ struct ath10k_sta {
        u32 bw;
        u32 nss;
        u32 smps;
+       u16 peer_id;
 
        struct work_struct update_wk;
 
@@ -323,7 +333,7 @@ struct ath10k_sta {
 #endif
 };
 
-#define ATH10K_VDEV_SETUP_TIMEOUT_HZ (5*HZ)
+#define ATH10K_VDEV_SETUP_TIMEOUT_HZ (5 * HZ)
 
 enum ath10k_beacon_state {
        ATH10K_BEACON_SCHEDULED = 0,
@@ -335,6 +345,7 @@ struct ath10k_vif {
        struct list_head list;
 
        u32 vdev_id;
+       u16 peer_id;
        enum wmi_vdev_type vdev_type;
        enum wmi_vdev_subtype vdev_subtype;
        u32 beacon_interval;
@@ -549,12 +560,17 @@ enum ath10k_dev_flags {
 
        /* Bluetooth coexistance enabled */
        ATH10K_FLAG_BTCOEX,
+
+       /* Per Station statistics service */
+       ATH10K_FLAG_PEER_STATS,
 };
 
 enum ath10k_cal_mode {
        ATH10K_CAL_MODE_FILE,
        ATH10K_CAL_MODE_OTP,
        ATH10K_CAL_MODE_DT,
+       ATH10K_PRE_CAL_MODE_FILE,
+       ATH10K_PRE_CAL_MODE_DT,
 };
 
 enum ath10k_crypt_mode {
@@ -573,6 +589,10 @@ static inline const char *ath10k_cal_mode_str(enum ath10k_cal_mode mode)
                return "otp";
        case ATH10K_CAL_MODE_DT:
                return "dt";
+       case ATH10K_PRE_CAL_MODE_FILE:
+               return "pre-cal-file";
+       case ATH10K_PRE_CAL_MODE_DT:
+               return "pre-cal-dt";
        }
 
        return "unknown";
@@ -606,6 +626,33 @@ enum ath10k_tx_pause_reason {
        ATH10K_TX_PAUSE_MAX,
 };
 
+struct ath10k_fw_file {
+       const struct firmware *firmware;
+
+       char fw_version[ETHTOOL_FWVERS_LEN];
+
+       DECLARE_BITMAP(fw_features, ATH10K_FW_FEATURE_COUNT);
+
+       enum ath10k_fw_wmi_op_version wmi_op_version;
+
+       const void *firmware_data;
+       size_t firmware_len;
+
+       const void *otp_data;
+       size_t otp_len;
+
+       const void *codeswap_data;
+       size_t codeswap_len;
+};
+
+struct ath10k_fw_components {
+       const struct firmware *board;
+       const void *board_data;
+       size_t board_len;
+
+       struct ath10k_fw_file fw_file;
+};
+
 struct ath10k {
        struct ath_common ath_common;
        struct ieee80211_hw *hw;
@@ -631,8 +678,6 @@ struct ath10k {
        /* protected by conf_mutex */
        bool ani_enabled;
 
-       DECLARE_BITMAP(fw_features, ATH10K_FW_FEATURE_COUNT);
-
        bool p2p;
 
        struct {
@@ -680,39 +725,31 @@ struct ath10k {
                /* The padding bytes's location is different on various chips */
                enum ath10k_hw_4addr_pad hw_4addr_pad;
 
-               u32 num_msdu_desc;
-               u32 qcache_active_peers;
                u32 tx_chain_mask;
                u32 rx_chain_mask;
                u32 max_spatial_stream;
+               u32 cal_data_len;
 
                struct ath10k_hw_params_fw {
                        const char *dir;
-                       const char *fw;
-                       const char *otp;
                        const char *board;
                        size_t board_size;
                        size_t board_ext_size;
                } fw;
        } hw_params;
 
-       const struct firmware *board;
-       const void *board_data;
-       size_t board_len;
-
-       const struct firmware *otp;
-       const void *otp_data;
-       size_t otp_len;
+       /* contains the firmware images used with ATH10K_FIRMWARE_MODE_NORMAL */
+       struct ath10k_fw_components normal_mode_fw;
 
-       const struct firmware *firmware;
-       const void *firmware_data;
-       size_t firmware_len;
+       /* READ-ONLY images of the running firmware, which can be either
+        * normal or UTF. Do not modify, release etc!
+        */
+       const struct ath10k_fw_components *running_fw;
 
+       const struct firmware *pre_cal_file;
        const struct firmware *cal_file;
 
        struct {
-               const void *firmware_codeswap_data;
-               size_t firmware_codeswap_len;
                struct ath10k_swap_code_seg_info *firmware_swap_code_seg_info;
        } swap;
 
@@ -756,6 +793,9 @@ struct ath10k {
        /* current operating channel definition */
        struct cfg80211_chan_def chandef;
 
+       /* currently configured operating channel in firmware */
+       struct ieee80211_channel *tgt_oper_chan;
+
        unsigned long long free_vdev_map;
        struct ath10k_vif *monitor_arvif;
        bool monitor;
@@ -786,9 +826,13 @@ struct ath10k {
 
        /* protects shared structure data */
        spinlock_t data_lock;
+       /* protects: ar->txqs, artxq->list */
+       spinlock_t txqs_lock;
 
+       struct list_head txqs;
        struct list_head arvifs;
        struct list_head peers;
+       struct ath10k_peer *peer_map[ATH10K_MAX_NUM_PEER_IDS];
        wait_queue_head_t peer_mapping_wq;
 
        /* protected by conf_mutex */
@@ -851,13 +895,8 @@ struct ath10k {
 
        struct {
                /* protected by conf_mutex */
-               const struct firmware *utf;
-               char utf_version[32];
-               const void *utf_firmware_data;
-               size_t utf_firmware_len;
-               DECLARE_BITMAP(orig_fw_features, ATH10K_FW_FEATURE_COUNT);
-               enum ath10k_fw_wmi_op_version orig_wmi_op_version;
-               enum ath10k_fw_wmi_op_version op_version;
+               struct ath10k_fw_components utf_mode_fw;
+
                /* protected by data_lock */
                bool utf_monitor;
        } testmode;
@@ -876,6 +915,15 @@ struct ath10k {
        u8 drv_priv[0] __aligned(sizeof(void *));
 };
 
+static inline bool ath10k_peer_stats_enabled(struct ath10k *ar)
+{
+       if (test_bit(ATH10K_FLAG_PEER_STATS, &ar->dev_flags) &&
+           test_bit(WMI_SERVICE_PEER_STATS, ar->wmi.svc_map))
+               return true;
+
+       return false;
+}
+
 struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev,
                                  enum ath10k_bus bus,
                                  enum ath10k_hw_rev hw_rev,
@@ -885,7 +933,8 @@ void ath10k_core_get_fw_features_str(struct ath10k *ar,
                                     char *buf,
                                     size_t max_len);
 
-int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode);
+int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode,
+                     const struct ath10k_fw_components *fw_components);
 int ath10k_wait_for_suspend(struct ath10k *ar, u32 suspend_opt);
 void ath10k_core_stop(struct ath10k *ar);
 int ath10k_core_register(struct ath10k *ar, u32 chip_id);