[libteam]: Update libteam to the latest master (#4216)

This commit is contained in:
pavel-shirshov 2020-03-09 16:13:49 -07:00 committed by GitHub
parent 7d0570c517
commit fc91f81dab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 107 additions and 223 deletions

View File

@ -1,6 +1,6 @@
# libteam packages
LIBTEAM_VERSION = 1.28-1
LIBTEAM_VERSION = 1.30-1
export LIBTEAM_VERSION

View File

@ -15,7 +15,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
rm -rf ./libteam
git clone https://github.com/jpirko/libteam.git
pushd ./libteam
git checkout -b teamd -f 8c7614abf5993d92e332a800f244bdebd7c9a2c8
git checkout -b teamd -f c7237377dead39ae4a711297203bacf7edb9fa41
# Apply patch series
stg init
@ -25,7 +25,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
# Obtain debian packaging
git clone https://salsa.debian.org/debian/libteam.git tmp
pushd ./tmp
git checkout -f 7188c361 # v1.28-1
git checkout -f debian/1.30-1
popd
mv tmp/debian libteam/

View File

@ -1,25 +1,25 @@
From 10602c2b1184aa0c6907b5a7f06fcba8a7141148 Mon Sep 17 00:00:00 2001
From: Shuotian Cheng <shuche@microsoft.com>
Date: Mon, 27 Feb 2017 14:21:09 -0800
Subject: [PATCH 1/8] libteam: Temporarily remove redundant debug messages
From fa8c4604e739abde29278b403a1a1d502337c21b Mon Sep 17 00:00:00 2001
From: Pavel Shirshov <pavelsh@microsoft.com>
Date: Tue, 3 Mar 2020 12:47:32 -0800
Subject: [PATCH] libteam: Temporarily remove redundant debug messages
---
teamd/teamd_runner_lacp.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c
index d292d69..7c91aed 100644
index ec01237..2d5a823 100644
--- a/teamd/teamd_runner_lacp.c
+++ b/teamd/teamd_runner_lacp.c
@@ -929,8 +929,6 @@ static void lacp_port_actor_update(struct lacp_port *lacp_port)
state |= INFO_STATE_DEFAULTED;
if (teamd_port_count(lacp_port->ctx) > 0)
state |= INFO_STATE_AGGREGATION;
- teamd_log_dbg("%s: lacp info state: 0x%02X.", lacp_port->tdport->ifname,
- state);
- teamd_log_dbg(lacp_port->ctx, "%s: lacp info state: 0x%02X.",
- lacp_port->tdport->ifname, state);
lacp_port->actor.state = state;
}
--
2.7.4
2.17.1.windows.2

View File

