Skip to content

Commit c42858e

Browse files
Eric Dumazetdavem330
Eric Dumazet
authored andcommitted
gro_cells: remove spinlock protecting receive queues
As David pointed out, spinlock are no longer needed to protect the per cpu queues used in gro cells infrastructure. Also use new napi_complete_done() API so that gro_flush_timeout tweaks have an effect. Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e704059 commit c42858e

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

include/net/gro_cells.h

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,37 +32,28 @@ static inline void gro_cells_receive(struct gro_cells *gcells, struct sk_buff *s
3232
return;
3333
}
3434

35-
/* We run in BH context */
36-
spin_lock(&cell->napi_skbs.lock);
37-
3835
__skb_queue_tail(&cell->napi_skbs, skb);
3936
if (skb_queue_len(&cell->napi_skbs) == 1)
4037
napi_schedule(&cell->napi);
41-
42-
spin_unlock(&cell->napi_skbs.lock);
4338
}
4439

45-
/* called unser BH context */
40+
/* called under BH context */
4641
static inline int gro_cell_poll(struct napi_struct *napi, int budget)
4742
{
4843
struct gro_cell *cell = container_of(napi, struct gro_cell, napi);
4944
struct sk_buff *skb;
5045
int work_done = 0;
5146

52-
spin_lock(&cell->napi_skbs.lock);
5347
while (work_done < budget) {
5448
skb = __skb_dequeue(&cell->napi_skbs);
5549
if (!skb)
5650
break;
57-
spin_unlock(&cell->napi_skbs.lock);
5851
napi_gro_receive(napi, skb);
5952
work_done++;
60-
spin_lock(&cell->napi_skbs.lock);
6153
}
6254

6355
if (work_done < budget)
64-
napi_complete(napi);
65-
spin_unlock(&cell->napi_skbs.lock);
56+
napi_complete_done(napi, work_done);
6657
return work_done;
6758
}
6859

@@ -77,7 +68,7 @@ static inline int gro_cells_init(struct gro_cells *gcells, struct net_device *de
7768
for_each_possible_cpu(i) {
7869
struct gro_cell *cell = per_cpu_ptr(gcells->cells, i);
7970

80-
skb_queue_head_init(&cell->napi_skbs);
71+
__skb_queue_head_init(&cell->napi_skbs);
8172
netif_napi_add(dev, &cell->napi, gro_cell_poll, 64);
8273
napi_enable(&cell->napi);
8374
}
@@ -92,8 +83,9 @@ static inline void gro_cells_destroy(struct gro_cells *gcells)
9283
return;
9384
for_each_possible_cpu(i) {
9485
struct gro_cell *cell = per_cpu_ptr(gcells->cells, i);
86+
9587
netif_napi_del(&cell->napi);
96-
skb_queue_purge(&cell->napi_skbs);
88+
__skb_queue_purge(&cell->napi_skbs);
9789
}
9890
free_percpu(gcells->cells);
9991
gcells->cells = NULL;

0 commit comments

Comments
 (0)