Module Name:    src
Committed By:   msaitoh
Date:           Thu Apr 11 08:50:20 UTC 2019

Modified Files:
        src/sys/dev/mii: brgphy.c ciphy.c rgephy.c

Log Message:
 Fix a bug that the duplex of manual media setting may be wrong
when the IFM_GMASK bit other than IFM_[FH]DX is set. Same as a part of
FreeBSD r217413.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/dev/mii/brgphy.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/mii/ciphy.c
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/mii/rgephy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/brgphy.c
diff -u src/sys/dev/mii/brgphy.c:1.83 src/sys/dev/mii/brgphy.c:1.84
--- src/sys/dev/mii/brgphy.c:1.83	Mon Mar 25 09:20:46 2019
+++ src/sys/dev/mii/brgphy.c	Thu Apr 11 08:50:20 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: brgphy.c,v 1.83 2019/03/25 09:20:46 msaitoh Exp $	*/
+/*	$NetBSD: brgphy.c,v 1.84 2019/04/11 08:50:20 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.83 2019/03/25 09:20:46 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.84 2019/04/11 08:50:20 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -351,7 +351,7 @@ brgphy_service(struct mii_softc *sc, str
 			speed = BMCR_S10;
 setit:
 			brgphy_loop(sc);
-			if ((ife->ifm_media & IFM_GMASK) == IFM_FDX) {
+			if ((ife->ifm_media & IFM_FDX) != 0) {
 				speed |= BMCR_FDX;
 				gig = GTCR_ADV_1000TFDX;
 			} else

Index: src/sys/dev/mii/ciphy.c
diff -u src/sys/dev/mii/ciphy.c:1.32 src/sys/dev/mii/ciphy.c:1.33
--- src/sys/dev/mii/ciphy.c:1.32	Mon Mar 25 09:20:46 2019
+++ src/sys/dev/mii/ciphy.c	Thu Apr 11 08:50:20 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ciphy.c,v 1.32 2019/03/25 09:20:46 msaitoh Exp $ */
+/* $NetBSD: ciphy.c,v 1.33 2019/04/11 08:50:20 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2004
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.32 2019/03/25 09:20:46 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.33 2019/04/11 08:50:20 msaitoh Exp $");
 
 /*
  * Driver for the Cicada CS8201 10/100/1000 copper PHY.
@@ -184,7 +184,7 @@ ciphy_service(struct mii_softc *sc, stru
 		case IFM_10_T:
 			speed = BMCR_S10;
 setit:
-			if ((ife->ifm_media & IFM_GMASK) == IFM_FDX) {
+			if ((ife->ifm_media & IFM_FDX) != 0) {
 				speed |= BMCR_FDX;
 				gig = GTCR_ADV_1000TFDX;
 			} else

Index: src/sys/dev/mii/rgephy.c
diff -u src/sys/dev/mii/rgephy.c:1.52 src/sys/dev/mii/rgephy.c:1.53
--- src/sys/dev/mii/rgephy.c:1.52	Mon Mar 25 09:20:46 2019
+++ src/sys/dev/mii/rgephy.c	Thu Apr 11 08:50:20 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rgephy.c,v 1.52 2019/03/25 09:20:46 msaitoh Exp $	*/
+/*	$NetBSD: rgephy.c,v 1.53 2019/04/11 08:50:20 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2003
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rgephy.c,v 1.52 2019/03/25 09:20:46 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rgephy.c,v 1.53 2019/04/11 08:50:20 msaitoh Exp $");
 
 
 /*
@@ -231,7 +231,7 @@ rgephy_service(struct mii_softc *sc, str
 			anar |= ANAR_10_FD | ANAR_10;
  setit:
 			rgephy_loop(sc);
-			if ((ife->ifm_media & IFM_GMASK) == IFM_FDX) {
+			if ((ife->ifm_media & IFM_FDX) != 0) {
 				speed |= BMCR_FDX;
 				gig = GTCR_ADV_1000TFDX;
 				anar &= ~(ANAR_TX | ANAR_10);

Reply via email to