From nobody Wed Apr 27 17:35:54 2022 X-Original-To: dev-commits-src-branches@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 EB4691AA8503; Wed, 27 Apr 2022 17:35: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KpQrp5L2Bz4dSn; Wed, 27 Apr 2022 17:35:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651080954; 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=v5X/emG7SrfOh404UfHK6pCwpoaZt2sEeWiTTzzqb/s=; b=B5jGZgTdsZX+eVAvEUdlqkGECysff/3OwusJaB5Cs2Qsa8ir396JXN02wDT3mHDzyqt/Vb GbKCFT6gi5FYcyo9r9blpq92ppa9DWR/o0iHNPJvQeJVrCTiPaygaL4zaS+XwymIEyoHcB 5HpUydThc6cyTJCvvLrwqR1AQwvY3ZJa0I9KSTXOWpYVkKdZf/X1rp6IovNE1soScTQrya DjC/fxWT6Fdp3N+N89DXaFQ+KektzPl3XCDcZ91524Q55SSqXFKEkub0tui9VrMa1FgNN1 7b/eYWHYYBzXaax6cwGDbExHqfxSAOaXPJ7i8VuIOBH0Clyy8FX2jW9caXFp5w== 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 7C3E84C5; Wed, 27 Apr 2022 17:35:54 +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 23RHZsUT098150; Wed, 27 Apr 2022 17:35:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23RHZsqH098149; Wed, 27 Apr 2022 17:35:54 GMT (envelope-from git) Date: Wed, 27 Apr 2022 17:35:54 GMT Message-Id: <202204271735.23RHZsqH098149@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 429adef6197f - stable/13 - e1000: Try auto-negotiation for fixed 100 or 10 configuration List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 429adef6197fd93c1ad0be6ff759ce8de48a4fa5 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651080954; 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=v5X/emG7SrfOh404UfHK6pCwpoaZt2sEeWiTTzzqb/s=; b=UMhmdHadweoubjs45xPW03qwLXeVM9Lz/JH//b6TWkZEQ8+nV1rk+OGpd1Me3t1kUu6unz 18zrWE2IteYtHbkYLCM7pg1aTRGVXSJVNl93kq23g3mLZsp6jxEUZMAFQCkbpkzSKDgPZg BboNRekcnBml4KPSHHEtb3Z3Ggk/2RzSgJMRZ+VCOxX3mMFxM7gJFQbBJYC97B+GXGtwp6 cRnTlho41uvBma5DrANHWu1I20Gn2O9Yz9O15yTr9g8SgPaVglv/WlzBkCfuvcUs16Ys94 0vOOeDYSuw+MywSMpZcWzJJTvNnhzQXlI+U7E0jQJj1m9P6iA3g28hGttVKI+w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651080954; a=rsa-sha256; cv=none; b=Yp4dRDUNFgdgj0pvoPIpsZ0kQyWrCaC0VLP3yfUU7Owgrc88Ff7dFpkrP1IEj0YUiuLMxr Y06MXe34ReKBy77WQT4mwD8cQcysTEb+Wf9vyp+5uAuECTmdOfXr114yDjayH/jdsODBn/ AH4hWACWsL0IET+iWdB5KTPAME79dMUyspo8WPXdN2GMAy4X8zJee9TlcWhFSUyXmr9opb lmyTdTNVazjxkoZ3LV6VtID0vyf0Ou5WJBuKV7S9zLpwlcDkIx+Ookusxi5XOMoa4qjVOO dS+n9wVScBsNB8JrHmX0aFsscBos9iP1IJAsJcB5m4IerqUzqHBpk8ObX9L0mQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=429adef6197fd93c1ad0be6ff759ce8de48a4fa5 commit 429adef6197fd93c1ad0be6ff759ce8de48a4fa5 Author: J.R. Oldroyd AuthorDate: 2022-04-13 16:11:30 +0000 Commit: Kevin Bowling CommitDate: 2022-04-27 17:35:28 +0000 e1000: Try auto-negotiation for fixed 100 or 10 configuration Currently if an e1000 interface is set to a fixed media configuration, for gigabit, it will participate in auto-negotiation as required by IEEE 802.3-2018 Clause 37. However, if set to fixed media configuration for 100 or 10, it does NOT participate in auto-negotiation. By my reading of Clauses 28 and 37, while auto-negotiation is optional for 100 and 10, it is not prohibited and is, in fact, "highly recommended". This patch enables auto-negotiation for fixed 100 and 10 media configuration, in a similar manner to that already performed for 1000. I.e., the patch enables advertising of just the manually configured settings with the goal of allowing the remote end to match the manually configured settings if it has them available. To be clear, this patch does NOT allow an em(4) interface that has been manually configured with specific media settings to respond to auto-negotiation by then configuring different parameters to those that were manually configured. The intent of this patch is to fully comply with the requirements of Clause 37, but for 100 and 10. The need for this has arisen on an em(4) link where the other end is under a different administrative control and is set to full auto-negotiation. Due to the cable length GigE is not working well. It is desired to set the em(4) end to "media 100baseTX mediatype full-duplex" which does work when both ends are configured that way. Currently, because em(4) does not participate in autoneg for this setting, the remote defaults to half-duplex - i.e., there's a duplex mismatch and things don't work. With this patch, em(4) would inform the remote that it has only 100baseTX full, the remote would match that and it will work. Approved by: erj Differential Revision: https://reviews.freebsd.org/D34449 (cherry picked from commit 9ab4dfce8feda8cf3545be0c3c7569095b1fcd24) --- sys/dev/e1000/if_em.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index b3871361d335..f9d3edbd59a6 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -1628,20 +1628,24 @@ em_if_media_change(if_ctx_t ctx) sc->hw.phy.autoneg_advertised = ADVERTISE_1000_FULL; break; case IFM_100_TX: - sc->hw.mac.autoneg = false; - sc->hw.phy.autoneg_advertised = 0; - if ((ifm->ifm_media & IFM_GMASK) == IFM_FDX) + sc->hw.mac.autoneg = DO_AUTO_NEG; + if ((ifm->ifm_media & IFM_GMASK) == IFM_FDX) { + sc->hw.phy.autoneg_advertised = ADVERTISE_100_FULL; sc->hw.mac.forced_speed_duplex = ADVERTISE_100_FULL; - else + } else { + sc->hw.phy.autoneg_advertised = ADVERTISE_100_HALF; sc->hw.mac.forced_speed_duplex = ADVERTISE_100_HALF; + } break; case IFM_10_T: - sc->hw.mac.autoneg = false; - sc->hw.phy.autoneg_advertised = 0; - if ((ifm->ifm_media & IFM_GMASK) == IFM_FDX) + sc->hw.mac.autoneg = DO_AUTO_NEG; + if ((ifm->ifm_media & IFM_GMASK) == IFM_FDX) { + sc->hw.phy.autoneg_advertised = ADVERTISE_10_FULL; sc->hw.mac.forced_speed_duplex = ADVERTISE_10_FULL; - else + } else { + sc->hw.phy.autoneg_advertised = ADVERTISE_10_HALF; sc->hw.mac.forced_speed_duplex = ADVERTISE_10_HALF; + } break; default: device_printf(sc->dev, "Unsupported media type\n");