[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231009133754.9834-4-ansuelsmth@gmail.com>
Date: Mon, 9 Oct 2023 15:37:53 +0200
From: Christian Marangi <ansuelsmth@...il.com>
To: Jason Gunthorpe <jgg@...pe.ca>,
Leon Romanovsky <leon@...nel.org>,
Wolfgang Grandegger <wg@...ndegger.com>,
Marc Kleine-Budde <mkl@...gutronix.de>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Chris Snook <chris.snook@...il.com>,
Raju Rangoju <rajur@...lsio.com>,
Jeroen de Borst <jeroendb@...gle.com>,
Praveen Kaligineedi <pkaligineedi@...gle.com>,
Shailend Chand <shailend@...gle.com>,
Douglas Miller <dougmill@...ux.ibm.com>,
Nick Child <nnac123@...ux.ibm.com>,
Michael Ellerman <mpe@...erman.id.au>,
Nicholas Piggin <npiggin@...il.com>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Haren Myneni <haren@...ux.ibm.com>,
Rick Lindsley <ricklind@...ux.ibm.com>,
Dany Madden <danymadden@...ibm.com>,
Thomas Falcon <tlfalcon@...ux.ibm.com>,
Tariq Toukan <tariqt@...dia.com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
Jose Abreu <joabreu@...opsys.com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Krzysztof Halasa <khalasa@...p.pl>,
Kalle Valo <kvalo@...nel.org>,
Jeff Johnson <quic_jjohnson@...cinc.com>,
Gregory Greenman <gregory.greenman@...el.com>,
Chandrashekar Devegowda <chandrashekar.devegowda@...el.com>,
Intel Corporation <linuxwwan@...el.com>,
Chiranjeevi Rapolu <chiranjeevi.rapolu@...ux.intel.com>,
Liu Haijun <haijun.liu@...iatek.com>,
M Chetan Kumar <m.chetan.kumar@...ux.intel.com>,
Ricardo Martinez <ricardo.martinez@...ux.intel.com>,
Loic Poulain <loic.poulain@...aro.org>,
Sergey Ryazanov <ryazanov.s.a@...il.com>,
Johannes Berg <johannes@...solutions.net>,
Christian Marangi <ansuelsmth@...il.com>,
Yuanjun Gong <ruc_gongyuanjun@....com>,
Alex Elder <elder@...aro.org>,
Bhupesh Sharma <bhupesh.sharma@...aro.org>,
Simon Horman <horms@...nel.org>,
Rob Herring <robh@...nel.org>,
Bailey Forrest <bcf@...gle.com>,
Junfeng Guo <junfeng.guo@...el.com>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
Ziwei Xiao <ziweixiao@...gle.com>,
Rushil Gupta <rushilg@...gle.com>,
Thomas Gleixner <tglx@...utronix.de>,
Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
Yuri Karpov <YKarpov@...ras.ru>,
Andrew Lunn <andrew@...n.ch>,
Zheng Zengkai <zhengzengkai@...wei.com>,
Dawei Li <set_pte_at@...look.com>,
Anjaneyulu <pagadala.yesu.anjaneyulu@...el.com>,
Benjamin Berg <benjamin.berg@...el.com>,
linux-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-can@...r.kernel.org,
netdev@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org,
linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org,
ath10k@...ts.infradead.org,
linux-wireless@...r.kernel.org
Subject: [net-next v3 4/5] net: tc35815: rework network interface interrupt logic
Rework network interface logic. Before this change, the code flow was:
1. Disable interrupt
2. Try to schedule a NAPI
3. Check if it was possible (NAPI is not already scheduled)
4. emit BUG() if we receive interrupt while a NAPI is scheduled
If some application busy poll or set gro_flush_timeout low enough, it's
possible to reach the BUG() condition. Given that the condition may
happen and it wouldn't be a bug, rework the logic to permit such case
and prevent stall with interrupt never enabled again.
Disable the interrupt only if the NAPI can be scheduled (aka it's not
already scheduled) and drop the printk and BUG() call. With these
change, in the event of a NAPI already scheduled, the interrupt is
simply ignored with nothing done.
Suggested-by: Eric Dumazet <edumazet@...gle.com>
Signed-off-by: Christian Marangi <ansuelsmth@...il.com>
---
drivers/net/ethernet/toshiba/tc35815.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/toshiba/tc35815.c b/drivers/net/ethernet/toshiba/tc35815.c
index 14cf6ecf6d0d..6e3758dfbdbd 100644
--- a/drivers/net/ethernet/toshiba/tc35815.c
+++ b/drivers/net/ethernet/toshiba/tc35815.c
@@ -1434,14 +1434,10 @@ static irqreturn_t tc35815_interrupt(int irq, void *dev_id)
u32 dmactl = tc_readl(&tr->DMA_Ctl);
if (!(dmactl & DMA_IntMask)) {
- /* disable interrupts */
- tc_writel(dmactl | DMA_IntMask, &tr->DMA_Ctl);
- if (napi_schedule_prep(&lp->napi))
+ if (napi_schedule_prep(&lp->napi)) {
+ /* disable interrupts */
+ tc_writel(dmactl | DMA_IntMask, &tr->DMA_Ctl);
__napi_schedule(&lp->napi);
- else {
- printk(KERN_ERR "%s: interrupt taken in poll\n",
- dev->name);
- BUG();
}
(void)tc_readl(&tr->Int_Src); /* flush */
return IRQ_HANDLED;
--
2.40.1
Powered by blists - more mailing lists