Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Commit

Permalink
Renamed HasLibbpf to HasLibxdp and modified the host and main
Browse files Browse the repository at this point in the history
Signed-off-by: phansGithub <[email protected]>
  • Loading branch information
phansGithub committed Oct 5, 2023
1 parent b1d977a commit 2426d7c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 22 deletions.
34 changes: 18 additions & 16 deletions cmd/deviceplugin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,21 +185,23 @@ func configureLogging(cfg deviceplugin.PluginConfig) error {
// On each Kind node
// Create a bridge afxdp-kind-br
// Create 4 vethpairs starting at veth6
// +===============+
// | afxdp-kind-br |
// | +---------| +---------+
// | | veth7 | <=====> | veth6 |
// | +---------| +---------+
// | +---------| +---------+
// | | veth9 | <=====> | veth8 |
// | +---------| +---------+
// | +---------| +---------+
// | | veth11 | <=====> | veth10 |
// | +---------| +---------+
// | +---------| +---------+
// | | veth13 | <=====> | veth12 |
// | +---------| +---------+
// +===============+
//
// +===============+
// | afxdp-kind-br |
// | +---------| +---------+
// | | veth7 | <=====> | veth6 |
// | +---------| +---------+
// | +---------| +---------+
// | | veth9 | <=====> | veth8 |
// | +---------| +---------+
// | +---------| +---------+
// | | veth11 | <=====> | veth10 |
// | +---------| +---------+
// | +---------| +---------+
// | | veth13 | <=====> | veth12 |
// | +---------| +---------+
// +===============+
//
// The "even" veth of the pair will be added to the device plugin resource pool.
// and plumbed to the Pod.
func configureKindSecondaryNetwork() error {
Expand Down Expand Up @@ -249,7 +251,7 @@ func checkHost(host host.Handler) (bool, error) {

// libbpf
logging.Debugf("Checking host for Libbpf")
bpfInstalled, libs, err := host.HasLibbpf()
bpfInstalled, libs, err := host.HasLibxdp()
if err != nil {
err := fmt.Errorf("libbpf not found on host")
return false, err
Expand Down
10 changes: 5 additions & 5 deletions internal/host/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ package host

import (
"errors"
logging "github.com/sirupsen/logrus"
"io/ioutil"
"os"
"os/exec"
"strings"

logging "github.com/sirupsen/logrus"
)

/*
Expand All @@ -33,7 +34,7 @@ type Handler interface {
AllowsUnprivilegedBpf() (bool, error)
KernelVersion() (string, error)
HasEthtool() (bool, string, error)
HasLibbpf() (bool, []string, error)
HasLibxdp() (bool, []string, error)
HasDevlink() (bool, string, error)
Hostname() (string, error)
}
Expand Down Expand Up @@ -73,7 +74,7 @@ func (r *handler) KernelVersion() (string, error) {
HasLibbpf checks if the host has libbpf installed and returns a boolean.
It also returns a string array of libbpf libraries found under /usr/lib(64)/
*/
func (r *handler) HasLibbpf() (bool, []string, error) {
func (r *handler) HasLibxdp() (bool, []string, error) {
libPaths := []string{"/usr/lib/", "/usr/lib64/"}
foundLibbpf := false
var foundLibs []string
Expand All @@ -90,7 +91,7 @@ func (r *handler) HasLibbpf() (bool, []string, error) {
}

for _, file := range files {
if strings.Contains(file.Name(), "libbpf.so") {
if strings.Contains(file.Name(), "libxdp.so") {
foundLibbpf = true
foundLibs = append(foundLibs, path+file.Name())
}
Expand Down Expand Up @@ -254,4 +255,3 @@ func GivePermissions(filepath, uid, permissions string) error {
logging.Infof("Socket access granted to UID %s", uid)
return nil
}

2 changes: 1 addition & 1 deletion internal/host/host_fake.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (r *fakeHandler) HasEthtool() (bool, string, error) {
HasLibbpf checks if the host has libbpf installed and returns a boolean.
In this FakeHandler it returns a dummy value.
*/
func (r *fakeHandler) HasLibbpf() (bool, []string, error) {
func (r *fakeHandler) HasLibxdp() (bool, []string, error) {
return true, nil, nil
}

Expand Down

0 comments on commit 2426d7c

Please sign in to comment.