[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190302073438.GN2314@nanopsycho>
Date: Sat, 2 Mar 2019 08:34:38 +0100
From: Jiri Pirko <jiri@...nulli.us>
To: Florian Fainelli <f.fainelli@...il.com>
Cc: netdev@...r.kernel.org, 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
Sat, Mar 02, 2019 at 03:53:47AM CET, f.fainelli@...il.com wrote:
>
>
>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?
Might be, yes. On the other hand. attrs->switch_port is just one bit..
>--
>Florian
Powered by blists - more mailing lists