Commit b2a58c97 authored by Sara Sharon's avatar Sara Sharon Committed by Luca Coelho

iwlwifi: pcie: unionize used bd and completion descriptor

This allows less "dummy" declarations and casting.
Signed-off-by: default avatarSara Sharon <sara.sharon@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent 18ead597
...@@ -235,7 +235,11 @@ struct iwl_rxq { ...@@ -235,7 +235,11 @@ struct iwl_rxq {
int id; int id;
void *bd; void *bd;
dma_addr_t bd_dma; dma_addr_t bd_dma;
union {
void *used_bd; void *used_bd;
__le32 *bd_32;
struct iwl_rx_completion_desc *cd;
};
dma_addr_t used_bd_dma; dma_addr_t used_bd_dma;
__le16 *tr_tail; __le16 *tr_tail;
dma_addr_t tr_tail_dma; dma_addr_t tr_tail_dma;
......
...@@ -649,7 +649,6 @@ static void iwl_pcie_free_rxq_dma(struct iwl_trans *trans, ...@@ -649,7 +649,6 @@ static void iwl_pcie_free_rxq_dma(struct iwl_trans *trans,
struct iwl_rxq *rxq) struct iwl_rxq *rxq)
{ {
struct device *dev = trans->dev; struct device *dev = trans->dev;
struct iwl_rx_completion_desc *rx_cd;
bool use_rx_td = (trans->cfg->device_family >= bool use_rx_td = (trans->cfg->device_family >=
IWL_DEVICE_FAMILY_22560); IWL_DEVICE_FAMILY_22560);
int free_size = iwl_pcie_free_bd_size(trans, use_rx_td); int free_size = iwl_pcie_free_bd_size(trans, use_rx_td);
...@@ -671,7 +670,7 @@ static void iwl_pcie_free_rxq_dma(struct iwl_trans *trans, ...@@ -671,7 +670,7 @@ static void iwl_pcie_free_rxq_dma(struct iwl_trans *trans,
if (rxq->used_bd) if (rxq->used_bd)
dma_free_coherent(trans->dev, dma_free_coherent(trans->dev,
(use_rx_td ? sizeof(*rx_cd) : (use_rx_td ? sizeof(*rxq->cd) :
sizeof(__le32)) * rxq->queue_size, sizeof(__le32)) * rxq->queue_size,
rxq->used_bd, rxq->used_bd_dma); rxq->used_bd, rxq->used_bd_dma);
rxq->used_bd_dma = 0; rxq->used_bd_dma = 0;
...@@ -698,7 +697,6 @@ static int iwl_pcie_alloc_rxq_dma(struct iwl_trans *trans, ...@@ -698,7 +697,6 @@ static int iwl_pcie_alloc_rxq_dma(struct iwl_trans *trans,
{ {
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
struct device *dev = trans->dev; struct device *dev = trans->dev;
struct iwl_rx_completion_desc *rx_cd;
int i; int i;
int free_size; int free_size;
bool use_rx_td = (trans->cfg->device_family >= bool use_rx_td = (trans->cfg->device_family >=
...@@ -725,7 +723,7 @@ static int iwl_pcie_alloc_rxq_dma(struct iwl_trans *trans, ...@@ -725,7 +723,7 @@ static int iwl_pcie_alloc_rxq_dma(struct iwl_trans *trans,
if (trans->cfg->mq_rx_supported) { if (trans->cfg->mq_rx_supported) {
rxq->used_bd = dma_zalloc_coherent(dev, rxq->used_bd = dma_zalloc_coherent(dev,
(use_rx_td ? (use_rx_td ?
sizeof(*rx_cd) : sizeof(*rxq->cd) :
sizeof(__le32)) * sizeof(__le32)) *
rxq->queue_size, rxq->queue_size,
&rxq->used_bd_dma, &rxq->used_bd_dma,
...@@ -1371,18 +1369,10 @@ static void iwl_pcie_rx_handle(struct iwl_trans *trans, int queue) ...@@ -1371,18 +1369,10 @@ static void iwl_pcie_rx_handle(struct iwl_trans *trans, int queue)
* to retrieve the vid * to retrieve the vid
*/ */
if (trans->cfg->device_family >= if (trans->cfg->device_family >=
IWL_DEVICE_FAMILY_22560) { IWL_DEVICE_FAMILY_22560)
struct iwl_rx_completion_desc *rx_cd = vid = le16_to_cpu(rxq->cd[i].rbid) & 0x0FFF;
&((struct iwl_rx_completion_desc *) else
rxq->used_bd)[i]; vid = le32_to_cpu(rxq->bd_32[i]) & 0x0FFF;
vid = le16_to_cpu(rx_cd->rbid) & 0x0FFF;
} else {
__le32 *used =
&((__le32 *)rxq->used_bd)[i];
vid = le32_to_cpu(*used) & 0x0FFF;
}
if (WARN(!vid || if (WARN(!vid ||
vid > ARRAY_SIZE(trans_pcie->global_table), vid > ARRAY_SIZE(trans_pcie->global_table),
...@@ -1397,15 +1387,9 @@ static void iwl_pcie_rx_handle(struct iwl_trans *trans, int queue) ...@@ -1397,15 +1387,9 @@ static void iwl_pcie_rx_handle(struct iwl_trans *trans, int queue)
goto out; goto out;
} }
if (trans->cfg->device_family >= if (trans->cfg->device_family >=
IWL_DEVICE_FAMILY_22560) { IWL_DEVICE_FAMILY_22560)
struct iwl_rx_completion_desc *rx_cd = rxb->size = le32_to_cpu(rxq->cd[i].size) &
&((struct iwl_rx_completion_desc *)
rxq->used_bd)[i];
rxb->size = le32_to_cpu(rx_cd->size) &
IWL_RX_CD_SIZE; IWL_RX_CD_SIZE;
}
rxb->invalid = true; rxb->invalid = true;
} else { } else {
rxb = rxq->queue[i]; rxb = rxq->queue[i];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment