public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Horatiu Vultur <horatiu.vultur@microchip.com>
To: <linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>
Cc: <UNGLinuxDriver@microchip.com>, <davem@davemloft.net>,
	<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<linux@armlinux.org.uk>,
	Horatiu Vultur <horatiu.vultur@microchip.com>
Subject: [PATCH net-next 8/8] net: lan966x: Update PGID when lag ports are changing link status
Date: Sun, 26 Jun 2022 15:04:51 +0200	[thread overview]
Message-ID: <20220626130451.1079933-9-horatiu.vultur@microchip.com> (raw)
In-Reply-To: <20220626130451.1079933-1-horatiu.vultur@microchip.com>

When a port under a bond device is changing it's link status it is
required to recalculate the PGID entries. Otherwise the HW will still
try to transmit frames on the port that is down.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
 .../net/ethernet/microchip/lan966x/lan966x_lag.c | 16 ++++++++++++++++
 .../ethernet/microchip/lan966x/lan966x_main.h    |  3 +++
 .../ethernet/microchip/lan966x/lan966x_port.c    |  6 ++++++
 3 files changed, 25 insertions(+)

diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_lag.c b/drivers/net/ethernet/microchip/lan966x/lan966x_lag.c
index 4ce41a55737c..eec5d6912757 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_lag.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_lag.c
@@ -151,6 +151,22 @@ void lan966x_lag_port_leave(struct lan966x_port *port, struct net_device *bond)
 	lan966x_lag_set_aggr_pgids(lan966x);
 }
 
+void lan966x_lag_port_down(struct lan966x_port *port)
+{
+	port->bond_fix = port->bond;
+	lan966x_lag_port_leave(port, port->bond);
+}
+
+void lan966x_lag_port_up(struct lan966x_port *port)
+{
+	struct lan966x *lan966x = port->lan966x;
+
+	port->bond = port->bond_fix;
+	lan966x_lag_set_port_ids(lan966x);
+	lan966x_update_fwd_mask(lan966x);
+	lan966x_lag_set_aggr_pgids(lan966x);
+}
+
 int lan966x_lag_port_prechangeupper(struct net_device *dev,
 				    struct netdev_notifier_changeupper_info *info)
 {
diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.h b/drivers/net/ethernet/microchip/lan966x/lan966x_main.h
index c1f5ca5d91a4..23264e70fb8a 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.h
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.h
@@ -293,6 +293,7 @@ struct lan966x_port {
 	struct sk_buff_head tx_skbs;
 
 	struct net_device *bond;
+	struct net_device *bond_fix;
 	bool lag_tx_active;
 };
 
@@ -420,6 +421,8 @@ int lan966x_lag_port_join(struct lan966x_port *port,
 			  struct net_device *bond,
 			  struct netlink_ext_ack *extack);
 void lan966x_lag_port_leave(struct lan966x_port *port, struct net_device *bond);
+void lan966x_lag_port_down(struct lan966x_port *port);
+void lan966x_lag_port_up(struct lan966x_port *port);
 int lan966x_lag_port_prechangeupper(struct net_device *dev,
 				    struct netdev_notifier_changeupper_info *info);
 int lan966x_lag_port_changelowerstate(struct net_device *dev,
diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_port.c b/drivers/net/ethernet/microchip/lan966x/lan966x_port.c
index f141644e4372..e99478a443cb 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_port.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_port.c
@@ -274,11 +274,17 @@ static void lan966x_port_link_up(struct lan966x_port *port)
 void lan966x_port_config_down(struct lan966x_port *port)
 {
 	lan966x_port_link_down(port);
+
+	if (port->bond)
+		lan966x_lag_port_down(port);
 }
 
 void lan966x_port_config_up(struct lan966x_port *port)
 {
 	lan966x_port_link_up(port);
+
+	if (port->bond_fix)
+		lan966x_lag_port_up(port);
 }
 
 void lan966x_port_status_get(struct lan966x_port *port,
-- 
2.33.0


      parent reply	other threads:[~2022-06-26 13:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-26 13:04 [PATCH net-next 0/8] net: lan966x: Add lag support Horatiu Vultur
2022-06-26 13:04 ` [PATCH net-next 1/8] net: lan966x: Add reqisters used to configure lag interfaces Horatiu Vultur
2022-06-26 13:04 ` [PATCH net-next 2/8] net: lan966x: Split lan966x_fdb_event_work Horatiu Vultur
2022-06-26 13:04 ` [PATCH net-next 3/8] net: lan966x: Expose lan966x_switchdev_nb and lan966x_switchdev_blocking_nb Horatiu Vultur
2022-06-26 13:04 ` [PATCH net-next 4/8] net: lan966x: Extend lan966x_foreign_bridging_check Horatiu Vultur
2022-06-26 13:04 ` [PATCH net-next 5/8] net: lan966x: Add lag support for lan966x Horatiu Vultur
2022-06-26 14:11   ` Vladimir Oltean
2022-06-27  6:46     ` Horatiu Vultur
2022-06-27  9:40       ` Vladimir Oltean
2022-06-26 13:04 ` [PATCH net-next 6/8] net: lan966x: Extend FDB to support also lag Horatiu Vultur
2022-06-26 13:04 ` [PATCH net-next 7/8] net: lan966x: Extend MAC to support also lag interfaces Horatiu Vultur
2022-06-26 13:04 ` Horatiu Vultur [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=20220626130451.1079933-9-horatiu.vultur@microchip.com \
    --to=horatiu.vultur@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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