[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <82d5a049-293d-b7ed-615e-e11abc81f4dd@pensando.io>
Date: Tue, 19 May 2020 12:24:09 -0700
From: Shannon Nelson <snelson@...sando.io>
To: Ido Schimmel <idosch@...sch.org>, netdev@...r.kernel.org
Cc: davem@...emloft.net, kuba@...nel.org, jiri@...lanox.com,
danieller@...lanox.com, mlxsw@...lanox.com,
michael.chan@...adcom.com, jeffrey.t.kirsher@...el.com,
saeedm@...lanox.com, leon@...nel.org, drivers@...sando.io,
andrew@...n.ch, vivien.didelot@...il.com, f.fainelli@...il.com,
Ido Schimmel <idosch@...lanox.com>
Subject: Re: [PATCH net-next 2/3] devlink: Add a new devlink port width
attribute and pass to netlink
On 5/19/20 6:40 AM, Ido Schimmel wrote:
> From: Danielle Ratson <danieller@...lanox.com>
>
> Add a new devlink port attribute that indicates the port's width.
> Drivers are expected to set it via devlink_port_attrs_set(), before
> registering the port.
>
> The attribute is not passed to user space in case the width is invalid
> (0).
>
> Signed-off-by: Danielle Ratson <danieller@...lanox.com>
> Reviewed-by: Jiri Pirko <jiri@...lanox.com>
> Signed-off-by: Ido Schimmel <idosch@...lanox.com>
> ---
[...]
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_devlink.c b/drivers/net/ethernet/pensando/ionic/ionic_devlink.c
> index 273c889faaad..a21a10307ecc 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_devlink.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_devlink.c
> @@ -82,7 +82,7 @@ int ionic_devlink_register(struct ionic *ionic)
> return 0;
>
> devlink_port_attrs_set(&ionic->dl_port, DEVLINK_PORT_FLAVOUR_PHYSICAL,
> - 0, false, 0, NULL, 0);
> + 0, false, 0, 0, NULL, 0);
> err = devlink_port_register(dl, &ionic->dl_port, 0);
> if (err)
> dev_err(ionic->dev, "devlink_port_register failed: %d\n", err);
for ionic
Acked-by: Shannon Nelson <snelson@...sando.io>
[...]
> diff --git a/net/core/devlink.c b/net/core/devlink.c
> index 7b76e5fffc10..9887fba60a7a 100644
> --- a/net/core/devlink.c
> +++ b/net/core/devlink.c
> @@ -526,6 +526,10 @@ static int devlink_nl_port_attrs_put(struct sk_buff *msg,
>
> if (!attrs->set)
> return 0;
> + if (attrs->width) {
> + if (nla_put_u32(msg, DEVLINK_ATTR_PORT_WIDTH, attrs->width))
> + return -EMSGSIZE;
> + }
> if (nla_put_u16(msg, DEVLINK_ATTR_PORT_FLAVOUR, attrs->flavour))
> return -EMSGSIZE;
> switch (devlink_port->attrs.flavour) {
> @@ -7408,6 +7412,7 @@ static int __devlink_port_attrs_set(struct devlink_port *devlink_port,
> * @split: indicates if this is split port
> * @split_subport_number: if the port is split, this is the number
> * of subport.
> + * @width: width of the port. 0 value is not passed to netlink.
A little more explanation here would help - basically something like
@width: number of ways the port can be split. 0 value is not
passed to netlink.
Is this always going to be an even number, or a power-of-2? If so,
perhaps that should be noted here.
Thanks,
sln
Powered by blists - more mailing lists