Commit 663bc6c
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 eb7a200 commit 663bc6c
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 | |
|---|---|---|---|
| |||
10913 | 10913 | | |
10914 | 10914 | | |
10915 | 10915 | | |
10916 | | - | |
| 10916 | + | |
10917 | 10917 | | |
10918 | 10918 | | |
10919 | 10919 | | |
| |||
10940 | 10940 | | |
10941 | 10941 | | |
10942 | 10942 | | |
| 10943 | + | |
| 10944 | + | |
| 10945 | + | |
| 10946 | + | |
| 10947 | + | |
| 10948 | + | |
| 10949 | + | |
| 10950 | + | |
| 10951 | + | |
| 10952 | + | |
| 10953 | + | |
| 10954 | + | |
| 10955 | + | |
| 10956 | + | |
10943 | 10957 | | |
10944 | 10958 | | |
10945 | 10959 | | |
| |||
10964 | 10978 | | |
10965 | 10979 | | |
10966 | 10980 | | |
10967 | | - | |
| 10981 | + | |
10968 | 10982 | | |
10969 | 10983 | | |
10970 | 10984 | | |
| |||
10977 | 10991 | | |
10978 | 10992 | | |
10979 | 10993 | | |
10980 | | - | |
| 10994 | + | |
10981 | 10995 | | |
10982 | 10996 | | |
10983 | 10997 | | |
| |||
10989 | 11003 | | |
10990 | 11004 | | |
10991 | 11005 | | |
10992 | | - | |
| 11006 | + | |
10993 | 11007 | | |
10994 | 11008 | | |
10995 | 11009 | | |
| |||
11002 | 11016 | | |
11003 | 11017 | | |
11004 | 11018 | | |
11005 | | - | |
| 11019 | + | |
11006 | 11020 | | |
11007 | 11021 | | |
11008 | 11022 | | |
| |||
11014 | 11028 | | |
11015 | 11029 | | |
11016 | 11030 | | |
11017 | | - | |
| 11031 | + | |
11018 | 11032 | | |
11019 | 11033 | | |
11020 | 11034 | | |
| |||
| 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