Skip to content

Commit 71c5241

Browse files
samikhawajakuba-moo
authored andcommitted
net: Create separate gro_flush_normal function
Move multiple copies of same code snippet doing `gro_flush` and `gro_normal_list` into separate helper function. Signed-off-by: Samiullah Khawaja <skhawaja@google.com> Reviewed-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20250723013031.2911384-2-skhawaja@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent d2002cc commit 71c5241

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

include/net/gro.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,12 @@ static inline void gro_normal_list(struct gro_node *gro)
534534
gro->rx_count = 0;
535535
}
536536

537+
static inline void gro_flush_normal(struct gro_node *gro, bool flush_old)
538+
{
539+
gro_flush(gro, flush_old);
540+
gro_normal_list(gro);
541+
}
542+
537543
/* Queue one GRO_NORMAL SKB up for list processing. If batch size exceeded,
538544
* pass the whole batch up to the stack.
539545
*/

kernel/bpf/cpumap.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,7 @@ static void cpu_map_gro_flush(struct bpf_cpu_map_entry *rcpu, bool empty)
282282
* This is equivalent to how NAPI decides whether to perform a full
283283
* flush.
284284
*/
285-
gro_flush(&rcpu->gro, !empty && HZ >= 1000);
286-
gro_normal_list(&rcpu->gro);
285+
gro_flush_normal(&rcpu->gro, !empty && HZ >= 1000);
287286
}
288287

289288
static int cpu_map_kthread_run(void *data)

net/core/dev.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6578,8 +6578,7 @@ bool napi_complete_done(struct napi_struct *n, int work_done)
65786578
* it, we need to bound somehow the time packets are kept in
65796579
* the GRO layer.
65806580
*/
6581-
gro_flush(&n->gro, !!timeout);
6582-
gro_normal_list(&n->gro);
6581+
gro_flush_normal(&n->gro, !!timeout);
65836582

65846583
if (unlikely(!list_empty(&n->poll_list))) {
65856584
/* If n->poll_list is not empty, we need to mask irqs */
@@ -6649,8 +6648,7 @@ static void __busy_poll_stop(struct napi_struct *napi, bool skip_schedule)
66496648
}
66506649

66516650
/* Flush too old packets. If HZ < 1000, flush all packets */
6652-
gro_flush(&napi->gro, HZ >= 1000);
6653-
gro_normal_list(&napi->gro);
6651+
gro_flush_normal(&napi->gro, HZ >= 1000);
66546652

66556653
clear_bit(NAPI_STATE_SCHED, &napi->state);
66566654
}
@@ -7515,8 +7513,7 @@ static int __napi_poll(struct napi_struct *n, bool *repoll)
75157513
}
75167514

75177515
/* Flush too old packets. If HZ < 1000, flush all packets */
7518-
gro_flush(&n->gro, HZ >= 1000);
7519-
gro_normal_list(&n->gro);
7516+
gro_flush_normal(&n->gro, HZ >= 1000);
75207517

75217518
/* Some drivers may have called napi_schedule
75227519
* prior to exhausting their budget.

0 commit comments

Comments
 (0)