@ -1,11 +1,9 @@
From 0ce56490a44191c4b17a75cc21aa6a5bdc535f1d Mon Sep 17 00:00:00 2001
From: yorke <yorke.yuan@asterfusion.com>
Date: Mon, 3 Jun 2019 11:58:19 +0800
Subject: [PATCH 2/8] [teamd] lacp runner will send lacp update right after it
received SIGINT signal From: Pavel Shirshov <pavelsh@microsoft.com>
Date: Wed, 20 Sep 2017 00:34:07 +0000
From 9e697b0c9fbd01f024acfea8aa25334816425c2b Mon Sep 17 00:00:00 2001
From: Pavel Shirshov <pavelsh@microsoft.com>
Date: Tue, 3 Mar 2020 12:50:23 -0800
Subject: [PATCH] [teamd] lacp runner will send lacp update right after it
received SIGINT signal
Signed-off-by: yorke <yorke.yuan@asterfusion.com>
---
teamd/teamd.c | 1 +
teamd/teamd.h | 3 +++
@ -14,7 +12,7 @@ Signed-off-by: yorke <yorke.yuan@asterfusion.com>
4 files changed, 28 insertions(+)
diff --git a/teamd/teamd.c b/teamd/teamd.c
index 6c47312..58d4fc8 100644
index e035ac5..dc46a62 100644
--- a/teamd/teamd.c
+++ b/teamd/teamd.c
@@ -392,6 +392,7 @@ static int teamd_run_loop_run(struct teamd_context *ctx)
@ -26,7 +24,7 @@ index 6c47312..58d4fc8 100644
if (err)
return err;
diff --git a/teamd/teamd.h b/teamd/teamd.h
index 01bd022..e71a5dc 100644
index f94c918..01ebc84 100644
--- a/teamd/teamd.h
+++ b/teamd/teamd.h
@@ -193,11 +193,14 @@ struct teamd_event_watch_ops {
@ -69,7 +67,7 @@ index 65aa46a..221803e 100644
struct teamd_port *tdport)
{
diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c
index 7c91aed..4dbd015 100644
index 2d5a823..7592b01 100644
--- a/teamd/teamd_runner_lacp.c
+++ b/teamd/teamd_runner_lacp.c
@@ -1421,6 +1421,16 @@ static int lacp_event_watch_port_changed(struct teamd_context *ctx,
@ -98,5 +96,5 @@ index 7c91aed..4dbd015 100644
static int lacp_carrier_init(struct teamd_context *ctx, struct lacp *lacp)
--
2.7.4
2.17.1.windows.2

View File

@ -1,16 +1,14 @@
commit f475746f56602a40861b8d94eac5f0979c4703f3
Author: yorke <yorke.yuan@asterfusion.com>
Date: Mon Jun 3 12:02:36 2019 +0800
From 4696acb51172dbe486d175073bdce8c94817f422 Mon Sep 17 00:00:00 2001
From: Pavel Shirshov <pavelsh@microsoft.com>
Date: Tue, 3 Mar 2020 12:52:28 -0800
Subject: [PATCH] [libteam] Add fallback support for single-member-port LAG
From 9b40af58575a89d06be51cfbb5a2265a59826110 Mon Sep 17 00:00:00 2001
Subject: [PATCH 3/8] [libteam] Add fallback support for single-member-port LAG
From: Haiyang Zheng <haiyang.z@alibaba-inc.com> Date: Fri, 15 Dec
2017 21:07:53 -0800
Signed-off-by: yorke <yorke.yuan@asterfusion.com>
---
teamd/teamd_runner_lacp.c | 48 +++++++++++++++++++++++++++++++++++----
1 file changed, 44 insertions(+), 4 deletions(-)
diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c
index 4dbd015..f8a9e16 100644
index 7592b01..2062bf2 100644
--- a/teamd/teamd_runner_lacp.c
+++ b/teamd/teamd_runner_lacp.c
@@ -138,6 +138,8 @@ struct lacp {
@ -24,12 +22,12 @@ index 4dbd015..f8a9e16 100644
enum lacp_agg_select_policy agg_select_policy;
@@ -272,6 +274,11 @@ static int lacp_load_config(struct teamd_context *ctx, struct lacp *lacp)
lacp->cfg.fast_rate = LACP_CFG_DFLT_FAST_RATE;
teamd_log_dbg("Using fast_rate \"%d\".", lacp->cfg.fast_rate);
teamd_log_dbg(ctx, "Using fast_rate \"%d\".", lacp->cfg.fast_rate);
+ err = teamd_config_bool_get(ctx, &lacp->cfg.fallback, "$.runner.fallback");
+ if (err)
+ lacp->cfg.fallback = LACP_CFG_DFLT_FALLBACK;
+ teamd_log_dbg("Using fallback \"%d\".", lacp->cfg.fallback);
+ teamd_log_dbg(ctx, "Using fallback \"%d\".", lacp->cfg.fallback);
+
err = teamd_config_int_get(ctx, &tmp, "$.runner.min_ports");
if (err) {
@ -45,7 +43,7 @@ index 4dbd015..f8a9e16 100644
+ */
+static bool is_lacp_fallback_eligible(struct lacp_port *lacp_port)
+{
+ teamd_log_dbg("%s fallback eligible state \"%d \" cfg \"%d\".",
+ teamd_log_dbg(lacp_port->ctx, "%s fallback eligible state \"%d \" cfg \"%d\".",
+ lacp_port->tdport->ifname, lacp_port->state,
+ lacp_port->lacp->cfg.fallback);
+ return lacp_port->state == PORT_STATE_DEFAULTED &&
@ -107,15 +105,18 @@ index 4dbd015..f8a9e16 100644
static int lacp_state_select_policy_get(struct teamd_context *ctx,
struct team_state_gsc *gsc,
void *priv)
@@ -1529,6 +1564,11 @@ static const struct teamd_state_val lacp_state_vals[] = {
@@ -1528,6 +1563,11 @@ static const struct teamd_state_val lacp_state_vals[] = {
.type = TEAMD_STATE_ITEM_TYPE_BOOL,
.getter = lacp_state_fast_rate_get,
},
{
+ {
+ .subpath = "fallback",
+ .type = TEAMD_STATE_ITEM_TYPE_BOOL,
+ .getter = lacp_state_fallback_get,
+ },
+ {
{
.subpath = "select_policy",
.type = TEAMD_STATE_ITEM_TYPE_STRING,
.getter = lacp_state_select_policy_get,
--
2.17.1.windows.2

View File

@ -1,17 +1,14 @@
From e18cbe5a6c76366923a8ace830c89056a1542745 Mon Sep 17 00:00:00 2001
From: yorke <yorke.yuan@asterfusion.com>
Date: Mon, 3 Jun 2019 12:06:00 +0800
Subject: [PATCH 4/8] Skip setting the same hwaddr to lag port to avoid
disrupting From: Jipan Yang <jipan.yang@alibaba-inc.com> Date: Sun,
24 Feb 2019 00:04:15 -0800
From 09af7e3106720c871cdbadff9f661685aa1bdb16 Mon Sep 17 00:00:00 2001
From: Pavel Shirshov <pavelsh@microsoft.com>
Date: Tue, 3 Mar 2020 12:54:09 -0800
Subject: [PATCH] Skip setting the same hwaddr to lag port to avoid disrupting
Signed-off-by: yorke <yorke.yuan@asterfusion.com>
---
teamd/teamd.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/teamd/teamd.c b/teamd/teamd.c
index 58d4fc8..9dc85b5 100644
index dc46a62..bf42347 100644
--- a/teamd/teamd.c
+++ b/teamd/teamd.c
@@ -834,7 +834,15 @@ static int teamd_set_hwaddr(struct teamd_context *ctx)
@ -22,7 +19,7 @@ index 58d4fc8..9dc85b5 100644
+
+ if(!memcmp(hwaddr, ctx->hwaddr, hwaddr_len)) {
+ err = 0;
+ teamd_log_dbg("Skip setting same hwaddr string: \"%s\".", hwaddr_str);
+ teamd_log_dbg(ctx, "Skip setting same hwaddr string: \"%s\".", hwaddr_str);
+ }
+ else{
+ err = team_hwaddr_set(ctx->th, ctx->ifindex, hwaddr, hwaddr_len);
@ -32,5 +29,5 @@ index 58d4fc8..9dc85b5 100644
ctx->hwaddr_explicit = true;
free_hwaddr:
--
2.7.4
2.17.1.windows.2

View File

@ -1,11 +1,8 @@
From 39e5b0a15bf276dffa6b8c61594ee945248a4e27 Mon Sep 17 00:00:00 2001
From: yorke <yorke.yuan@asterfusion.com>
Date: Mon, 3 Jun 2019 12:32:33 +0800
Subject: [PATCH 5/8] Increase default buffer size from 98304 to 983040
From: Pavel Shirshov <pavelsh@microsoft.com>
https://github.com/Azure/sonic-buildimage/pull/2822
From fcb9932bdb9212e9b18302de4ffb4d64003e93ab Mon Sep 17 00:00:00 2001
From: Pavel Shirshov <pavelsh@microsoft.com>
Date: Tue, 3 Mar 2020 12:55:50 -0800
Subject: [PATCH] Increase default buffer size from 98304 to 983040
Signed-off-by: yorke <yorke.yuan@asterfusion.com>
---
libteam/libteam.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
@ -27,5 +24,5 @@ index 9c9c93a..2cc80ca 100644
/**
* @param th libteam library context
--
2.7.4
2.17.1.windows.2

View File

@ -1,20 +1,18 @@
From f1eec95dd0475591897a781eba15d8d8ce370a6a Mon Sep 17 00:00:00 2001
From: yorke <yorke.yuan@asterfusion.com>
Date: Mon, 3 Jun 2019 13:21:07 +0800
Subject: [PATCH 6/8] [teamd]: Administratively shutdown port channel has
member ports in deselected state and traffic is not forwarded From:
phanindra-tv https://github.com/Azure/sonic-buildimage/pull/2882
From b188ed48f9ea6873a2c9263d5e036a3634c0f4ba Mon Sep 17 00:00:00 2001
From: Pavel Shirshov <pavelsh@microsoft.com>
Date: Tue, 3 Mar 2020 12:59:09 -0800
Subject: [PATCH] [teamd]: Administratively shutdown port channel has member
ports in deselected state and traffic is not forwarded
Signed-off-by: yorke <yorke.yuan@asterfusion.com>
---
teamd/teamd_runner_lacp.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c
index 9836824..7bf3700 100644
index 2062bf2..fa732ba 100644
--- a/teamd/teamd_runner_lacp.c
+++ b/teamd/teamd_runner_lacp.c
@@ -1101,12 +1101,17 @@ static int lacpdu_recv(struct lacp_port *lacp_port)
@@ -1103,12 +1103,17 @@ static int lacpdu_recv(struct lacp_port *lacp_port)
struct lacpdu lacpdu;
struct sockaddr_ll ll_from;
int err;
@ -33,5 +31,5 @@ index 9836824..7bf3700 100644
return 0;
--
2.7.4
2.17.1.windows.2

View File

@ -1,20 +1,17 @@
From b82da0dc94ca34b039396328a8c2fcb61aa73c0f Mon Sep 17 00:00:00 2001
From: yorke <yorke.yuan@asterfusion.com>
Date: Mon, 3 Jun 2019 13:27:26 +0800
Subject: [PATCH 7/8] Send LACP PDU immediately if our state changed From:
Pavel Shirshov <pavelsh@microsoft.com> Date: Wed, 29 May 2019 19:15:20
+0000
From 780cc967a5544d3ab6f43cba4076b5e0dbb48395 Mon Sep 17 00:00:00 2001
From: Pavel Shirshov <pavelsh@microsoft.com>
Date: Tue, 3 Mar 2020 13:01:14 -0800
Subject: [PATCH] Send LACP PDU immediately if our state changed
Signed-off-by: yorke <yorke.yuan@asterfusion.com>
---
teamd/teamd_runner_lacp.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c
index 7bf3700..4016b15 100644
index fa732ba..55abe88 100644
--- a/teamd/teamd_runner_lacp.c
+++ b/teamd/teamd_runner_lacp.c
@@ -1017,8 +1017,7 @@ static int lacp_port_set_state(struct lacp_port *lacp_port,
@@ -1019,8 +1019,7 @@ static int lacp_port_set_state(struct lacp_port *lacp_port,
return err;
lacp_port_actor_update(lacp_port);
@ -24,7 +21,7 @@ index 7bf3700..4016b15 100644
return lacpdu_send(lacp_port);
}
@@ -1136,9 +1135,10 @@ static int lacpdu_recv(struct lacp_port *lacp_port)
@@ -1138,9 +1137,10 @@ static int lacpdu_recv(struct lacp_port *lacp_port)
if (err)
return err;
@ -38,5 +35,5 @@ index 7bf3700..4016b15 100644
err = lacpdu_send(lacp_port);
if (err)
--
2.7.4
2.17.1.windows.2

View File

@ -1,7 +1,7 @@
From 113d482704198685fba09cd2597fd93ca9d297c5 Mon Sep 17 00:00:00 2001
From a4ab4de68134f6425f704a2ddcda33a4930645de Mon Sep 17 00:00:00 2001
From: Pavel Shirshov <pavelsh@microsoft.com>
Date: Tue, 1 Oct 2019 09:23:23 -0700
Subject: [PATCH 1/1] [libteam]: Reimplement Warm-Reboot procedure
Date: Tue, 3 Mar 2020 13:04:57 -0800
Subject: [PATCH] [libteam]: Reimplement Warm-Reboot procedure'
---
libteam/ifinfo.c | 6 +-
@ -35,7 +35,7 @@ index 46d56a2..b86d34c 100644
}
}
diff --git a/teamd/teamd.c b/teamd/teamd.c
index 9dc85b5..17221a9 100644
index bf42347..221d71d 100644
--- a/teamd/teamd.c
+++ b/teamd/teamd.c
@@ -117,7 +117,9 @@ static void print_help(const struct teamd_context *ctx) {
@ -139,7 +139,7 @@ index 9dc85b5..17221a9 100644
}
return 0;
}
@@ -1531,7 +1574,7 @@ static int teamd_start(struct teamd_context *ctx, enum teamd_exit_code *p_ret)
@@ -1533,7 +1576,7 @@ static int teamd_start(struct teamd_context *ctx, enum teamd_exit_code *p_ret)
return -errno;
}
@ -149,7 +149,7 @@ index 9dc85b5..17221a9 100644
daemon_retval_send(errno);
err = -errno;
diff --git a/teamd/teamd.h b/teamd/teamd.h
index e71a5dc..418214d 100644
index 01ebc84..701a6a4 100644
--- a/teamd/teamd.h
+++ b/teamd/teamd.h
@@ -126,6 +126,9 @@ struct teamd_context {
@ -203,7 +203,7 @@ index 221803e..bd4dcc1 100644
struct teamd_port *tdport)
{
diff --git a/teamd/teamd_per_port.c b/teamd/teamd_per_port.c
index f98a90d..a87e809 100644
index 166da57..03f8d63 100644
--- a/teamd/teamd_per_port.c
+++ b/teamd/teamd_per_port.c
@@ -350,6 +350,12 @@ static int teamd_port_remove(struct teamd_context *ctx,
@ -211,16 +211,16 @@ index f98a90d..a87e809 100644
int err;
+ if (ctx->keep_ports) {
+ teamd_log_dbg("%s: Keeping port (found ifindex \"%d\").",
+ teamd_log_dbg(ctx, "%s: Keeping port (found ifindex \"%d\").",
+ tdport->ifname, tdport->ifindex);
+ return 0;
+ }
+
teamd_log_dbg("%s: Removing port (found ifindex \"%d\").",
teamd_log_dbg(ctx, "%s: Removing port (found ifindex \"%d\").",
tdport->ifname, tdport->ifindex);
err = team_port_remove(ctx->th, tdport->ifindex);
diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c
index 4016b15..81be5b7 100644
index 55abe88..f225fb2 100644
--- a/teamd/teamd_runner_lacp.c
+++ b/teamd/teamd_runner_lacp.c
@@ -31,6 +31,7 @@
@ -345,7 +345,7 @@ index 4016b15..81be5b7 100644
+ char filename[PATH_MAX];
+ int err, nitems;
+
+ teamd_log_dbg("WR-mode. function lacpdu_read(): %s", lacp_port->tdport->ifname);
+ teamd_log_dbg(lacp_port->ctx, "WR-mode. function lacpdu_read(): %s", lacp_port->tdport->ifname);
+
+ generate_path(lacp_port->ctx, filename, lacp_port->tdport->ifname);
+
@ -423,7 +423,7 @@ index 4016b15..81be5b7 100644
+ FILE *fp;
+ int data1, data2, i, err;
+
+ teamd_log_dbg("WR-mode. function lacp_state_load()");
+ teamd_log_dbg(ctx, "WR-mode. function lacp_state_load()");
+
+ generate_path(ctx, filename, ctx->team_devname);
+
@ -473,7 +473,7 @@ index 4016b15..81be5b7 100644
static struct lacp_port *lacp_port_get(struct lacp *lacp,
struct teamd_port *tdport)
{
@@ -486,20 +697,95 @@ static int lacp_set_carrier(struct lacp *lacp, bool carrier_up)
@@ -488,20 +699,95 @@ static int lacp_set_carrier(struct lacp *lacp, bool carrier_up)
return 0;
}
@ -489,7 +489,7 @@ index 4016b15..81be5b7 100644
int err;
+ if (lacp->ctx->warm_start_mode) {
+ teamd_log_dbg("WR-mode. function lacp_update_carrier()");
+ teamd_log_dbg(lacp->ctx, "WR-mode. function lacp_update_carrier()");
+ }
+
ports_enabled = 0;
@ -561,7 +561,7 @@ index 4016b15..81be5b7 100644
+ }
+
+ if (ports_enabled >= lacp->cfg.min_ports) {
+ teamd_log_dbg("Enable carrier. Number of enabled ports %d >= configured min_ports %d",
+ teamd_log_dbg(lacp->ctx, "Enable carrier. Number of enabled ports %d >= configured min_ports %d",
+ ports_enabled, lacp->cfg.min_ports);
+ return lacp_set_carrier(lacp, true);
+ }
@ -572,7 +572,7 @@ index 4016b15..81be5b7 100644
}
return lacp_set_carrier(lacp, false);
@@ -919,6 +1205,18 @@ static void lacp_port_actor_system_update(struct lacp_port *lacp_port)
@@ -921,6 +1207,18 @@ static void lacp_port_actor_system_update(struct lacp_port *lacp_port)
memcpy(actor->system, lacp_port->ctx->hwaddr, ETH_ALEN);
}
@ -591,7 +591,7 @@ index 4016b15..81be5b7 100644
static void lacp_port_actor_init(struct lacp_port *lacp_port)
{
struct lacpdu_info *actor = &lacp_port->actor;
@@ -926,7 +1224,7 @@ static void lacp_port_actor_init(struct lacp_port *lacp_port)
@@ -928,7 +1226,7 @@ static void lacp_port_actor_init(struct lacp_port *lacp_port)
actor->system_priority = htons(lacp_port->lacp->cfg.sys_prio);
actor->key = htons(lacp_port->cfg.lacp_key);
actor->port_priority = htons(lacp_port->cfg.lacp_prio);
@ -600,7 +600,7 @@ index 4016b15..81be5b7 100644
lacp_port_actor_system_update(lacp_port);
}
@@ -1006,6 +1304,13 @@ static int lacp_port_set_state(struct lacp_port *lacp_port,
@@ -1008,6 +1306,13 @@ static int lacp_port_set_state(struct lacp_port *lacp_port,
break;
}
@ -614,7 +614,7 @@ index 4016b15..81be5b7 100644
teamd_log_info("%s: Changed port state: \"%s\" -> \"%s\"",
lacp_port->tdport->ifname,
lacp_port_state_name[lacp_port->state],
@@ -1095,34 +1400,23 @@ static int lacpdu_send(struct lacp_port *lacp_port)
@@ -1097,34 +1402,23 @@ static int lacpdu_send(struct lacp_port *lacp_port)
return err;
}
@ -657,7 +657,7 @@ index 4016b15..81be5b7 100644
err = lacp_port_partner_update(lacp_port);
if (err)
return err;
@@ -1138,21 +1432,56 @@ static int lacpdu_recv(struct lacp_port *lacp_port)
@@ -1140,21 +1434,56 @@ static int lacpdu_recv(struct lacp_port *lacp_port)
lacp_port_actor_update(lacp_port);
/* Check if the other side has correct info about us */
@ -717,16 +717,16 @@ index 4016b15..81be5b7 100644
static int lacp_callback_timeout(struct teamd_context *ctx, int events,
void *priv)
{
@@ -1258,6 +1587,8 @@ static int lacp_port_added(struct teamd_context *ctx,
@@ -1260,6 +1589,8 @@ static int lacp_port_added(struct teamd_context *ctx,
struct lacp *lacp = creator_priv;
int err;
+ teamd_log_dbg("function lacp_port_added(): %s", tdport->ifname);
+ teamd_log_dbg(ctx, "function lacp_port_added(): %s", tdport->ifname);
+
lacp_port->ctx = ctx;
lacp_port->tdport = tdport;
lacp_port->lacp = lacp;
@@ -1304,6 +1635,13 @@ static int lacp_port_added(struct teamd_context *ctx,
@@ -1306,6 +1637,13 @@ static int lacp_port_added(struct teamd_context *ctx,
goto periodic_callback_del;
}
@ -740,12 +740,12 @@ index 4016b15..81be5b7 100644
/* Newly added ports are disabled */
err = team_set_port_enabled(ctx->th, tdport->ifindex, false);
if (err) {
@@ -1341,7 +1679,13 @@ static void lacp_port_removed(struct teamd_context *ctx,
@@ -1343,7 +1681,13 @@ static void lacp_port_removed(struct teamd_context *ctx,
{
struct lacp_port *lacp_port = priv;
- lacp_port_set_state(lacp_port, PORT_STATE_DISABLED);
+ teamd_log_dbg("function lacp_port_removed(): %s", tdport->ifname);
+ teamd_log_dbg(lacp_port->ctx, "function lacp_port_removed(): %s", tdport->ifname);
+
+ if (!lacp_port->ctx->keep_ports) {
+ /* Don't transition into DISABLED state,
@ -755,7 +755,7 @@ index 4016b15..81be5b7 100644
teamd_loop_callback_del(ctx, LACP_TIMEOUT_CB_NAME, lacp_port);
teamd_loop_callback_del(ctx, LACP_PERIODIC_CB_NAME, lacp_port);
teamd_loop_callback_del(ctx, LACP_SOCKET_CB_NAME, lacp_port);
@@ -1449,16 +1793,51 @@ static int lacp_event_watch_port_changed(struct teamd_context *ctx,
@@ -1451,16 +1795,51 @@ static int lacp_event_watch_port_changed(struct teamd_context *ctx,
return lacp_port_link_update(lacp_port);
}
@ -810,7 +810,7 @@ index 4016b15..81be5b7 100644
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,
@@ -1467,21 +1846,35 @@ static const struct teamd_event_watch_ops lacp_event_watch_ops = {
@@ -1469,21 +1848,35 @@ static const struct teamd_event_watch_ops lacp_event_watch_ops = {
.port_changed = lacp_event_watch_port_changed,
.admin_state_changed = lacp_event_watch_admin_state_changed,
.refresh = lacp_event_watch_refresh,
@ -826,7 +826,7 @@ index 4016b15..81be5b7 100644
+ lacp->carrier_up = false;
+
+ if (ctx->warm_start_mode) {
+ teamd_log_dbg("WR-mode. function lacp_carrier_init()");
+ teamd_log_dbg(ctx, "WR-mode. function lacp_carrier_init()");
+
+ /* Disable WR start mode if LAG interface was down */
+ if (lacp->wr.carrier_up) {
@ -851,7 +851,7 @@ index 4016b15..81be5b7 100644
return 0;
}
@@ -1949,6 +2342,12 @@ static int lacp_init(struct teamd_context *ctx, void *priv)
@@ -1951,6 +2344,12 @@ static int lacp_init(struct teamd_context *ctx, void *priv)
}
lacp->ctx = ctx;
@ -864,7 +864,7 @@ index 4016b15..81be5b7 100644
err = teamd_hash_func_set(ctx);
if (err)
return err;
@@ -1990,10 +2389,13 @@ static void lacp_fini(struct teamd_context *ctx, void *priv)
@@ -1992,10 +2391,13 @@ static void lacp_fini(struct teamd_context *ctx, void *priv)
{
struct lacp *lacp = priv;

View File

@ -1,6 +1,6 @@
From 9a27e9b85afbbf6235e61c2426481e49a2139219 Mon Sep 17 00:00:00 2001
From: Shu0T1an ChenG <shuche@microsoft.com>
Date: Tue, 15 Jan 2019 12:23:02 -0800
From a678d9087b05aaf6947e15f0cc9a93ace299466f Mon Sep 17 00:00:00 2001
From: Pavel Shirshov <pavelsh@microsoft.com>
Date: Tue, 3 Mar 2020 13:14:13 -0800
Subject: [PATCH] Fix ifinfo_link_with_port race condition with newlink
The race condition could happen like this:
@ -18,17 +18,15 @@ to be added into the team handler's port list.
This fix adds a condition to check if ifinfo_link_with_port is linking ifinfo
to a port or to the team interface itself. If it is a port, ifinfo_find_create
function is used to fix the race condition.
Signed-off-by: Shu0T1an ChenG <shuche@microsoft.com>
---
libteam/ifinfo.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libteam/ifinfo.c b/libteam/ifinfo.c
index 44de4ca..444e0cd 100644
index b86d34c..e48193e 100644
--- a/libteam/ifinfo.c
+++ b/libteam/ifinfo.c
@@ -429,7 +429,10 @@ int ifinfo_link_with_port(struct team_handle *th, uint32_t ifindex,
@@ -451,7 +451,10 @@ int ifinfo_link_with_port(struct team_handle *th, uint32_t ifindex,
{
struct team_ifinfo *ifinfo;
@ -41,5 +39,5 @@ index 44de4ca..444e0cd 100644
return -ENOENT;
if (ifinfo->linked)
--
2.1.4
2.17.1.windows.2

View File

@ -1,6 +1,6 @@
From 038bed6fe3970dc829dbf9a282f7bea7198e7826 Mon Sep 17 00:00:00 2001
From: Pavel Shirshov <pavelsh@microsoft.com.com>
Date: Wed, 28 Aug 2019 16:39:35 -0700
From e6cd756eac31e3818afb32662469ddf7797c71df Mon Sep 17 00:00:00 2001
From: Pavel Shirshov <pavelsh@microsoft.com>
Date: Tue, 3 Mar 2020 13:19:28 -0800
Subject: [PATCH] When read of timerfd returned 0, don't consider this an error
Just skip this event.
@ -9,7 +9,7 @@ Just skip this event.
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/teamd/teamd.c b/teamd/teamd.c
index 96794e8..a5ce745 100644
index 221d71d..530302b 100644
--- a/teamd/teamd.c
+++ b/teamd/teamd.c
@@ -285,6 +285,10 @@ static int handle_period_fd(int fd)
@ -35,5 +35,5 @@ index 96794e8..a5ce745 100644
}
err = lcb->func(ctx, events, lcb->priv);
--
2.7.4
2.17.1.windows.2

View File

@ -1,101 +0,0 @@
From c0eb9e4bfe1c6a0e77f02b1459d91498c1a3dcff Mon Sep 17 00:00:00 2001
From: Pavel Shirshov <pavelsh@microsoft.com>
Date: Tue, 4 Feb 2020 09:39:08 -0800
Subject: [PATCH 1/1] teamd: fix possible race in master ifname callback
---
teamd/teamd.h | 2 ++
teamd/teamd_link_watch.c | 13 ++++++++++---
teamd/teamd_per_port.c | 24 +++++++++++++++++++-----
3 files changed, 31 insertions(+), 8 deletions(-)
diff --git a/teamd/teamd.h b/teamd/teamd.h
index 418214d..1ce120e 100644
--- a/teamd/teamd.h
+++ b/teamd/teamd.h
@@ -334,6 +334,8 @@ int teamd_port_remove_all(struct teamd_context *ctx);
void teamd_port_obj_remove_all(struct teamd_context *ctx);
int teamd_port_enabled(struct teamd_context *ctx, struct teamd_port *tdport,
bool *enabled);
+int teamd_port_enabled_check(struct teamd_context *ctx,
+ struct teamd_port *tdport, bool *enabled);
int teamd_port_prio(struct teamd_context *ctx, struct teamd_port *tdport);
int teamd_port_check_enable(struct teamd_context *ctx,
struct teamd_port *tdport,
diff --git a/teamd/teamd_link_watch.c b/teamd/teamd_link_watch.c
index 62f8267..e4b3d3f 100644
--- a/teamd/teamd_link_watch.c
+++ b/teamd/teamd_link_watch.c
@@ -423,9 +423,16 @@ static int link_watch_refresh_forced_send(struct teamd_context *ctx)
int err;
teamd_for_each_tdport(tdport, ctx) {
- err = teamd_port_enabled(ctx, tdport, &port_enabled);
- if (err)
- return err;
+ err = teamd_port_enabled_check(ctx, tdport, &port_enabled);
+ if (err) {
+ /* Looks like the options are not ready for this port.
+ * This can happen when called from
+ * link_watch_port_master_ifindex_changed(). Skip this
+ * for now, let it be handled by future call of
+ * link_watch_enabled_option_changed().
+ */
+ continue;
+ }
__set_forced_send_for_port(tdport, port_enabled);
if (port_enabled)
enabled_port_count++;
diff --git a/teamd/teamd_per_port.c b/teamd/teamd_per_port.c
index a87e809..d10cfb2 100644
--- a/teamd/teamd_per_port.c
+++ b/teamd/teamd_per_port.c
@@ -395,19 +395,21 @@ int teamd_port_remove_ifname(struct teamd_context *ctx, const char *port_name)
return teamd_port_remove(ctx, tdport);
}
-int teamd_port_enabled(struct teamd_context *ctx, struct teamd_port *tdport,
- bool *enabled)
+int __teamd_port_enabled(struct teamd_context *ctx, struct teamd_port *tdport,
+ bool *enabled, bool may_fail)
{
struct team_option *option;
option = team_get_option(ctx->th, "np", "enabled", tdport->ifindex);
if (!option) {
- teamd_log_err("%s: Failed to find \"enabled\" option.",
- tdport->ifname);
+ if (!may_fail)
+ teamd_log_err("%s: Failed to find \"enabled\" option.",
+ tdport->ifname);
return -ENOENT;
}
if (team_get_option_type(option) != TEAM_OPTION_TYPE_BOOL) {
- teamd_log_err("Unexpected type of \"enabled\" option.");
+ if (!may_fail)
+ teamd_log_err("Unexpected type of \"enabled\" option.");
return -EINVAL;
}
@@ -415,6 +417,18 @@ int teamd_port_enabled(struct teamd_context *ctx, struct teamd_port *tdport,
return 0;
}
+int teamd_port_enabled(struct teamd_context *ctx, struct teamd_port *tdport,
+ bool *enabled)
+{
+ return __teamd_port_enabled(ctx, tdport, enabled, false);
+}
+
+int teamd_port_enabled_check(struct teamd_context *ctx,
+ struct teamd_port *tdport, bool *enabled)
+{
+ return __teamd_port_enabled(ctx, tdport, enabled, true);
+}
+
int teamd_port_prio(struct teamd_context *ctx, struct teamd_port *tdport)
{
int prio;
--
2.17.1.windows.2

View File

@ -8,4 +8,3 @@
0008-libteam-Add-warm_reboot-mode.patch
0009-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch
0010-When-read-of-timerfd-returned-0-don-t-consider-this-.patch
0011-teamd-fix-possible-race-in-master-ifname-callback.patch