From nobody Wed Apr 27 17:40:52 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 F065E1AA9E26; Wed, 27 Apr 2022 17:40:52 +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 4KpQyX45YLz4g0t; Wed, 27 Apr 2022 17:40:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651081252; 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=BfJVnaYqOWYV/bxFaPzn9CmzQHBl7q8STjX/ffxGeOE=; b=LAL083+pHASvy+du4pDu53DKSoQhtjAF/lTbeddJEawrz/O/ETxrLcdwAioGdeCGIqILVg mdZ20ReTBEJPaZTo/DIPaIOiNyrihgSstt1dGGcHpA4w2boNOlBdKBW4PAwNFQZjXcZZ2x 3PJBixk7V1lbeMls2UQ/k+MHwWrAaX2k5yjQqZ7jG6jw4AxnI2YfnctWMEK7g4ddU39oX/ IiWzhtJpN1m5mrD9c7gUCezHxNvBhi0E0wTxIIm8WIxGhJUEfDedsvydfJWmuUUNbZKnlj /vBKSlPzSaP4itagOmPjxzaEhEJw1H4wzgHzhHvc1FRdWUbjReSfFEWE1/XBvQ== 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 3CA89446; Wed, 27 Apr 2022 17:40:52 +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 23RHeqgt007245; Wed, 27 Apr 2022 17:40:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23RHeqGm007244; Wed, 27 Apr 2022 17:40:52 GMT (envelope-from git) Date: Wed, 27 Apr 2022 17:40:52 GMT Message-Id: <202204271740.23RHeqGm007244@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: 59fc91f952eb - stable/12 - 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/12 X-Git-Reftype: branch X-Git-Commit: 59fc91f952eb678f4c7b97495f5c45b9bf1e1639 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651081252; 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=BfJVnaYqOWYV/bxFaPzn9CmzQHBl7q8STjX/ffxGeOE=; b=olG70t76S+773aaXi+fdZxO1+bH/ck+++rYdIyxUND62Yn4VoSExI9kJ5NmxMhBjbKwkrB xELI6r3cXahJDzPaoC1KHd1XatAnCG0QxhHIPRTSdIIw/XEvSmP6yqV1He60kxwlyQlRYG RB5FQOB2Anv9iqr0/kI7vKX+VO0lP9/5nWlB+JxEvycSTknT1OqihEWuuIbXHCrtr6zRnY 2/IlYWKA6xGLWX86LbpeWw6MlgLE+D4gBoPzSwTAJXkVaCeeSFnHcC0HOktt8WO97PHjzD 1jE8pABxK5x4W/10GSYArLW/DYgOBfN8bzcE3bS7C9Xx8izVdFh+CWAQ9g0EVQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651081252; a=rsa-sha256; cv=none; b=Jp3dg/+L6YDJ8zVgzbsYjlmS8omzeiHN5RiJxEKi/fZ+wfCToqMLPXwkVik60AcB7dvyOB iCZSRIHHp49xAkSdXQ9OFh5uNFt/E2J13bUTG4sakWhn91WVJatpyiu1QJnMixkV0Qx53f dBd03SE5g9uY8gsGRwbn5XzDz7uQlBIn/GuMbTN9Uwkteg9CgJFIE4wEbvpFSQz/VE+0FI ee4te95HhvERsjVX4m/7r4xLg0lxQEnM5ZeE/yucBqqRdwf/8yTEHwyJAc5TOa/QwlaxVY ZnMdG9DL22HDgBmgszsR+tfqjF+CU1OOODYzpcA2OAF94K/DytlJDgzo9KPN7g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=59fc91f952eb678f4c7b97495f5c45b9bf1e1639 commit 59fc91f952eb678f4c7b97495f5c45b9bf1e1639 Author: J.R. Oldroyd AuthorDate: 2022-04-13 16:11:30 +0000 Commit: Kevin Bowling CommitDate: 2022-04-27 17:36:48 +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 d7b4ab61303a..7e854514aafb 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -1629,20 +1629,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");