Ver código fonte

r8152: avoid rx queue more than 1000 packets

Stop queuing rx packets if it is more than 1000.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
hayeswang 8 anos atrás
pai
commit
745444583a
1 arquivos alterados com 4 adições e 0 exclusões
  1. 4 0
      drivers/net/usb/r8152.c

+ 4 - 0
drivers/net/usb/r8152.c

@@ -1813,6 +1813,10 @@ static int rx_bottom(struct r8152 *tp, int budget)
 			unsigned int pkt_len;
 			unsigned int pkt_len;
 			struct sk_buff *skb;
 			struct sk_buff *skb;
 
 
+			/* limite the skb numbers for rx_queue */
+			if (unlikely(skb_queue_len(&tp->rx_queue) >= 1000))
+				break;
+
 			pkt_len = le32_to_cpu(rx_desc->opts1) & RX_LEN_MASK;
 			pkt_len = le32_to_cpu(rx_desc->opts1) & RX_LEN_MASK;
 			if (pkt_len < ETH_ZLEN)
 			if (pkt_len < ETH_ZLEN)
 				break;
 				break;