mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-16 10:54:09 +08:00
r8169: inline rtl8169_free_rx_databuff
rtl8169_free_rx_databuff is used in only one place, so let's inline it. We can improve the loop because rtl8169_init_ring zero's RX_databuff before calling rtl8169_rx_fill, and rtl8169_rx_fill fills Rx_databuff starting from index 0. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
d35bbe84c1
commit
eb2e7f0922
@ -5260,18 +5260,6 @@ static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc)
|
|||||||
desc->opts1 &= ~cpu_to_le32(DescOwn | RsvdMask);
|
desc->opts1 &= ~cpu_to_le32(DescOwn | RsvdMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rtl8169_free_rx_databuff(struct rtl8169_private *tp,
|
|
||||||
struct page **data_buff,
|
|
||||||
struct RxDesc *desc)
|
|
||||||
{
|
|
||||||
dma_unmap_page(tp_to_dev(tp), le64_to_cpu(desc->addr),
|
|
||||||
R8169_RX_BUF_SIZE, DMA_FROM_DEVICE);
|
|
||||||
|
|
||||||
__free_pages(*data_buff, get_order(R8169_RX_BUF_SIZE));
|
|
||||||
*data_buff = NULL;
|
|
||||||
rtl8169_make_unusable_by_asic(desc);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void rtl8169_mark_to_asic(struct RxDesc *desc)
|
static inline void rtl8169_mark_to_asic(struct RxDesc *desc)
|
||||||
{
|
{
|
||||||
u32 eor = le32_to_cpu(desc->opts1) & RingEnd;
|
u32 eor = le32_to_cpu(desc->opts1) & RingEnd;
|
||||||
@ -5312,11 +5300,13 @@ static void rtl8169_rx_clear(struct rtl8169_private *tp)
|
|||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < NUM_RX_DESC; i++) {
|
for (i = 0; i < NUM_RX_DESC && tp->Rx_databuff[i]; i++) {
|
||||||
if (tp->Rx_databuff[i]) {
|
dma_unmap_page(tp_to_dev(tp),
|
||||||
rtl8169_free_rx_databuff(tp, tp->Rx_databuff + i,
|
le64_to_cpu(tp->RxDescArray[i].addr),
|
||||||
tp->RxDescArray + i);
|
R8169_RX_BUF_SIZE, DMA_FROM_DEVICE);
|
||||||
}
|
__free_pages(tp->Rx_databuff[i], get_order(R8169_RX_BUF_SIZE));
|
||||||
|
tp->Rx_databuff[i] = NULL;
|
||||||
|
rtl8169_make_unusable_by_asic(tp->RxDescArray + i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user