safchain / ethtool

A simple ethtool "like" library for GO
Apache License 2.0
116 stars 69 forks source link

Support requesting feature changes #20

Closed 0x5a17ed closed 5 years ago

0x5a17ed commented 5 years ago

This PR adds support to request changes in the device feature configuration.

Example:

    t, _ := ethtool.NewEthtool()
    _ := t.Configure("enp5s0", map[string]bool{
        "tx-checksum-ipv4": true,
    })
safchain commented 5 years ago

Thanks for your contribution !

It has to be used like this :

    t, _ := ethtool.NewEthtool()
    _ := t.Change("enp5s0", map[string]bool{
        "tx-checksum-ipv4": true,
    })
0x5a17ed commented 5 years ago

You're right regarding the sample code how to use the Change function. I guess I didn't update the example I prepared for the pull request description after refactoring the function name.

But I think that Change is a more fitting name for what the function does than Configure considering how the API internally works. In the end these are only requests sent to the kernel to change these settings and the kernel decides whenever to apply these requests or not. Naming things is hard.

Thanks for merging these changes!