@@ -1364,10 +1364,6 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port)
13641364 mlxsw_sp_port -> dev = dev ;
13651365 mlxsw_sp_port -> mlxsw_sp = mlxsw_sp ;
13661366 mlxsw_sp_port -> local_port = local_port ;
1367- mlxsw_sp_port -> learning = 1 ;
1368- mlxsw_sp_port -> learning_sync = 1 ;
1369- mlxsw_sp_port -> uc_flood = 1 ;
1370- mlxsw_sp_port -> pvid = 1 ;
13711367 bytes = DIV_ROUND_UP (VLAN_N_VID , BITS_PER_BYTE );
13721368 mlxsw_sp_port -> active_vlans = kzalloc (bytes , GFP_KERNEL );
13731369 if (!mlxsw_sp_port -> active_vlans ) {
@@ -1991,24 +1987,29 @@ static int mlxsw_sp_port_bridge_join(struct mlxsw_sp_port *mlxsw_sp_port)
19911987 */
19921988 err = mlxsw_sp_port_kill_vid (dev , 0 , 1 );
19931989 if (err )
1994- netdev_err ( dev , "Failed to remove VID 1\n" ) ;
1990+ return err ;
19951991
1996- return err ;
1992+ mlxsw_sp_port -> learning = 1 ;
1993+ mlxsw_sp_port -> learning_sync = 1 ;
1994+ mlxsw_sp_port -> uc_flood = 1 ;
1995+ mlxsw_sp_port -> bridged = 1 ;
1996+
1997+ return 0 ;
19971998}
19981999
19992000static int mlxsw_sp_port_bridge_leave (struct mlxsw_sp_port * mlxsw_sp_port )
20002001{
20012002 struct net_device * dev = mlxsw_sp_port -> dev ;
2002- int err ;
2003+
2004+ mlxsw_sp_port -> learning = 0 ;
2005+ mlxsw_sp_port -> learning_sync = 0 ;
2006+ mlxsw_sp_port -> uc_flood = 0 ;
2007+ mlxsw_sp_port -> bridged = 0 ;
20032008
20042009 /* Add implicit VLAN interface in the device, so that untagged
20052010 * packets will be classified to the default vFID.
20062011 */
2007- err = mlxsw_sp_port_add_vid (dev , 0 , 1 );
2008- if (err )
2009- netdev_err (dev , "Failed to add VID 1\n" );
2010-
2011- return err ;
2012+ return mlxsw_sp_port_add_vid (dev , 0 , 1 );
20122013}
20132014
20142015static bool mlxsw_sp_master_bridge_check (struct mlxsw_sp * mlxsw_sp ,
@@ -2358,16 +2359,18 @@ static int mlxsw_sp_netdevice_port_upper_event(struct net_device *dev,
23582359 } else if (netif_is_bridge_master (upper_dev )) {
23592360 if (info -> linking ) {
23602361 err = mlxsw_sp_port_bridge_join (mlxsw_sp_port );
2361- if (err )
2362+ if (err ) {
23622363 netdev_err (dev , "Failed to join bridge\n" );
2364+ return NOTIFY_BAD ;
2365+ }
23632366 mlxsw_sp_master_bridge_inc (mlxsw_sp , upper_dev );
2364- mlxsw_sp_port -> bridged = 1 ;
23652367 } else {
23662368 err = mlxsw_sp_port_bridge_leave (mlxsw_sp_port );
2367- if (err )
2368- netdev_err (dev , "Failed to leave bridge\n" );
2369- mlxsw_sp_port -> bridged = 0 ;
23702369 mlxsw_sp_master_bridge_dec (mlxsw_sp , upper_dev );
2370+ if (err ) {
2371+ netdev_err (dev , "Failed to leave bridge\n" );
2372+ return NOTIFY_BAD ;
2373+ }
23712374 }
23722375 } else if (netif_is_lag_master (upper_dev )) {
23732376 if (info -> linking ) {
0 commit comments