Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Jan 2021 16:40:44 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 5a6dd9d6f4f8 - stable/12 - MFC 19ecb5e8dabe: Fix for IPoIB over lagg(4).
Message-ID:  <202101121640.10CGeiH9082670@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by hselasky:

URL: https://cgit.FreeBSD.org/src/commit/?id=5a6dd9d6f4f8e9cfa084edc36ca650375ba4a322

commit 5a6dd9d6f4f8e9cfa084edc36ca650375ba4a322
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2020-12-29 16:34:01 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101121640.10CGeiH9082670>