Skip to content

Commit

Permalink
iwlwifi: pcie: fix the byte count table format for 22560 devices
Browse files Browse the repository at this point in the history
Starting from 22560, the byte count is expected to be in
bytes and we have now 14 bits. Ajust the code to this.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  • Loading branch information
Emmanuel Grumbach authored and Kalle Valo committed Aug 20, 2019
1 parent 50f5604 commit 884b756
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,7 @@ void iwl_pcie_gen2_update_byte_tbl(struct iwl_trans_pcie *trans_pcie,
u16 len = byte_cnt;
__le16 bc_ent;

if (trans_pcie->bc_table_dword)
len = DIV_ROUND_UP(len, 4);

if (WARN_ON(len > 0xFFF || idx >= txq->n_window))
if (WARN(idx >= txq->n_window, "%d >= %d\n", idx, txq->n_window))
return;

filled_tfd_size = offsetof(struct iwl_tfh_tfd, tbs) +
Expand All @@ -117,11 +114,20 @@ void iwl_pcie_gen2_update_byte_tbl(struct iwl_trans_pcie *trans_pcie,
*/
num_fetch_chunks = DIV_ROUND_UP(filled_tfd_size, 64) - 1;

bc_ent = cpu_to_le16(len | (num_fetch_chunks << 12));
if (trans->cfg->device_family >= IWL_DEVICE_FAMILY_22560)
if (trans->cfg->device_family >= IWL_DEVICE_FAMILY_22560) {
/* Starting from 22560, the HW expects bytes */
WARN_ON(trans_pcie->bc_table_dword);
WARN_ON(len > 0x3FFF);
bc_ent = cpu_to_le16(len | (num_fetch_chunks << 14));
scd_bc_tbl_gen3->tfd_offset[idx] = bc_ent;
else
} else {
/* Until 22560, the HW expects DW */
WARN_ON(!trans_pcie->bc_table_dword);
len = DIV_ROUND_UP(len, 4);
WARN_ON(len > 0xFFF);
bc_ent = cpu_to_le16(len | (num_fetch_chunks << 12));
scd_bc_tbl->tfd_offset[idx] = bc_ent;
}
}

/*
Expand Down

0 comments on commit 884b756

Please sign in to comment.