Skip to content

Commit

Permalink
xdp: make cilium_calls_xdp map per-endpoint
Browse files Browse the repository at this point in the history
[ upstream commit 2fd9150 ]

This is a partial backport of an upstream commit that made cilium_calls_xdp
a per-endpoint map with an ifindex suffix. This is affecting 1.14 and 1.15
release branches, so backport only the specific behaviour.

Signed-off-by: Timo Beckers <[email protected]>
  • Loading branch information
ti-mo committed Nov 21, 2024
1 parent 5dc4133 commit df65da5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion bugtool/cmd/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ func defaultCommands(confDir string, cmdDir string, k8sPods []string) []string {
fmt.Sprintf("bpftool map dump pinned %s/tc/globals/cilium_auth_map", bpffsMountpoint),
fmt.Sprintf("bpftool map dump pinned %s/tc/globals/cilium_call_policy", bpffsMountpoint),
fmt.Sprintf("bpftool map dump pinned %s/tc/globals/cilium_calls_overlay_2", bpffsMountpoint),
fmt.Sprintf("bpftool map dump pinned %s/tc/globals/cilium_calls_xdp", bpffsMountpoint),
fmt.Sprintf("bpftool map dump pinned %s/tc/globals/cilium_capture_cache", bpffsMountpoint),
fmt.Sprintf("bpftool map dump pinned %s/tc/globals/cilium_runtime_config", bpffsMountpoint),
fmt.Sprintf("bpftool map dump pinned %s/tc/globals/cilium_lxc", bpffsMountpoint),
Expand Down
5 changes: 0 additions & 5 deletions pkg/bpf/bpffs_migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,6 @@ func RepinMap(bpffsPath string, name string, spec *ebpf.MapSpec) error {
pinned.ValueSize() == spec.ValueSize &&
pinned.Flags() == spec.Flags &&
pinned.MaxEntries() == spec.MaxEntries {
// cilium_calls_xdp is shared between XDP interfaces and should only be
// migrated if the existing map is incompatible.
if spec.Name == "cilium_calls_xdp" {
return nil
}
// Maps prefixed with cilium_calls_ should never be reused by subsequent ELF
// loads and should be migrated unconditionally.
if !strings.HasPrefix(spec.Name, "cilium_calls_") {
Expand Down
5 changes: 5 additions & 0 deletions pkg/datapath/loader/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/vishvananda/netlink"

"github.com/cilium/cilium/pkg/backoff"
"github.com/cilium/cilium/pkg/bpf"
"github.com/cilium/cilium/pkg/command/exec"
"github.com/cilium/cilium/pkg/datapath/alignchecker"
"github.com/cilium/cilium/pkg/datapath/connector"
Expand Down Expand Up @@ -297,6 +298,10 @@ func (l *Loader) reinitializeXDPLocked(ctx context.Context, extraCArgs []string)
return err
}
}

// Clean up the legacy cilium_calls_xdp path.
os.Remove(filepath.Join(bpf.TCGlobalsPath(), "cilium_calls_xdp"))

return nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/datapath/loader/xdp.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func xdpCompileArgs(xdpDev string, extraCArgs []string) ([]string, error) {
args := []string{
fmt.Sprintf("-DSECLABEL=%d", identity.ReservedIdentityWorld),
fmt.Sprintf("-DNODE_MAC={.addr=%s}", mac.CArrayString(link.Attrs().HardwareAddr)),
"-DCALLS_MAP=cilium_calls_xdp",
fmt.Sprintf("-DCALLS_MAP=cilium_calls_xdp_%d", link.Attrs().Index),
}
args = append(args, extraCArgs...)
if option.Config.EnableNodePort {
Expand Down

0 comments on commit df65da5

Please sign in to comment.