From patchwork Tue Oct 27 13:49:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 312936 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=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 147E6C56202 for ; Tue, 27 Oct 2020 14:29:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CB3632222C for ; Tue, 27 Oct 2020 14:29:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603808940; bh=Cafa5nJqxJBZLsFfCnkrhB8kg0e0icCc36VpY2GV9rY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=PEhrYH/eG88BAflvLyS/DjregpMauqlXIbMTvMl4n0nC/Jlbzw+9jTNdEatudslHy 9NvLniQOFpmts53Phtd6ox6jwI7mMrbi4X3/ZDzcMyNQYM/NcgsPZQcKGZ9pTGDuS7 yapYs5885eHVybeYb3EDcy3QkVqHJiA4IdSGz+LE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759302AbgJ0O24 (ORCPT ); Tue, 27 Oct 2020 10:28:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:55436 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759292AbgJ0O24 (ORCPT ); Tue, 27 Oct 2020 10:28:56 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 8384120754; Tue, 27 Oct 2020 14:28:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603808934; bh=Cafa5nJqxJBZLsFfCnkrhB8kg0e0icCc36VpY2GV9rY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XxhuZLQFfWifc3RDsjmS/yKf88VFP67jPXuD3mwKLq2xhyg04va2/3KIxTOFRyBAp /Jp9jFu2p+d2LlobuUsmsB5MbpqFbh+cT67ClDWeKxsuAUjOW08Az3spJkUqKEbHf6 FQnKBHOeXCWcI4h668Obs9c8XV7ZoiwQZUZmkJb0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Lemon , Tariq Toukan , Jakub Kicinski Subject: [PATCH 5.4 004/408] mlx4: handle non-napi callers to napi_poll Date: Tue, 27 Oct 2020 14:49:02 +0100 Message-Id: <20201027135455.245102992@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jonathan Lemon [ Upstream commit b2b8a92733b288128feb57ffa694758cf475106c ] netcons calls napi_poll with a budget of 0 to transmit packets. Handle this by: - skipping RX processing - do not try to recycle TX packets to the RX cache Signed-off-by: Jonathan Lemon Reviewed-by: Tariq Toukan Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlx4/en_rx.c | 3 +++ drivers/net/ethernet/mellanox/mlx4/en_tx.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c @@ -942,6 +942,9 @@ int mlx4_en_poll_rx_cq(struct napi_struc bool clean_complete = true; int done; + if (!budget) + return 0; + if (priv->tx_ring_num[TX_XDP]) { xdp_tx_cq = priv->tx_cq[TX_XDP][cq->ring]; if (xdp_tx_cq->xdp_busy) { --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c @@ -350,7 +350,7 @@ u32 mlx4_en_recycle_tx_desc(struct mlx4_ .dma = tx_info->map0_dma, }; - if (!mlx4_en_rx_recycle(ring->recycle_ring, &frame)) { + if (!napi_mode || !mlx4_en_rx_recycle(ring->recycle_ring, &frame)) { dma_unmap_page(priv->ddev, tx_info->map0_dma, PAGE_SIZE, priv->dma_dir); put_page(tx_info->page);