Skip to contentSkip to conversation

net: ag71xx: 2 small patches for 'ag71xx_rings_init()'

PATCH Applied Christophe JAILLET 3 participants 7 messages Jul 31, 2019 – Aug 8, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover net: ag71xx: 2 small patches for 'ag71xx_rings_init()'

Christophe JAILLET (2):
net: ag71xx: Slighly simplify code in 'ag71xx_rings_init()'
net: ag71xx: Use GFP_KERNEL instead of GFP_ATOMIC in

    'ag71xx_rings_init()'
 drivers/net/ethernet/atheros/ag71xx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/2 net: ag71xx: Slighly simplify code in 'ag71xx_rings_init()'

A few lines above, we have:
tx_size = BIT(tx->order);

So use 'tx_size' directly to be consistent with the way 'rx->descs_cpu' and 'rx->descs_dma' are computed below.

---
 drivers/net/ethernet/atheros/ag71xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/atheros/ag71xx.c +1 -1
index 77542bd1e5bd..40a8717f51b1 100644
@@ -1148,7 +1148,7 @@ static int ag71xx_rings_init(struct ag71xx *ag)
 		return -ENOMEM;
 	}
 
-	rx->buf = &tx->buf[BIT(tx->order)];
+	rx->buf = &tx->buf[tx_size];
 	rx->descs_cpu = ((void *)tx->descs_cpu) + tx_size * AG71XX_DESC_SIZE;
 	rx->descs_dma = tx->descs_dma + tx_size * AG71XX_DESC_SIZE;
 
Signature · 1 line
2.20.1
maintainer Applied
#2 lore raw

Re: [PATCH 1/2] net: ag71xx: Slighly simplify code in 'ag71xx_rings_init()'

From: Christophe JAILLET <[email protected]>
Date: Wed, 31 Jul 2019 10:06:38 +0200

Quoted 7 lines

A few lines above, we have:

   tx_size = BIT(tx->order);

So use 'tx_size' directly to be consistent with the way 'rx->descs_cpu' and 'rx->descs_dma' are computed below.

Applied to net-next.

Reviewed-by on v1 1/2
#3 lore raw

Re: [PATCH 1/2] net: ag71xx: Slighly simplify code in 'ag71xx_rings_init()'

In reply to Christophe JAILLET
Quoted 7 lines · On Wed, 31 Jul 2019 10:06:38 +0200 Christophe JAILLET…

A few lines above, we have:

   tx_size = BIT(tx->order);

So use 'tx_size' directly to be consistent with the way 'rx->descs_cpu' and 'rx->descs_dma' are computed below.

#4 lore raw

PATCH 2/2 net: ag71xx: Use GFP_KERNEL instead of GFP_ATOMIC in 'ag71xx_rings_init()'

In reply to Christophe JAILLET

There is no need to use GFP_ATOMIC here, GFP_KERNEL should be enough. The 'kcalloc()' just a few lines above, already uses GFP_KERNEL.

---
I've done my best to check if a spinlock can be hold when reaching this code. Apparently it is never the case.
But double check to be sure that it is not the kcalloc that should use GFP_ATOMIC.

---
 drivers/net/ethernet/atheros/ag71xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/atheros/ag71xx.c +1 -1
index 40a8717f51b1..7548247455d7 100644
@@ -1141,7 +1141,7 @@ static int ag71xx_rings_init(struct ag71xx *ag)
 
 	tx->descs_cpu = dma_alloc_coherent(&ag->pdev->dev,
 					   ring_size * AG71XX_DESC_SIZE,
-					   &tx->descs_dma, GFP_ATOMIC);
+					   &tx->descs_dma, GFP_KERNEL);
 	if (!tx->descs_cpu) {
 		kfree(tx->buf);
 		tx->buf = NULL;
Signature · 1 line
2.20.1
maintainer Applied
#5 lore raw

Re: [PATCH 2/2] net: ag71xx: Use GFP_KERNEL instead of GFP_ATOMIC in 'ag71xx_rings_init()'

From: Christophe JAILLET <[email protected]>
Date: Wed, 31 Jul 2019 10:06:48 +0200

Quoted 4 lines

There is no need to use GFP_ATOMIC here, GFP_KERNEL should be enough. The 'kcalloc()' just a few lines above, already uses GFP_KERNEL.

Applied to 'net'

Reviewed-by on v1 2/2
#6 lore raw

Re: [PATCH 2/2] net: ag71xx: Use GFP_KERNEL instead of GFP_ATOMIC in 'ag71xx_rings_init()'

In reply to Christophe JAILLET
Quoted 4 lines · On Wed, 31 Jul 2019 10:06:48 +0200 Christophe JAILLET…

There is no need to use GFP_ATOMIC here, GFP_KERNEL should be enough. The 'kcalloc()' just a few lines above, already uses GFP_KERNEL.