From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B947C43603 for ; Thu, 19 Dec 2019 18:51:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 706BD24682 for ; Thu, 19 Dec 2019 18:51:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576781476; bh=UjZxgWLJxI//Uh5TdQ0R8WVmBVBMlHZApL3S4cFDTUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Y4eAjpyk2IhYGcK3TOP0v7SmErS9oEIkOh0TIzcTmsmzQQCmQbm5c6Q8HCHczvOBx e7K0hWbzfgiM+3hIllY4NwGOmub2sCufbqIJm2IWY5XKhcm3L2LtSpopgBLHDUZ1t8 sQ3u3jK/aKKAczKfyt99wKP38HUU/00d7q0jVgNc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730119AbfLSSvP (ORCPT ); Thu, 19 Dec 2019 13:51:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:45466 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729843AbfLSSvP (ORCPT ); Thu, 19 Dec 2019 13:51:15 -0500 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 ADA492064B; Thu, 19 Dec 2019 18:51:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576781474; bh=UjZxgWLJxI//Uh5TdQ0R8WVmBVBMlHZApL3S4cFDTUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=155omfXOw8sAtr+1quAgw9GtUUMF5IvNdR+eUeVGdzF61srfedZ7oIPEA5ZBatwmU WLNbQAnivXya5Q8WxMsF/lco2Ea7hbEoiGJj+4COaBEwTnAknLYOpZpXCCE6ft67Tc mi+t/Z1JMS6wP5DhqNcUWXw3zFnjHqcLKFqGW94U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aaro Koskinen , "David S. Miller" , Aviraj CJ Subject: [PATCH 4.14 36/36] net: stmmac: dont stop NAPI processing when dropping a packet Date: Thu, 19 Dec 2019 19:34:53 +0100 Message-Id: <20191219182929.416563499@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191219182848.708141124@linuxfoundation.org> References: <20191219182848.708141124@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Aaro Koskinen commit 07b3975352374c3f5ebb4a42ef0b253fe370542d upstream. 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 [acj: backport v4.14 -stable - adjust context] Signed-off-by: Aviraj CJ Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3323,9 +3323,8 @@ static inline void stmmac_rx_refill(stru static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) { struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue]; - unsigned int entry = rx_q->cur_rx; int coe = priv->hw->rx_csum; - unsigned int next_entry; + unsigned int next_entry = rx_q->cur_rx; unsigned int count = 0; if (netif_msg_rx_status(priv)) { @@ -3340,10 +3339,12 @@ static int stmmac_rx(struct stmmac_priv priv->hw->desc->display_ring(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 @@ -3410,7 +3411,7 @@ static int stmmac_rx(struct stmmac_priv "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 @@ -3446,7 +3447,7 @@ static int stmmac_rx(struct stmmac_priv dev_warn(priv->device, "packet dropped\n"); priv->dev->stats.rx_dropped++; - break; + continue; } dma_sync_single_for_cpu(priv->device, @@ -3471,7 +3472,7 @@ static int stmmac_rx(struct stmmac_priv "%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; @@ -3506,7 +3507,6 @@ static int stmmac_rx(struct stmmac_priv priv->dev->stats.rx_packets++; priv->dev->stats.rx_bytes += frame_len; } - entry = next_entry; } stmmac_rx_refill(priv, queue);