From nobody Tue Jun 2 22:50:49 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4gVQzL5HfNz6gZbS for ; Tue, 02 Jun 2026 22:50:54 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gVQzL3PQLz3fyP for ; Tue, 02 Jun 2026 22:50:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780440654; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Pm+hsEzerVWmI15bUN83NSS+I9uICdkzPLPHw0KrDK4=; b=QX1r3LSK88DOMdRm9DpOQcpJ2ryNehT4lly29PBYsjMKbTF44ZoBtiWyUv1Htkn3VLCgRW Csf1CfUPi+Ms2ooulOsphdu+M/88wBAOCQgb3ldn4f+zy4S/lF8PJ0kRoC6OnNz3zP7jz6 6ZgMTk2YJGPYz6B5OlshXTKc+bB+W/uAi36asYmYdfAC6gqB+jGU0FZnCDuV+f1ntN02Jw 6/2BktXZ1CGoNm+8u673sPvi84W+d7fgovh8SIjdWIbMKD6th8HhuXIGQa1T0T3MEaEV+0 coqvfJcaIn658zLJpnYv0pydAH0wcoYytWjzFtSJIiQ42/y1EGxSrXM7wA4Png== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780440654; a=rsa-sha256; cv=none; b=Iosy89c5OKdDmjyqwN2blisT8ygHtRjgWMebgxgkBW/xNLbGSj3+Ts0xPmdeH62ZACuD3P sLBAM9vmVd20SvjVoj4o2w4egaYVzSJVcFrRvK9OE+d6XjH0Hz8LTTa8mNs6x/3ohXaQJ4 u924C2mzPtlPGBMQR+i9L1gomZOCu7OugeCAQWvY2vj3NrIvsoGi4KqeCLIrRjdsHmTrDb PDWFJzf4YgoEpnXpZ6krQOi3oTijf41w0linqejdsgtEsapBEfw4U5x6RuEYLtit9cVgzK nxzi4DyCurhWOwOv/5p3O2LcLB1KSCARswZb7p+xXIG3IYBfzl/++TDig9/ADw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780440654; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Pm+hsEzerVWmI15bUN83NSS+I9uICdkzPLPHw0KrDK4=; b=H5W9nemsZKQoIBTn7iEp9McMjPofKLxoWlAqzjGSwfK2xSWLHp3p6j5cC3gcTIEo5jdGXV Eb5YOhmd7yojA8dlMTX366/lBe0lQMZu/O3OhEdtK818su6ZjjfJhoDjS2nkHPEUIHJB7R WVKkVQH9VRUgb53Rvz/59EwUx77RsqPsN2ky0OjuaAZlmcCFKyRwmjQqPihaofeCrUR/zf 8+BhnEEu0y04L7Kw+0SvulLfc0IjlpMKWVxANhWD1mkyE+fVhrqK3++3dJzMY6aaRRLO3Z nRSgX4z9QSlvUCvdVdFTZwBLGb1IZERDzxFbz03lMQrs5jPWjbmg8qLx8WS+aA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gVQzL2xz1zkx8 for ; Tue, 02 Jun 2026 22:50:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 451af by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 02 Jun 2026 22:50:49 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Gallatin Subject: git: e98ed8d99fd4 - main - lacp: Simplify lacp_compose_key() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gallatin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e98ed8d99fd41873dc52cf78e70e9f12e3e93042 Auto-Submitted: auto-generated Date: Tue, 02 Jun 2026 22:50:49 +0000 Message-Id: <6a1f5e49.451af.57d1a72@gitrepo.freebsd.org> The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=e98ed8d99fd41873dc52cf78e70e9f12e3e93042 commit e98ed8d99fd41873dc52cf78e70e9f12e3e93042 Author: Andrew Gallatin AuthorDate: 2026-06-02 16:18:03 +0000 Commit: Andrew Gallatin CommitDate: 2026-06-02 22:49:25 +0000 lacp: Simplify lacp_compose_key() lacp uses interface speed to separate lacp members into different aggregation groups. It wants to use the lower 4 bits of the key to represent the speed. This change fixes a few bugs around that: 1) Actually use the baud rate reported by the interface as the speed (and fall back to use the baudrate associated with the media if the interface somehow doesn't support if_baudrate) 2) Compressess the baud rates down to the 4 bits reserved for them. Using things like FM_400G_FR8 does not fit in 4 bits (its value is 0x1811) . In fact, interfaces faster than 1Gb/s don't fit in 4 bits using the old scheme 3) Emits a warning on the console once per boot if it encounters a NIC with an unsupported speed to make it slightly more obvious why LACP might not behave as expected. This was prompted by a 400g nic with a broken media detection reporting "unknown" as its speed, and being unable to be in the same aggregation group with a different 400g nic that was properly reporting its speed. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D57026 Reviewed by: slavash --- sys/net/ieee8023ad_lacp.c | 173 +++++++++++----------------------------------- 1 file changed, 40 insertions(+), 133 deletions(-) diff --git a/sys/net/ieee8023ad_lacp.c b/sys/net/ieee8023ad_lacp.c index 8c695f71cc0f..99eee570c2a2 100644 --- a/sys/net/ieee8023ad_lacp.c +++ b/sys/net/ieee8023ad_lacp.c @@ -1129,8 +1129,10 @@ lacp_compose_key(struct lacp_port *lp) { struct lagg_port *lgp = lp->lp_lagg; struct lagg_softc *sc = lgp->lp_softc; + uint64_t baudrate; u_int media = lp->lp_media; uint16_t key; + static bool warned; if ((lp->lp_state & LACP_STATE_AGGREGATION) == 0) { /* @@ -1149,155 +1151,60 @@ lacp_compose_key(struct lacp_port *lp) KASSERT(IFM_TYPE(media) == IFM_ETHER, ("invalid media type")); KASSERT((media & IFM_FDX) != 0, ("aggregating HDX interface")); - /* bit 0..4: IFM_SUBTYPE modulo speed */ - switch (subtype) { - case IFM_10_T: - case IFM_10_2: - case IFM_10_5: - case IFM_10_STP: - case IFM_10_FL: - key = IFM_10_T; + baudrate = lp->lp_ifp->if_baudrate; + if (baudrate == 0) + baudrate = ifmedia_baudrate(media); + /* bit 0..4: encoded speed */ + switch (baudrate) { + case IF_Mbps(10): + key = 1; break; - case IFM_100_TX: - case IFM_100_FX: - case IFM_100_T4: - case IFM_100_VG: - case IFM_100_T2: - case IFM_100_T: - case IFM_100_SGMII: - case IFM_100_BX: - key = IFM_100_TX; + case IF_Mbps(100): + key = 2; break; - case IFM_1000_SX: - case IFM_1000_LX: - case IFM_1000_CX: - case IFM_1000_T: - case IFM_1000_KX: - case IFM_1000_SGMII: - case IFM_1000_CX_SGMII: - case IFM_1000_BX: - key = IFM_1000_SX; + case IF_Gbps(1): + key = 3; break; - case IFM_10G_LR: - case IFM_10G_SR: - case IFM_10G_CX4: - case IFM_10G_TWINAX: - case IFM_10G_TWINAX_LONG: - case IFM_10G_LRM: - case IFM_10G_T: - case IFM_10G_KX4: - case IFM_10G_KR: - case IFM_10G_CR1: - case IFM_10G_ER: - case IFM_10G_SFI: - case IFM_10G_AOC: - key = IFM_10G_LR; + case IF_Mbps(2500): + key = 4; break; - case IFM_20G_KR2: - key = IFM_20G_KR2; + case IF_Gbps(5): + key = 5; break; - case IFM_2500_KX: - case IFM_2500_T: - case IFM_2500_X: - key = IFM_2500_KX; + case IF_Gbps(10): + key = 6; break; - case IFM_5000_T: - case IFM_5000_KR: - case IFM_5000_KR_S: - case IFM_5000_KR1: - key = IFM_5000_T; + case IF_Gbps(20): + key = 7; break; - case IFM_50G_PCIE: - case IFM_50G_CR2: - case IFM_50G_KR2: - case IFM_50G_KR4: - case IFM_50G_SR2: - case IFM_50G_LR2: - case IFM_50G_LAUI2_AC: - case IFM_50G_LAUI2: - case IFM_50G_AUI2_AC: - case IFM_50G_AUI2: - case IFM_50G_CP: - case IFM_50G_SR: - case IFM_50G_LR: - case IFM_50G_FR: - case IFM_50G_KR_PAM4: - case IFM_50G_AUI1_AC: - case IFM_50G_AUI1: - key = IFM_50G_PCIE; + case IF_Gbps(25): + key = 8; break; - case IFM_56G_R4: - key = IFM_56G_R4; + case IF_Gbps(40): + key = 9; break; - case IFM_25G_PCIE: - case IFM_25G_CR: - case IFM_25G_KR: - case IFM_25G_SR: - case IFM_25G_LR: - case IFM_25G_ACC: - case IFM_25G_AOC: - case IFM_25G_T: - case IFM_25G_CR_S: - case IFM_25G_CR1: - case IFM_25G_KR_S: - case IFM_25G_AUI: - case IFM_25G_KR1: - key = IFM_25G_PCIE; + case IF_Gbps(50): + key = 10; break; - case IFM_40G_CR4: - case IFM_40G_SR4: - case IFM_40G_LR4: - case IFM_40G_LM4: - case IFM_40G_XLPPI: - case IFM_40G_KR4: - case IFM_40G_XLAUI: - case IFM_40G_XLAUI_AC: - case IFM_40G_ER4: - key = IFM_40G_CR4; + case IF_Gbps(56): + key = 11; break; - case IFM_100G_CR4: - case IFM_100G_SR4: - case IFM_100G_KR4: - case IFM_100G_LR4: - case IFM_100G_CAUI4_AC: - case IFM_100G_CAUI4: - case IFM_100G_AUI4_AC: - case IFM_100G_AUI4: - case IFM_100G_CR_PAM4: - case IFM_100G_KR_PAM4: - case IFM_100G_CP2: - case IFM_100G_SR2: - case IFM_100G_DR: - case IFM_100G_KR2_PAM4: - case IFM_100G_CAUI2_AC: - case IFM_100G_CAUI2: - case IFM_100G_AUI2_AC: - case IFM_100G_AUI2: - key = IFM_100G_CR4; + case IF_Gbps(100): + key = 12; break; - case IFM_200G_CR4_PAM4: - case IFM_200G_SR4: - case IFM_200G_FR4: - case IFM_200G_LR4: - case IFM_200G_DR4: - case IFM_200G_KR4_PAM4: - case IFM_200G_AUI4_AC: - case IFM_200G_AUI4: - case IFM_200G_AUI8_AC: - case IFM_200G_AUI8: - key = IFM_200G_CR4_PAM4; + case IF_Gbps(200): + key = 13; break; - case IFM_400G_FR8: - case IFM_400G_LR8: - case IFM_400G_DR4: - case IFM_400G_AUI8_AC: - case IFM_400G_AUI8: - case IFM_400G_SR8: - case IFM_400G_CR8: - key = IFM_400G_FR8; + case IF_Gbps(400): + key = 14; break; default: key = subtype; + if (!warned) { + printf("%s LACP: support %ju baudrate!\n", + lp->lp_ifp->if_xname, baudrate); + warned = true; + } break; } /* bit 5..14: (some bits of) if_index of lagg device */