Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2534185yba; Mon, 6 May 2019 07:37:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwnKHlYgCRFcDmfO94sYz0otsPK/R1kqU5PpAAjU09Yj5UJ6sNPpxa/ZndM0mkex2hhwle1 X-Received: by 2002:a63:541d:: with SMTP id i29mr32113437pgb.174.1557153455076; Mon, 06 May 2019 07:37:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557153455; cv=none; d=google.com; s=arc-20160816; b=Mbs2Li/srdiVWOQXv1G7tS7JVM1eWdA1ss7hqejUnAG3l8dsV69ph3XQhtomFo/QQN XriwJxXJ0DxDyKmTXonK1mNgqNx9fRs9o/V6k2e3xlwdHVh2fs9tsu2k2aX3fL43Lo75 dN8Y7vhJcKveaMQrDZ4HNq6ieRi5bdKl5SLXZuNxMQjOnzzUk1mA+ad0FTdxfkzes3u4 cF/IH71qyp6tJwlRLnYJAoeiqR3beSfpk1lqqMW1LSR6uqFcAUy9MJuvicIucNRpdDUE Mv+QXUtCiNcEYFuVAKmMbBBRQQWxOZvokyO4+OMazIHQl1C8FI+fwUtZUd7IoTpTJXWo xnTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=e4bs2Xd+hICk+1aKLkTifMpMXAEps/6AEr3i91iZIcc=; b=haDDeK3x/CR6x/T68WL4qNwEIz3sP63Hrg0dFSiq5r3ww8Ne1ZS+gyxQjzpG3qiN+4 dz/ufq52RTo7PbVArk+BMR2i8Yvr3ft1LWyZ/E2mDj17WiwE2oyUoYr63T0r60HaM1jU yseQ16Y8oNxYlBQypwJjue8qx8SBOQ0+Awo5bA82GP9W8qOc+ji2fy8RywYzw446+XWZ cvtVktf2wkWTAmZqH2RKDx225clneP0a7lPUPbtqOClyhvSm213bkcvmJ1sdPayM7BHQ GMuWswLf+GwTDEbs3xCB7zskcyOaIVT6s2QG0Fr6t2r/BMtyMMoqcoIykhgcbQB59x8Q LKDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=egEzfc61; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z29si16343363pgl.584.2019.05.06.07.37.19; Mon, 06 May 2019 07:37:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=egEzfc61; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726989AbfEFOfn (ORCPT + 99 others); Mon, 6 May 2019 10:35:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:55818 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726983AbfEFOfk (ORCPT ); Mon, 6 May 2019 10:35:40 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EA17A214AE; Mon, 6 May 2019 14:35:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557153339; bh=aBS23To4zgYe4FkCBU84AS1SB4OpLcZTHtMQFMMKQ1M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=egEzfc61qeUVUhX1Xl1gkOoOH6jsuIUHLc84ivWpVps70IuPF6ZLjdmWSxqrHpZXZ wcsgT18HipuvrZ6UGUM8Z/vpOHfmZI5lzD53cUGhiXGZSG9fWHlSUkFoyWEi4IDsTN W/wkdfyRd2p7La3VzAZ7+IRxAI4rqzzw2F8/IeQA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aaro Koskinen , "David S. Miller" , "Sasha Levin (Microsoft)" Subject: [PATCH 5.0 052/122] net: stmmac: dont stop NAPI processing when dropping a packet Date: Mon, 6 May 2019 16:31:50 +0200 Message-Id: <20190506143059.586115083@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190506143054.670334917@linuxfoundation.org> References: <20190506143054.670334917@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 07b3975352374c3f5ebb4a42ef0b253fe370542d ] Currently, if we drop a packet, we exit from NAPI loop before the budget is consumed. In some situations this will make the RX processing stall e.g. when flood pinging the system with oversized packets, as the errorneous packets are not dropped efficiently. If we drop a packet, we should just continue to the next one as long as the budget allows. Signed-off-by: Aaro Koskinen Signed-off-by: David S. Miller Signed-off-by: Sasha Levin (Microsoft) --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 0ccf91a08290..f0e0593e54f3 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3328,9 +3328,8 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) { struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue]; struct stmmac_channel *ch = &priv->channel[queue]; - unsigned int entry = rx_q->cur_rx; + unsigned int next_entry = rx_q->cur_rx; int coe = priv->hw->rx_csum; - unsigned int next_entry; unsigned int count = 0; bool xmac; @@ -3348,10 +3347,12 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) stmmac_display_ring(priv, rx_head, DMA_RX_SIZE, true); } while (count < limit) { - int status; + int entry, status; struct dma_desc *p; struct dma_desc *np; + entry = next_entry; + if (priv->extend_desc) p = (struct dma_desc *)(rx_q->dma_erx + entry); else @@ -3412,7 +3413,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) "len %d larger than size (%d)\n", frame_len, priv->dma_buf_sz); priv->dev->stats.rx_length_errors++; - break; + continue; } /* ACS is set; GMAC core strips PAD/FCS for IEEE 802.3 @@ -3447,7 +3448,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) dev_warn(priv->device, "packet dropped\n"); priv->dev->stats.rx_dropped++; - break; + continue; } dma_sync_single_for_cpu(priv->device, @@ -3472,7 +3473,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) "%s: Inconsistent Rx chain\n", priv->dev->name); priv->dev->stats.rx_dropped++; - break; + continue; } prefetch(skb->data - NET_IP_ALIGN); rx_q->rx_skbuff[entry] = NULL; @@ -3507,7 +3508,6 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) priv->dev->stats.rx_packets++; priv->dev->stats.rx_bytes += frame_len; } - entry = next_entry; } stmmac_rx_refill(priv, queue); -- 2.20.1