iwlwifi: move to wide ID for all commands
authorSara Sharon <sara.sharon@intel.com>
Mon, 15 Aug 2016 14:36:47 +0000 (17:36 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Mon, 19 Sep 2016 07:09:39 +0000 (10:09 +0300)
Due to firmware design considerations, move to wide ID for
all commands.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/iwl-notif-wait.c
drivers/net/wireless/intel/iwlwifi/iwl-trans.c
drivers/net/wireless/intel/iwlwifi/iwl-trans.h
drivers/net/wireless/intel/iwlwifi/mvm/ops.c
drivers/net/wireless/intel/iwlwifi/pcie/internal.h
drivers/net/wireless/intel/iwlwifi/pcie/trans.c
drivers/net/wireless/intel/iwlwifi/pcie/tx.c

index 8aa1f2b7fdfc5ce16b7fc4c0914be994fb799ef3..88f260db3744006244509a71b938d0d2d26b4082 100644 (file)
@@ -99,8 +99,12 @@ void iwl_notification_wait_notify(struct iwl_notif_wait_data *notif_wait,
                                continue;
 
                        for (i = 0; i < w->n_cmds; i++) {
-                               if (w->cmds[i] ==
-                                   WIDE_ID(pkt->hdr.group_id, pkt->hdr.cmd)) {
+                               u16 rec_id = WIDE_ID(pkt->hdr.group_id,
+                                                    pkt->hdr.cmd);
+
+                               if (w->cmds[i] == rec_id ||
+                                   (!iwl_cmd_groupid(w->cmds[i]) &&
+                                    DEF_ID(w->cmds[i]) == rec_id)) {
                                        found = true;
                                        break;
                                }
index b0bd67c64b5ca6aaaa800de3c1a034f16d8fea01..b42152c697be9c8494ce0f1b3311c137e5255a8d 100644 (file)
@@ -140,6 +140,9 @@ int iwl_trans_send_cmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
        if (!(cmd->flags & CMD_ASYNC))
                lock_map_acquire_read(&trans->sync_cmd_lockdep_map);
 
+       if (trans->wide_cmd_header && !iwl_cmd_groupid(cmd->id))
+               cmd->id = DEF_ID(cmd->id);
+
        ret = trans->ops->send_cmd(trans, cmd);
 
        if (!(cmd->flags & CMD_ASYNC))
index 04e998d9d5fe014863248c84fb51c0f2cc25fa95..0296124a7f9cf013c01f46583d11d5c110185707 100644 (file)
@@ -153,6 +153,7 @@ static inline u32 iwl_cmd_id(u8 opcode, u8 groupid, u8 version)
 
 /* make u16 wide id out of u8 group and opcode */
 #define WIDE_ID(grp, opcode) ((grp << 8) | opcode)
+#define DEF_ID(opcode) ((1 << 8) | (opcode))
 
 /* due to the conversion, this group is special; new groups
  * should be defined in the appropriate fw-api header files
@@ -484,7 +485,6 @@ struct iwl_hcmd_arr {
  * @bc_table_dword: set to true if the BC table expects the byte count to be
  *     in DWORD (as opposed to bytes)
  * @scd_set_active: should the transport configure the SCD for HCMD queue
- * @wide_cmd_header: firmware supports wide host command header
  * @sw_csum_tx: transport should compute the TCP checksum
  * @command_groups: array of command groups, each member is an array of the
  *     commands in the group; for debugging only
@@ -506,7 +506,6 @@ struct iwl_trans_config {
        enum iwl_amsdu_size rx_buf_size;
        bool bc_table_dword;
        bool scd_set_active;
-       bool wide_cmd_header;
        bool sw_csum_tx;
        const struct iwl_hcmd_arr *command_groups;
        int command_groups_size;
@@ -770,6 +769,7 @@ enum iwl_plat_pm_mode {
  * @hw_id_str: a string with info about HW ID. Set during transport allocation.
  * @pm_support: set to true in start_hw if link pm is supported
  * @ltr_enabled: set to true if the LTR is enabled
+ * @wide_cmd_header: true when ucode supports wide command header format
  * @num_rx_queues: number of RX queues allocated by the transport;
  *     the transport must set this before calling iwl_drv_start()
  * @dev_cmd_pool: pool for Tx cmd allocation - for internal use only.
@@ -821,6 +821,7 @@ struct iwl_trans {
 
        const struct iwl_hcmd_arr *command_groups;
        int command_groups_size;
+       bool wide_cmd_header;
 
        u8 num_rx_queues;
 
index de34c9f4f0f45eec423e2585d35d4775b451ee55..b2d8722cbb116736a7572eb006ce5a81f24671be 100644 (file)
@@ -652,8 +652,8 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
        /* the hardware splits the A-MSDU */
        if (mvm->cfg->mq_rx_supported)
                trans_cfg.rx_buf_size = IWL_AMSDU_4K;
-       trans_cfg.wide_cmd_header = fw_has_api(&mvm->fw->ucode_capa,
-                                              IWL_UCODE_TLV_API_WIDE_CMD_HDR);
+       trans->wide_cmd_header = fw_has_api(&mvm->fw->ucode_capa,
+                                           IWL_UCODE_TLV_API_WIDE_CMD_HDR);
 
        if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_DW_BC_TABLE)
                trans_cfg.bc_table_dword = true;
index 987a0770fb5badc830eb36c34942c870ec3a7d24..2d81630fba0f71dffb7f5c54c6285fd6cb2fe1b1 100644 (file)
@@ -332,7 +332,6 @@ enum iwl_shared_irq_flags {
  * @rx_buf_size: Rx buffer size
  * @bc_table_dword: true if the BC table expects DWORD (as opposed to bytes)
  * @scd_set_active: should the transport configure the SCD for HCMD queue
- * @wide_cmd_header: true when ucode supports wide command header format
  * @sw_csum_tx: if true, then the transport will compute the csum of the TXed
  *     frame.
  * @rx_page_order: page order for receive buffer size
@@ -405,7 +404,6 @@ struct iwl_trans_pcie {
        enum iwl_amsdu_size rx_buf_size;
        bool bc_table_dword;
        bool scd_set_active;
-       bool wide_cmd_header;
        bool sw_csum_tx;
        u32 rx_page_order;
 
index 74199b1749485fe44a19cc6c6821f38b3e7c9aaf..68fa8438134381c1a49a5431571aadcfe50ee320 100644 (file)
@@ -1755,7 +1755,6 @@ static void iwl_trans_pcie_configure(struct iwl_trans *trans,
        trans_pcie->rx_page_order =
                iwl_trans_get_rb_size_order(trans_pcie->rx_buf_size);
 
-       trans_pcie->wide_cmd_header = trans_cfg->wide_cmd_header;
        trans_pcie->bc_table_dword = trans_cfg->bc_table_dword;
        trans_pcie->scd_set_active = trans_cfg->scd_set_active;
        trans_pcie->sw_csum_tx = trans_cfg->sw_csum_tx;
index 0d156fddbf3d809c63165785335a57e3b0cb39fd..e00e7d8f197ae8bac2620c1d86317d62e1cbe9ff 100644 (file)
@@ -1493,7 +1493,7 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans,
        const u8 *cmddata[IWL_MAX_CMD_TBS_PER_TFD];
        u16 cmdlen[IWL_MAX_CMD_TBS_PER_TFD];
 
-       if (WARN(!trans_pcie->wide_cmd_header &&
+       if (WARN(!trans->wide_cmd_header &&
                 group_id > IWL_ALWAYS_LONG_GROUP,
                 "unsupported wide command %#x\n", cmd->id))
                return -EINVAL;