teamd/teamd_runner_lacp:PORT_STATE_DEFAULTED use 0x02
diff mbox series

Message ID 20181106121409.37130-1-mengkoon@live.com
State New
Headers show
Series
  • teamd/teamd_runner_lacp:PORT_STATE_DEFAULTED use 0x02
Related show

Commit Message

Meng Koon Lim Nov. 6, 2018, 12:14 p.m. UTC
if new state is PORT_STATE_DEFAULTED, set lacp_port->partner.state
to 0x02

This ensures LACPDU is sent to update the far side when
local port transitions from default to current

Currently, local port moves from default to current without
sending LACPDU until 30sec later. This causes traffic disruption
because far side has not completed negotiation

Using 0x02 also cause LACPDU to be sent every 1 sec as long as
port remains in defaulted state and LACP mode used is "active"

Signed-off-by: Meng Koon Lim <mengkoon@live.com>
---
 teamd/teamd_runner_lacp.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Jiri Pirko Nov. 7, 2018, 11:08 a.m. UTC | #1
Tue, Nov 06, 2018 at 01:14:09PM CET, mengkoon@live.com wrote:
>if new state is PORT_STATE_DEFAULTED, set lacp_port->partner.state
>to 0x02
>
>This ensures LACPDU is sent to update the far side when
>local port transitions from default to current
>
>Currently, local port moves from default to current without
>sending LACPDU until 30sec later. This causes traffic disruption
>because far side has not completed negotiation
>
>Using 0x02 also cause LACPDU to be sent every 1 sec as long as
>port remains in defaulted state and LACP mode used is "active"
>

Please try to re-phrase the subject and the decription in imperative
way. Like you would tell the codebase what do to. Please look at the git
log for inspiration. Thanks!


>Signed-off-by: Meng Koon Lim <mengkoon@live.com>
>---
> teamd/teamd_runner_lacp.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
>diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c
>index 7b8f0a7..555aa06 100644
>--- a/teamd/teamd_runner_lacp.c
>+++ b/teamd/teamd_runner_lacp.c
>@@ -965,7 +965,12 @@ static int lacp_port_set_state(struct lacp_port *lacp_port,
> 	case PORT_STATE_DEFAULTED:
> 		teamd_loop_callback_disable(lacp_port->ctx,
> 					    LACP_TIMEOUT_CB_NAME, lacp_port);
>-		/* fall through */
>+		memset(&lacp_port->partner, 0, sizeof(lacp_port->partner));
>+		lacp_port->partner.state |= INFO_STATE_LACP_TIMEOUT;
>+		err = lacp_port_partner_update(lacp_port);
>+		if (err)
>+			return err;
>+		break;
> 	case PORT_STATE_DISABLED:
> 		memset(&lacp_port->partner, 0, sizeof(lacp_port->partner));
> 		err = lacp_port_partner_update(lacp_port);
>-- 
>2.14.3 (Apple Git-98)
>

Patch
diff mbox series

diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c
index 7b8f0a7..555aa06 100644
--- a/teamd/teamd_runner_lacp.c
+++ b/teamd/teamd_runner_lacp.c
@@ -965,7 +965,12 @@  static int lacp_port_set_state(struct lacp_port *lacp_port,
 	case PORT_STATE_DEFAULTED:
 		teamd_loop_callback_disable(lacp_port->ctx,
 					    LACP_TIMEOUT_CB_NAME, lacp_port);
-		/* fall through */
+		memset(&lacp_port->partner, 0, sizeof(lacp_port->partner));
+		lacp_port->partner.state |= INFO_STATE_LACP_TIMEOUT;
+		err = lacp_port_partner_update(lacp_port);
+		if (err)
+			return err;
+		break;
 	case PORT_STATE_DISABLED:
 		memset(&lacp_port->partner, 0, sizeof(lacp_port->partner));
 		err = lacp_port_partner_update(lacp_port);