Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751999AbdFIJMx (ORCPT ); Fri, 9 Jun 2017 05:12:53 -0400 Received: from rtits2.realtek.com ([211.75.126.72]:41075 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751556AbdFIJMu (ORCPT ); Fri, 9 Jun 2017 05:12:50 -0400 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.59 with qID v599Ch0F015387, This message is accepted by code: ctloc85258 From: Hayes Wang To: CC: , , , Hayes Wang Subject: [PATCH net-next 10/11] r8152: avoid rx queue more than 1000 packets Date: Fri, 9 Jun 2017 17:11:47 +0800 Message-ID: <1394712342-15778-270-Taiwan-albertk@realtek.com> X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <1394712342-15778-260-Taiwan-albertk@realtek.com> References: <1394712342-15778-260-Taiwan-albertk@realtek.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.21.177.200] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 675 Lines: 24 Stop queuing rx packets if it is more than 1000. Signed-off-by: Hayes Wang --- drivers/net/usb/r8152.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 204f4b2..fa29583 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -1813,6 +1813,10 @@ static int rx_bottom(struct r8152 *tp, int budget) unsigned int pkt_len; 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; if (pkt_len < ETH_ZLEN) break; -- 2.7.4