-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add function EnableHwTcOffload to the network pkg
This function ensures that hw-tc-offload feature is enabled for the interface if the interface supports it. relies on github.com/safchain/ethtool lib Signed-off-by: Yury Kulazhenkov <[email protected]>
- Loading branch information
1 parent
0d51338
commit d00c856
Showing
19 changed files
with
1,688 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package ethtool | ||
|
||
import ( | ||
"github.com/safchain/ethtool" | ||
) | ||
|
||
func New() EthtoolLib { | ||
return &libWrapper{} | ||
} | ||
|
||
//go:generate ../../../../../bin/mockgen -destination mock/mock_ethtool.go -source ethtool.go | ||
type EthtoolLib interface { | ||
// Features retrieves features of the given interface name. | ||
Features(ifaceName string) (map[string]bool, error) | ||
// FeatureNames shows supported features by their name. | ||
FeatureNames(ifaceName string) (map[string]uint, error) | ||
// Change requests a change in the given device's features. | ||
Change(ifaceName string, config map[string]bool) error | ||
} | ||
|
||
type libWrapper struct{} | ||
|
||
// Features retrieves features of the given interface name. | ||
func (w *libWrapper) Features(ifaceName string) (map[string]bool, error) { | ||
e, err := ethtool.NewEthtool() | ||
if err != nil { | ||
return nil, err | ||
} | ||
defer e.Close() | ||
return e.Features(ifaceName) | ||
} | ||
|
||
// FeatureNames shows supported features by their name. | ||
func (w *libWrapper) FeatureNames(ifaceName string) (map[string]uint, error) { | ||
e, err := ethtool.NewEthtool() | ||
if err != nil { | ||
return nil, err | ||
} | ||
defer e.Close() | ||
return e.FeatureNames(ifaceName) | ||
} | ||
|
||
// Change requests a change in the given device's features. | ||
func (w *libWrapper) Change(ifaceName string, config map[string]bool) error { | ||
e, err := ethtool.NewEthtool() | ||
if err != nil { | ||
return err | ||
} | ||
defer e.Close() | ||
return e.Change(ifaceName, config) | ||
} |
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
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
Oops, something went wrong.