From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jiri Pirko Subject: Re: [patch net-next 24/26] mlxsw: spectrum: Implement LAG port join/leave Date: Wed, 2 Dec 2015 08:57:00 +0100 Message-ID: <20151202075659.GC2355@nanopsycho.orion> References: <1448977744-17930-1-git-send-email-jiri@resnulli.us> <1448977744-17930-25-git-send-email-jiri@resnulli.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Linux Netdev List , David Miller , Ido Schimmel , Elad Raz , yotamg@mellanox.com, Or Gerlitz To: Or Gerlitz Return-path: Received: from mail-wm0-f42.google.com ([74.125.82.42]:38327 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752479AbbLBH5C (ORCPT ); Wed, 2 Dec 2015 02:57:02 -0500 Received: by wmec201 with SMTP id c201so46194240wme.1 for ; Tue, 01 Dec 2015 23:57:01 -0800 (PST) Content-Disposition: inline In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: Wed, Dec 02, 2015 at 06:47:51AM CET, gerlitz.or@gmail.com wrote: >On Tue, Dec 1, 2015 at 3:49 PM, Jiri Pirko wrote: >> Implement basic procedures for joining/leaving port to/from LAG. That >> includes HW setup of collector, core LAG mapping setup. >> >> Signed-off-by: Jiri Pirko >> --- >> drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 284 +++++++++++++++++++++++-- >> drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 35 ++- >> 2 files changed, 302 insertions(+), 17 deletions(-) >> >> --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c >> +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c > >[...] > >> +static int mlxsw_sp_port_lag_leave(struct mlxsw_sp_port *mlxsw_sp_port, >> + struct net_device *lag_dev) >> +{ >> + struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; >> + struct mlxsw_sp_upper *lag; >> + u16 lag_id = mlxsw_sp_port->lag_id; >> + int err; >> + >> + if (!mlxsw_sp_port->lagged) >> + return 0; >> + lag = mlxsw_sp_lag_get(mlxsw_sp, lag_id); >> + BUG_ON(lag->ref_count == 0); > >is this a must to crash the system here? can't we do something less drastic? This can never happen, unless something is seriously wrong with the system (memory corruption, etc).