Sat, Mar 02, 2019 at 03:53:47AM CET, f.faine...@gmail.com wrote:
>
>
>On 3/1/2019 8:05 AM, Jiri Pirko wrote:
>> From: Jiri Pirko <j...@mellanox.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 <j...@mellanox.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

Reply via email to