netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Paolo Abeni <pabeni@redhat.com>, Jakub Kicinski <kuba@kernel.org>,
	David Miller <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Realtek linux nic maintainers <nic_swsd@realtek.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"Simon Horman" <simon.horman@corigine.com>,
	"Kai-Heng Feng" <kai.heng.feng@canonical.com>,
	"Holger Hoffstätte" <holger@applied-asynchrony.com>
Subject: [PATCH net-next 5/6] r8169: disable ASPM during NAPI poll
Date: Mon, 6 Mar 2023 22:26:47 +0100	[thread overview]
Message-ID: <eacc78aa-d2ad-2db5-e41d-e7852c7b170b@gmail.com> (raw)
In-Reply-To: <b434a0ce-9a76-e227-3267-ee26497ec446@gmail.com>

Several chip versions have problems with ASPM, what may result in
rx_missed errors or tx timeouts. The root cause isn't known but
experience shows that disabling ASPM during NAPI poll can avoid
these problems.

Suggested-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Tested-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Tested-by: Holger Hoffstätte <holger@applied-asynchrony.com>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/ethernet/realtek/r8169_main.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index 96af31aea..2897b9bf2 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -4577,6 +4577,10 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)
 	}
 
 	if (napi_schedule_prep(&tp->napi)) {
+		rtl_unlock_config_regs(tp);
+		rtl_hw_aspm_clkreq_enable(tp, false);
+		rtl_lock_config_regs(tp);
+
 		rtl_irq_disable(tp);
 		__napi_schedule(&tp->napi);
 	}
@@ -4636,9 +4640,14 @@ static int rtl8169_poll(struct napi_struct *napi, int budget)
 
 	work_done = rtl_rx(dev, tp, budget);
 
-	if (work_done < budget && napi_complete_done(napi, work_done))
+	if (work_done < budget && napi_complete_done(napi, work_done)) {
 		rtl_irq_enable(tp);
 
+		rtl_unlock_config_regs(tp);
+		rtl_hw_aspm_clkreq_enable(tp, true);
+		rtl_lock_config_regs(tp);
+	}
+
 	return work_done;
 }
 
-- 
2.39.2




  parent reply	other threads:[~2023-03-06 21:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-06 21:17 [PATCH net-next 0/6] r8169: disable ASPM during NAPI poll Heiner Kallweit
2023-03-06 21:23 ` [PATCH net-next 1/6] r8169: use spinlock to protect mac ocp register access Heiner Kallweit
2023-03-06 21:24 ` [PATCH net-next 2/6] r8169: use spinlock to protect access to registers Config2 and Config5 Heiner Kallweit
2023-03-06 21:24 ` [PATCH net-next 3/6] r8169: enable cfg9346 config register access in atomic context Heiner Kallweit
2023-03-06 21:25 ` [PATCH net-next 4/6] r8169: prepare rtl_hw_aspm_clkreq_enable for usage " Heiner Kallweit
2023-03-06 21:26 ` Heiner Kallweit [this message]
2023-03-06 21:28 ` [PATCH net-next 6/6] r8169: remove ASPM restrictions now that ASPM is disabled during NAPI poll Heiner Kallweit
2023-03-08 10:00 ` [PATCH net-next 0/6] r8169: disable ASPM " patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eacc78aa-d2ad-2db5-e41d-e7852c7b170b@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=holger@applied-asynchrony.com \
    --cc=kai.heng.feng@canonical.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.com \
    --cc=pabeni@redhat.com \
    --cc=simon.horman@corigine.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).