Skip to content

Commit 54f137c

Browse files
liuhangbinjpirko
authored andcommitted
teamd: lacp: update port state according to partner's sync bit
According to 6.4.15 of IEEE 802.1AX-2014, Figure 6-22, the state that the port is selected moves MUX state from DETACHED to ATTACHED. But ATTACHED state does not mean that the port can send and receive user frames. COLLECTING_DISTRIBUTION state is the state that the port can send and receive user frames. To move MUX state from ATTACHED to COLLECTING_DISTRIBUTION, the partner state should be sync as well as the port selected. In function lacp_port_actor_update(), only INFO_STATE_SYNCHRONIZATION should be set to the actor.state when the port is selected. INFO_STATE_COLLECTING and INFO_STATE_DISTRIBUTING should be set to false with ATTACHED mode and set to true when INFO_STATE_SYNCHRONIZATION of partner.state is set. In function lacp_port_should_be_{enabled, disabled}(), we also need to check the INFO_STATE_SYNCHRONIZATION bit of partner.state. Signed-off-by: Hangbin Liu <[email protected]> Signed-off-by: Jiri Pirko <[email protected]>
1 parent f36c191 commit 54f137c

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

teamd/teamd_runner_lacp.c

+11-5
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,8 @@ static int lacp_port_should_be_enabled(struct lacp_port *lacp_port)
333333
struct lacp *lacp = lacp_port->lacp;
334334

335335
if (lacp_port_selected(lacp_port) &&
336-
lacp_port->agg_lead == lacp->selected_agg_lead)
336+
lacp_port->agg_lead == lacp->selected_agg_lead &&
337+
lacp_port->partner.state & INFO_STATE_SYNCHRONIZATION)
337338
return true;
338339
return false;
339340
}
@@ -343,7 +344,8 @@ static int lacp_port_should_be_disabled(struct lacp_port *lacp_port)
343344
struct lacp *lacp = lacp_port->lacp;
344345

345346
if (!lacp_port_selected(lacp_port) ||
346-
lacp_port->agg_lead != lacp->selected_agg_lead)
347+
lacp_port->agg_lead != lacp->selected_agg_lead ||
348+
!(lacp_port->partner.state & INFO_STATE_SYNCHRONIZATION))
347349
return true;
348350
return false;
349351
}
@@ -914,9 +916,13 @@ static void lacp_port_actor_update(struct lacp_port *lacp_port)
914916
if (lacp_port->lacp->cfg.fast_rate)
915917
state |= INFO_STATE_LACP_TIMEOUT;
916918
if (lacp_port_selected(lacp_port) &&
917-
lacp_port_agg_selected(lacp_port))
918-
state |= INFO_STATE_SYNCHRONIZATION |
919-
INFO_STATE_COLLECTING | INFO_STATE_DISTRIBUTING;
919+
lacp_port_agg_selected(lacp_port)) {
920+
state |= INFO_STATE_SYNCHRONIZATION;
921+
state &= ~(INFO_STATE_COLLECTING | INFO_STATE_DISTRIBUTING);
922+
if (lacp_port->partner.state & INFO_STATE_SYNCHRONIZATION)
923+
state |= INFO_STATE_COLLECTING |
924+
INFO_STATE_DISTRIBUTING;
925+
}
920926
if (lacp_port->state == PORT_STATE_EXPIRED)
921927
state |= INFO_STATE_EXPIRED;
922928
if (lacp_port->state == PORT_STATE_DEFAULTED)

0 commit comments

Comments
 (0)