From nobody Wed Apr 13 16:18:04 2022 X-Original-To: dev-commits-src-main@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 F17231B222D7; Wed, 13 Apr 2022 16:18:04 +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 4KdnnS6N4Mz4sFS; Wed, 13 Apr 2022 16:18:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649866684; 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=gUVdAnBKFZ+7uSdO9YsKsVmAtvSoUu3hpzhfRfcLhlw=; b=Refp+2qfkd0utP8Dm4ix+8wUPuoj/+4+mfE/Bf7smTSvh3OhJStJG/Oj3oytlGBfkNPBOR LlIaHuKAS7FLJitfHsduaDRMiV+AJYBQUa1WRKfeybgDsJcOkebdp50pUZyGEwEVCrXcHv Iy3hrgSrZATEFU3iHJ82cAUcrdh5uLc1ZGBhcsChQppjbAVg1xChW2h8CWcSSRtXus59wQ Y3G7CnobYyvIJdYGcas9ArLS0ch1OnEF8hQGnR1nGirNjqwFTaBMA3RvVs8morEng/gQ10 q54jlsIgRakbm44LsYj0Esl4jYjcK0iapWPXVxgclcDdLDxr+DRGbBlzz/kO4g== 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 B81C07455; Wed, 13 Apr 2022 16:18:04 +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 23DGI4QZ019031; Wed, 13 Apr 2022 16:18:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23DGI4Dr019030; Wed, 13 Apr 2022 16:18:04 GMT (envelope-from git) Date: Wed, 13 Apr 2022 16:18:04 GMT Message-Id: <202204131618.23DGI4Dr019030@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 9ab4dfce8fed - main - e1000: Try auto-negotiation for fixed 100 or 10 configuration List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 9ab4dfce8feda8cf3545be0c3c7569095b1fcd24 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649866684; 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=gUVdAnBKFZ+7uSdO9YsKsVmAtvSoUu3hpzhfRfcLhlw=; b=KgI2RxAc3iINJOMBe7uuwN3QGC0XPBMrQMN1fYa5gCawXQgpUfpldKA8O6MLwdOo4qx8OT YqLtqlVAgT4uJYyP+vwct5OFlNW3BX8u5Z7SJCos4NMsiSaLMfCnc3D3YcL7/X0EAk3OPD OSgVFFrk2+HGIOSPPvCgZo0ez4/6EMJjPwPyvN9mF90wSPeVNRSU7sJGXVEb/c0tbFV/jT Cs8fdSdxSXFmzfNLizGqgansISVuugBVGoyLyzqKLxLgBnp043chLZg5XajVEVVJazsUR6 WpBCHkdhO3w63BoL+9UdMxuVDDQTIk5lGzyXWlDvBCjezrOSXhh601boxJ+j6g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649866684; a=rsa-sha256; cv=none; b=Qo1bTskk7juLVX+MK4vmPmQ0xK5I1JIC6csw+0A3LqieeetYRm4v+rDL65hPBkNqoEPG2f W/tfxqGcZGD5pLRqYrYYxydNZ302vsBwTYOUg+CZhfQbeP+tRrPPgkVLlKNXTh8b5Xq7u3 o7vefOM0Ga9aXnn9jPippDKU7empAfW7ILrR1VcDbMBQ0ycwz+OVkHhrw69wBhfWWsxC2J D3yyl3lkncFWLlLsHKHgEhfWNjAevmKZxc1MT1Be85+f4QqKr52S3ZHUu+5i5T8RpHjAG+ P0z4lOf/LG7OiTVd5cOSCA1STCM7ypc0pxvsE1ZHqu9EmxQlz248kSSUrF4kPQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=9ab4dfce8feda8cf3545be0c3c7569095b1fcd24 commit 9ab4dfce8feda8cf3545be0c3c7569095b1fcd24 Author: J.R. Oldroyd AuthorDate: 2022-04-13 16:11:30 +0000 Commit: Kevin Bowling CommitDate: 2022-04-13 16:17:32 +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 MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D34449 --- 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");