public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, mlxsw@mellanox.com,
	idosch@mellanox.com, jakub.kicinski@netronome.com,
	dirk.vandermerwe@netronome.com, andrew@lunn.ch,
	vivien.didelot@gmail.com
Subject: Re: [patch net-next RFC 2/8] net: devlink: extend port attrs for switch ID
Date: Sat, 2 Mar 2019 08:34:38 +0100	[thread overview]
Message-ID: <20190302073438.GN2314@nanopsycho> (raw)
In-Reply-To: <6943ae8f-8415-3638-736a-e32a5c157bff@gmail.com>

Sat, Mar 02, 2019 at 03:53:47AM CET, f.fainelli@gmail.com wrote:
>
>
>On 3/1/2019 8:05 AM, Jiri Pirko wrote:
>> From: Jiri Pirko <jiri@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 <jiri@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	other threads:[~2019-03-02  7:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-01 16:05 [patch net-next RFC 0/8] net: expose switch ID via devlink Jiri Pirko
2019-03-01 16:05 ` [patch net-next RFC 1/8] net: devlink: convert devlink_port_attrs bools to bits Jiri Pirko
2019-03-02  2:48   ` Florian Fainelli
2019-03-01 16:05 ` [patch net-next RFC 2/8] net: devlink: extend port attrs for switch ID Jiri Pirko
2019-03-02  2:53   ` Florian Fainelli
2019-03-02  7:34     ` Jiri Pirko [this message]
2019-03-01 16:05 ` [patch net-next RFC 3/8] net: devlink: introduce devlink_compat_switch_id_get() helper Jiri Pirko
2019-03-01 16:45   ` Jakub Kicinski
2019-03-01 16:40     ` Jiri Pirko
2019-03-01 16:05 ` [patch net-next RFC 4/8] mlxsw: Pass switch ID through devlink_port_attrs_set() Jiri Pirko
2019-03-01 16:05 ` [patch net-next RFC 5/8] mlxsw: Remove ndo_get_port_parent_id implementation Jiri Pirko
2019-03-02  2:57   ` Florian Fainelli
2019-03-02  7:36     ` Jiri Pirko
2019-03-01 16:05 ` [patch net-next RFC 6/8] nfp: pass switch ID through devlink_port_attrs_set() Jiri Pirko
2019-03-01 16:05 ` [patch net-next RFC 7/8] nfp: register devlink port before netdev Jiri Pirko
2019-03-01 16:05 ` [patch net-next RFC 8/8] nfp: remove ndo_get_port_parent_id implementation Jiri Pirko
2019-03-02  2:58   ` Florian Fainelli
2019-03-02  2:58 ` [patch net-next RFC 0/8] net: expose switch ID via devlink Florian Fainelli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190302073438.GN2314@nanopsycho \
    --to=jiri@resnulli.us \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dirk.vandermerwe@netronome.com \
    --cc=f.fainelli@gmail.com \
    --cc=idosch@mellanox.com \
    --cc=jakub.kicinski@netronome.com \
    --cc=mlxsw@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox