diff mbox

teamd: add port_hwaddr_changed for lacp runner

Message ID 861ab5ce75c128ea3688af03b0bd462bd2e695e6.1510029216.git.lucien.xin@gmail.com (mailing list archive)
State Accepted
Headers show

Commit Message

Xin Long Nov. 7, 2017, 4:33 a.m. UTC
To fix the same issue fixed in commit efaa6ae709bb ("teamd: add
port_hwaddr_changed for ab runner") for lacp runner, this patch
is to add .port_hwaddr_changed for lacp runner as well.

Signed-off-by: Xin Long <lucien.xin@gmail.com>

---
 teamd/teamd_runner_lacp.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

-- 
2.1.0

Comments

Jiri Pirko Nov. 7, 2017, 6:29 a.m. UTC | #1
Tue, Nov 07, 2017 at 05:33:36AM CET, lucien.xin@gmail.com wrote:
>To fix the same issue fixed in commit efaa6ae709bb ("teamd: add

>port_hwaddr_changed for ab runner") for lacp runner, this patch

>is to add .port_hwaddr_changed for lacp runner as well.

>

>Signed-off-by: Xin Long <lucien.xin@gmail.com>


Applied. Thanks
diff mbox

Patch

diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c
index 1310f67..7b8f0a7 100644
--- a/teamd/teamd_runner_lacp.c
+++ b/teamd/teamd_runner_lacp.c
@@ -1336,6 +1336,31 @@  static int lacp_event_watch_hwaddr_changed(struct teamd_context *ctx,
 	return 0;
 }
 
+static int lacp_event_watch_port_hwaddr_changed(struct teamd_context *ctx,
+						struct teamd_port *tdport,
+						void *priv)
+{
+	struct lacp_port *lacp_port;
+	struct lacp *lacp = priv;
+	int err;
+
+	if (!teamd_port_present(ctx, tdport))
+		return 0;
+
+	if (!memcmp(team_get_ifinfo_hwaddr(tdport->team_ifinfo),
+		    ctx->hwaddr, ctx->hwaddr_len))
+		return 0;
+
+	err = lacp_port_set_mac(ctx, tdport);
+	if (err)
+		return err;
+
+	lacp_port = lacp_port_get(lacp, tdport);
+	lacp_port_actor_system_update(lacp_port);
+
+	return 0;
+}
+
 static int lacp_event_watch_admin_state_changed(struct teamd_context *ctx,
 					        void *priv)
 {
@@ -1389,6 +1414,7 @@  static int lacp_event_watch_port_changed(struct teamd_context *ctx,
 
 static const struct teamd_event_watch_ops lacp_event_watch_ops = {
 	.hwaddr_changed = lacp_event_watch_hwaddr_changed,
+	.port_hwaddr_changed = lacp_event_watch_port_hwaddr_changed,
 	.port_added = lacp_event_watch_port_added,
 	.port_removed = lacp_event_watch_port_removed,
 	.port_changed = lacp_event_watch_port_changed,