Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp31634lqb; Tue, 28 May 2024 08:06:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVuLazsU5mD2fus8wSowCNkLsVKJJYoLtNP/xYVtVkWriE9TraS0CsOkWQy1T4fphRjWftEhNQa1PEwkFRU3/iZE7fhnNvaQaQ90mm4Bw== X-Google-Smtp-Source: AGHT+IHYWgJYZmW5maNa14KAbwOZRxd7vSOqMX+jXucU03LN9UbuGoAsW//Gkm7+ww3+NS0JN6EC X-Received: by 2002:a17:906:3e50:b0:a63:5a33:500e with SMTP id a640c23a62f3a-a635a33509amr51399666b.70.1716908816091; Tue, 28 May 2024 08:06:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716908816; cv=pass; d=google.com; s=arc-20160816; b=Xc9WNky105Hlck4QKK+WBBRTU3wC6ErFK1tUm5nMMCDFY1LyeLHWpMTLzJw9RGfIoZ 7H1TdpS7TVEsZ9RwAn3SqkflaiAdHRvr+Ph6VkjqQyhzDOCEbmhoE1l9PCK5QI80Tcif XuKlUWDFfHKgy4OWjaQoevFLDKTv0RaMVGBzkEpdVoGK5wr8jsK1DWW+785kzrlMlznY ZBJusDJubG0OludzH2ggev1T+bhI8Bi+Qm2AmCU6A8qZADqeNOdT3qi5BUOBqIAxJoQG bCwz/N9nJaRarwh7or6tVHX1i961GA6MECNOiTYMKAvbLa16zE1ZGzfbSxEddjK/wpvF 9OoA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=aoB1eKvaTrdN9s1BpGnSJCNH8hscnPRRP7JB10qeqTE=; fh=sUSjRpK/Wu5cmnXAa9+f+Tp7sXIZjWkQDF+/Uu3kmYo=; b=H3iViHZqTEB1RppR46CTZA1UqhPScMLmzqWsuaPnqhp0ipUJj1J7WsVVVbPggAnq9k CNC3ye8q5FtLUZ6UwW49+H4M5BjSU4NkcJpTQuiEGRxMZ7FvgJHgBPI9t1UfFkiNFQ+u kct+IjIfSw9DiLojvMSFL8E8m6exRK0QjkkxEbzrLPev8sFslAIEWpl33d6DmzO7gxJ2 1y8/m8gIxKDruerTUULBpPVMTseNVnjltjLlnV6Pt0vo+s6/+HxfPgqywj5NyYvB5LuJ zvGrUV4JcfoVnJid04TcLFg14UmfMZOCHpjQtciWh2VmnheQPNrGOgfN1q4OQTlXnuZd RgbQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=bp.renesas.com dmarc=pass fromdomain=bp.renesas.com); spf=pass (google.com: domain of linux-kernel+bounces-192605-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192605-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a62f57fd7a6si231065966b.109.2024.05.28.08.06.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 08:06:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-192605-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=bp.renesas.com dmarc=pass fromdomain=bp.renesas.com); spf=pass (google.com: domain of linux-kernel+bounces-192605-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192605-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D037D1F241E0 for ; Tue, 28 May 2024 15:06:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 370B817333D; Tue, 28 May 2024 15:04:06 +0000 (UTC) Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 624C8172BDF; Tue, 28 May 2024 15:04:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716908645; cv=none; b=U23yqa4TNXrEb42I5eafcBhMMtcOaAkG9GwFOP+JFknAGv0JxgBPQMWodZ/p/86tmE3ZGnE7GC2x5jSLA6NRQI9iGd+7vOoyn7MDcl+uqsjF/sNCS+xrwO4uOD+LkQsc7o5wtzBfcUBw2yxWKT5qwKQR+0bsX4jHa+0+GO61iWE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716908645; c=relaxed/simple; bh=EnUGL5IKsUeT6sWwOIOtdHqyp1aMQvEuMBahq08UmYM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=h+l6savYYvvrHm+6HK4WH5IP36fBdDeoGMijYLSZbR8MDk/7G8Nb2Mw7MgXvduih850ox3Loec7QdVm2zE4ypA1xg7EN9nQLQ+doQyqJ+ibRAMJfcD7SISDO1rjylxVccP5P3SXXto2LsPXBXbwymVMndU6nxJF2ZfbAL2a2jjs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-IronPort-AV: E=Sophos;i="6.08,195,1712588400"; d="scan'208";a="209903727" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 29 May 2024 00:03:59 +0900 Received: from renesas-deb12.cephei.uk (unknown [10.226.93.69]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id D5CA7400CF1E; Wed, 29 May 2024 00:03:54 +0900 (JST) From: Paul Barker To: Sergey Shtylyov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , =?UTF-8?q?Niklas=20S=C3=B6derlund?= Cc: Paul Barker , Biju Das , Claudiu Beznea , Yoshihiro Shimoda , netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [net-next PATCH v4 2/7] net: ravb: Consider busypolling status when re-enabling interrupts Date: Tue, 28 May 2024 16:03:34 +0100 Message-Id: <20240528150339.6791-3-paul.barker.ct@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240528150339.6791-1-paul.barker.ct@bp.renesas.com> References: <20240528150339.6791-1-paul.barker.ct@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Make use of the busypolling status returned from NAPI complete to decide if interrupts shall be re-enabled or not. This is useful to reduce the interrupt overhead. While at it switch to using napi_complete_done() as it take into account the work done when providing the busypolling status. Signed-off-by: Paul Barker --- Changes v3->v4: * Used Niklas' suggested commit message. drivers/net/ethernet/renesas/ravb_main.c | 26 ++++++++++-------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 193ad05383a8..472aa80002be 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1341,23 +1341,19 @@ static int ravb_poll(struct napi_struct *napi, int budget) if (priv->rx_fifo_errors != ndev->stats.rx_fifo_errors) ndev->stats.rx_fifo_errors = priv->rx_fifo_errors; - if (work_done == budget) - goto out; - - napi_complete(napi); - - /* Re-enable RX/TX interrupts */ - spin_lock_irqsave(&priv->lock, flags); - if (!info->irq_en_dis) { - ravb_modify(ndev, RIC0, mask, mask); - ravb_modify(ndev, TIC, mask, mask); - } else { - ravb_write(ndev, mask, RIE0); - ravb_write(ndev, mask, TIE); + if (work_done < budget && napi_complete_done(napi, work_done)) { + /* Re-enable RX/TX interrupts */ + spin_lock_irqsave(&priv->lock, flags); + if (!info->irq_en_dis) { + ravb_modify(ndev, RIC0, mask, mask); + ravb_modify(ndev, TIC, mask, mask); + } else { + ravb_write(ndev, mask, RIE0); + ravb_write(ndev, mask, TIE); + } + spin_unlock_irqrestore(&priv->lock, flags); } - spin_unlock_irqrestore(&priv->lock, flags); -out: return work_done; } -- 2.39.2