Skip to content

Commit d53793c

Browse files
wojtas-marcindavem330
authored andcommitted
net: mvpp2: remove excessive spinlocks from driver initialization
Using spinlocks protection during one-time driver initialization is not necessary. Moreover it resulted in invalid GFP_KERNEL allocation under the lock. This commit removes redundant spinlocks from buffer manager part of mvpp2 initialization. Signed-off-by: Marcin Wojtas <[email protected]> Reported-by: Alexandre Fournier <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent fe1e187 commit d53793c

File tree

1 file changed

+0
-15
lines changed
  • drivers/net/ethernet/marvell

1 file changed

+0
-15
lines changed

drivers/net/ethernet/marvell/mvpp2.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -913,8 +913,6 @@ struct mvpp2_bm_pool {
913913
/* Occupied buffers indicator */
914914
atomic_t in_use;
915915
int in_use_thresh;
916-
917-
spinlock_t lock;
918916
};
919917

920918
struct mvpp2_buff_hdr {
@@ -3376,7 +3374,6 @@ static int mvpp2_bm_pool_create(struct platform_device *pdev,
33763374
bm_pool->pkt_size = 0;
33773375
bm_pool->buf_num = 0;
33783376
atomic_set(&bm_pool->in_use, 0);
3379-
spin_lock_init(&bm_pool->lock);
33803377

33813378
return 0;
33823379
}
@@ -3647,7 +3644,6 @@ static struct mvpp2_bm_pool *
36473644
mvpp2_bm_pool_use(struct mvpp2_port *port, int pool, enum mvpp2_bm_type type,
36483645
int pkt_size)
36493646
{
3650-
unsigned long flags = 0;
36513647
struct mvpp2_bm_pool *new_pool = &port->priv->bm_pools[pool];
36523648
int num;
36533649

@@ -3656,8 +3652,6 @@ mvpp2_bm_pool_use(struct mvpp2_port *port, int pool, enum mvpp2_bm_type type,
36563652
return NULL;
36573653
}
36583654

3659-
spin_lock_irqsave(&new_pool->lock, flags);
3660-
36613655
if (new_pool->type == MVPP2_BM_FREE)
36623656
new_pool->type = type;
36633657

@@ -3686,24 +3680,19 @@ mvpp2_bm_pool_use(struct mvpp2_port *port, int pool, enum mvpp2_bm_type type,
36863680
if (num != pkts_num) {
36873681
WARN(1, "pool %d: %d of %d allocated\n",
36883682
new_pool->id, num, pkts_num);
3689-
/* We need to undo the bufs_add() allocations */
3690-
spin_unlock_irqrestore(&new_pool->lock, flags);
36913683
return NULL;
36923684
}
36933685
}
36943686

36953687
mvpp2_bm_pool_bufsize_set(port->priv, new_pool,
36963688
MVPP2_RX_BUF_SIZE(new_pool->pkt_size));
36973689

3698-
spin_unlock_irqrestore(&new_pool->lock, flags);
3699-
37003690
return new_pool;
37013691
}
37023692

37033693
/* Initialize pools for swf */
37043694
static int mvpp2_swf_bm_pool_init(struct mvpp2_port *port)
37053695
{
3706-
unsigned long flags = 0;
37073696
int rxq;
37083697

37093698
if (!port->pool_long) {
@@ -3714,9 +3703,7 @@ static int mvpp2_swf_bm_pool_init(struct mvpp2_port *port)
37143703
if (!port->pool_long)
37153704
return -ENOMEM;
37163705

3717-
spin_lock_irqsave(&port->pool_long->lock, flags);
37183706
port->pool_long->port_map |= (1 << port->id);
3719-
spin_unlock_irqrestore(&port->pool_long->lock, flags);
37203707

37213708
for (rxq = 0; rxq < rxq_number; rxq++)
37223709
mvpp2_rxq_long_pool_set(port, rxq, port->pool_long->id);
@@ -3730,9 +3717,7 @@ static int mvpp2_swf_bm_pool_init(struct mvpp2_port *port)
37303717
if (!port->pool_short)
37313718
return -ENOMEM;
37323719

3733-
spin_lock_irqsave(&port->pool_short->lock, flags);
37343720
port->pool_short->port_map |= (1 << port->id);
3735-
spin_unlock_irqrestore(&port->pool_short->lock, flags);
37363721

37373722
for (rxq = 0; rxq < rxq_number; rxq++)
37383723
mvpp2_rxq_short_pool_set(port, rxq,

0 commit comments

Comments
 (0)