mbox series

[net-next,v8,0/8] devlink: Add configuration parameters support for devlink_port

Message ID 1548678627-21938-1-git-send-email-vasundhara-v.volam@broadcom.com
Headers show
Series devlink: Add configuration parameters support for devlink_port | expand

Message

Vasundhara Volam Jan. 28, 2019, 12:30 p.m. UTC
This patchset adds support for configuration parameters setting through
devlink_port.  Each device registers supported configuration parameters
table.

The user can retrieve data on these parameters by
"devlink port param show" command and can set new value to a
parameter by "devlink port param set" command.
All configuration modes supported by devlink_dev are supported
by devlink_port also.

Command examples and output:

# devlink port param show
pci/0000:3b:00.0/0:
  name wake-on-lan type generic
    values:
      cmode permanent value false

pci/0000:3b:00.1/1:
  name wake-on-lan type generic
    values:
      cmode permanent value false

pci/0000:af:00.0/0:
  name wake-on-lan type generic
    values:
      cmode permanent value true

# devlink port param show pci/0000:3b:00.0/0 name wake-on-lan
pci/0000:3b:00.0/0:
  name wake-on-lan type generic
    values:
      cmode permanent value false

# devlink port param set pci/0000:3b:00.0/0 name wake-on-lan cmode permanent value true

There is difference of opinion on adding WOL parameter to devlink, between
Jakub Kicinski and Michael Chan.

Quote from Jakud Kicinski:
********
As explained previously I think it's a very bad idea to add existing
configuration options to devlink, just because devlink has the ability
to persist the setting in NVM.  Especially that for WoL you have to get
the link up so you potentially have all link config stuff as well.  And
that n-tuple filters are one of the WoL options, meaning we'd need the
ability to persist n-tuple filters via devlink.

The effort would be far better spent helping with migrating ethtool to
netlink, and allowing persisting there.

I have not heard any reason why devlink is a better fit.  I can imagine
you're just doing it here because it's less effort for you since
ethtool is not yet migrated.
********

Quote from Michael Chan:
********
The devlink's WoL parameter is a persistent WoL parameter stored in the
NIC's NVRAM. It is different from ethtool's WoL parameter in a number of
ways. ethtool WoL is not persistent over AC power cycle and is considered
OS-present WoL. As such, ethtool WoL can use a more sophisticated pattern
including n-tuple with IP address in addition to the more basic types
(e.g. magic packet). Whereas OS-absent power up WoL should only include
magic packet and other simple types. The devlink WoL setting does not have
to match the ethtool WoL setting. The card will autoneg up to the speed
supported by Vaux so no special devlink link setting is needed.
********

Future expansion of WOL parameter to devlink:
********
Add an additional flag to support additional setting to address link settings.
This will allow attributes to support both runtime and persistent
configuration.
********

v7->v8:
* Re-ordered function definitions.
* Append with "Acked-by: Jiri Pirko <jiri@mellanox.com>" to first 3 patches.
* Add missing devlink_port_param_driverinit_value_get() declaration.

v6->v7:
* Remove RFC tag from the patch-set.

v5->v6:
* Replace '-' with '*' in cover letter to avoid cutoff by git.

v4->v5:
* Added quotes from Jakub Kicinski and Michael chan on devlink's WOL
  parameter in the cover letter.

v3->v4:
* Update changes done from v2 to v3 version in individual patch
  descriptions.

v2->v3:
Make following changes as per suggestions from Jiri Pirko and
Michal Kubecek.
* Add a helper __devlink_params_register() with common code used by
  both devlink_params_register() and devlink_port_params_register().
* Define only WOL types used now and define them as bitfield, so that
  mutliple WOL types can be enabled upon power on.
* Modify "wake-on-lan" name to "wake_on_lan" to be symmetric with
  previous definitions.
* Rename DEVLINK_PARAM_WOL_XXX to DEVLINK_PARAM_WAKE_XXX to be
  symmetrical with ethtool WOL definitions.
* Modify bnxt_dl_wol_validate(), to throw error message when user gives
  value other than DEVLINK_PARAM_WAKE_MAGIC or to disable WOL.
* Use netdev_err() instead of netdev_warn(), when devlink_port_register()
  and devlink_port_params_register() returns error. Also, don't log rc
  in this message.

v1->v2:
Make following changes as per suggestions from Jiri Pirko.
* Remove separate enum devlink_port_param_generic_id for port params.
  Instead club it with existing device params. Accordingly refactor
  remaining patchset.
* Move INIT_LIST_HEAD of port param_list to devlink_port_register()
* Add a helper devlink_param_verify() to be used for both
  devlink_params_register() and devlink_port_params_register().
* Add a helper __devlink_params_unregister() for common code in
  devlink_params_unregister() and devlink_port_params_unregister().
* Move DEVLINK_CMD_PORT_PARAM_XXX definitions to the end of the enum.
* Split the patches for devlink_port_param_driverinit_value_get() and
  devlink_port_param_driverinit_value_set() into separate patches.
