netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Ido Schimmel <idosch@idosch.org>
Cc: netdev@vger.kernel.org, j.vosburgh@gmail.com, vfalico@gmail.com,
	andy@greyhouse.net, jiri@mellanox.com, idosch@mellanox.com,
	davem@davemloft.net, bridge@lists.linux-foundation.org
Subject: Re: [PATCH net-next 7/7] mlxsw: spectrum: Add extack messages for enslave failures
Date: Wed, 4 Oct 2017 08:44:22 -0700	[thread overview]
Message-ID: <2db8450f-aa7a-24e5-603c-bb76c009fad7@gmail.com> (raw)
In-Reply-To: <20171004132403.GA14864@splinter>

On 10/4/17 6:24 AM, Ido Schimmel wrote:
> On Tue, Oct 03, 2017 at 09:58:54PM -0700, David Ahern wrote:
>> mlxsw fails device enslavement for a number of reasons. Use the extack
>> facility to return an error message to the user stating why the enslave
>> is failing.
>>
>> Messages are prefixed with "spectrum" so users know it is a constraint
>> imposed by the hardware driver. For example:
>>     $ ip li add br0.11 link br0 type vlan id 11
>>     $ ip li set swp11 master br0
>>     Error: spectrum: Enslaving a port to a device that already has an upper device is not supported.
>>
>> Signed-off-by: David Ahern <dsahern@gmail.com>
> 
> Great stuff, thanks David!
> 
> Reviewed-by: Ido Schimmel <idosch@mellanox.com>
> Tested-by: Ido Schimmel <idosch@mellanox.com>
> 
> See one small nit below, but I would like to patch
> mlxsw_sp_netdevice_port_vlan_event() as well, so I can take care of it
> then.

ok. Works for me. I was planning to add more error messages to mlxsw;
happy to concede that to you or someone else. For example a bridge
without vlan filtering:

$ ip li add br1 type bridge
$ ip li set swp20 master br1
RTNETLINK answers: Invalid argument


> 
>> ---
>>  drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 46 ++++++++++++++++++++------
>>  1 file changed, 36 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
>> index 3adf237c951a..a6cc00e4e543 100644
>> --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
>> +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
>> @@ -4019,14 +4019,20 @@ static int mlxsw_sp_lag_index_get(struct mlxsw_sp *mlxsw_sp,
>>  static bool
>>  mlxsw_sp_master_lag_check(struct mlxsw_sp *mlxsw_sp,
>>  			  struct net_device *lag_dev,
>> -			  struct netdev_lag_upper_info *lag_upper_info)
>> +			  struct netdev_lag_upper_info *lag_upper_info,
>> +			  struct netlink_ext_ack *extack)
>>  {
>>  	u16 lag_id;
>>  
>> -	if (mlxsw_sp_lag_index_get(mlxsw_sp, lag_dev, &lag_id) != 0)
>> +	if (mlxsw_sp_lag_index_get(mlxsw_sp, lag_dev, &lag_id) != 0) {
>> +		NL_SET_ERR_MSG(extack, "spectrum: Unknown LAG device");
> 
> A more accurate message would be:
> "spectrum: Exceeded number of supported LAG devices"

Right. will update.


> 
>>  		return false;
>> -	if (lag_upper_info->tx_type != NETDEV_LAG_TX_TYPE_HASH)
>> +	}
>> +	if (lag_upper_info->tx_type != NETDEV_LAG_TX_TYPE_HASH) {
>> +		NL_SET_ERR_MSG(extack,
>> +			       "spectrum: LAG device using unsupported Tx type");
>>  		return false;
>> +	}
>>  	return true;
>>  }

      reply	other threads:[~2017-10-04 15:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-04  4:58 [PATCH net-next 0/7] net: Plumb extack error reporting to enslavements David Ahern
2017-10-04  4:58 ` [PATCH net-next 1/7] net: Add extack to netdev_notifier_info David Ahern
2017-10-04  4:58 ` [PATCH net-next 2/7] net: Add extack to ndo_add_slave David Ahern
2017-10-04  4:58 ` [PATCH net-next 3/7] net: Add extack to upper device linking David Ahern
2017-10-04  4:58 ` [PATCH net-next 4/7] net: vrf: Add extack messages for enslave errors David Ahern
2017-10-04  4:58 ` [PATCH net-next 5/7] net: bonding: Add extack messages for some enslave failures David Ahern
2017-10-04  6:38   ` Jiri Pirko
2017-10-04 15:35     ` David Ahern
2017-10-04 18:04       ` Jiri Pirko
2017-10-04 18:06         ` David Ahern
2017-10-04 18:39           ` Jiri Pirko
2017-10-04  4:58 ` [PATCH net-next 6/7] net: bridge: Pass extack to down to netdev_master_upper_dev_link David Ahern
2017-10-04 15:13   ` Stephen Hemminger
2017-10-04 16:16     ` David Ahern
2017-10-04  4:58 ` [PATCH net-next 7/7] mlxsw: spectrum: Add extack messages for enslave failures David Ahern
2017-10-04 13:24   ` Ido Schimmel
2017-10-04 15:44     ` David Ahern [this message]

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=2db8450f-aa7a-24e5-603c-bb76c009fad7@gmail.com \
    --to=dsahern@gmail.com \
    --cc=andy@greyhouse.net \
    --cc=bridge@lists.linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=idosch@idosch.org \
    --cc=idosch@mellanox.com \
    --cc=j.vosburgh@gmail.com \
    --cc=jiri@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=vfalico@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;
as well as URLs for NNTP newsgroup(s).