Commit 12e4462
libbpf: Add BPF_F_CPU and BPF_F_ALL_CPUS flags support for percpu maps
Add libbpf support for the BPF_F_CPU flag for percpu maps by embedding the
cpu info into the high 32 bits of:
1. **flags**: bpf_map_lookup_elem_flags(), bpf_map__lookup_elem(),
bpf_map_update_elem() and bpf_map__update_elem()
2. **opts->elem_flags**: bpf_map_lookup_batch() and
bpf_map_update_batch()
And the flag can be BPF_F_ALL_CPUS, but cannot be
'BPF_F_CPU | BPF_F_ALL_CPUS'.
Behavior:
* If the flag is BPF_F_ALL_CPUS, the update is applied across all CPUs.
* If the flag is BPF_F_CPU, it updates value only to the specified CPU.
* If the flag is BPF_F_CPU, lookup value only from the specified CPU.
* lookup does not support BPF_F_ALL_CPUS.
Signed-off-by: Leon Hwang <[email protected]>1 parent 708e882 commit 12e4462
3 files changed
+36
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
289 | 297 | | |
290 | 298 | | |
291 | 299 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10603 | 10603 | | |
10604 | 10604 | | |
10605 | 10605 | | |
10606 | | - | |
| 10606 | + | |
10607 | 10607 | | |
10608 | 10608 | | |
10609 | 10609 | | |
| |||
10630 | 10630 | | |
10631 | 10631 | | |
10632 | 10632 | | |
| 10633 | + | |
| 10634 | + | |
| 10635 | + | |
| 10636 | + | |
| 10637 | + | |
| 10638 | + | |
| 10639 | + | |
| 10640 | + | |
| 10641 | + | |
| 10642 | + | |
| 10643 | + | |
| 10644 | + | |
| 10645 | + | |
| 10646 | + | |
10633 | 10647 | | |
10634 | 10648 | | |
10635 | 10649 | | |
| |||
10654 | 10668 | | |
10655 | 10669 | | |
10656 | 10670 | | |
10657 | | - | |
| 10671 | + | |
10658 | 10672 | | |
10659 | 10673 | | |
10660 | 10674 | | |
| |||
10667 | 10681 | | |
10668 | 10682 | | |
10669 | 10683 | | |
10670 | | - | |
| 10684 | + | |
10671 | 10685 | | |
10672 | 10686 | | |
10673 | 10687 | | |
| |||
10679 | 10693 | | |
10680 | 10694 | | |
10681 | 10695 | | |
10682 | | - | |
| 10696 | + | |
10683 | 10697 | | |
10684 | 10698 | | |
10685 | 10699 | | |
| |||
10692 | 10706 | | |
10693 | 10707 | | |
10694 | 10708 | | |
10695 | | - | |
| 10709 | + | |
10696 | 10710 | | |
10697 | 10711 | | |
10698 | 10712 | | |
| |||
10704 | 10718 | | |
10705 | 10719 | | |
10706 | 10720 | | |
10707 | | - | |
| 10721 | + | |
10708 | 10722 | | |
10709 | 10723 | | |
10710 | 10724 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1196 | 1196 | | |
1197 | 1197 | | |
1198 | 1198 | | |
1199 | | - | |
1200 | | - | |
1201 | | - | |
1202 | | - | |
1203 | | - | |
1204 | | - | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
1205 | 1206 | | |
1206 | 1207 | | |
1207 | 1208 | | |
| |||
1219 | 1220 | | |
1220 | 1221 | | |
1221 | 1222 | | |
1222 | | - | |
1223 | | - | |
1224 | | - | |
1225 | | - | |
1226 | | - | |
1227 | | - | |
1228 | | - | |
| 1223 | + | |
1229 | 1224 | | |
1230 | 1225 | | |
1231 | 1226 | | |
| |||
0 commit comments