Commit 5db84325 authored by Roger Quadros's avatar Roger Quadros Committed by Jakub Kicinski
Browse files

net: ethernet: ti: am65-cpsw: fix memleak in certain XDP cases



If the XDP program doesn't result in XDP_PASS then we leak the
memory allocated by am65_cpsw_build_skb().

It is pointless to allocate SKB memory before running the XDP
program as we would be wasting CPU cycles for cases other than XDP_PASS.
Move the SKB allocation after evaluating the XDP program result.

This fixes the memleak. A performance boost is seen for XDP_DROP test.

XDP_DROP test:
Before: 460256 rx/s                  0 err/s
After:  784130 rx/s                  0 err/s

Fixes: 8acacc40 ("net: ethernet: ti: am65-cpsw: Add minimal XDP support")
Signed-off-by: default avatarRoger Quadros <rogerq@kernel.org>
Link: https://patch.msgid.link/20250210-am65-cpsw-xdp-fixes-v1-1-ec6b1f7f1aca@kernel.org


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent b698b9a8
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment