Commit d9514c6
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.
Acked-by: Andrii Nakryiko <[email protected]>
Signed-off-by: Leon Hwang <[email protected]>1 parent 7068146 commit d9514c6
3 files changed
+36
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
292 | 300 | | |
293 | 301 | | |
294 | 302 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10673 | 10673 | | |
10674 | 10674 | | |
10675 | 10675 | | |
10676 | | - | |
| 10676 | + | |
10677 | 10677 | | |
10678 | 10678 | | |
10679 | 10679 | | |
| |||
10700 | 10700 | | |
10701 | 10701 | | |
10702 | 10702 | | |
| 10703 | + | |
| 10704 | + | |
| 10705 | + | |
| 10706 | + | |
| 10707 | + | |
| 10708 | + | |
| 10709 | + | |
| 10710 | + | |
| 10711 | + | |
| 10712 | + | |
| 10713 | + | |
| 10714 | + | |
| 10715 | + | |
| 10716 | + | |
10703 | 10717 | | |
10704 | 10718 | | |
10705 | 10719 | | |
| |||
10724 | 10738 | | |
10725 | 10739 | | |
10726 | 10740 | | |
10727 | | - | |
| 10741 | + | |
10728 | 10742 | | |
10729 | 10743 | | |
10730 | 10744 | | |
| |||
10737 | 10751 | | |
10738 | 10752 | | |
10739 | 10753 | | |
10740 | | - | |
| 10754 | + | |
10741 | 10755 | | |
10742 | 10756 | | |
10743 | 10757 | | |
| |||
10749 | 10763 | | |
10750 | 10764 | | |
10751 | 10765 | | |
10752 | | - | |
| 10766 | + | |
10753 | 10767 | | |
10754 | 10768 | | |
10755 | 10769 | | |
| |||
10762 | 10776 | | |
10763 | 10777 | | |
10764 | 10778 | | |
10765 | | - | |
| 10779 | + | |
10766 | 10780 | | |
10767 | 10781 | | |
10768 | 10782 | | |
| |||
10774 | 10788 | | |
10775 | 10789 | | |
10776 | 10790 | | |
10777 | | - | |
| 10791 | + | |
10778 | 10792 | | |
10779 | 10793 | | |
10780 | 10794 | | |
| |||
| 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