* define DEVLINK_PARAM_GENERIC_ID_WOL type as u8 and define enum for
  different types of WOL. Accordingly modify bnxt_en patch to validate
  wol type.

Vasundhara Volam (8):
  devlink: Add devlink_param for port register and unregister
  devlink: Add port param get command
  devlink: Add port param set command
  devlink: Add support for driverinit get value for devlink_port
  devlink: Add support for driverinit set value for devlink_port
  devlink: Add devlink notifications support for port params
  devlink: Add a generic wake_on_lan port parameter
  bnxt_en: Add bnxt_en initial port params table and register it

 drivers/net/ethernet/broadcom/bnxt/bnxt.h         |   1 +
 drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c |  43 +-
 drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h |   1 +
 include/net/devlink.h                             |  61 +++
 include/uapi/linux/devlink.h                      |   5 +
 net/core/devlink.c                                | 467 ++++++++++++++++++----
 6 files changed, 494 insertions(+), 84 deletions(-)

Comments

David Miller Jan. 30, 2019, 6:13 a.m. UTC | #1
From: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Date: Mon, 28 Jan 2019 18:00:19 +0530

> This patchset adds support for configuration parameters setting through
> devlink_port.  Each device registers supported configuration parameters
> table.
> 
> The user can retrieve data on these parameters by
> "devlink port param show" command and can set new value to a
> parameter by "devlink port param set" command.
> All configuration modes supported by devlink_dev are supported
> by devlink_port also.
> 
> Command examples and output:
 ...

Series applied to net-next, thanks.
Jakub Kicinski Jan. 30, 2019, 11:57 p.m. UTC | #2
On Mon, 28 Jan 2019 18:00:19 +0530, Vasundhara Volam wrote:
> This patchset adds support for configuration parameters setting through
> devlink_port.  Each device registers supported configuration parameters
> table.
> 
> The user can retrieve data on these parameters by
> "devlink port param show" command and can set new value to a
> parameter by "devlink port param set" command.
> All configuration modes supported by devlink_dev are supported
> by devlink_port also.

Hm, I think we were kind of going somewhere with the ethtool/nl
attribute encapsulation idea.  You seem to have ignored those comments
on v7 and reposted v8 a day after.  

I think we should explore the nesting further.  The only obstacle is
that ethtool netlink conversion is not yet finished, but that's just 
a simple matter of programming.  Do you disagree with that direction?
Please comment.
Vasundhara Volam Jan. 31, 2019, 8:44 a.m. UTC | #3
On Thu, Jan 31, 2019 at 5:28 AM Jakub Kicinski
<jakub.kicinski@netronome.com> wrote:
>
> On Mon, 28 Jan 2019 18:00:19 +0530, Vasundhara Volam wrote:
> > This patchset adds support for configuration parameters setting through
> > devlink_port.  Each device registers supported configuration parameters
> > table.
> >
> > The user can retrieve data on these parameters by
> > "devlink port param show" command and can set new value to a
> > parameter by "devlink port param set" command.
> > All configuration modes supported by devlink_dev are supported
> > by devlink_port also.
>
> Hm, I think we were kind of going somewhere with the ethtool/nl
> attribute encapsulation idea.  You seem to have ignored those comments
> on v7 and reposted v8 a day after.
Jakub, I have added the idea of future expansion of WOL in my v8 cover letter
mentioning the same. I will work on this as a future patchset.
>
> I think we should explore the nesting further.  The only obstacle is
> that ethtool netlink conversion is not yet finished, but that's just
> a simple matter of programming.  Do you disagree with that direction?
> Please comment.
No, I agree with you about ethtool netlink encapsulation.
David Miller Jan. 31, 2019, 5:25 p.m. UTC | #4
From: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Date: Thu, 31 Jan 2019 14:14:02 +0530

> On Thu, Jan 31, 2019 at 5:28 AM Jakub Kicinski
> <jakub.kicinski@netronome.com> wrote:
>>
>> On Mon, 28 Jan 2019 18:00:19 +0530, Vasundhara Volam wrote:
>> > This patchset adds support for configuration parameters setting through
>> > devlink_port.  Each device registers supported configuration parameters
>> > table.
>> >
>> > The user can retrieve data on these parameters by
>> > "devlink port param show" command and can set new value to a
>> > parameter by "devlink port param set" command.
>> > All configuration modes supported by devlink_dev are supported
>> > by devlink_port also.
>>
>> Hm, I think we were kind of going somewhere with the ethtool/nl
>> attribute encapsulation idea.  You seem to have ignored those comments
>> on v7 and reposted v8 a day after.
> Jakub, I have added the idea of future expansion of WOL in my v8 cover letter
> mentioning the same. I will work on this as a future patchset.
>>
>> I think we should explore the nesting further.  The only obstacle is
>> that ethtool netlink conversion is not yet finished, but that's just
>> a simple matter of programming.  Do you disagree with that direction?
>> Please comment.
> No, I agree with you about ethtool netlink encapsulation.

This is great.

But this has to be resolved before the next merge window, otherwise I will
really have to revert this patch series.  You have been warned, so do not
let this slip under the cracks.

Thank you.