netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: dsa: ksz: Fix port membership
@ 2018-12-07 17:44 Marek Vasut
  2018-12-07 19:37 ` Tristram.Ha
  0 siblings, 1 reply; 12+ messages in thread
From: Marek Vasut @ 2018-12-07 17:44 UTC (permalink / raw)
  To: netdev
  Cc: f.fainelli, vivien.didelot, andrew, Woojung.Huh, UNGLinuxDriver,
	Marek Vasut, Woojung Huh, David S . Miller, Tristram Ha

If two ports are in the same bridge and in forwarding state, the packets
must be able to pass between them in both directions. The current code
only configures this bridge membership for a port newly added to the
bridge, but does not update all the other ports. Thus, ingress packets
on the new port will be forwarded, but ingress packets on other ports
destined for the new port (eg. a reply) will not be forwarded back to
the new port, because they are not configured to do so. This patch fixes
that by updating the membership registers of all ports.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Cc: Woojung Huh <woojung.huh@microchip.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Tristram Ha <Tristram.Ha@microchip.com>
---
 drivers/net/dsa/microchip/ksz9477.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
index 0684657fbf9a9..e24dd14ccde77 100644
--- a/drivers/net/dsa/microchip/ksz9477.c
+++ b/drivers/net/dsa/microchip/ksz9477.c
@@ -396,7 +396,7 @@ static void ksz9477_port_stp_state_set(struct dsa_switch *ds, int port,
 	struct ksz_device *dev = ds->priv;
 	struct ksz_port *p = &dev->ports[port];
 	u8 data;
-	int member = -1;
+	int i, member = -1;
 
 	ksz_pread8(dev, port, P_STP_CTRL, &data);
 	data &= ~(PORT_TX_ENABLE | PORT_RX_ENABLE | PORT_LEARN_DISABLE);
@@ -454,8 +454,8 @@ static void ksz9477_port_stp_state_set(struct dsa_switch *ds, int port,
 		dev->tx_ports &= ~(1 << port);
 
 	/* Port membership may share register with STP state. */
-	if (member >= 0 && member != p->member)
-		ksz9477_cfg_port_member(dev, port, (u8)member);
+	for (i = 0; i < SWITCH_PORT_NUM; i++)
+		ksz9477_cfg_port_member(dev, i, (u8)member);
 
 	/* Check if forwarding needs to be updated. */
 	if (state != BR_STATE_FORWARDING) {
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-12-13  4:20 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-07 17:44 [PATCH] net: dsa: ksz: Fix port membership Marek Vasut
2018-12-07 19:37 ` Tristram.Ha
2018-12-07 19:43   ` Florian Fainelli
2018-12-08  0:01     ` Tristram.Ha
2018-12-07 19:56   ` Marek Vasut
2018-12-08  0:13     ` Tristram.Ha
2018-12-08  4:23       ` Marek Vasut
2018-12-08 11:00         ` Andrew Lunn
2018-12-10 12:43           ` Marek Vasut
2018-12-13  3:51           ` Marek Vasut
2018-12-07 20:05   ` Andrew Lunn
2018-12-08  0:08     ` Tristram.Ha

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).