>>>attachment is the scripts,
>>># ip netns exec ns1 ./team1.sh
>>># ping 192.168.11.3
>>>the issue is team0 cannot switch to veth2, even if the veth0 has no carrier.
>>>> This should be definitelly fixed in user part.
>>>now it can disable/enable it in lw_ethtool_event_watch_port_changed()
>>>when receive event from kernel, but at the beginning, the first event from
>>>adding port will not going to team_port_en_option_set, as new_link_up
>>>== common_ppriv->link_up in lw_ethtool_event_watch_port_changed().
>>>maybe it should be fixed there ?
>> Yes please.
>considering this issue only happens when adding ports,
>I found two places to fix it:
>lw_ethtool_port_added() and link_watch_event_watch_port_added()
>I prefer in lw_ethtool_port_added(), as only when using ethtool link_watch it
>has this issue.
That does not look to me good at all.
Looking at the scripts you send me and teamd code, I don't understand
that the problem is. Look at lb_event_watch_port_link_changed:
return teamd_port_check_enable(ctx, tdport, port_up, !port_up);
It enables/disables the port according to the linkup.
pls note the path of calling
now in lw_ethtool_event_watch_port_changed(),
it return earlier when checking:
if (!teamd_link_watch_link_up_differs(common_ppriv, link_up))
lb_event_watch_port_link_changed has no chance to be called at that time.
as we add a UNPLUG port, new_link_up and common_ppriv->link_up
both are false.
is it clear now ?
What is the issue?
>@@ -156,6 +156,9 @@ static int lw_ethtool_port_added(struct teamd_context *ctx,
> teamd_log_err("Failed to register event watch.");
> goto delay_callback_del;
>+ if (!team_is_port_link_up(tdport->team_port))
>+ team_set_port_enabled(ctx->th, tdport->ifindex, false);
> return 0;
>what do you think ?
>I also noticed another issue (not related to this one), at the first time
>port_changed event is triggered, right after port_added event, there
>is always a err log:
> veth2: Failed to find "enabled" option.
>lw_ethtool_event_watch_port_changed -> ...
>teamd_port_check_enable -> teamd_port_enabled
>it's because at that time, no 'enabled' option is set in userspace yet.
>do you think it's also a bug ?
It looks like it. Not sure why this happens. Could you debug a bit more?
team_get_option calls find_option which created a temporary option if
that is not fetched from kernel yet.
yes, but in teamd_port_enabled(), it use "np" instead of "np!"
as the param:
option = team_get_option(ctx->th, "np", "enabled",
which wouldn't create the option.