linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Nir Dotan <nird@mellanox.com>, Jiri Pirko <jiri@mellanox.com>,
	Ido Schimmel <idosch@mellanox.com>,
	"David S . Miller" <davem@davemloft.net>,
	Sasha Levin <sashal@kernel.org>,
	netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 4.19 037/100] mlxsw: spectrum: Set LAG port collector only when active
Date: Fri, 18 Oct 2019 18:04:22 -0400	[thread overview]
Message-ID: <20191018220525.9042-37-sashal@kernel.org> (raw)
In-Reply-To: <20191018220525.9042-1-sashal@kernel.org>

From: Nir Dotan <nird@mellanox.com>

[ Upstream commit 48ebab31d424fbdb8ede8914923bec671a933246 ]

The LAG port collecting (receive) function was mistakenly set when the
port was registered as a LAG member, while it should be set only when
the port collection state is set to true. Set LAG port to collecting
when it is set to distributing, as described in the IEEE link
aggregation standard coupled control mux machine state diagram.

Signed-off-by: Nir Dotan <nird@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 .../net/ethernet/mellanox/mlxsw/spectrum.c    | 62 ++++++++++++++-----
 1 file changed, 45 insertions(+), 17 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index ee126bcf7c350..ccd9aca281b37 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -4410,9 +4410,6 @@ static int mlxsw_sp_port_lag_join(struct mlxsw_sp_port *mlxsw_sp_port,
 	err = mlxsw_sp_lag_col_port_add(mlxsw_sp_port, lag_id, port_index);
 	if (err)
 		goto err_col_port_add;
-	err = mlxsw_sp_lag_col_port_enable(mlxsw_sp_port, lag_id);
-	if (err)
-		goto err_col_port_enable;
 
 	mlxsw_core_lag_mapping_set(mlxsw_sp->core, lag_id, port_index,
 				   mlxsw_sp_port->local_port);
@@ -4427,8 +4424,6 @@ static int mlxsw_sp_port_lag_join(struct mlxsw_sp_port *mlxsw_sp_port,
 
 	return 0;
 
-err_col_port_enable:
-	mlxsw_sp_lag_col_port_remove(mlxsw_sp_port, lag_id);
 err_col_port_add:
 	if (!lag->ref_count)
 		mlxsw_sp_lag_destroy(mlxsw_sp, lag_id);
@@ -4447,7 +4442,6 @@ static void mlxsw_sp_port_lag_leave(struct mlxsw_sp_port *mlxsw_sp_port,
 	lag = mlxsw_sp_lag_get(mlxsw_sp, lag_id);
 	WARN_ON(lag->ref_count == 0);
 
-	mlxsw_sp_lag_col_port_disable(mlxsw_sp_port, lag_id);
 	mlxsw_sp_lag_col_port_remove(mlxsw_sp_port, lag_id);
 
 	/* Any VLANs configured on the port are no longer valid */
@@ -4492,21 +4486,56 @@ static int mlxsw_sp_lag_dist_port_remove(struct mlxsw_sp_port *mlxsw_sp_port,
 	return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sldr), sldr_pl);
 }
 
-static int mlxsw_sp_port_lag_tx_en_set(struct mlxsw_sp_port *mlxsw_sp_port,
-				       bool lag_tx_enabled)
+static int
+mlxsw_sp_port_lag_col_dist_enable(struct mlxsw_sp_port *mlxsw_sp_port)
 {
-	if (lag_tx_enabled)
-		return mlxsw_sp_lag_dist_port_add(mlxsw_sp_port,
-						  mlxsw_sp_port->lag_id);
-	else
-		return mlxsw_sp_lag_dist_port_remove(mlxsw_sp_port,
-						     mlxsw_sp_port->lag_id);
+	int err;
+
+	err = mlxsw_sp_lag_col_port_enable(mlxsw_sp_port,
+					   mlxsw_sp_port->lag_id);
+	if (err)
+		return err;
+
+	err = mlxsw_sp_lag_dist_port_add(mlxsw_sp_port, mlxsw_sp_port->lag_id);
+	if (err)
+		goto err_dist_port_add;
+
+	return 0;
+
+err_dist_port_add:
+	mlxsw_sp_lag_col_port_disable(mlxsw_sp_port, mlxsw_sp_port->lag_id);
+	return err;
+}
+
+static int
+mlxsw_sp_port_lag_col_dist_disable(struct mlxsw_sp_port *mlxsw_sp_port)
+{
+	int err;
+
+	err = mlxsw_sp_lag_dist_port_remove(mlxsw_sp_port,
+					    mlxsw_sp_port->lag_id);
+	if (err)
+		return err;
+
+	err = mlxsw_sp_lag_col_port_disable(mlxsw_sp_port,
+					    mlxsw_sp_port->lag_id);
+	if (err)
+		goto err_col_port_disable;
+
+	return 0;
+
+err_col_port_disable:
+	mlxsw_sp_lag_dist_port_add(mlxsw_sp_port, mlxsw_sp_port->lag_id);
+	return err;
 }
 
 static int mlxsw_sp_port_lag_changed(struct mlxsw_sp_port *mlxsw_sp_port,
 				     struct netdev_lag_lower_state_info *info)
 {
-	return mlxsw_sp_port_lag_tx_en_set(mlxsw_sp_port, info->tx_enabled);
+	if (info->tx_enabled)
+		return mlxsw_sp_port_lag_col_dist_enable(mlxsw_sp_port);
+	else
+		return mlxsw_sp_port_lag_col_dist_disable(mlxsw_sp_port);
 }
 
 static int mlxsw_sp_port_stp_set(struct mlxsw_sp_port *mlxsw_sp_port,
@@ -4668,8 +4697,7 @@ static int mlxsw_sp_netdevice_port_upper_event(struct net_device *lower_dev,
 				err = mlxsw_sp_port_lag_join(mlxsw_sp_port,
 							     upper_dev);
 			} else {
-				mlxsw_sp_port_lag_tx_en_set(mlxsw_sp_port,
-							    false);
+				mlxsw_sp_port_lag_col_dist_disable(mlxsw_sp_port);
 				mlxsw_sp_port_lag_leave(mlxsw_sp_port,
 							upper_dev);
 			}
-- 
2.20.1


  parent reply	other threads:[~2019-10-18 22:21 UTC|newest]

Thread overview: 107+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-18 22:03 [PATCH AUTOSEL 4.19 001/100] wil6210: fix freeing of rx buffers in EDMA mode Sasha Levin
2019-10-18 22:03 ` [PATCH AUTOSEL 4.19 002/100] f2fs: flush quota blocks after turnning it off Sasha Levin
2019-10-18 22:03 ` [PATCH AUTOSEL 4.19 003/100] scsi: lpfc: Fix a duplicate 0711 log message number Sasha Levin
2019-10-18 22:03 ` [PATCH AUTOSEL 4.19 004/100] sc16is7xx: Fix for "Unexpected interrupt: 8" Sasha Levin
2019-10-18 22:03 ` [PATCH AUTOSEL 4.19 005/100] powerpc/powernv: hold device_hotplug_lock when calling memtrace_offline_pages() Sasha Levin
2019-10-18 22:03 ` [PATCH AUTOSEL 4.19 006/100] f2fs: fix to recover inode's i_gc_failures during POR Sasha Levin
2019-10-18 22:03 ` [PATCH AUTOSEL 4.19 007/100] f2fs: fix to recover inode->i_flags of inode block " Sasha Levin
2019-10-18 22:03 ` [PATCH AUTOSEL 4.19 008/100] HID: i2c-hid: add Direkt-Tek DTLAPY133-1 to descriptor override Sasha Levin
2019-10-18 22:03 ` [PATCH AUTOSEL 4.19 009/100] usb: dwc2: fix unbalanced use of external vbus-supply Sasha Levin
2019-10-18 22:03 ` [PATCH AUTOSEL 4.19 010/100] tools/power turbostat: fix goldmont C-state limit decoding Sasha Levin
2019-10-18 22:03 ` [PATCH AUTOSEL 4.19 011/100] x86/cpu: Add Atom Tremont (Jacobsville) Sasha Levin
2019-10-18 22:03 ` [PATCH AUTOSEL 4.19 012/100] drm/msm/dpu: handle failures while initializing displays Sasha Levin
2019-10-18 22:03 ` [PATCH AUTOSEL 4.19 013/100] bcache: fix input overflow to writeback_rate_minimum Sasha Levin
2019-10-18 22:03 ` [PATCH AUTOSEL 4.19 014/100] PCI: Fix Switchtec DMA aliasing quirk dmesg noise Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 015/100] Btrfs: fix deadlock on tree root leaf when finding free extent Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 016/100] netfilter: ipset: Make invalid MAC address checks consistent Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 017/100] HID: i2c-hid: Disable runtime PM for LG touchscreen Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 018/100] HID: i2c-hid: Ignore input report if there's no data present on Elan touchpanels Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 019/100] HID: i2c-hid: Add Odys Winbook 13 to descriptor override Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 020/100] platform/x86: Add the VLV ISP PCI ID to atomisp2_pm Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 021/100] platform/x86: Fix config space access for intel_atomisp2_pm Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 022/100] ath10k: assign 'n_cipher_suites = 11' for WCN3990 to enable WPA3 Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 023/100] clk: boston: unregister clks on failure in clk_boston_setup() Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 024/100] scripts/setlocalversion: Improve -dirty check with git-status --no-optional-locks Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 025/100] staging: mt7621-pinctrl: use pinconf-generic for 'dt_node_to_map' and 'dt_free_map' Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 026/100] HID: Add ASUS T100CHI keyboard dock battery quirks Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 027/100] NFSv4: Ensure that the state manager exits the loop on SIGKILL Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 028/100] HID: steam: fix boot loop with bluetooth firmware Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 029/100] HID: steam: fix deadlock with input devices Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 030/100] samples: bpf: fix: seg fault with NULL pointer arg Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 031/100] usb: dwc3: gadget: early giveback if End Transfer already completed Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 032/100] usb: dwc3: gadget: clear DWC3_EP_TRANSFER_STARTED on cmd complete Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 033/100] ALSA: usb-audio: Add quirk for MOTU MicroBook II Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 034/100] ALSA: usb-audio: Cleanup DSD whitelist Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 035/100] usb: handle warm-reset port requests on hub resume Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 036/100] rtc: pcf8523: set xtal load capacitance from DT Sasha Levin
2019-10-18 22:04 ` Sasha Levin [this message]
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 038/100] net: stmmac: Fix NAPI poll in TX path when in multi-queue Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 039/100] scsi: lpfc: Correct localport timeout duration error Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 040/100] CIFS: Respect SMB2 hdr preamble size in read responses Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 041/100] cifs: add credits from unmatched responses/messages Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 042/100] ALSA: hda/realtek - Apply ALC294 hp init also for S4 resume Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 043/100] media: vimc: Remove unused but set variables Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 044/100] ext4: disallow files with EXT4_JOURNAL_DATA_FL from EXT4_IOC_SWAP_BOOT Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 045/100] exec: load_script: Do not exec truncated interpreter path Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 046/100] net: dsa: mv88e6xxx: Release lock while requesting IRQ Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 047/100] PCI/PME: Fix possible use-after-free on remove Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 048/100] drm/amd/display: fix odm combine pipe reset Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 049/100] power: supply: max14656: fix potential use-after-free Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 050/100] iio: adc: meson_saradc: Fix memory allocation order Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 051/100] iio: fix center temperature of bmc150-accel-core Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 052/100] libsubcmd: Make _FORTIFY_SOURCE defines dependent on the feature Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 053/100] perf tests: Avoid raising SEGV using an obvious NULL dereference Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 054/100] perf map: Fix overlapped map handling Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 055/100] perf script brstackinsn: Fix recovery from LBR/binary mismatch Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 056/100] perf jevents: Fix period for Intel fixed counters Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 057/100] perf tools: Propagate get_cpuid() error Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 058/100] perf annotate: Propagate perf_env__arch() error Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 059/100] perf annotate: Fix the signedness of failure returns Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 060/100] perf annotate: Propagate the symbol__annotate() error return Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 061/100] perf annotate: Return appropriate error code for allocation failures Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 062/100] staging: rtl8188eu: fix null dereference when kzalloc fails Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 063/100] crypto: arm/aes-ce - add dependency on AES library Sasha Levin
2019-10-21  6:08   ` Ard Biesheuvel
2019-10-29  9:19     ` Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 064/100] RDMA/hfi1: Prevent memory leak in sdma_init Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 065/100] RDMA/iwcm: Fix a lock inversion issue Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 066/100] HID: hyperv: Use in-place iterator API in the channel callback Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 067/100] nfs: Fix nfsi->nrequests count error on nfs_inode_remove_request Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 068/100] arm64: ftrace: Ensure synchronisation in PLT setup for Neoverse-N1 #1542419 Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 069/100] tty: serial: owl: Fix the link time qualifier of 'owl_uart_exit()' Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 070/100] tty: n_hdlc: fix build on SPARC Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 071/100] RDMA/cxgb4: Do not dma memory off of the stack Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 072/100] gpio: max77620: Use correct unit for debounce times Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 073/100] fs: cifs: mute -Wunused-const-variable message Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 074/100] serial: mctrl_gpio: Check for NULL pointer Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 075/100] efi/cper: Fix endianness of PCIe class code Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 076/100] efi/x86: Do not clean dummy variable in kexec path Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 077/100] kbuild: fix build error of 'make nsdeps' in clean tree Sasha Levin
2019-10-19  0:13   ` Masahiro Yamada
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 078/100] MIPS: include: Mark __cmpxchg as __always_inline Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 079/100] x86/xen: Return from panic notifier Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 080/100] ocfs2: clear zero in unaligned direct IO Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 081/100] fs: ocfs2: fix possible null-pointer dereferences in ocfs2_xa_prepare_entry() Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 082/100] fs: ocfs2: fix a possible null-pointer dereference in ocfs2_write_end_nolock() Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 083/100] fs: ocfs2: fix a possible null-pointer dereference in ocfs2_info_scan_inode_alloc() Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 084/100] arm64: armv8_deprecated: Checking return value for memory allocation Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 085/100] x86/cpu: Add Comet Lake to the Intel CPU models header Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 086/100] sched/vtime: Fix guest/system mis-accounting on task switch Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 087/100] perf/x86/amd: Change/fix NMI latency mitigation to use a timestamp Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 088/100] drm/amdgpu: fix memory leak Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 089/100] iio: adc: hx711: fix bug in sampling of data Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 090/100] iio: imu: adis16400: release allocated memory on failure Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 091/100] iio: adc: ad799x: fix probe error handling Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 092/100] iio: light: opt3001: fix mutex unlock race Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 093/100] MIPS: include: Mark __xchg as __always_inline Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 094/100] MIPS: fw: sni: Fix out of bounds init of o32 stack Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 095/100] USB: usb-skeleton: fix use-after-free after driver unbind Sasha Levin
2019-10-18 22:22   ` Greg Kroah-Hartman
2019-10-29  9:04     ` Sasha Levin
2019-10-29  9:43       ` Greg Kroah-Hartman
2019-10-29 10:04         ` Johan Hovold
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 096/100] virt: vbox: fix memory leak in hgcm_call_preprocess_linaddr Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 097/100] nbd: fix possible sysfs duplicate warning Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 098/100] NFSv4: Fix leak of clp->cl_acceptor string Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 099/100] s390/uaccess: avoid (false positive) compiler warnings Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 100/100] tracing: Initialize iter->seq after zeroing in tracing_read_pipe() Sasha Levin

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=20191018220525.9042-37-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=davem@davemloft.net \
    --cc=idosch@mellanox.com \
    --cc=jiri@mellanox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nird@mellanox.com \
    --cc=stable@vger.kernel.org \
    /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).