Skip to content

Commit 6204d51

Browse files
committed
wifi: iwlwifi: use bc entries instead of bc table also for pre-ax210
iwlagn_scd_bc_tbl is used for pre-ax210 devices, and iwl_gen3_bc_tbl_entry is used for ax210 and on. But there is no difference between the the 22000 version and the AX210+ one. In order to unify the two, as first step make iwlagn_scd_bc_tbl an entry as well, and adjust the code. In a later patch both structures will be unified. Signed-off-by: Miri Korenblit <[email protected]> Link: https://patch.msgid.link/20250511195137.645cd82ebf48.Iaa7e88179372d60ef31157e379737b5babe54012@changeid
1 parent f74cb4d commit 6204d51

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

drivers/net/wireless/intel/iwlwifi/iwl-fh.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ struct iwl_tfh_tfd {
717717
/* Fixed (non-configurable) rx data from phy */
718718

719719
/**
720-
* struct iwlagn_scd_bc_tbl - scheduler byte count table
720+
* struct iwlagn_scd_bc_tbl_entry - scheduler byte count table entry
721721
* base physical address provided by SCD_DRAM_BASE_ADDR
722722
* For devices up to 22000:
723723
* @tfd_offset:
@@ -729,8 +729,8 @@ struct iwl_tfh_tfd {
729729
* 12-13 - number of 64 byte chunks
730730
* 14-16 - reserved
731731
*/
732-
struct iwlagn_scd_bc_tbl {
733-
__le16 tfd_offset[TFD_QUEUE_BC_SIZE];
732+
struct iwlagn_scd_bc_tbl_entry {
733+
__le16 tfd_offset;
734734
} __packed;
735735

736736
/**

drivers/net/wireless/intel/iwlwifi/pcie/trans.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3839,7 +3839,8 @@ iwl_trans_pcie_alloc(struct pci_dev *pdev,
38393839
trans_pcie->txqs.bc_tbl_size =
38403840
sizeof(struct iwl_gen3_bc_tbl_entry) * TFD_QUEUE_BC_SIZE_AX210;
38413841
else
3842-
trans_pcie->txqs.bc_tbl_size = sizeof(struct iwlagn_scd_bc_tbl);
3842+
trans_pcie->txqs.bc_tbl_size =
3843+
sizeof(struct iwlagn_scd_bc_tbl_entry) * TFD_QUEUE_BC_SIZE;
38433844
/*
38443845
* For gen2 devices, we use a single allocation for each byte-count
38453846
* table, but they're pretty small (1k) so use a DMA pool that we

drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,12 +587,12 @@ static void iwl_pcie_gen2_update_byte_tbl(struct iwl_trans *trans,
587587
bc_ent = cpu_to_le16(len | (num_fetch_chunks << 14));
588588
scd_bc_tbl_gen3[idx].tfd_offset = bc_ent;
589589
} else {
590-
struct iwlagn_scd_bc_tbl *scd_bc_tbl = txq->bc_tbl.addr;
590+
struct iwlagn_scd_bc_tbl_entry *scd_bc_tbl = txq->bc_tbl.addr;
591591

592592
len = DIV_ROUND_UP(len, 4);
593593
WARN_ON(len > 0xFFF);
594594
bc_ent = cpu_to_le16(len | (num_fetch_chunks << 12));
595-
scd_bc_tbl->tfd_offset[idx] = bc_ent;
595+
scd_bc_tbl[idx].tfd_offset = bc_ent;
596596
}
597597
}
598598

drivers/net/wireless/intel/iwlwifi/pcie/tx.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,8 @@ int iwl_pcie_txq_alloc(struct iwl_trans *trans, struct iwl_txq *txq,
796796
return -ENOMEM;
797797
}
798798

799+
#define BC_TABLE_SIZE (sizeof(struct iwlagn_scd_bc_tbl_entry) * TFD_QUEUE_BC_SIZE)
800+
799801
/*
800802
* iwl_pcie_tx_alloc - allocate TX context
801803
* Allocate all Tx DMA structures and initialize them
@@ -810,7 +812,7 @@ static int iwl_pcie_tx_alloc(struct iwl_trans *trans)
810812
if (WARN_ON(trans->mac_cfg->device_family >= IWL_DEVICE_FAMILY_AX210))
811813
return -EINVAL;
812814

813-
bc_tbls_size *= sizeof(struct iwlagn_scd_bc_tbl);
815+
bc_tbls_size *= BC_TABLE_SIZE;
814816

815817
/*It is not allowed to alloc twice, so warn when this happens.
816818
* We cannot rely on the previous allocation, so free and fail */
@@ -2065,7 +2067,7 @@ static void iwl_txq_gen1_update_byte_cnt_tbl(struct iwl_trans *trans,
20652067
int num_tbs)
20662068
{
20672069
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
2068-
struct iwlagn_scd_bc_tbl *scd_bc_tbl;
2070+
struct iwlagn_scd_bc_tbl_entry *scd_bc_tbl;
20692071
int write_ptr = txq->write_ptr;
20702072
int txq_id = txq->id;
20712073
u8 sec_ctl = 0;
@@ -2099,10 +2101,10 @@ static void iwl_txq_gen1_update_byte_cnt_tbl(struct iwl_trans *trans,
20992101

21002102
bc_ent = cpu_to_le16(len | (sta_id << 12));
21012103

2102-
scd_bc_tbl[txq_id].tfd_offset[write_ptr] = bc_ent;
2104+
scd_bc_tbl[txq_id * BC_TABLE_SIZE + write_ptr].tfd_offset = bc_ent;
21032105

21042106
if (write_ptr < TFD_QUEUE_SIZE_BC_DUP)
2105-
scd_bc_tbl[txq_id].tfd_offset[TFD_QUEUE_SIZE_MAX + write_ptr] =
2107+
scd_bc_tbl[txq_id * BC_TABLE_SIZE + TFD_QUEUE_SIZE_MAX + write_ptr].tfd_offset =
21062108
bc_ent;
21072109
}
21082110

@@ -2312,7 +2314,7 @@ static void iwl_txq_gen1_inval_byte_cnt_tbl(struct iwl_trans *trans,
23122314
int read_ptr)
23132315
{
23142316
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
2315-
struct iwlagn_scd_bc_tbl *scd_bc_tbl = trans_pcie->txqs.scd_bc_tbls.addr;
2317+
struct iwlagn_scd_bc_tbl_entry *scd_bc_tbl = trans_pcie->txqs.scd_bc_tbls.addr;
23162318
int txq_id = txq->id;
23172319
u8 sta_id = 0;
23182320
__le16 bc_ent;
@@ -2326,10 +2328,10 @@ static void iwl_txq_gen1_inval_byte_cnt_tbl(struct iwl_trans *trans,
23262328

23272329
bc_ent = cpu_to_le16(1 | (sta_id << 12));
23282330

2329-
scd_bc_tbl[txq_id].tfd_offset[read_ptr] = bc_ent;
2331+
scd_bc_tbl[txq_id * BC_TABLE_SIZE + read_ptr].tfd_offset = bc_ent;
23302332

23312333
if (read_ptr < TFD_QUEUE_SIZE_BC_DUP)
2332-
scd_bc_tbl[txq_id].tfd_offset[TFD_QUEUE_SIZE_MAX + read_ptr] =
2334+
scd_bc_tbl[txq_id * BC_TABLE_SIZE + TFD_QUEUE_SIZE_MAX + read_ptr].tfd_offset =
23332335
bc_ent;
23342336
}
23352337

0 commit comments

Comments
 (0)