diff mbox series

[net-next,3/7] dpaa2-eth: Remove preempt_disable() from seed_pool()

Message ID 20190529221523.22399-4-bigeasy@linutronix.de
State Changes Requested
Delegated to: David Miller
Headers show
Series Avoid local_irq_save() and use napi_alloc_frag() where possible | expand

Commit Message

Sebastian Andrzej Siewior May 29, 2019, 10:15 p.m. UTC
According to the comment, the preempt_disable() statement is required
due to synchronisation in napi_alloc_frag(). The awful truth is that
local_bh_disable() is required because otherwise the NAPI poll callback
can be invoked while the open function setup buffers. This isn't
unlikely since the dpaa2 provides multiple devices.

The usage of napi_alloc_frag() has been removed in commit

 27c874867c4e9 ("dpaa2-eth: Use a single page per Rx buffer")

which means that the comment is not accurate and the preempt_disable()
statement is not required.

Remove the outdated comment and the no longer required
preempt_disable().

Cc: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 9 ---------
 1 file changed, 9 deletions(-)

Comments

Ioana Radulescu May 30, 2019, 9:24 a.m. UTC | #1
> -----Original Message-----
> From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Sent: Thursday, May 30, 2019 1:15 AM
> To: netdev@vger.kernel.org
> Cc: tglx@linutronix.de; David S. Miller <davem@davemloft.net>; Sebastian
> Andrzej Siewior <bigeasy@linutronix.de>; Ioana Ciocoi Radulescu
> <ruxandra.radulescu@nxp.com>
> Subject: [PATCH net-next 3/7] dpaa2-eth: Remove preempt_disable() from
> seed_pool()
> 
> According to the comment, the preempt_disable() statement is required
> due to synchronisation in napi_alloc_frag(). The awful truth is that
> local_bh_disable() is required because otherwise the NAPI poll callback
> can be invoked while the open function setup buffers. This isn't
> unlikely since the dpaa2 provides multiple devices.
> 
> The usage of napi_alloc_frag() has been removed in commit
> 
>  27c874867c4e9 ("dpaa2-eth: Use a single page per Rx buffer")
> 
> which means that the comment is not accurate and the preempt_disable()
> statement is not required.
> 
> Remove the outdated comment and the no longer required
> preempt_disable().
> 
> Cc: Ioana Radulescu <ruxandra.radulescu@nxp.com>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Acked-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>

Thanks,
Ioana
diff mbox series

Patch

diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
index 63b1ecc18c26f..f9ae97ba63334 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
@@ -997,13 +997,6 @@  static int seed_pool(struct dpaa2_eth_priv *priv, u16 bpid)
 	int i, j;
 	int new_count;
 
-	/* This is the lazy seeding of Rx buffer pools.
-	 * dpaa2_add_bufs() is also used on the Rx hotpath and calls
-	 * napi_alloc_frag(). The trouble with that is that it in turn ends up
-	 * calling this_cpu_ptr(), which mandates execution in atomic context.
-	 * Rather than splitting up the code, do a one-off preempt disable.
-	 */
-	preempt_disable();
 	for (j = 0; j < priv->num_channels; j++) {
 		for (i = 0; i < DPAA2_ETH_NUM_BUFS;
 		     i += DPAA2_ETH_BUFS_PER_CMD) {
@@ -1011,12 +1004,10 @@  static int seed_pool(struct dpaa2_eth_priv *priv, u16 bpid)
 			priv->channel[j]->buf_count += new_count;
 
 			if (new_count < DPAA2_ETH_BUFS_PER_CMD) {
-				preempt_enable();
 				return -ENOMEM;
 			}
 		}
 	}
-	preempt_enable();
 
 	return 0;
 }