diff options
author | Larry Finger <Larry.Finger@lwfinger.net> | 2015-02-03 20:15:18 +0300 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2015-02-06 09:36:08 +0300 |
commit | 6d4beca3775222884e1ee9d48ef586c438c3dfa1 (patch) | |
tree | 6c5fec1f68d1b68b9bc02c8ae4e0d77c8065a345 /drivers/net/wireless/rtlwifi/pci.h | |
parent | d0311314d00298f83aa5450a1d4a92889e7cc2ea (diff) | |
download | linux-6d4beca3775222884e1ee9d48ef586c438c3dfa1.tar.xz |
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: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org> [V3.18]
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/rtlwifi/pci.h')
-rw-r--r-- | drivers/net/wireless/rtlwifi/pci.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/wireless/rtlwifi/pci.h b/drivers/net/wireless/rtlwifi/pci.h index 5e832306dba9..d4567d12e07e 100644 --- a/drivers/net/wireless/rtlwifi/pci.h +++ b/drivers/net/wireless/rtlwifi/pci.h @@ -325,4 +325,11 @@ 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) +{ + if (rp <= wp) + return RTL_PCI_MAX_RX_COUNT - 1 + rp - wp; + return rp - wp - 1; +} + #endif |