From owner-dev-commits-src-branches@freebsd.org Tue Jan 12 16:40:44 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD6574DE24D; Tue, 12 Jan 2021 16:40:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DFbt44BqQz3mwq; Tue, 12 Jan 2021 16:40:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 830671A3; Tue, 12 Jan 2021 16:40:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10CGeiCn082671; Tue, 12 Jan 2021 16:40:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10CGeiH9082670; Tue, 12 Jan 2021 16:40:44 GMT (envelope-from git) Date: Tue, 12 Jan 2021 16:40:44 GMT Message-Id: <202101121640.10CGeiH9082670@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 5a6dd9d6f4f8 - stable/12 - MFC 19ecb5e8dabe: Fix for IPoIB over lagg(4). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 5a6dd9d6f4f8e9cfa084edc36ca650375ba4a322 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jan 2021 16:40:44 -0000 The branch stable/12 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=5a6dd9d6f4f8e9cfa084edc36ca650375ba4a322 commit 5a6dd9d6f4f8e9cfa084edc36ca650375ba4a322 Author: Hans Petter Selasky AuthorDate: 2020-12-29 16:34:01 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-12 16:35:49 +0000 MFC 19ecb5e8dabe: Fix for IPoIB over lagg(4). Need to update both link layer address and broadcast address when active link changes for IP over infiniband. This is because the broadcast address contains the so-called P-key, which is interface dependent. Reviewed by: kib @ Differential Revision: https://reviews.freebsd.org/D27658 Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/net/if_lagg.c | 12 +++++------- sys/net/if_lagg.h | 5 +++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c index 4699a6b8d769..049978bcfd6c 100644 --- a/sys/net/if_lagg.c +++ b/sys/net/if_lagg.c @@ -496,11 +496,6 @@ lagg_clone_create(struct if_clone *ifc, int unit, caddr_t params) int if_type; int error; static const uint8_t eaddr[LAGG_ADDR_LEN]; - static const uint8_t ib_bcast_addr[INFINIBAND_ADDR_LEN] = { - 0x00, 0xff, 0xff, 0xff, - 0xff, 0x12, 0x40, 0x1b, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff - }; if (params != NULL) { error = copyin(params, &iflp, sizeof(iflp)); @@ -582,7 +577,7 @@ lagg_clone_create(struct if_clone *ifc, int unit, caddr_t params) ether_ifattach(ifp, eaddr); break; case IFT_INFINIBAND: - infiniband_ifattach(ifp, eaddr, ib_bcast_addr); + infiniband_ifattach(ifp, eaddr, sc->sc_bcast_addr); break; default: break; @@ -1214,8 +1209,11 @@ lagg_watchdog_infiniband(void *arg) lp_ifp = lp->lp_ifp; if (ifp != NULL && lp_ifp != NULL && - memcmp(IF_LLADDR(ifp), IF_LLADDR(lp_ifp), ifp->if_addrlen) != 0) { + (memcmp(IF_LLADDR(ifp), IF_LLADDR(lp_ifp), ifp->if_addrlen) != 0 || + memcmp(sc->sc_bcast_addr, lp_ifp->if_broadcastaddr, ifp->if_addrlen) != 0)) { memcpy(IF_LLADDR(ifp), IF_LLADDR(lp_ifp), ifp->if_addrlen); + memcpy(sc->sc_bcast_addr, lp_ifp->if_broadcastaddr, ifp->if_addrlen); + CURVNET_SET(ifp->if_vnet); EVENTHANDLER_INVOKE(iflladdr_event, ifp); CURVNET_RESTORE(); diff --git a/sys/net/if_lagg.h b/sys/net/if_lagg.h index 2a7796748786..de0fdd712b3e 100644 --- a/sys/net/if_lagg.h +++ b/sys/net/if_lagg.h @@ -257,13 +257,14 @@ struct lagg_softc { int flowid_shift; /* shift the flowid */ struct lagg_counters detached_counters; /* detached ports sum */ struct callout sc_watchdog; /* watchdog timer */ +#define LAGG_ADDR_LEN \ + MAX(INFINIBAND_ADDR_LEN, ETHER_ADDR_LEN) + uint8_t sc_bcast_addr[LAGG_ADDR_LEN]; }; struct lagg_port { struct ifnet *lp_ifp; /* physical interface */ struct lagg_softc *lp_softc; /* parent lagg */ -#define LAGG_ADDR_LEN \ - MAX(INFINIBAND_ADDR_LEN, ETHER_ADDR_LEN) uint8_t lp_lladdr[LAGG_ADDR_LEN]; u_char lp_iftype; /* interface type */