Bug 92599

Summary: BUG: IEEE 802.3 compliance of autonegotiation process
Product: Base System Reporter: Rene de Vries <rene>
Component: kernAssignee: Pyun YongHyeon <yongari>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Rene de Vries 2006-01-31 11:50:01 UTC
	This patch fixes 3 problems:

	A. dcphy inadvertently accepts 100BASE-T4 technology
	When a link partner announces 100BASE-T4 capability,
	dcphy will accept and choose this technology, even though
	it is not supported and we don't announce it ourselves.
	dcphy should mask the link partner's announcement
	with our own capabilities, so we only accept the highest
	technology we commonly share.

	This bug is triggered when connecting SYM-based 21143 boards
	to a Cisco 3550 switch, which inadvertently announces 100BASE-T4
	capability even though it doesn't do 100BASE-T4.
	Symptom is dat the 21143 eventually switches to 100BASE-TX
	while the 3550 switch switches to 100BASE-TX,FDX, or the link
	may not come up at all.

	Files affected: 
	dev/mii/dcphy.c


	B. Autonegotiation selection order is wrong
	Autonegotiation selection is based on selecting
	the highest common technology both link partners will accept.
	For this to work, IEEE 802.3 defines a priority order
	in which the technologies are selected.
	As of IEEE 802.3-2002, annex 28B.3, the list is, from high to low:
		1000BASE-T full-duplex
		1000BASE-T 
		100BASE-T2 full-duplex
		100BASE-TX full-duplex
		100BASE-T2 
		100BASE-T4 
		100BASE-TX 
		10BASE-T full-duplex
		10BASE-T 

	However, the PHY code that reads the link partner capability
	registers and decides on the highest common technology,
	didn't use this order: the priority of 100BASE-T4 was too high
	(which helped to trigger bug A above).

	While I think that it is unlikely that we will encounter
	100BASE-T4 technology in the field in the future, 
	having a wrong order may lead to more bugs and incompatibilities
	so the testing order was changed to match the IEEE spec.

	Files affected:
	dev/mii/amphy.c
	dev/mii/dcphy.c
	dev/mii/nsphy.c
	dev/mii/rlphy.c
	dev/mii/tdkphy.c
	dev/mii/ukphy_subr.c
	dev/txp/if_txp.c


	C. if_txp: mask link partner's capability mask against
	   own capabilities
	From code inspection, it looks like we don't mask 
	the capabilities of the link partner against our own,
	which means that a technology may be selected that we
	don't support.

	The fix is roughly similar to B. above, but I didn't have
	a 3C990 to test with and hence this patch is untested.

	Files affected:
	dev/txp/if_txp.c


Author: Geert Jan de Groot

Fix: Diff against FreeBSD 6.0:
How-To-Repeat: 	See description
Comment 1 K. Macy freebsd_committer freebsd_triage 2007-11-16 02:01:31 UTC
Responsible Changed
From-To: freebsd-bugs->yongari


