[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6943ae8f-8415-3638-736a-e32a5c157bff@gmail.com>
Date: Fri, 1 Mar 2019 18:53:47 -0800
From: Florian Fainelli <f.fainelli@...il.com>
To: Jiri Pirko <jiri@...nulli.us>, netdev@...r.kernel.org
Cc: davem@...emloft.net, mlxsw@...lanox.com, idosch@...lanox.com,
jakub.kicinski@...ronome.com, dirk.vandermerwe@...ronome.com,
andrew@...n.ch, vivien.didelot@...il.com
Subject: Re: [patch net-next RFC 2/8] net: devlink: extend port attrs for
switch ID
On 3/1/2019 8:05 AM, Jiri Pirko wrote:
> From: Jiri Pirko <jiri@...lanox.com>
>
> Extend devlink_port_attrs_set() to pass switch ID for ports which are
> part of switch and store it in port attrs. For other ports, this is
> NULL. During dump to userspace only valid switch ID is filled up.
> Note that this allows the driver to group devlink ports into one or more
> switches according to the actual topology.
>
> Signed-off-by: Jiri Pirko <jiri@...lanox.com>
> ---
[snip]
> @@ -5415,6 +5423,15 @@ void devlink_port_attrs_set(struct devlink_port *devlink_port,
> attrs->port_number = port_number;
> attrs->split = split;
> attrs->split_subport_number = split_subport_number;
> + if (switch_id) {
> + attrs->switch_port = true;
> + if (WARN_ON(switch_id_len > MAX_PHYS_ITEM_ID_LEN))
> + switch_id_len = MAX_PHYS_ITEM_ID_LEN;
> + memcpy(attrs->switch_id.id, switch_id, switch_id_len);
> + attrs->switch_id.id_len = switch_id_len;
> + } else {
> + attrs->switch_port = false;
Would not switch_id.id_len != 0 be enough of an indicator that this is a
switch port?
--
Florian
Powered by blists - more mailing lists