summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerhard Engleder <gerhard@engleder-embedded.com>2023-09-15 23:01:24 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-10-06 14:56:57 +0200
commit78ac1e7dec24683045b3a1790f3ec2248893f0d0 (patch)
tree92a47a81d2fd6d68d5013b3a81dd5e763d660f79
parentb09c1359e4f08bc8369357cf4ec4a08150b47888 (diff)
downloadlinux-stable-78ac1e7dec24683045b3a1790f3ec2248893f0d0.tar.gz
linux-stable-78ac1e7dec24683045b3a1790f3ec2248893f0d0.tar.bz2
linux-stable-78ac1e7dec24683045b3a1790f3ec2248893f0d0.zip
tsnep: Fix NAPI scheduling
[ Upstream commit ea852c17f5382a0a52041cfbd9a4451ae0fa1a38 ] According to the NAPI documentation networking/napi.rst, drivers which have to mask interrupts explicitly should use the napi_schedule_prep() and __napi_schedule() calls. No problem seen so far with current implementation. Nevertheless, let's align the implementation with documentation. Signed-off-by: Gerhard Engleder <gerhard@engleder-embedded.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/net/ethernet/engleder/tsnep_main.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/net/ethernet/engleder/tsnep_main.c b/drivers/net/ethernet/engleder/tsnep_main.c
index 6bf3cc11d212..00436a6f785e 100644
--- a/drivers/net/ethernet/engleder/tsnep_main.c
+++ b/drivers/net/ethernet/engleder/tsnep_main.c
@@ -65,8 +65,11 @@ static irqreturn_t tsnep_irq(int irq, void *arg)
/* handle TX/RX queue 0 interrupt */
if ((active & adapter->queue[0].irq_mask) != 0) {
- tsnep_disable_irq(adapter, adapter->queue[0].irq_mask);
- napi_schedule(&adapter->queue[0].napi);
+ if (napi_schedule_prep(&adapter->queue[0].napi)) {
+ tsnep_disable_irq(adapter, adapter->queue[0].irq_mask);
+ /* schedule after masking to avoid races */
+ __napi_schedule(&adapter->queue[0].napi);
+ }
}
return IRQ_HANDLED;
@@ -77,8 +80,11 @@ static irqreturn_t tsnep_irq_txrx(int irq, void *arg)
struct tsnep_queue *queue = arg;
/* handle TX/RX queue interrupt */
- tsnep_disable_irq(queue->adapter, queue->irq_mask);
- napi_schedule(&queue->napi);
+ if (napi_schedule_prep(&queue->napi)) {
+ tsnep_disable_irq(queue->adapter, queue->irq_mask);
+ /* schedule after masking to avoid races */
+ __napi_schedule(&queue->napi);
+ }
return IRQ_HANDLED;
}