land bpf2go basic support for Variable and VariableSpec #1610
+555
−86
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Commit messages should (hopefully) describe the introduced changes. In brief:
add bpf2go basic support to emit Variables and VariableSpecs
: as discussed in the reference PR*, this commit adds the minimal support to bpf2go for emittingVariables
andVariableSpecs
. Introduced in Collection: add Variables field to interact with global variables #1572,Variables
are always emitted for everyVariableSpec
in theCollectionSpec
, despite its usage being supported or not (kernel >=v5.5).fix typo in comment when bpf2go emits bpfProgramSpecs
: fixed a typo in a bpf2go-generated comment (bpfSpecs
rather thanbpfProgramSpecs
)regenerate all TARGETS in main
: plain execution ofmake
, to regenerate all the targets after (1).add bpf2go test emit-and-load specs+bpf objects
: extendedapi_test.go
to check also for Variables to be loaded, and all the{Map,Variable,Program}Specs
to be loaded. Introduced new test inoutput_test.go
to verify that the generated bpf2go output is as expected for every spec and bpf object.simplify and update tcx example to use Variable API
: showcase the new Variable API in the TCX example. Back then when we introduced it, we wanted to use global variables, but there were no support for that, so we used bpf maps for counting packets.*Reference PR with the discussion: #1543