From: Ping-Ke Shih Date: Mon, 13 Nov 2017 09:39:34 +0000 (+0800) Subject: rtlwifi: fix the wrong size to calculate fifo space X-Git-Tag: v4.19~1702^2~329^2~33 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dc9682a0cca5018a64eefe1630f204fe4fbfebcc;p=platform%2Fkernel%2Flinux-rpi.git 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 Signed-off-by: Ping-Ke Shih Signed-off-by: Kalle Valo --- diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.h b/drivers/net/wireless/realtek/rtlwifi/pci.h index e7d070e..ed5de12 100644 --- a/drivers/net/wireless/realtek/rtlwifi/pci.h +++ b/drivers/net/wireless/realtek/rtlwifi/pci.h @@ -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; } diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c index 1225568..bc44d9d 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c @@ -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;