net: ag71xx: 2 small patches for 'ag71xx_rings_init()'
Subsystems (4)
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
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
@@ -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
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.Signed-off-by Christophe JAILLET <[email protected]>
Applied to net-next.
Re: [PATCH 1/2] net: ag71xx: Slighly simplify code in 'ag71xx_rings_init()'
In reply to Christophe JAILLETQuoted 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.Signed-off-by Christophe JAILLET <[email protected]>
PATCH 2/2 net: ag71xx: Use GFP_KERNEL instead of GFP_ATOMIC in 'ag71xx_rings_init()'
In reply to Christophe JAILLETThere 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
@@ -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
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_ATOMIChere,GFP_KERNELshould be enough. The 'kcalloc()' just a few lines above, already usesGFP_KERNEL.Signed-off-by Christophe JAILLET <[email protected]>
Applied to 'net'
Re: [PATCH 2/2] net: ag71xx: Use GFP_KERNEL instead of GFP_ATOMIC in 'ag71xx_rings_init()'
In reply to Christophe JAILLETQuoted 4 lines · On Wed, 31 Jul 2019 10:06:48 +0200 Christophe JAILLET…
There is no need to use
GFP_ATOMIChere,GFP_KERNELshould be enough. The 'kcalloc()' just a few lines above, already usesGFP_KERNEL.Signed-off-by Christophe JAILLET <[email protected]>