Just confirmed the issue is not cause by this code. I will give an update
after get
more info.
Sorry to bother you.
Update: This issue was caused by teaming PFs and VFs .
The customer has a topology like
eth0 (PF link that's running LACP)
--> vf0 (VF that use loadbalance mode)
eth1 (physical link that's running LACP)
--> vf1 (VF that use loadbalance mode)
After eth0/vf0 down and up. eth0 enters lacp negotiate mode and not
active yet. But vf0 is up immediately. So vf0 will be active(cause it use
loadbalance mode) and starts sending packets. In the end, these packets
are sent from eth0 as it's PF device.
To avoid vf0 active before eth0 finishing LACP negotiation. The
customer use 'teamnl -p eth0 team0 getoption enabled' to detect
eth0's state and setup vf0 manually. This method works. But I'm not
sure if we have a gentle/auto ways.
Thanks
Hangbin