Commit 5db8432
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: 8acacc4 ("net: ethernet: ti: am65-cpsw: Add minimal XDP support")
Signed-off-by: Roger Quadros <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>1 parent b698b9a commit 5db8432
1 file changed
+13
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
842 | 842 | | |
843 | 843 | | |
844 | 844 | | |
845 | | - | |
| 845 | + | |
| 846 | + | |
846 | 847 | | |
847 | 848 | | |
848 | 849 | | |
| |||
852 | 853 | | |
853 | 854 | | |
854 | 855 | | |
855 | | - | |
| 856 | + | |
856 | 857 | | |
857 | 858 | | |
858 | 859 | | |
| |||
1315 | 1316 | | |
1316 | 1317 | | |
1317 | 1318 | | |
1318 | | - | |
1319 | 1319 | | |
1320 | 1320 | | |
1321 | | - | |
1322 | | - | |
1323 | | - | |
1324 | | - | |
1325 | | - | |
1326 | | - | |
1327 | | - | |
1328 | 1321 | | |
1329 | 1322 | | |
1330 | 1323 | | |
| |||
1334 | 1327 | | |
1335 | 1328 | | |
1336 | 1329 | | |
1337 | | - | |
1338 | | - | |
1339 | | - | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
1340 | 1340 | | |
1341 | 1341 | | |
1342 | 1342 | | |
| |||
0 commit comments