From patchwork Tue Oct 27 13:44:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 289663 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=unavailable 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 5197AC83034 for ; Tue, 27 Oct 2020 15:43:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0F48922400 for ; Tue, 27 Oct 2020 15:43:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603813430; bh=VXz311ySXAooZYlF4YlnnfuKP8cN8xxb7DHHl+Ud6yo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=qD2FM7hIVqYf5UmZMMuWJJVWZtnLMKxi7FZAAhTOs97vyPwz9Nb+GlGbZfC9pFtrT U1m4sGA/i80p1jbXqcGBUCTUzhEU9GjzycZb4j2R1Z6EcqlnPc7nIh/uBBvtwyDwdJ tPqFg15fJMeJtfGFtsN01h5e3oXSroT6SyJgbk/k= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1796565AbgJ0PTf (ORCPT ); Tue, 27 Oct 2020 11:19:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:57164 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1796562AbgJ0PT3 (ORCPT ); Tue, 27 Oct 2020 11:19:29 -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 ACD522064B; Tue, 27 Oct 2020 15:19:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603811969; bh=VXz311ySXAooZYlF4YlnnfuKP8cN8xxb7DHHl+Ud6yo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fl8um3vKoRrXYwmcAfCzZutRML58UsmIZgbPRSQbTfXcuI28yXjCNf6CO1HIcSKZn CqWOuV3aW1Ifnd3VGhwbgpWHDgHyiplv2hJBrbf16cFvKCuQnvl/ieuliGxU+24ad0 k5qFraJXeBM1rujhZAMPqA3JiNh4Xe5XILEj+mRU= 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.9 005/757] mlx4: handle non-napi callers to napi_poll Date: Tue, 27 Oct 2020 14:44:15 +0100 Message-Id: <20201027135450.778192093@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135450.497324313@linuxfoundation.org> References: <20201027135450.497324313@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 @@ -943,6 +943,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);