iwlwifi: pcie: update bytes in the byte count table
authorGolan Ben Ami <golan.ben.ami@intel.com>
Tue, 2 Jan 2018 10:08:31 +0000 (12:08 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Thu, 26 Jul 2018 10:16:15 +0000 (13:16 +0300)
For devices which use the image loader image, the length of the frame
must be updated in the byte count in bytes, and not dwords as today.
Avoid dividing the input length by 4.

Signed-off-by: Golan Ben Ami <golan.ben.ami@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/ops.c
drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c

index aa11b35d6f51520c1d21332170764a13def4a188..5d9b9306ea1ce81d85da0476c9dfdf36452df9c9 100644 (file)
@@ -708,7 +708,8 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
                trans_cfg.rx_buf_size = IWL_AMSDU_4K;
 
        trans->wide_cmd_header = true;
-       trans_cfg.bc_table_dword = true;
+       trans_cfg.bc_table_dword =
+               mvm->trans->cfg->device_family < IWL_DEVICE_FAMILY_22560;
 
        trans_cfg.command_groups = iwl_mvm_groups;
        trans_cfg.command_groups_size = ARRAY_SIZE(iwl_mvm_groups);
index 48890a1c825fd9ded157f57d12599601e4c8d6e7..5f05bcb267763be5c787c84502862bc034bdaa11 100644 (file)
@@ -6,6 +6,7 @@
  * GPL LICENSE SUMMARY
  *
  * Copyright(c) 2017 Intel Deutschland GmbH
+ * Copyright(c) 2018        Intel Corporation
  *
  * 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
@@ -19,6 +20,7 @@
  * BSD LICENSE
  *
  * Copyright(c) 2017 Intel Deutschland GmbH
+ * Copyright(c) 2018        Intel Corporation
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -84,7 +86,8 @@ void iwl_pcie_gen2_tx_stop(struct iwl_trans *trans)
 /*
  * iwl_pcie_txq_update_byte_tbl - Set up entry in Tx byte-count array
  */
-static void iwl_pcie_gen2_update_byte_tbl(struct iwl_txq *txq, u16 byte_cnt,
+static void iwl_pcie_gen2_update_byte_tbl(struct iwl_trans_pcie *trans_pcie,
+                                         struct iwl_txq *txq, u16 byte_cnt,
                                          int num_tbs)
 {
        struct iwlagn_scd_bc_tbl *scd_bc_tbl = txq->bc_tbl.addr;
@@ -93,7 +96,8 @@ static void iwl_pcie_gen2_update_byte_tbl(struct iwl_txq *txq, u16 byte_cnt,
        u16 len = byte_cnt;
        __le16 bc_ent;
 
-       len = DIV_ROUND_UP(len, 4);
+       if (trans_pcie->bc_table_dword)
+               len = DIV_ROUND_UP(len, 4);
 
        if (WARN_ON(len > 0xFFF || idx >= txq->n_window))
                return;
@@ -526,7 +530,7 @@ int iwl_trans_pcie_gen2_tx(struct iwl_trans *trans, struct sk_buff *skb,
        }
 
        /* Set up entry for this TFD in Tx byte-count array */
-       iwl_pcie_gen2_update_byte_tbl(txq, le16_to_cpu(tx_cmd->len),
+       iwl_pcie_gen2_update_byte_tbl(trans_pcie, txq, le16_to_cpu(tx_cmd->len),
                                      iwl_pcie_gen2_get_num_tbs(trans, tfd));
 
        /* start timer if queue currently empty */