diff --git a/rules/libteam.mk b/rules/libteam.mk index 747f5dde4033..5510d9427767 100644 --- a/rules/libteam.mk +++ b/rules/libteam.mk @@ -1,6 +1,6 @@ # libteam packages -LIBTEAM_VERSION = 1.26-1 +LIBTEAM_VERSION = 1.28-1 export LIBTEAM_VERSION @@ -24,4 +24,3 @@ $(eval $(call add_derived_package,$(LIBTEAM),$(LIBTEAM_UTILS))) # are archived into debug one image to facilitate debugging. # DBG_SRC_ARCHIVE += libteam - diff --git a/src/libteam/0001-libteam-Add-team_get_port_enabled-function.patch b/src/libteam/0001-libteam-Add-team_get_port_enabled-function.patch deleted file mode 100644 index 9bf08ce61308..000000000000 --- a/src/libteam/0001-libteam-Add-team_get_port_enabled-function.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 2f9248dd07d51361bc0a93ef70d0f8ac2631af35 Mon Sep 17 00:00:00 2001 -From: Shuotian Cheng -Date: Fri, 20 Jan 2017 12:10:13 -0800 -Subject: [PATCH] libteam: Add team_get_port_enabled function - ---- - include/team.h | 2 ++ - libteam/libteam.c | 22 ++++++++++++++++++++++ - 2 files changed, 24 insertions(+) - -diff --git a/include/team.h b/include/team.h -index 20ebcf6..9ae517d 100644 ---- a/include/team.h -+++ b/include/team.h -@@ -68,6 +68,8 @@ int team_get_bpf_hash_func(struct team_handle *th, struct sock_fprog *fp); - int team_set_bpf_hash_func(struct team_handle *th, const struct sock_fprog *fp); - int team_set_port_enabled(struct team_handle *th, - uint32_t port_ifindex, bool val); -+int team_get_port_enabled(struct team_handle *th, -+ uint32_t port_ifindex, bool *enabled); - int team_set_port_user_linkup_enabled(struct team_handle *th, - uint32_t port_ifindex, bool val); - int team_get_port_user_linkup(struct team_handle *th, -diff --git a/libteam/libteam.c b/libteam/libteam.c -index ac187aa..106e5cf 100644 ---- a/libteam/libteam.c -+++ b/libteam/libteam.c -@@ -1295,6 +1295,28 @@ int team_set_port_enabled(struct team_handle *th, - /** - * @param th libteam library context - * @param port_ifindex port interface index -+ * @param enabled where the enabled state will be stored -+ * -+ * @details Gets enabled state for port identified by port_ifindex -+ * -+ * @return Zero on success or negative number in case of an error. -+ **/ -+TEAM_EXPORT -+int team_get_port_enabled(struct team_handle *th, -+ uint32_t port_ifindex, bool *enabled) -+{ -+ struct team_option *option; -+ -+ option = team_get_option(th, "np", "enabled", port_ifindex); -+ if (!option) -+ return -ENOENT; -+ *enabled = team_get_option_value_bool(option); -+ return 0; -+} -+ -+/** -+ * @param th libteam library context -+ * @param port_ifindex port interface index - * @param val boolean value - * - * @details Enables or disable user linkup for port identified by port_ifindex --- -2.1.4 - diff --git a/src/libteam/0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch b/src/libteam/0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch deleted file mode 100644 index f6c8a832d593..000000000000 --- a/src/libteam/0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 43e512b114176feb1828ff0a75f0224f2b219a2d Mon Sep 17 00:00:00 2001 -From: Jipan Yang -Date: Sun, 24 Feb 2019 00:04:15 -0800 -Subject: [PATCH] Skip setting the same hwaddr to lag port to avoid disrupting - neighbor entries - -Signed-off-by: Jipan Yang ---- - teamd/teamd.c | 11 ++++++++++- - 1 file changed, 10 insertions(+), 1 deletion(-) - -diff --git a/teamd/teamd.c b/teamd/teamd.c -index c987333..0f8993e 100644 ---- a/teamd/teamd.c -+++ b/teamd/teamd.c -@@ -828,7 +828,16 @@ static int teamd_set_hwaddr(struct teamd_context *ctx) - err = -EINVAL; - goto free_hwaddr; - } -- err = team_hwaddr_set(ctx->th, ctx->ifindex, hwaddr, hwaddr_len); -+ -+ if(!memcmp(hwaddr, ctx->hwaddr, hwaddr_len)) -+ { -+ err = 0; -+ teamd_log_dbg("Skip setting same hwaddr string: \"%s\".", hwaddr_str); -+ } -+ else -+ { -+ err = team_hwaddr_set(ctx->th, ctx->ifindex, hwaddr, hwaddr_len); -+ } - if (!err) - ctx->hwaddr_explicit = true; - free_hwaddr: --- -2.9.2 - diff --git a/src/libteam/0010-teamd-lacp-update-port-state-according-to-partners-sy.patch b/src/libteam/0010-teamd-lacp-update-port-state-according-to-partners-sy.patch deleted file mode 100644 index 4cef90ea1920..000000000000 --- a/src/libteam/0010-teamd-lacp-update-port-state-according-to-partners-sy.patch +++ /dev/null @@ -1,71 +0,0 @@ -commit 15b56de0f309c942f0f3a588f40944d078db97f9 -Author: Pavel Shirshov -Date: Tue Apr 16 12:18:12 2019 -0700 - - teamd: lacp: update port state according to partner's sync bit - - Backport of - https://github.com/jpirko/libteam/commit/54f137c10579bf97800c61ebb13e732aa1d843e6#diff-f17610bfcc2bafe661a9f3ba496ebf12 - - 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 - Signed-off-by: Jiri Pirko - -diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c -index 81324de..813b604 100644 ---- a/teamd/teamd_runner_lacp.c -+++ b/teamd/teamd_runner_lacp.c -@@ -356,7 +356,8 @@ static int lacp_port_should_be_enabled(struct lacp_port *lacp_port) - struct lacp *lacp = lacp_port->lacp; - - if (lacp_port_selected(lacp_port) && -- lacp_port->agg_lead == lacp->selected_agg_lead) -+ lacp_port->agg_lead == lacp->selected_agg_lead && -+ lacp_port->partner.state & INFO_STATE_SYNCHRONIZATION) - return true; - return false; - } -@@ -366,7 +367,8 @@ static int lacp_port_should_be_disabled(struct lacp_port *lacp_port) - struct lacp *lacp = lacp_port->lacp; - - if (!lacp_port_selected(lacp_port) || -- lacp_port->agg_lead != lacp->selected_agg_lead) -+ lacp_port->agg_lead != lacp->selected_agg_lead || -+ !(lacp_port->partner.state & INFO_STATE_SYNCHRONIZATION)) - return true; - return false; - } -@@ -936,9 +938,14 @@ static void lacp_port_actor_update(struct lacp_port *lacp_port) - state |= INFO_STATE_LACP_ACTIVITY; - if (lacp_port->lacp->cfg.fast_rate) - state |= INFO_STATE_LACP_TIMEOUT; -- if (lacp_port_selected(lacp_port)) -+ if (lacp_port_selected(lacp_port) && -+ lacp_port_agg_selected(lacp_port)) { - state |= INFO_STATE_SYNCHRONIZATION; -- state |= INFO_STATE_COLLECTING | INFO_STATE_DISTRIBUTING; -+ state &= ~(INFO_STATE_COLLECTING | INFO_STATE_DISTRIBUTING); -+ if (lacp_port->partner.state & INFO_STATE_SYNCHRONIZATION) -+ state |= INFO_STATE_COLLECTING | -+ INFO_STATE_DISTRIBUTING; -+ } - if (lacp_port->state == PORT_STATE_EXPIRED) - state |= INFO_STATE_EXPIRED; - if (lacp_port->state == PORT_STATE_DEFAULTED) diff --git a/src/libteam/0011-libteam-resynchronize-ifinfo-after-lost-RTNLGRP_LINK-.patch b/src/libteam/0011-libteam-resynchronize-ifinfo-after-lost-RTNLGRP_LINK-.patch deleted file mode 100644 index a53369fb7376..000000000000 --- a/src/libteam/0011-libteam-resynchronize-ifinfo-after-lost-RTNLGRP_LINK-.patch +++ /dev/null @@ -1,302 +0,0 @@ -commit 046fb6ba0aec8246075b18d787daec43201566fa -Author: Antti Tiainen -Date: Mon Feb 6 15:41:05 2017 +0200 - - libteam: resynchronize ifinfo after lost RTNLGRP_LINK notifications - - When there's a large number of interfaces (e.g. vlans), teamd loses - link notifications as it cannot read them as fast as kernel is - broadcasting them. This often prevents teamd starting properly if - started concurrently when other links are being set up. It can also - fail when it's up and running, especially in the cases where the team - device itself has a lot of vlans under it. - - This can easily be reproduces by simple example (in SMP system) by - manually adding team device with a bunch of vlans, putting it up, - and starting teamd with --take-over option: - - root@debian:~# ip link add name team0 type team - root@debian:~# for i in `seq 100 150` ; do - > ip link add link team0 name team0.$i type vlan id $i ; done - root@debian:~# ip link set team0 up - root@debian:~# cat teamd.conf - { - "device": "team0", - "runner": { - "name": "activebackup" - }, - "ports": { - "eth1": {}, - "eth2": {} - } - } - root@debian:~# teamd -o -N -f teamd.conf - - At this point, teamd will not give any error messages or other - indication that something is wrong. But state will not look healthy: - - root@debian:~# teamdctl team0 state - setup: - runner: activebackup - ports: - eth1 - link watches: - link summary: up - instance[link_watch_0]: - name: ethtool - link: up - down count: 0 - Failed to parse JSON port dump. - command call failed (Invalid argument) - - If checking state dump, it will show that port eth2 is missing info. - Running strace to teamd will reveal that there's one recvmsgs() that - returned -1 with errno ENOBUFS. What happened in this example was - that when teamd started, all vlans got carrier up, and kernel flooded - notifications faster than teamd could read them. It then lost events - related to port eth2 getting enslaved and up. - - The socket that joins RTNLGRP_LINK notifications uses default libnl - 32k buffer size. Netlink messages are large (over 1k), and this buffer - gets easily full. Kernel neither knows nor cares were notification - broadcasts delivered. This cannot be fixed by simply increasing the - buffer size, as there's no size that is guaranteed to work in every - use case, and this can require several megabytes of buffer (a way over - normal rmem_max limit) if there are hunderds of vlans. - - Only way to recover from this is to refresh all ifinfo list, as it's - invalidated at this point. It cannot easily work around of this by - just refreshing team device and its ports, because library side might - not have ports linked due to events missed, and it doesn't know about - teamd configuration. - - Checks now return value of nl_recvmsgs_default() for event socket. In - case of ENOBUFS (which libnl nicely changes to ENOMEM), refreshes - all ifinfo list. get_ifinfo_list() also checks now for removed interfaces - in case of missed dellink event. Currently all TEAM_IFINFO_CHANGE - handlers processed events one by one, so it had to be changed to support - multiple ifinfo changes. For this, ifinfo changed flags are cleared - and removed entries destroyed only after all handlers have been called. - - Also, increased nl_cli.sock_event receive buffers to 96k like all other - sockets. Added possibility to change this via environment variable. - - Signed-off-by: Antti Tiainen - Signed-off-by: Jiri Pirko - -diff --git a/libteam/ifinfo.c b/libteam/ifinfo.c -index 72155ae..5c32a9c 100644 ---- a/libteam/ifinfo.c -+++ b/libteam/ifinfo.c -@@ -72,6 +72,10 @@ struct team_ifinfo { - #define CHANGED_PHYS_PORT_ID (1 << 5) - #define CHANGED_PHYS_PORT_ID_LEN (1 << 6) - #define CHANGED_ADMIN_STATE (1 << 7) -+/* This is only used when tagging interfaces for finding -+ * removed, and thus not included to CHANGED_ANY. -+ */ -+#define CHANGED_REFRESHING (1 << 8) - #define CHANGED_ANY (CHANGED_REMOVED | CHANGED_HWADDR | \ - CHANGED_HWADDR_LEN | CHANGED_IFNAME | \ - CHANGED_MASTER_IFINDEX | CHANGED_PHYS_PORT_ID | \ -@@ -202,7 +206,7 @@ static struct team_ifinfo *ifinfo_find(struct team_handle *th, uint32_t ifindex) - return NULL; - } - --static void clear_last_changed(struct team_handle *th) -+void ifinfo_clear_changed(struct team_handle *th) - { - struct team_ifinfo *ifinfo; - -@@ -236,7 +240,7 @@ static void ifinfo_destroy(struct team_ifinfo *ifinfo) - free(ifinfo); - } - --static void ifinfo_destroy_removed(struct team_handle *th) -+void ifinfo_destroy_removed(struct team_handle *th) - { - struct team_ifinfo *ifinfo, *tmp; - -@@ -254,8 +258,6 @@ static void obj_input_newlink(struct nl_object *obj, void *arg, bool event) - uint32_t ifindex; - int err; - -- ifinfo_destroy_removed(th); -- - link = (struct rtnl_link *) obj; - - ifindex = rtnl_link_get_ifindex(link); -@@ -269,7 +271,7 @@ static void obj_input_newlink(struct nl_object *obj, void *arg, bool event) - return; - } - -- clear_last_changed(th); -+ clear_changed(ifinfo); - ifinfo_update(ifinfo, link); - - if (event) -@@ -292,8 +294,6 @@ static void event_handler_obj_input_dellink(struct nl_object *obj, void *arg) - uint32_t ifindex; - int err; - -- ifinfo_destroy_removed(th); -- - link = (struct rtnl_link *) obj; - - ifindex = rtnl_link_get_ifindex(link); -@@ -311,7 +311,7 @@ static void event_handler_obj_input_dellink(struct nl_object *obj, void *arg) - return; - } - -- clear_last_changed(th); -+ clear_changed(ifinfo); - set_changed(ifinfo, CHANGED_REMOVED); - set_call_change_handlers(th, TEAM_IFINFO_CHANGE); - } -@@ -367,6 +367,14 @@ int get_ifinfo_list(struct team_handle *th) - }; - int ret; - int retry = 1; -+ struct team_ifinfo *ifinfo; -+ -+ /* Tag all ifinfo, this is cleared in newlink handler. -+ * Any interface that has this after dump is processed -+ * has been removed. -+ */ -+ list_for_each_node_entry(ifinfo, &th->ifinfo_list, list) -+ set_changed(ifinfo, CHANGED_REFRESHING); - - while (retry) { - retry = 0; -@@ -395,6 +403,15 @@ int get_ifinfo_list(struct team_handle *th) - retry = 1; - } - } -+ -+ list_for_each_node_entry(ifinfo, &th->ifinfo_list, list) { -+ if (is_changed(ifinfo, CHANGED_REFRESHING)) { -+ clear_changed(ifinfo); -+ set_changed(ifinfo, CHANGED_REMOVED); -+ set_call_change_handlers(th, TEAM_IFINFO_CHANGE); -+ } -+ } -+ - ret = check_call_change_handlers(th, TEAM_IFINFO_CHANGE); - if (ret < 0) - err(th, "get_ifinfo_list: check_call_change_handers failed"); -diff --git a/libteam/libteam.c b/libteam/libteam.c -index 106e5cf..afe05cb 100644 ---- a/libteam/libteam.c -+++ b/libteam/libteam.c -@@ -236,6 +236,10 @@ int check_call_change_handlers(struct team_handle *th, - break; - } - } -+ if (call_type_mask & TEAM_IFINFO_CHANGE) { -+ ifinfo_destroy_removed(th); -+ ifinfo_clear_changed(th); -+ } - th->change_handler.pending_type_mask &= ~call_type_mask; - return err; - } -@@ -546,6 +550,11 @@ int team_destroy(struct team_handle *th) - #endif - /* \endcond */ - -+/* libnl uses default 32k socket receive buffer size, -+ * whicn can get too small. Use 96k for all sockets. -+ */ -+#define NETLINK_RCVBUF 983040 -+ - /** - * @param th libteam library context - * @param ifindex team device interface index -@@ -561,6 +570,8 @@ int team_init(struct team_handle *th, uint32_t ifindex) - int err; - int grp_id; - int val; -+ int eventbufsize; -+ const char *env; - - if (!ifindex) { - err(th, "Passed interface index %d is not valid.", ifindex); -@@ -589,12 +600,12 @@ int team_init(struct team_handle *th, uint32_t ifindex) - return -errno; - } - -- err = nl_socket_set_buffer_size(th->nl_sock, 98304, 0); -+ err = nl_socket_set_buffer_size(th->nl_sock, NETLINK_RCVBUF, 0); - if (err) { - err(th, "Failed to set buffer size of netlink sock."); - return -nl2syserr(err); - } -- err = nl_socket_set_buffer_size(th->nl_sock_event, 98304, 0); -+ err = nl_socket_set_buffer_size(th->nl_sock_event, NETLINK_RCVBUF, 0); - if (err) { - err(th, "Failed to set buffer size of netlink event sock."); - return -nl2syserr(err); -@@ -627,6 +638,25 @@ int team_init(struct team_handle *th, uint32_t ifindex) - nl_socket_modify_cb(th->nl_cli.sock_event, NL_CB_VALID, - NL_CB_CUSTOM, cli_event_handler, th); - nl_cli_connect(th->nl_cli.sock_event, NETLINK_ROUTE); -+ -+ env = getenv("TEAM_EVENT_BUFSIZE"); -+ if (env) { -+ eventbufsize = strtol(env, NULL, 10); -+ /* ignore other errors, libnl forces minimum 32k and -+ * too large values are truncated to system rmem_max -+ */ -+ if (eventbufsize < 0) -+ eventbufsize = 0; -+ } else { -+ eventbufsize = NETLINK_RCVBUF; -+ } -+ -+ err = nl_socket_set_buffer_size(th->nl_cli.sock_event, eventbufsize, 0); -+ if (err) { -+ err(th, "Failed to set cli event socket buffer size."); -+ return err; -+ } -+ - err = nl_socket_add_membership(th->nl_cli.sock_event, RTNLGRP_LINK); - if (err < 0) { - err(th, "Failed to add netlink membership."); -@@ -767,7 +797,23 @@ static int get_cli_sock_event_fd(struct team_handle *th) - - static int cli_sock_event_handler(struct team_handle *th) - { -- nl_recvmsgs_default(th->nl_cli.sock_event); -+ int err; -+ -+ err = nl_recvmsgs_default(th->nl_cli.sock_event); -+ err = -nl2syserr(err); -+ -+ /* libnl thinks ENOBUFS and ENOMEM are same. Hope it was ENOBUFS. */ -+ if (err == -ENOMEM) { -+ warn(th, "Lost link notifications from kernel."); -+ /* There's no way to know what events were lost and no -+ * way to get them again. Refresh all. -+ */ -+ err = get_ifinfo_list(th); -+ } -+ -+ if (err) -+ return err; -+ - return check_call_change_handlers(th, TEAM_IFINFO_CHANGE); - } - -diff --git a/libteam/team_private.h b/libteam/team_private.h -index a07632f..a5eb0be 100644 ---- a/libteam/team_private.h -+++ b/libteam/team_private.h -@@ -115,6 +115,9 @@ int ifinfo_link_with_port(struct team_handle *th, uint32_t ifindex, - int ifinfo_link(struct team_handle *th, uint32_t ifindex, - struct team_ifinfo **p_ifinfo); - void ifinfo_unlink(struct team_ifinfo *ifinfo); -+void ifinfo_clear_changed(struct team_handle *th); -+void ifinfo_destroy_removed(struct team_handle *th); -+int get_ifinfo_list(struct team_handle *th); - int get_options_handler(struct nl_msg *msg, void *arg); - int option_list_alloc(struct team_handle *th); - int option_list_init(struct team_handle *th); diff --git a/src/libteam/0012-teamd-do-not-process-lacpdu-before-the-port-ifinfo-i.patch b/src/libteam/0012-teamd-do-not-process-lacpdu-before-the-port-ifinfo-i.patch deleted file mode 100644 index 3779ae186351..000000000000 --- a/src/libteam/0012-teamd-do-not-process-lacpdu-before-the-port-ifinfo-i.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 28ccb37eb388e7e3d214a9b05011f8421f0d65ac Mon Sep 17 00:00:00 2001 -From: Ying Xie -Date: Fri, 26 Apr 2019 23:30:38 +0000 -Subject: [PATCH] teamd: do not process lacpdu before the port ifinfo is set - -Now the port ifinfo will be set in obj_input_newlink when a RTM_NEWLINK -event is received. - -But when a port is being added, if a lacpdu gets received on this port -before the RTM_NEWLINK event, lacpdu_recv will process the packet with -incorrect port ifinfo. - -In Patrick's case, as ifinfo->master_ifindex was 0, it would skip this -port in teamd_for_each_tdport, which caused lacp_port->agg_lead not to -be updated in lacp_switch_agg_lead. Later the lacp_port actor would go -to a unexpected state. - -This patch is to avoid it by checking teamd_port_present in lacpdu_recv -so that it would not process lacpdu before the port ifinfo is set. - -Reported-by: Patrick Talbert -Tested-by: Patrick Talbert -Signed-off-by: Xin Long -Reviewed-by: Marcelo Ricardo Leitner -Signed-off-by: Jiri Pirko ---- - teamd/teamd_runner_lacp.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c -index 813b604..d6e5840 100644 ---- a/teamd/teamd_runner_lacp.c -+++ b/teamd/teamd_runner_lacp.c -@@ -1102,6 +1102,9 @@ static int lacpdu_recv(struct lacp_port *lacp_port) - if (err <= 0) - return err; - -+ if (!teamd_port_present(lacp_port->ctx, lacp_port->tdport)) -+ return 0; -+ - if (!lacpdu_check(&lacpdu)) { - teamd_log_warn("malformed LACP PDU came."); - return 0; - --- -2.7.4 - diff --git a/src/libteam/0013-teamd-lacp-port-admin-down-recv-not-processing.patch b/src/libteam/0013-teamd-lacp-port-admin-down-recv-not-processing.patch deleted file mode 100644 index e5f26637ee5d..000000000000 --- a/src/libteam/0013-teamd-lacp-port-admin-down-recv-not-processing.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c -index d6e5840..2144334 100644 ---- a/teamd/teamd_runner_lacp.c -+++ b/teamd/teamd_runner_lacp.c -@@ -1096,6 +1096,7 @@ static int lacpdu_recv(struct lacp_port *lacp_port) - struct lacpdu lacpdu; - struct sockaddr_ll ll_from; - int err; -+ bool admin_state; - - err = teamd_recvfrom(lacp_port->sock, &lacpdu, sizeof(lacpdu), 0, - (struct sockaddr *) &ll_from, sizeof(ll_from)); -@@ -1105,6 +1106,10 @@ static int lacpdu_recv(struct lacp_port *lacp_port) - if (!teamd_port_present(lacp_port->ctx, lacp_port->tdport)) - return 0; - -+ admin_state = team_get_ifinfo_admin_state(lacp_port->ctx->ifinfo); -+ if (!admin_state) -+ return 0; -+ - if (!lacpdu_check(&lacpdu)) { - teamd_log_warn("malformed LACP PDU came."); - return 0; diff --git a/src/libteam/Makefile b/src/libteam/Makefile index 256680d34943..dade8f949aaa 100644 --- a/src/libteam/Makefile +++ b/src/libteam/Makefile @@ -12,17 +12,19 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : rm -rf ./libteam git clone https://github.com/jpirko/libteam.git pushd ./libteam - git checkout -b teamd -f v1.26 + git checkout -b teamd -f 5c5e498bff9 # Apply patch series stg init - stg import -s ../series + stg import -s ../patch/series popd # Obtain debian packaging git clone https://salsa.debian.org/debian/libteam.git tmp pushd ./tmp - git checkout -f da006f2 # v1.26 + git checkout -f 7188c361 # v1.28-1 + # Revert dependency on higher version of debhelper + git revert 57166478 --quiet -n popd mv tmp/debian libteam/ diff --git a/src/libteam/0002-libteam-Temporarily-remove-redundant-debug-mes.patch b/src/libteam/patch/0001-libteam-Temporarily-remove-redundant-debug-messages.patch similarity index 70% rename from src/libteam/0002-libteam-Temporarily-remove-redundant-debug-mes.patch rename to src/libteam/patch/0001-libteam-Temporarily-remove-redundant-debug-messages.patch index a640f40e6e07..d922c91c425e 100644 --- a/src/libteam/0002-libteam-Temporarily-remove-redundant-debug-mes.patch +++ b/src/libteam/patch/0001-libteam-Temporarily-remove-redundant-debug-messages.patch @@ -1,17 +1,17 @@ -From a5c8f3f41c575ebb7018e67cb3d1f724f0685850 Mon Sep 17 00:00:00 2001 +From 10602c2b1184aa0c6907b5a7f06fcba8a7141148 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 27 Feb 2017 14:21:09 -0800 -Subject: [PATCH] libteam: Temporarily remove redundant debug messages +Subject: [PATCH 1/8] 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 9c77fae..5e37a4c 100644 +index d292d69..7c91aed 100644 --- a/teamd/teamd_runner_lacp.c +++ b/teamd/teamd_runner_lacp.c -@@ -922,8 +922,6 @@ static void lacp_port_actor_update(struct lacp_port *lacp_port) +@@ -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; @@ -21,5 +21,5 @@ index 9c77fae..5e37a4c 100644 } -- -2.1.4 +2.7.4 diff --git a/src/libteam/0003-teamd-lacp-runner-will-send-lacp-update-right-after-.patch b/src/libteam/patch/0002-teamd-lacp-runner-will-send-lacp-update-right-after-.patch similarity index 67% rename from src/libteam/0003-teamd-lacp-runner-will-send-lacp-update-right-after-.patch rename to src/libteam/patch/0002-teamd-lacp-runner-will-send-lacp-update-right-after-.patch index 1cae8bad21aa..c4e78257103d 100644 --- a/src/libteam/0003-teamd-lacp-runner-will-send-lacp-update-right-after-.patch +++ b/src/libteam/patch/0002-teamd-lacp-runner-will-send-lacp-update-right-after-.patch @@ -1,21 +1,23 @@ -From 417e9dfdccbbee2cf86e46e994e8ece3433b46a4 Mon Sep 17 00:00:00 2001 -From: Pavel Shirshov -Date: Wed, 20 Sep 2017 00:34:07 +0000 -Subject: [PATCH] [teamd] lacp runner will send lacp update right after it - received SIGINT signal +From 0ce56490a44191c4b17a75cc21aa6a5bdc535f1d Mon Sep 17 00:00:00 2001 +From: yorke +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 + Date: Wed, 20 Sep 2017 00:34:07 +0000 +Signed-off-by: yorke --- teamd/teamd.c | 1 + teamd/teamd.h | 3 +++ teamd/teamd_events.c | 13 +++++++++++++ - teamd/teamd_runner_lacp.c | 10 ++++++++++ - 4 files changed, 27 insertions(+) + teamd/teamd_runner_lacp.c | 11 +++++++++++ + 4 files changed, 28 insertions(+) diff --git a/teamd/teamd.c b/teamd/teamd.c -index aac2511..c987333 100644 +index 6c47312..58d4fc8 100644 --- a/teamd/teamd.c +++ b/teamd/teamd.c -@@ -386,6 +386,7 @@ static int teamd_run_loop_run(struct teamd_context *ctx) +@@ -392,6 +392,7 @@ static int teamd_run_loop_run(struct teamd_context *ctx) case 'q': if (quit_in_progress) return -EBUSY; @@ -24,13 +26,13 @@ index aac2511..c987333 100644 if (err) return err; diff --git a/teamd/teamd.h b/teamd/teamd.h -index 5dbfb9b..ef0fb1c 100644 +index 01bd022..e71a5dc 100644 --- a/teamd/teamd.h +++ b/teamd/teamd.h -@@ -189,11 +189,14 @@ struct teamd_event_watch_ops { - struct teamd_port *tdport, void *priv); - int (*port_ifname_changed)(struct teamd_context *ctx, - struct teamd_port *tdport, void *priv); +@@ -193,11 +193,14 @@ struct teamd_event_watch_ops { + int (*port_master_ifindex_changed)(struct teamd_context *ctx, + struct teamd_port *tdport, + void *priv); + void (*refresh)(struct teamd_context *ctx, + struct teamd_port *tdport, void *priv); int (*option_changed)(struct teamd_context *ctx, @@ -43,7 +45,7 @@ index 5dbfb9b..ef0fb1c 100644 struct teamd_port *tdport); void teamd_event_port_removed(struct teamd_context *ctx, diff --git a/teamd/teamd_events.c b/teamd/teamd_events.c -index 1a95974..5c2ef56 100644 +index 65aa46a..221803e 100644 --- a/teamd/teamd_events.c +++ b/teamd/teamd_events.c @@ -34,6 +34,19 @@ struct event_watch_item { @@ -67,25 +69,27 @@ index 1a95974..5c2ef56 100644 struct teamd_port *tdport) { diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c -index 9c77fae..e38c291 100644 +index 7c91aed..4dbd015 100644 --- a/teamd/teamd_runner_lacp.c +++ b/teamd/teamd_runner_lacp.c -@@ -1383,12 +1383,22 @@ static int lacp_event_watch_port_changed(struct teamd_context *ctx, +@@ -1421,6 +1421,16 @@ static int lacp_event_watch_port_changed(struct teamd_context *ctx, return lacp_port_link_update(lacp_port); } -+static void lacp_event_watch_refresh(struct teamd_context *ctx, struct teamd_port *tdport, void *priv) ++static void lacp_event_watch_refresh(struct teamd_context *ctx, ++ struct teamd_port *tdport, void *priv) +{ + struct lacp *lacp = priv; -+ + struct lacp_port *lacp_port = lacp_port_get(lacp, tdport); ++ + if (lacp_port_selected(lacp_port)) + (void) lacpdu_send(lacp_port); +} + static const struct teamd_event_watch_ops lacp_event_watch_ops = { .hwaddr_changed = lacp_event_watch_hwaddr_changed, - .port_added = lacp_event_watch_port_added, + .port_hwaddr_changed = lacp_event_watch_port_hwaddr_changed, +@@ -1428,6 +1438,7 @@ static const struct teamd_event_watch_ops lacp_event_watch_ops = { .port_removed = lacp_event_watch_port_removed, .port_changed = lacp_event_watch_port_changed, .admin_state_changed = lacp_event_watch_admin_state_changed, diff --git a/src/libteam/0004-libteam-Add-lacp-fallback-support-for-single-member-.patch b/src/libteam/patch/0003-libteam-Add-fallback-support-for-single-member-port-.patch similarity index 84% rename from src/libteam/0004-libteam-Add-lacp-fallback-support-for-single-member-.patch rename to src/libteam/patch/0003-libteam-Add-fallback-support-for-single-member-port-.patch index 3139f83f33a4..8559e476aec1 100644 --- a/src/libteam/0004-libteam-Add-lacp-fallback-support-for-single-member-.patch +++ b/src/libteam/patch/0003-libteam-Add-fallback-support-for-single-member-port-.patch @@ -1,16 +1,17 @@ -From ec966f9a0229bd7226e3abe15b56659b36af9d66 Mon Sep 17 00:00:00 2001 -From: Haiyang Zheng -Date: Fri, 15 Dec 2017 21:07:53 -0800 -Subject: [patch libteam] [libteam] Add fallback support for single-member-port - LAG +From 9b40af58575a89d06be51cfbb5a2265a59826110 Mon Sep 17 00:00:00 2001 +From: yorke +Date: Mon, 3 Jun 2019 12:02:36 +0800 +Subject: [PATCH 3/8] [libteam] Add fallback support for single-member-port LAG + From: Haiyang Zheng Date: Fri, 15 Dec + 2017 21:07:53 -0800 -Signed-off-by: Haiyang Zheng +Signed-off-by: yorke --- teamd/teamd_runner_lacp.c | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c -index 9c77fae..a3646a6 100644 +index 4dbd015..9836824 100644 --- a/teamd/teamd_runner_lacp.c +++ b/teamd/teamd_runner_lacp.c @@ -138,6 +138,8 @@ struct lacp { @@ -70,7 +71,7 @@ index 9c77fae..a3646a6 100644 return false; return true; } -@@ -1452,6 +1475,16 @@ static int lacp_state_fast_rate_get(struct teamd_context *ctx, +@@ -1502,6 +1525,16 @@ static int lacp_state_fast_rate_get(struct teamd_context *ctx, return 0; } @@ -87,7 +88,7 @@ index 9c77fae..a3646a6 100644 static int lacp_state_select_policy_get(struct teamd_context *ctx, struct team_state_gsc *gsc, void *priv) -@@ -1479,6 +1512,11 @@ static const struct teamd_state_val lacp_state_vals[] = { +@@ -1529,6 +1562,11 @@ static const struct teamd_state_val lacp_state_vals[] = { .getter = lacp_state_fast_rate_get, }, { diff --git a/src/libteam/patch/0004-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch b/src/libteam/patch/0004-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch new file mode 100644 index 000000000000..3d99132b92dc --- /dev/null +++ b/src/libteam/patch/0004-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch @@ -0,0 +1,36 @@ +From e18cbe5a6c76366923a8ace830c89056a1542745 Mon Sep 17 00:00:00 2001 +From: yorke +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 Date: Sun, + 24 Feb 2019 00:04:15 -0800 + +Signed-off-by: yorke +--- + 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 +--- a/teamd/teamd.c ++++ b/teamd/teamd.c +@@ -834,7 +834,15 @@ static int teamd_set_hwaddr(struct teamd_context *ctx) + err = -EINVAL; + goto free_hwaddr; + } +- err = team_hwaddr_set(ctx->th, ctx->ifindex, hwaddr, hwaddr_len); ++ ++ if(!memcmp(hwaddr, ctx->hwaddr, hwaddr_len)) { ++ err = 0; ++ teamd_log_dbg("Skip setting same hwaddr string: \"%s\".", hwaddr_str); ++ } ++ else{ ++ err = team_hwaddr_set(ctx->th, ctx->ifindex, hwaddr, hwaddr_len); ++ } ++ + if (!err) + ctx->hwaddr_explicit = true; + free_hwaddr: +-- +2.7.4 + diff --git a/src/libteam/patch/0005-Increase-default-buffer-size-from-98304-to-983040.patch b/src/libteam/patch/0005-Increase-default-buffer-size-from-98304-to-983040.patch new file mode 100644 index 000000000000..517b86992e27 --- /dev/null +++ b/src/libteam/patch/0005-Increase-default-buffer-size-from-98304-to-983040.patch @@ -0,0 +1,31 @@ +From 39e5b0a15bf276dffa6b8c61594ee945248a4e27 Mon Sep 17 00:00:00 2001 +From: yorke +Date: Mon, 3 Jun 2019 12:32:33 +0800 +Subject: [PATCH 5/8] Increase default buffer size from 98304 to 983040 + From: Pavel Shirshov + https://github.com/Azure/sonic-buildimage/pull/2822 + +Signed-off-by: yorke +--- + libteam/libteam.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libteam/libteam.c b/libteam/libteam.c +index 9c9c93a..2cc80ca 100644 +--- a/libteam/libteam.c ++++ b/libteam/libteam.c +@@ -551,9 +551,9 @@ int team_destroy(struct team_handle *th) + /* \endcond */ + + /* libnl uses default 32k socket receive buffer size, +- * which can get too small. Use 192k for all sockets. ++ * which can get too small. Use 960k for all sockets. + */ +-#define NETLINK_RCVBUF 196608 ++#define NETLINK_RCVBUF 983040 + + /** + * @param th libteam library context +-- +2.7.4 + diff --git a/src/libteam/patch/0006-teamd-Administratively-shutdown-port-channel-has-mem.patch b/src/libteam/patch/0006-teamd-Administratively-shutdown-port-channel-has-mem.patch new file mode 100644 index 000000000000..344dbc8d2609 --- /dev/null +++ b/src/libteam/patch/0006-teamd-Administratively-shutdown-port-channel-has-mem.patch @@ -0,0 +1,37 @@ +From f1eec95dd0475591897a781eba15d8d8ce370a6a Mon Sep 17 00:00:00 2001 +From: yorke +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 + +Signed-off-by: yorke +--- + 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 +--- 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) + struct lacpdu lacpdu; + struct sockaddr_ll ll_from; + int err; ++ bool admin_state; + + err = teamd_recvfrom(lacp_port->sock, &lacpdu, sizeof(lacpdu), 0, + (struct sockaddr *) &ll_from, sizeof(ll_from)); + if (err <= 0) + return err; + ++ admin_state = team_get_ifinfo_admin_state(lacp_port->ctx->ifinfo); ++ if (!admin_state) ++ return 0; ++ + if (!teamd_port_present(lacp_port->ctx, lacp_port->tdport)) + return 0; + +-- +2.7.4 + diff --git a/src/libteam/0014-Send-LACP-PDU-immediately-if-our-state-changed.patch b/src/libteam/patch/0007-Send-LACP-PDU-immediately-if-our-state-changed.patch similarity index 59% rename from src/libteam/0014-Send-LACP-PDU-immediately-if-our-state-changed.patch rename to src/libteam/patch/0007-Send-LACP-PDU-immediately-if-our-state-changed.patch index b4c9c68f8aca..d26e2a74ea42 100644 --- a/src/libteam/0014-Send-LACP-PDU-immediately-if-our-state-changed.patch +++ b/src/libteam/patch/0007-Send-LACP-PDU-immediately-if-our-state-changed.patch @@ -1,17 +1,20 @@ -From 0e0ee4a68b118d540d9ef5836a55483fcfb8771b Mon Sep 17 00:00:00 2001 -From: Pavel Shirshov -Date: Wed, 29 May 2019 19:15:20 +0000 -Subject: [PATCH] Send LACP PDU immediately if our state changed +From b82da0dc94ca34b039396328a8c2fcb61aa73c0f Mon Sep 17 00:00:00 2001 +From: yorke +Date: Mon, 3 Jun 2019 13:27:26 +0800 +Subject: [PATCH 7/8] Send LACP PDU immediately if our state changed From: + Pavel Shirshov Date: Wed, 29 May 2019 19:15:20 + +0000 +Signed-off-by: yorke --- 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 2144334..0930b22 100644 +index 7bf3700..4016b15 100644 --- a/teamd/teamd_runner_lacp.c +++ b/teamd/teamd_runner_lacp.c -@@ -1012,8 +1012,7 @@ static int lacp_port_set_state(struct lacp_port *lacp_port, +@@ -1017,8 +1017,7 @@ static int lacp_port_set_state(struct lacp_port *lacp_port, return err; lacp_port_actor_update(lacp_port); @@ -21,7 +24,7 @@ index 2144334..0930b22 100644 return lacpdu_send(lacp_port); } -@@ -1131,9 +1130,10 @@ static int lacpdu_recv(struct lacp_port *lacp_port) +@@ -1136,9 +1135,10 @@ static int lacpdu_recv(struct lacp_port *lacp_port) if (err) return err; diff --git a/src/libteam/0015-libteam-Add-warm_reboot-mode.patch b/src/libteam/patch/0008-libteam-Add-warm_reboot-mode.patch similarity index 90% rename from src/libteam/0015-libteam-Add-warm_reboot-mode.patch rename to src/libteam/patch/0008-libteam-Add-warm_reboot-mode.patch index e6f2a3257198..10770b8740b5 100644 --- a/src/libteam/0015-libteam-Add-warm_reboot-mode.patch +++ b/src/libteam/patch/0008-libteam-Add-warm_reboot-mode.patch @@ -1,5 +1,18 @@ +From a21a3dec9f9b9d825a0229e2963e07862395bbba Mon Sep 17 00:00:00 2001 +From: Pavel Shirshov +Date: Fri, 14 Jun 2019 14:20:05 -0700 +Subject: [PATCH] [libteam]: Reimplement Warm-Reboot procedure + +--- + libteam/ifinfo.c | 6 +- + teamd/teamd.c | 42 +++- + teamd/teamd.h | 6 + + teamd/teamd_events.c | 13 ++ + teamd/teamd_runner_lacp.c | 474 +++++++++++++++++++++++++++++++++++--- + 5 files changed, 498 insertions(+), 43 deletions(-) + diff --git a/libteam/ifinfo.c b/libteam/ifinfo.c -index 5c32a9c..c418243 100644 +index 46d56a2..b86d34c 100644 --- a/libteam/ifinfo.c +++ b/libteam/ifinfo.c @@ -109,15 +109,13 @@ static void update_hwaddr(struct team_ifinfo *ifinfo, struct rtnl_link *link) @@ -21,10 +34,10 @@ index 5c32a9c..c418243 100644 } } diff --git a/teamd/teamd.c b/teamd/teamd.c -index 0f8993e..ad91fe5 100644 +index 9dc85b5..96794e8 100644 --- a/teamd/teamd.c +++ b/teamd/teamd.c -@@ -116,7 +116,9 @@ static void print_help(const struct teamd_context *ctx) { +@@ -117,7 +117,9 @@ static void print_help(const struct teamd_context *ctx) { " -D --dbus-enable Enable D-Bus interface\n" " -Z --zmq-enable=ADDRESS Enable ZeroMQ interface\n" " -U --usock-enable Enable UNIX domain socket interface\n" @@ -35,7 +48,7 @@ index 0f8993e..ad91fe5 100644 ctx->argv0); printf("Available runners: "); for (i = 0; i < TEAMD_RUNNER_LIST_SIZE; i++) { -@@ -149,10 +151,12 @@ static int parse_command_line(struct teamd_context *ctx, +@@ -151,10 +153,12 @@ static int parse_command_line(struct teamd_context *ctx, { "zmq-enable", required_argument, NULL, 'Z' }, { "usock-enable", no_argument, NULL, 'U' }, { "usock-disable", no_argument, NULL, 'u' }, @@ -44,12 +57,12 @@ index 0f8993e..ad91fe5 100644 { NULL, 0, NULL, 0 } }; -- while ((opt = getopt_long(argc, argv, "hdkevf:c:p:groNt:nDZ:Uu", -+ while ((opt = getopt_long(argc, argv, "hdkevf:c:p:groNt:nDZ:UuwL:", +- while ((opt = getopt_long(argc, argv, "hdkevf:c:p:gl:roNt:nDZ:Uu", ++ while ((opt = getopt_long(argc, argv, "hdkevf:c:p:gl:roNt:nDZ:UuwL:", long_options, NULL)) >= 0) { switch(opt) { -@@ -230,11 +234,27 @@ static int parse_command_line(struct teamd_context *ctx, +@@ -236,11 +240,27 @@ static int parse_command_line(struct teamd_context *ctx, case 'u': ctx->usock.enabled = false; break; @@ -77,7 +90,7 @@ index 0f8993e..ad91fe5 100644 if (optind < argc) { fprintf(stderr, "Too many arguments\n"); return -1; -@@ -384,8 +404,14 @@ static int teamd_run_loop_run(struct teamd_context *ctx) +@@ -390,8 +410,14 @@ static int teamd_run_loop_run(struct teamd_context *ctx) if (err != -1) { switch(ctrl_byte) { case 'q': @@ -92,7 +105,7 @@ index 0f8993e..ad91fe5 100644 teamd_refresh_ports(ctx); err = teamd_flush_ports(ctx); if (err) -@@ -428,6 +454,12 @@ void teamd_run_loop_quit(struct teamd_context *ctx, int err) +@@ -434,6 +460,12 @@ void teamd_run_loop_quit(struct teamd_context *ctx, int err) teamd_run_loop_sent_ctrl_byte(ctx, 'q'); } @@ -105,7 +118,7 @@ index 0f8993e..ad91fe5 100644 void teamd_run_loop_restart(struct teamd_context *ctx) { teamd_run_loop_sent_ctrl_byte(ctx, 'r'); -@@ -694,6 +726,10 @@ static int callback_daemon_signal(struct teamd_context *ctx, int events, +@@ -700,6 +732,10 @@ static int callback_daemon_signal(struct teamd_context *ctx, int events, teamd_log_warn("Got SIGINT, SIGQUIT or SIGTERM."); teamd_run_loop_quit(ctx, 0); break; @@ -116,7 +129,7 @@ index 0f8993e..ad91fe5 100644 } return 0; } -@@ -1516,7 +1552,7 @@ static int teamd_start(struct teamd_context *ctx, enum teamd_exit_code *p_ret) +@@ -1531,7 +1567,7 @@ static int teamd_start(struct teamd_context *ctx, enum teamd_exit_code *p_ret) return -errno; } @@ -126,10 +139,10 @@ index 0f8993e..ad91fe5 100644 daemon_retval_send(errno); err = -errno; diff --git a/teamd/teamd.h b/teamd/teamd.h -index ef0fb1c..72330f1 100644 +index e71a5dc..418214d 100644 --- a/teamd/teamd.h +++ b/teamd/teamd.h -@@ -125,6 +125,9 @@ struct teamd_context { +@@ -126,6 +126,9 @@ struct teamd_context { char * hwaddr; uint32_t hwaddr_len; bool hwaddr_explicit; @@ -139,8 +152,8 @@ index ef0fb1c..72330f1 100644 struct { struct list_item callback_list; int ctrl_pipe_r; -@@ -191,12 +194,15 @@ struct teamd_event_watch_ops { - struct teamd_port *tdport, void *priv); +@@ -195,12 +198,15 @@ struct teamd_event_watch_ops { + void *priv); void (*refresh)(struct teamd_context *ctx, struct teamd_port *tdport, void *priv); + void (*port_flush_data)(struct teamd_context *ctx, @@ -156,7 +169,7 @@ index ef0fb1c..72330f1 100644 struct teamd_port *tdport); void teamd_event_port_removed(struct teamd_context *ctx, diff --git a/teamd/teamd_events.c b/teamd/teamd_events.c -index 5c2ef56..50e5a08 100644 +index 221803e..bd4dcc1 100644 --- a/teamd/teamd_events.c +++ b/teamd/teamd_events.c @@ -47,6 +47,19 @@ void teamd_refresh_ports(struct teamd_context *ctx) @@ -180,7 +193,7 @@ index 5c2ef56..50e5a08 100644 struct teamd_port *tdport) { diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c -index 0930b22..dc87448 100644 +index 4016b15..81be5b7 100644 --- a/teamd/teamd_runner_lacp.c +++ b/teamd/teamd_runner_lacp.c @@ -31,6 +31,7 @@ @@ -560,7 +573,7 @@ index 0930b22..dc87448 100644 lacp_port_actor_system_update(lacp_port); } -@@ -1001,6 +1299,13 @@ static int lacp_port_set_state(struct lacp_port *lacp_port, +@@ -1006,6 +1304,13 @@ static int lacp_port_set_state(struct lacp_port *lacp_port, break; } @@ -574,7 +587,7 @@ index 0930b22..dc87448 100644 teamd_log_info("%s: Changed port state: \"%s\" -> \"%s\"", lacp_port->tdport->ifname, lacp_port_state_name[lacp_port->state], -@@ -1090,34 +1395,23 @@ static int lacpdu_send(struct lacp_port *lacp_port) +@@ -1095,34 +1400,23 @@ static int lacpdu_send(struct lacp_port *lacp_port) return err; } @@ -585,19 +598,19 @@ index 0930b22..dc87448 100644 - struct sockaddr_ll ll_from; int err; - bool admin_state; - +- - err = teamd_recvfrom(lacp_port->sock, &lacpdu, sizeof(lacpdu), 0, - (struct sockaddr *) &ll_from, sizeof(ll_from)); - if (err <= 0) - return err; - -- if (!teamd_port_present(lacp_port->ctx, lacp_port->tdport)) -- return 0; -- - admin_state = team_get_ifinfo_admin_state(lacp_port->ctx->ifinfo); - if (!admin_state) - return 0; - +- if (!teamd_port_present(lacp_port->ctx, lacp_port->tdport)) +- return 0; + - if (!lacpdu_check(&lacpdu)) { + if (!lacpdu_check(lacpdu)) { teamd_log_warn("malformed LACP PDU came."); @@ -617,7 +630,7 @@ index 0930b22..dc87448 100644 err = lacp_port_partner_update(lacp_port); if (err) return err; -@@ -1133,21 +1427,56 @@ static int lacpdu_recv(struct lacp_port *lacp_port) +@@ -1138,21 +1432,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 */ @@ -677,7 +690,7 @@ index 0930b22..dc87448 100644 static int lacp_callback_timeout(struct teamd_context *ctx, int events, void *priv) { -@@ -1253,6 +1582,8 @@ static int lacp_port_added(struct teamd_context *ctx, +@@ -1258,6 +1587,8 @@ static int lacp_port_added(struct teamd_context *ctx, struct lacp *lacp = creator_priv; int err; @@ -686,7 +699,7 @@ index 0930b22..dc87448 100644 lacp_port->ctx = ctx; lacp_port->tdport = tdport; lacp_port->lacp = lacp; -@@ -1299,6 +1630,13 @@ static int lacp_port_added(struct teamd_context *ctx, +@@ -1304,6 +1635,13 @@ static int lacp_port_added(struct teamd_context *ctx, goto periodic_callback_del; } @@ -700,7 +713,7 @@ index 0930b22..dc87448 100644 /* Newly added ports are disabled */ err = team_set_port_enabled(ctx->th, tdport->ifindex, false); if (err) { -@@ -1336,7 +1674,13 @@ static void lacp_port_removed(struct teamd_context *ctx, +@@ -1341,7 +1679,13 @@ static void lacp_port_removed(struct teamd_context *ctx, { struct lacp_port *lacp_port = priv; @@ -715,7 +728,19 @@ index 0930b22..dc87448 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); -@@ -1428,6 +1772,42 @@ static void lacp_event_watch_refresh(struct teamd_context *ctx, struct teamd_por +@@ -1449,16 +1793,51 @@ static int lacp_event_watch_port_changed(struct teamd_context *ctx, + return lacp_port_link_update(lacp_port); + } + +-static void lacp_event_watch_refresh(struct teamd_context *ctx, +- struct teamd_port *tdport, void *priv) ++static void lacp_event_watch_refresh(struct teamd_context *ctx, struct teamd_port *tdport, void *priv) + { + struct lacp *lacp = priv; +- struct lacp_port *lacp_port = lacp_port_get(lacp, tdport); + ++ struct lacp_port *lacp_port = lacp_port_get(lacp, tdport); + if (lacp_port_selected(lacp_port)) (void) lacpdu_send(lacp_port); } @@ -757,8 +782,8 @@ index 0930b22..dc87448 100644 + static const struct teamd_event_watch_ops lacp_event_watch_ops = { .hwaddr_changed = lacp_event_watch_hwaddr_changed, - .port_added = lacp_event_watch_port_added, -@@ -1435,21 +1815,35 @@ static const struct teamd_event_watch_ops lacp_event_watch_ops = { + .port_hwaddr_changed = lacp_event_watch_port_hwaddr_changed, +@@ -1467,21 +1846,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, @@ -799,7 +824,7 @@ index 0930b22..dc87448 100644 return 0; } -@@ -1917,6 +2311,12 @@ static int lacp_init(struct teamd_context *ctx, void *priv) +@@ -1949,6 +2342,12 @@ static int lacp_init(struct teamd_context *ctx, void *priv) } lacp->ctx = ctx; @@ -812,7 +837,7 @@ index 0930b22..dc87448 100644 err = teamd_hash_func_set(ctx); if (err) return err; -@@ -1958,10 +2358,13 @@ static void lacp_fini(struct teamd_context *ctx, void *priv) +@@ -1990,10 +2389,13 @@ static void lacp_fini(struct teamd_context *ctx, void *priv) { struct lacp *lacp = priv; @@ -827,3 +852,6 @@ index 0930b22..dc87448 100644 } const struct teamd_runner teamd_runner_lacp = { +-- +2.17.1.windows.2 + diff --git a/src/libteam/0016-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch b/src/libteam/patch/0009-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch similarity index 100% rename from src/libteam/0016-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch rename to src/libteam/patch/0009-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch diff --git a/src/libteam/patch/series b/src/libteam/patch/series new file mode 100644 index 000000000000..c30bdc7dd861 --- /dev/null +++ b/src/libteam/patch/series @@ -0,0 +1,9 @@ +0001-libteam-Temporarily-remove-redundant-debug-messages.patch +0002-teamd-lacp-runner-will-send-lacp-update-right-after-.patch +0003-libteam-Add-fallback-support-for-single-member-port-.patch +0004-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch +0005-Increase-default-buffer-size-from-98304-to-983040.patch +0006-teamd-Administratively-shutdown-port-channel-has-mem.patch +0007-Send-LACP-PDU-immediately-if-our-state-changed.patch +0008-libteam-Add-warm_reboot-mode.patch +0009-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch diff --git a/src/libteam/series b/src/libteam/series deleted file mode 100644 index d1fec73c1fad..000000000000 --- a/src/libteam/series +++ /dev/null @@ -1,12 +0,0 @@ -0001-libteam-Add-team_get_port_enabled-function.patch -0002-libteam-Temporarily-remove-redundant-debug-mes.patch -0003-teamd-lacp-runner-will-send-lacp-update-right-after-.patch -0004-libteam-Add-lacp-fallback-support-for-single-member-.patch -0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch -0010-teamd-lacp-update-port-state-according-to-partners-sy.patch -0011-libteam-resynchronize-ifinfo-after-lost-RTNLGRP_LINK-.patch -0012-teamd-do-not-process-lacpdu-before-the-port-ifinfo-i.patch -0013-teamd-lacp-port-admin-down-recv-not-processing.patch -0014-Send-LACP-PDU-immediately-if-our-state-changed.patch -0015-libteam-Add-warm_reboot-mode.patch -0016-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch