iwlwifi: get the correct HCMD in the response handler
[deliverable/linux.git] / drivers / net / wireless / iwlwifi / iwl-trans.h
index 00efde8e5536bf674be9e3d612c8872930529aad..ff1154232885da82add146706ffe67b325d3e9b2 100644 (file)
@@ -184,14 +184,20 @@ struct iwl_rx_packet {
  * @CMD_SYNC: The caller will be stalled until the fw responds to the command
  * @CMD_ASYNC: Return right away and don't want for the response
  * @CMD_WANT_SKB: valid only with CMD_SYNC. The caller needs the buffer of the
- *     response.
+ *     response. The caller needs to call iwl_free_resp when done.
+ * @CMD_WANT_HCMD: The caller needs to get the HCMD that was sent in the
+ *     response handler. Chunks flagged by %IWL_HCMD_DFL_NOCOPY won't be
+ *     copied. The pointer passed to the response handler is in the transport
+ *     ownership and don't need to be freed by the op_mode. This also means
+ *     that the pointer is invalidated after the op_mode's handler returns.
  * @CMD_ON_DEMAND: This command is sent by the test mode pipe.
  */
 enum CMD_MODE {
        CMD_SYNC = 0,
        CMD_ASYNC = BIT(0),
        CMD_WANT_SKB = BIT(1),
-       CMD_ON_DEMAND = BIT(2),
+       CMD_WANT_HCMD = BIT(2),
+       CMD_ON_DEMAND = BIT(3),
 };
 
 #define DEF_CMD_PAYLOAD_SIZE 320
@@ -290,16 +296,17 @@ static inline struct page *rxb_steal_page(struct iwl_rx_cmd_buffer *r)
  * currently supports
  */
 #define IWL_MAX_HW_QUEUES              32
+#define IWL_INVALID_STATION    255
+#define IWL_MAX_TID_COUNT      8
+#define IWL_FRAME_LIMIT        64
 
 /**
  * struct iwl_trans_config - transport configuration
  *
  * @op_mode: pointer to the upper layer.
- * @queue_to_fifo: queue to FIFO mapping to set up by
- *     default
- * @n_queue_to_fifo: number of queues to set up
  * @cmd_queue: the index of the command queue.
  *     Must be set before start_fw.
+ * @cmd_fifo: the fifo for host commands
  * @no_reclaim_cmds: Some devices erroneously don't set the
  *     SEQ_RX_FRAME bit on some notifications, this is the
  *     list of such notifications to filter. Max length is
@@ -314,10 +321,9 @@ static inline struct page *rxb_steal_page(struct iwl_rx_cmd_buffer *r)
  */
 struct iwl_trans_config {
        struct iwl_op_mode *op_mode;
-       const u8 *queue_to_fifo;
-       u8 n_queue_to_fifo;
 
        u8 cmd_queue;
+       u8 cmd_fifo;
        const u8 *no_reclaim_cmds;
        int n_no_reclaim_cmds;
 
@@ -355,9 +361,9 @@ struct iwl_trans;
  *     Must be atomic
  * @reclaim: free packet until ssn. Returns a list of freed packets.
  *     Must be atomic
- * @txq_enable: setup a tx queue for AMPDU - will be called once the HW is
- *     ready and a successful ADDBA response has been received.
- *     May sleep
+ * @txq_enable: setup a queue. To setup an AC queue, use the
+ *     iwl_trans_ac_txq_enable wrapper. fw_alive must have been called before
+ *     this one. The op_mode must not configure the HCMD queue. May sleep.
  * @txq_disable: de-configure a Tx queue to send AMPDUs
  *     Must be atomic
  * @wait_tx_queue_empty: wait until all tx queues are empty
@@ -458,6 +464,9 @@ struct iwl_trans {
        /* The following fields are internal only */
        struct kmem_cache *dev_cmd_pool;
        size_t dev_cmd_headroom;
+       char dev_cmd_pool_name[50];
+
+       struct dentry *dbgfs_dir;
 
        /* pointer to trans specific struct */
        /*Ensure that this pointer will always be aligned to sizeof pointer */
@@ -497,9 +506,9 @@ static inline void iwl_trans_fw_alive(struct iwl_trans *trans)
 {
        might_sleep();
 
-       trans->ops->fw_alive(trans);
-
        trans->state = IWL_TRANS_FW_ALIVE;
+
+       trans->ops->fw_alive(trans);
 }
 
 static inline int iwl_trans_start_fw(struct iwl_trans *trans,
@@ -593,6 +602,13 @@ static inline void iwl_trans_txq_enable(struct iwl_trans *trans, int queue,
                                 frame_limit, ssn);
 }
 
+static inline void iwl_trans_ac_txq_enable(struct iwl_trans *trans, int queue,
+                                          int fifo)
+{
+       iwl_trans_txq_enable(trans, queue, fifo, IWL_INVALID_STATION,
+                            IWL_MAX_TID_COUNT, IWL_FRAME_LIMIT, 0);
+}
+
 static inline int iwl_trans_wait_tx_queue_empty(struct iwl_trans *trans)
 {
        WARN_ONCE(trans->state != IWL_TRANS_FW_ALIVE,
This page took 0.036776 seconds and 5 git commands to generate.