rtlwifi: fix the wrong size to calculate fifo space

Give correct fifo size to calculate fifo space. Fortunately, the values of
RTL_PCI_MAX_RX_COUNT and TX_DESC_NUM_92E are the same in old code, so it
still works.

Signed-off-by: Steven Ting <steventing@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
Ping-Ke Shih 2017-11-13 17:39:34 +08:00 committed by Kalle Valo
parent fb9829e90d
commit dc9682a0cc
2 changed files with 6 additions and 4 deletions

View File

@ -320,10 +320,10 @@ static inline void pci_write32_async(struct rtl_priv *rtlpriv,
writel(val, (u8 __iomem *)rtlpriv->io.pci_mem_start + addr);
}
static inline u16 calc_fifo_space(u16 rp, u16 wp)
static inline u16 calc_fifo_space(u16 rp, u16 wp, u16 size)
{
if (rp <= wp)
return RTL_PCI_MAX_RX_COUNT - 1 + rp - wp;
return size - 1 + rp - wp;
return rp - wp - 1;
}

View File

@ -498,7 +498,8 @@ u16 rtl92ee_rx_desc_buff_remained_cnt(struct ieee80211_hw *hw, u8 queue_index)
if (!start_rx)
return 0;
remind_cnt = calc_fifo_space(read_point, write_point);
remind_cnt = calc_fifo_space(read_point, write_point,
RTL_PCI_MAX_RX_COUNT);
if (remind_cnt == 0)
return 0;
@ -560,7 +561,8 @@ u16 rtl92ee_get_available_desc(struct ieee80211_hw *hw, u8 q_idx)
current_tx_write_point = (u16)((tmp_4byte) & 0x0fff);
point_diff = calc_fifo_space(current_tx_read_point,
current_tx_write_point);
current_tx_write_point,
TX_DESC_NUM_92E);
rtlpci->tx_ring[q_idx].avl_desc = point_diff;
return point_diff;