[ISSUE] Failed to find "enabled" option.
by Xin Long
I found this err in "loadbalance" and "lacp" runner when adding ports.
It's caused by trying to set "enabled" option in .port_link_changed()
or .port_changed().
When a new port is added, the first 'port changed event' process is
earlier than CMD TEAM_CMD_OPTIONS_GET, in this CMD, all
the options are synchronized from kernel.
It means there's no 'enabled' option yet when calling port_link_changed
in the first 'port changed event' process. In lb_event_watch_port_link_changed
and lacp_event_watch_port_changed, they call teamd_port_check_enable
to set 'enabled' option. this err is triggered.
I'm not sure why teamd_port_check_enable needs to check if
'enabled' option exists. I checked the ab's .port_link_changed(),
it just sets it by calling team_set_port_enabled(), instead of
checking 'enabled' option first.
can we just use team_set_port_enabled to set it directly in
.port(_link)_changed OR improve teamd_port_check_enable
to avoid this err ?
Thanks.
4 years
[PATCH] teamd: add port_hwaddr_changed for lacp runner
by Xin Long
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(a)gmail.com>
---
teamd/teamd_runner_lacp.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
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,
--
2.1.0
5 years, 10 months
[PATCH] teamd: add port_hwaddr_changed for lb runner
by Xin Long
To fix the same issue fixed in commit efaa6ae709bb ("teamd: add
port_hwaddr_changed for ab runner") for lb runner, this patch is
to add .port_hwaddr_changed for lb runner as well.
Signed-off-by: Xin Long <lucien.xin(a)gmail.com>
---
teamd/teamd_runner_loadbalance.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/teamd/teamd_runner_loadbalance.c b/teamd/teamd_runner_loadbalance.c
index a1e2130..b9bfc13 100644
--- a/teamd/teamd_runner_loadbalance.c
+++ b/teamd/teamd_runner_loadbalance.c
@@ -87,8 +87,31 @@ static int lb_event_watch_hwaddr_changed(struct teamd_context *ctx, void *priv)
return 0;
}
+static int lb_event_watch_port_hwaddr_changed(struct teamd_context *ctx,
+ struct teamd_port *tdport,
+ void *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 = team_hwaddr_set(ctx->th, tdport->ifindex, ctx->hwaddr,
+ ctx->hwaddr_len);
+ if (err)
+ teamd_log_err("%s: Failed to set port hardware address.",
+ tdport->ifname);
+
+ return err;
+}
+
static const struct teamd_event_watch_ops lb_port_watch_ops = {
.hwaddr_changed = lb_event_watch_hwaddr_changed,
+ .port_hwaddr_changed = lb_event_watch_port_hwaddr_changed,
.port_added = lb_event_watch_port_added,
.port_removed = lb_event_watch_port_removed,
.port_link_changed = lb_event_watch_port_link_changed,
--
2.1.0
5 years, 10 months