提交 6d4beca3 编写于 作者: L Larry Finger 提交者: Kalle Valo

rtlwifi: rtl8192ee: Fix problems with calculating free space in FIFO

This driver utilizes a FIFO buffer for RX descriptors. There are four places
in the code where it calculates the number of free slots. Several of those
locations do the calculation incorrectly. To fix these and to prevent future
mistakes, a common inline routine is created.
Signed-off-by: NLarry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org> [V3.18]
Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
上级 d0311314
...@@ -325,4 +325,11 @@ static inline void pci_write32_async(struct rtl_priv *rtlpriv, ...@@ -325,4 +325,11 @@ static inline void pci_write32_async(struct rtl_priv *rtlpriv,
writel(val, (u8 __iomem *) rtlpriv->io.pci_mem_start + addr); writel(val, (u8 __iomem *) rtlpriv->io.pci_mem_start + addr);
} }
static inline u16 calc_fifo_space(u16 rp, u16 wp)
{
if (rp <= wp)
return RTL_PCI_MAX_RX_COUNT - 1 + rp - wp;
return rp - wp - 1;
}
#endif #endif
...@@ -499,14 +499,7 @@ u16 rtl92ee_rx_desc_buff_remained_cnt(struct ieee80211_hw *hw, u8 queue_index) ...@@ -499,14 +499,7 @@ u16 rtl92ee_rx_desc_buff_remained_cnt(struct ieee80211_hw *hw, u8 queue_index)
if (!start_rx) if (!start_rx)
return 0; return 0;
if ((last_read_point > (RX_DESC_NUM_92E / 2)) && remind_cnt = calc_fifo_space(read_point, write_point);
(read_point <= (RX_DESC_NUM_92E / 2))) {
remind_cnt = RX_DESC_NUM_92E - write_point;
} else {
remind_cnt = (read_point >= write_point) ?
(read_point - write_point) :
(RX_DESC_NUM_92E - write_point + read_point);
}
if (remind_cnt == 0) if (remind_cnt == 0)
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册