diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2024-06-28 12:18:56 +0200 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2024-07-02 15:26:57 +0200 |
commit | e3d69f585d651aba877e18866de7e8cfa2476caa (patch) | |
tree | a822126b33b57d6d3abde8196612806e49545f3f /net/xdp | |
parent | d839a73179ae91c07f5f2f97ccb9c69b2b7c3306 (diff) | |
download | linux-e3d69f585d651aba877e18866de7e8cfa2476caa.tar.gz linux-e3d69f585d651aba877e18866de7e8cfa2476caa.tar.bz2 linux-e3d69f585d651aba877e18866de7e8cfa2476caa.zip |
net: Move flush list retrieval to where it is used.
The bpf_net_ctx_get_.*_flush_list() are used at the top of the function.
This means the variable is always assigned even if unused. By moving the
function to where it is used, it is possible to delay the initialisation
until it is unavoidable.
Not sure how much this gains in reality but by looking at bq_enqueue()
(in devmap.c) gcc pushes one register less to the stack. \o/.
Move flush list retrieval to where it is used.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Jesper Dangaard Brouer <hawk@kernel.org>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net/xdp')
-rw-r--r-- | net/xdp/xsk.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c index de9c0322bc29..7e16336044b2 100644 --- a/net/xdp/xsk.c +++ b/net/xdp/xsk.c @@ -370,15 +370,17 @@ static int xsk_rcv(struct xdp_sock *xs, struct xdp_buff *xdp) int __xsk_map_redirect(struct xdp_sock *xs, struct xdp_buff *xdp) { - struct list_head *flush_list = bpf_net_ctx_get_xskmap_flush_list(); int err; err = xsk_rcv(xs, xdp); if (err) return err; - if (!xs->flush_node.prev) + if (!xs->flush_node.prev) { + struct list_head *flush_list = bpf_net_ctx_get_xskmap_flush_list(); + list_add(&xs->flush_node, flush_list); + } return 0; } |