From owner-svn-src-head@freebsd.org Mon Aug 13 14:13:26 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C247A1073F2E; Mon, 13 Aug 2018 14:13:26 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 78B147B983; Mon, 13 Aug 2018 14:13:26 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5A9DE5D83; Mon, 13 Aug 2018 14:13:26 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w7DEDQJY049136; Mon, 13 Aug 2018 14:13:26 GMT (envelope-from gallatin@FreeBSD.org) Received: (from gallatin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w7DEDQFr049135; Mon, 13 Aug 2018 14:13:26 GMT (envelope-from gallatin@FreeBSD.org) Message-Id: <201808131413.w7DEDQFr049135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gallatin set sender to gallatin@FreeBSD.org using -f From: Andrew Gallatin Date: Mon, 13 Aug 2018 14:13:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r337709 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: gallatin X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 337709 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Aug 2018 14:13:26 -0000 Author: gallatin Date: Mon Aug 13 14:13:25 2018 New Revision: 337709 URL: https://svnweb.freebsd.org/changeset/base/337709 Log: lagg: allow lacp to manage the link state Lacp needs to manage the link state itself. Unlike other lagg protocols, the ability of lacp to pass traffic depends not only on the lagg members having link, but also on the lacp protocol converging to a distributing state with the link partner. If we prematurely mark the link as up, then we will send a gratuitous arp (via arp_handle_ifllchange()) before the lacp interface is capable of passing traffic. When this happens, the gratuitous arp is lost, and our link partner may cache a stale mac address (eg, when the base mac address for the lagg bundle changes, due to a BIOS change re-ordering NIC unit numbers) Reviewed by: jtl, hselasky Sponsored by: Netflix Modified: head/sys/net/ieee8023ad_lacp.c head/sys/net/if_lagg.c Modified: head/sys/net/ieee8023ad_lacp.c ============================================================================== --- head/sys/net/ieee8023ad_lacp.c Mon Aug 13 13:58:45 2018 (r337708) +++ head/sys/net/ieee8023ad_lacp.c Mon Aug 13 14:13:25 2018 (r337709) @@ -711,6 +711,8 @@ lacp_disable_distributing(struct lacp_port *lp) } lp->lp_state &= ~LACP_STATE_DISTRIBUTING; + if_link_state_change(sc->sc_ifp, + sc->sc_active ? LINK_STATE_UP : LINK_STATE_DOWN); } static void @@ -745,6 +747,9 @@ lacp_enable_distributing(struct lacp_port *lp) } else /* try to become the active aggregator */ lacp_select_active_aggregator(lsc); + + if_link_state_change(sc->sc_ifp, + sc->sc_active ? LINK_STATE_UP : LINK_STATE_DOWN); } static void Modified: head/sys/net/if_lagg.c ============================================================================== --- head/sys/net/if_lagg.c Mon Aug 13 13:58:45 2018 (r337708) +++ head/sys/net/if_lagg.c Mon Aug 13 14:13:25 2018 (r337709) @@ -1737,6 +1737,10 @@ lagg_linkstate(struct lagg_softc *sc) LAGG_XLOCK_ASSERT(sc); + /* LACP handles link state itself */ + if (sc->sc_proto == LAGG_PROTO_LACP) + return; + /* Our link is considered up if at least one of our ports is active */ LAGG_RLOCK(); CK_SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) {