]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: Create separate gro_flush_normal function
authorSamiullah Khawaja <skhawaja@google.com>
Wed, 23 Jul 2025 01:30:29 +0000 (01:30 +0000)
committerJakub Kicinski <kuba@kernel.org>
Fri, 25 Jul 2025 01:34:55 +0000 (18:34 -0700)
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>
include/net/gro.h
kernel/bpf/cpumap.c
net/core/dev.c

index 22d3a69e4404c06d3add782e656dfde252cd38dc..a0fca7ac6e7e74bbc629b9aa8826efaa665d2192 100644 (file)
@@ -534,6 +534,12 @@ static inline void gro_normal_list(struct gro_node *gro)
        gro->rx_count = 0;
 }
 
+static inline void gro_flush_normal(struct gro_node *gro, bool flush_old)
+{
+       gro_flush(gro, flush_old);
+       gro_normal_list(gro);
+}
+
 /* Queue one GRO_NORMAL SKB up for list processing. If batch size exceeded,
  * pass the whole batch up to the stack.
  */
index 67e8a2fc1a99decba52ee998051beeeafd0d7133..b2b7b8ec2c2a1c6d6af58b031991d9b8f10256dd 100644 (file)
@@ -282,8 +282,7 @@ static void cpu_map_gro_flush(struct bpf_cpu_map_entry *rcpu, bool empty)
         * This is equivalent to how NAPI decides whether to perform a full
         * flush.
         */
-       gro_flush(&rcpu->gro, !empty && HZ >= 1000);
-       gro_normal_list(&rcpu->gro);
+       gro_flush_normal(&rcpu->gro, !empty && HZ >= 1000);
 }
 
 static int cpu_map_kthread_run(void *data)
index 354d3453b4071cfeacae3d94be18095cd753c327..76384b8a7871cc74fa1f0d665181fb82578243c4 100644 (file)
@@ -6578,8 +6578,7 @@ bool napi_complete_done(struct napi_struct *n, int work_done)
         * it, we need to bound somehow the time packets are kept in
         * the GRO layer.
         */
-       gro_flush(&n->gro, !!timeout);
-       gro_normal_list(&n->gro);
+       gro_flush_normal(&n->gro, !!timeout);
 
        if (unlikely(!list_empty(&n->poll_list))) {
                /* 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)
        }
 
        /* Flush too old packets. If HZ < 1000, flush all packets */
-       gro_flush(&napi->gro, HZ >= 1000);
-       gro_normal_list(&napi->gro);
+       gro_flush_normal(&napi->gro, HZ >= 1000);
 
        clear_bit(NAPI_STATE_SCHED, &napi->state);
 }
@@ -7515,8 +7513,7 @@ static int __napi_poll(struct napi_struct *n, bool *repoll)
        }
 
        /* Flush too old packets. If HZ < 1000, flush all packets */
-       gro_flush(&n->gro, HZ >= 1000);
-       gro_normal_list(&n->gro);
+       gro_flush_normal(&n->gro, HZ >= 1000);
 
        /* Some drivers may have called napi_schedule
         * prior to exhausting their budget.