Commit 31a01b9
committed
bpf/nat: Move ipv6_nat_entry to map
This commit moves the ipv6_nat_entry local variable of
snat_v6_nat_handle_mapping from the stack to a per-cpu array map. This
function (or rather its caller) has a very large stack because
ipv6_nat_entry is huge and we manipulate several variables of that type.
We're currently close to the limit and few changes are often enough to
get us above the 512B stack size limit. This is currently blocking
ongoing work on complexity issues and BPF Host Routing in other pull
requests.
This commit therefore implements the strategy tried by Aditi before and
extends it to the tmp variable. We're moving the rstate and tmp
variables of type ipv6_nat_entry to a map. We can use the same map for
both variables because (1) they are not used at the same time and (2)
they are always cleared before being used anyway.
The following two tables show the impact on the stack size of
tail_handle_snat_fwd_ipv6 of moving the two variables to the map. Config
1 corresponds to the config generated by "make build_all". Config 2
corresponds to the config generated by "make".
Impact on tail_handle_snat_fwd_ipv6 after moving rstate to the map:
| Program | Config 1 | Config 2 |
|---------------|----------|----------|
| bpf_host | -0 | -0 |
| bpf_overlay | -0 | -0 |
| bpf_wireguard | -56 | -0 |
Impact on tail_handle_snat_fwd_ipv6 after moving tmp to the map:
| Program | Config 1 | Config 2 |
|---------------|----------|----------|
| bpf_host | -64 | -48 |
| bpf_overlay | -40 | -48 |
| bpf_wireguard | -56 | -56 |
Co-developed-by: Aditi Ghag <aditi@cilium.io>
Signed-off-by: Aditi Ghag <aditi@cilium.io>
Signed-off-by: Paul Chaignon <paul.chaignon@gmail.com>1 parent 899bab8 commit 31a01b9
1 file changed
Lines changed: 26 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1373 | 1373 | | |
1374 | 1374 | | |
1375 | 1375 | | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
1376 | 1384 | | |
1377 | 1385 | | |
1378 | 1386 | | |
1379 | 1387 | | |
1380 | 1388 | | |
1381 | | - | |
1382 | 1389 | | |
1383 | 1390 | | |
1384 | 1391 | | |
1385 | 1392 | | |
1386 | 1393 | | |
1387 | 1394 | | |
| 1395 | + | |
1388 | 1396 | | |
1389 | 1397 | | |
1390 | 1398 | | |
| |||
1422 | 1430 | | |
1423 | 1431 | | |
1424 | 1432 | | |
1425 | | - | |
| 1433 | + | |
1426 | 1434 | | |
1427 | 1435 | | |
1428 | 1436 | | |
1429 | 1437 | | |
1430 | | - | |
1431 | | - | |
1432 | | - | |
1433 | | - | |
1434 | | - | |
1435 | | - | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
1436 | 1448 | | |
1437 | 1449 | | |
1438 | 1450 | | |
| |||
1454 | 1466 | | |
1455 | 1467 | | |
1456 | 1468 | | |
1457 | | - | |
1458 | | - | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
1459 | 1473 | | |
1460 | 1474 | | |
1461 | 1475 | | |
| |||
1847 | 1861 | | |
1848 | 1862 | | |
1849 | 1863 | | |
1850 | | - | |
| 1864 | + | |
1851 | 1865 | | |
1852 | 1866 | | |
1853 | | - | |
| 1867 | + | |
1854 | 1868 | | |
1855 | 1869 | | |
1856 | 1870 | | |
| |||
0 commit comments