Skip to content

Commit

Permalink
rtlwifi: fix the wrong size to calculate fifo space
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ping-Ke Shih authored and Kalle Valo committed Dec 7, 2017
1 parent fb9829e commit dc9682a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions drivers/net/wireless/realtek/rtlwifi/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
6 changes: 4 additions & 2 deletions drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit dc9682a

Please sign in to comment.