forked from openshift/sriov-network-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request openshift#588 from ykulazhenkov/pr-add-funcs-to-ho…
…st-pkg [switchdev 3/x] Extend host pkg with required functions
- Loading branch information
Showing
21 changed files
with
1,373 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package govdpa | ||
|
||
import ( | ||
"github.com/k8snetworkplumbingwg/govdpa/pkg/kvdpa" | ||
) | ||
|
||
func New() GoVdpaLib { | ||
return &libWrapper{} | ||
} | ||
|
||
type VdpaDevice interface { | ||
kvdpa.VdpaDevice | ||
} | ||
|
||
//go:generate ../../../../../bin/mockgen -destination mock/mock_govdpa.go -source govdpa.go | ||
type GoVdpaLib interface { | ||
// GetVdpaDevice returns the vdpa device information by a vdpa device name | ||
GetVdpaDevice(vdpaDeviceName string) (VdpaDevice, error) | ||
// AddVdpaDevice adds a new vdpa device to the given management device | ||
AddVdpaDevice(mgmtDeviceName string, vdpaDeviceName string) error | ||
// DeleteVdpaDevice deletes a vdpa device | ||
DeleteVdpaDevice(vdpaDeviceName string) error | ||
} | ||
|
||
type libWrapper struct{} | ||
|
||
// GetVdpaDevice returns the vdpa device information by a vdpa device name | ||
func (w *libWrapper) GetVdpaDevice(name string) (VdpaDevice, error) { | ||
return kvdpa.GetVdpaDevice(name) | ||
} | ||
|
||
// AddVdpaDevice adds a new vdpa device to the given management device | ||
func (w *libWrapper) AddVdpaDevice(mgmtDeviceName string, vdpaDeviceName string) error { | ||
return kvdpa.AddVdpaDevice(mgmtDeviceName, vdpaDeviceName) | ||
} | ||
|
||
// DeleteVdpaDevice deletes a vdpa device | ||
func (w *libWrapper) DeleteVdpaDevice(name string) error { | ||
return kvdpa.DeleteVdpaDevice(name) | ||
} |
Oops, something went wrong.