Please assign to appropriate person to import patches, or close. Thanks.
Comment 2 dfilter service freebsd_committer freebsd_triage 2007-11-16 10:25:44 UTC
yongari     2007-11-16 10:25:36 UTC

  FreeBSD src repository

  Modified files:
    sys/dev/mii          amphy.c nsphy.c rlphy.c tdkphy.c 
                         ukphy_subr.c 
    sys/dev/dc           dcphy.c 
    sys/dev/txp          if_txp.c 
  Log:
  IEEE 802.3 Annex 28B.3 explicitly specifies the following relative
  priorities of the technologies supported by 802.3 Selector Field
  value.
  
  1000BASE-T full duplex
  1000BASE-T
  100BASE-T2 full duplex
  100BASE-TX full duplex
  100BASE-T2
  100BASE-T4
  100BASE-TX
  10BASE-T full duplex
  10BAST-T
  
  However PHY drivers didn't honor the order such that 100BASE-T4 had
  higher priority than 100BASE-TX full duplex. Fix that long standing
  bugs such that have PHY drivers choose the highest common denominator
  ability.
  Fix a bug in dcphy which inadvertently aceepts 100BASE-T4.
  
  PR:     92599
  
  Revision  Changes    Path
  1.33      +4 -4      src/sys/dev/dc/dcphy.c
  1.23      +3 -3      src/sys/dev/mii/amphy.c
  1.29      +3 -3      src/sys/dev/mii/nsphy.c
  1.32      +3 -3      src/sys/dev/mii/rlphy.c
  1.23      +3 -3      src/sys/dev/mii/tdkphy.c
  1.10      +2 -2      src/sys/dev/mii/ukphy_subr.c
  1.47      +3 -3      src/sys/dev/txp/if_txp.c
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 3 dfilter service freebsd_committer freebsd_triage 2007-11-16 10:32:18 UTC
yongari     2007-11-16 10:32:10 UTC

  FreeBSD src repository

  Modified files:
    sys/dev/txp          if_txp.c 
  Log:
  Read MII_ANAR register and get common denominator ability.
  
  PR:     92599
  
  Revision  Changes    Path
  1.48      +6 -1      src/sys/dev/txp/if_txp.c
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 4 Pyun YongHyeon freebsd_committer freebsd_triage 2007-11-16 10:41:27 UTC
State Changed
From-To: open->patched

Patch committed to HEAD.
Comment 5 dfilter service freebsd_committer freebsd_triage 2008-02-03 04:12:12 UTC
yongari     2008-02-03 04:12:06 UTC

  FreeBSD src repository

  Modified files:        (Branch: RELENG_7)
    sys/dev/dc           dcphy.c 
    sys/dev/mii          amphy.c nsphy.c rlphy.c tdkphy.c 
                         ukphy_subr.c 
    sys/dev/txp          if_txp.c 
  Log:
  MFC fix for IEEE 802.3 compliance of auto-negotiation process.
    IEEE 802.3 Annex 28B.3 explicitly specifies the following relative
    priorities of the technologies supported by 802.3 Selector Field
    value.
  
    1000BASE-T full duplex
    1000BASE-T
    100BASE-T2 full duplex
    100BASE-TX full duplex
    100BASE-T2
    100BASE-T4
    100BASE-TX
    10BASE-T full duplex
    10BAST-T
  
    However PHY drivers didn't honor the order such that 100BASE-T4 had
    higher priority than 100BASE-TX full duplex. Fix that long standing
    bugs such that have PHY drivers choose the highest common denominator
    ability.
    Fix a bug in dcphy which inadvertently aceepts 100BASE-T4.
  
    PR:   92599
  
  Revision  Changes    Path
  1.32.2.1  +4 -4      src/sys/dev/dc/dcphy.c
  1.22.2.1  +3 -3      src/sys/dev/mii/amphy.c
  1.28.2.1  +3 -3      src/sys/dev/mii/nsphy.c
  1.31.2.1  +3 -3      src/sys/dev/mii/rlphy.c
  1.22.2.1  +3 -3      src/sys/dev/mii/tdkphy.c
  1.9.2.1   +2 -2      src/sys/dev/mii/ukphy_subr.c
  1.46.2.1  +3 -3      src/sys/dev/txp/if_txp.c
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 6 dfilter service freebsd_committer freebsd_triage 2008-02-03 04:16:35 UTC
yongari     2008-02-03 04:16:26 UTC

  FreeBSD src repository

  Modified files:        (Branch: RELENG_7)
    sys/dev/txp          if_txp.c 
  Log:
  MFC if_txp.c, rev 1.48 to RELENG_7.
    Read MII_ANAR register and get common denominator ability.
  
    PR:   92599
  
  Revision  Changes    Path
  1.46.2.2  +6 -1      src/sys/dev/txp/if_txp.c
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 7 Pyun YongHyeon freebsd_committer freebsd_triage 2008-02-03 04:53:52 UTC
State Changed
From-To: patched->closed

MFC done. Thanks for reporting!