Commit 375c8b4
libbpf: Support BPF_F_CPU for percpu_array maps
Add libbpf support for the BPF_F_CPU flag for percpu_array 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()
Behavior:
* If cpu is (u32)~0, the update is applied across all CPUs.
* Otherwise, it updates value only to the specified CPU.
* If cpu is (u32)~0, lookup values across all CPUs.
* Otherwise, it lookups value only from the specified CPU.
Signed-off-by: Leon Hwang <[email protected]>1 parent def4741 commit 375c8b4
3 files changed
+33
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
289 | 294 | | |
290 | 295 | | |
291 | 296 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10593 | 10593 | | |
10594 | 10594 | | |
10595 | 10595 | | |
10596 | | - | |
| 10596 | + | |
10597 | 10597 | | |
| 10598 | + | |
| 10599 | + | |
10598 | 10600 | | |
10599 | 10601 | | |
10600 | 10602 | | |
| |||
10612 | 10614 | | |
10613 | 10615 | | |
10614 | 10616 | | |
| 10617 | + | |
| 10618 | + | |
| 10619 | + | |
| 10620 | + | |
| 10621 | + | |
| 10622 | + | |
| 10623 | + | |
| 10624 | + | |
| 10625 | + | |
| 10626 | + | |
| 10627 | + | |
| 10628 | + | |
| 10629 | + | |
| 10630 | + | |
10615 | 10631 | | |
10616 | 10632 | | |
10617 | 10633 | | |
| |||
10644 | 10660 | | |
10645 | 10661 | | |
10646 | 10662 | | |
10647 | | - | |
| 10663 | + | |
10648 | 10664 | | |
10649 | 10665 | | |
10650 | 10666 | | |
| |||
10657 | 10673 | | |
10658 | 10674 | | |
10659 | 10675 | | |
10660 | | - | |
| 10676 | + | |
10661 | 10677 | | |
10662 | 10678 | | |
10663 | 10679 | | |
| |||
10669 | 10685 | | |
10670 | 10686 | | |
10671 | 10687 | | |
10672 | | - | |
| 10688 | + | |
10673 | 10689 | | |
10674 | 10690 | | |
10675 | 10691 | | |
| |||
10682 | 10698 | | |
10683 | 10699 | | |
10684 | 10700 | | |
10685 | | - | |
| 10701 | + | |
10686 | 10702 | | |
10687 | 10703 | | |
10688 | 10704 | | |
| |||
10694 | 10710 | | |
10695 | 10711 | | |
10696 | 10712 | | |
10697 | | - | |
| 10713 | + | |
10698 | 10714 | | |
10699 | 10715 | | |
10700 | 10716 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1169 | 1169 | | |
1170 | 1170 | | |
1171 | 1171 | | |
1172 | | - | |
1173 | | - | |
1174 | | - | |
1175 | | - | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
1176 | 1177 | | |
1177 | 1178 | | |
1178 | 1179 | | |
| |||
1192 | 1193 | | |
1193 | 1194 | | |
1194 | 1195 | | |
1195 | | - | |
1196 | | - | |
1197 | | - | |
1198 | | - | |
1199 | | - | |
1200 | | - | |
1201 | | - | |
| 1196 | + | |
1202 | 1197 | | |
1203 | 1198 | | |
1204 | 1199 | | |
| |||
0 commit comments