mirror of https://gitee.com/openkylin/linux.git
r8169: improve rtl_rx
There's no need to check min(budget, NUM_RX_DESC). At first budget (NAPI_POLL_WEIGHT = 64) is less then NUM_RX_DESC (256). And more important: Even in case of budget > NUM_RX_DESC we could safely continue processing descriptors as long as they are owned by the CPU. In addition replace rx_left with a normal counter variable, this allows to simplify the code. Last but not least there's no need any longer to pass the budget as an u32. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
00649542f1
commit
2f53e9d7bc
|
@ -4415,15 +4415,13 @@ static inline void rtl8169_rx_csum(struct sk_buff *skb, u32 opts1)
|
||||||
skb_checksum_none_assert(skb);
|
skb_checksum_none_assert(skb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rtl_rx(struct net_device *dev, struct rtl8169_private *tp, u32 budget)
|
static int rtl_rx(struct net_device *dev, struct rtl8169_private *tp, int budget)
|
||||||
{
|
{
|
||||||
unsigned int cur_rx, rx_left, count;
|
|
||||||
struct device *d = tp_to_dev(tp);
|
struct device *d = tp_to_dev(tp);
|
||||||
|
int count;
|
||||||
|
|
||||||
cur_rx = tp->cur_rx;
|
for (count = 0; count < budget; count++, tp->cur_rx++) {
|
||||||
|
unsigned int pkt_size, entry = tp->cur_rx % NUM_RX_DESC;
|
||||||
for (rx_left = min(budget, NUM_RX_DESC); rx_left > 0; rx_left--, cur_rx++) {
|
|
||||||
unsigned int pkt_size, entry = cur_rx % NUM_RX_DESC;
|
|
||||||
struct RxDesc *desc = tp->RxDescArray + entry;
|
struct RxDesc *desc = tp->RxDescArray + entry;
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
const void *rx_buf;
|
const void *rx_buf;
|
||||||
|
@ -4500,9 +4498,6 @@ static int rtl_rx(struct net_device *dev, struct rtl8169_private *tp, u32 budget
|
||||||
rtl8169_mark_to_asic(desc);
|
rtl8169_mark_to_asic(desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
count = cur_rx - tp->cur_rx;
|
|
||||||
tp->cur_rx = cur_rx;
|
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4561,7 +4556,7 @@ static int rtl8169_poll(struct napi_struct *napi, int budget)
|
||||||
struct net_device *dev = tp->dev;
|
struct net_device *dev = tp->dev;
|
||||||
int work_done;
|
int work_done;
|
||||||
|
|
||||||
work_done = rtl_rx(dev, tp, (u32) budget);
|
work_done = rtl_rx(dev, tp, budget);
|
||||||
|
|
||||||
rtl_tx(dev, tp, budget);
|
rtl_tx(dev, tp, budget);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue