Skip to content

Commit

Permalink
Merge pull request #398 from almaslennikov/netlink_update
Browse files Browse the repository at this point in the history
Updated netlink dependency version
  • Loading branch information
adrianchiris authored Nov 18, 2021
2 parents 889d422 + 33bcaad commit 7488066
Show file tree
Hide file tree
Showing 36 changed files with 1,304 additions and 108 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/onsi/gomega v1.9.0
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.7.0
github.com/vishvananda/netlink v1.1.1-0.20210518155637-4cb3795f2ccb
github.com/vishvananda/netlink v1.1.1-0.20211101163509-b10eb8fe5cf6
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d // indirect
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e // indirect
google.golang.org/grpc v1.28.1
Expand Down
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,9 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE=
github.com/vishvananda/netlink v1.1.1-0.20210518155637-4cb3795f2ccb h1:zjAvI0rxQJQruCr5KOFzryjK5F1GGolyVXy90jYdxUE=
github.com/vishvananda/netlink v1.1.1-0.20210518155637-4cb3795f2ccb/go.mod h1:twkDnbuQxJYemMlGd4JFIcuhgX83tXhKS2B/PRMpOho=
github.com/vishvananda/netlink v1.1.1-0.20211101163509-b10eb8fe5cf6 h1:167a2omrzz+nN9Of6lN/0yOB9itzw+IOioRThNZ30jA=
github.com/vishvananda/netlink v1.1.1-0.20211101163509-b10eb8fe5cf6/go.mod h1:twkDnbuQxJYemMlGd4JFIcuhgX83tXhKS2B/PRMpOho=
github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU=
github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae h1:4hwBBUfQCFe3Cym0ZtKyq7L16eZUtYKs+BaHDN6mAns=
github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0=
Expand Down
10 changes: 2 additions & 8 deletions pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,16 @@ func GetPfAddr(pciAddr string) (string, error) {
// If device is not VF then it will return its own ifname if exist else empty string
func GetPfName(pciAddr string) (string, error) {
pfEswitchMode, err := GetPfEswitchMode(pciAddr)
if err != nil {
errString := strings.ToLower(fmt.Sprint(err))
if pfEswitchMode == "" {
// If device doesn't support eswitch mode query or doesn't have sriov enabled,
// fall back to the default implementation
if strings.Contains(errString, "no such device") || strings.Contains(errString, "operation not supported") {
if err == nil || strings.Contains(strings.ToLower(fmt.Sprint(err)), "no such device") {
glog.Infof("Devlink query for eswitch mode is not supported for device %s. %v", pciAddr, err)
} else {
return "", err
}
}

if pfEswitchMode == "" {
glog.Warningf("Failed to retrieve eswitch mode with devlink query for device %s", pciAddr)
} else if pfEswitchMode == eswitchModeSwitchdev {
name, err := GetSriovnetProvider().GetUplinkRepresentor(pciAddr)

if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/utils/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ var _ = Describe("In the utils package", func() {
On("GetDevLinkDeviceEswitchAttrs", "nonDevlinkDevice").
Return(nil, fmt.Errorf("devlink error: no such device")).
On("GetDevLinkDeviceEswitchAttrs", "nonSriovDevice").
Return(nil, fmt.Errorf("devlink error: operation not supported")).
Return(&nl.DevlinkDevEswitchAttr{Mode: ""}, nil).
On("GetDevLinkDeviceEswitchAttrs", "unknownDevice").
Return(nil, fmt.Errorf("unknown error"))
SetNetlinkProviderInst(&fakeNetlinkProvider)
Expand Down
2 changes: 1 addition & 1 deletion vendor/github.com/vishvananda/netlink/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions vendor/github.com/vishvananda/netlink/addr_linux.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions vendor/github.com/vishvananda/netlink/bpf_linux.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions vendor/github.com/vishvananda/netlink/class_linux.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

94 changes: 83 additions & 11 deletions vendor/github.com/vishvananda/netlink/conntrack_linux.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7488066

Please sign in to comment.