NetBSD Problem Report #50527

From www@NetBSD.org  Fri Dec 11 09:48:55 2015
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.NetBSD.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id D91B9A667D
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 11 Dec 2015 09:48:55 +0000 (UTC)
Message-Id: <20151211094855.103C5A6682@mollari.NetBSD.org>
Date: Fri, 11 Dec 2015 09:48:55 +0000 (UTC)
From: dcb314@hotmail.com
Reply-To: dcb314@hotmail.com
To: gnats-bugs@NetBSD.org
Subject: src/sys/dev/pci/if_wm.c:3108: bad test ?
X-Send-Pr-Version: www-1.0

>Number:         50527
>Category:       kern
>Synopsis:       src/sys/dev/pci/if_wm.c:3108: bad test ?
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Dec 11 09:50:00 +0000 2015
>Closed-Date:    Sun Dec 13 20:27:23 +0000 2015
>Last-Modified:  Fri May 06 18:45:01 +0000 2016
>Originator:     David Binderman
>Release:        cvs dated 20151210
>Organization:
>Environment:
>Description:
[src/sys/dev/pci/if_wm.c:3108]: (style) Expression '(X & 0xe) == 0x1' is always false.

  if (sc->sc_type == WM_T_82544 && (reg & 0xe) == 1) {

Another case of wrong code on initial inspection.

>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/50527 CVS commit: src/sys/dev/pci
Date: Sun, 13 Dec 2015 14:06:43 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Sun Dec 13 19:06:43 UTC 2015

 Modified Files:
 	src/sys/dev/pci: if_wm.c

 Log Message:
 PR/50527: David Binderman: Fix impossible code. Odd offsets need special
 treatment.


 To generate a diff of this commit:
 cvs rdiff -u -r1.381 -r1.382 src/sys/dev/pci/if_wm.c

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

State-Changed-From-To: open->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Sun, 13 Dec 2015 20:27:23 +0000
State-Changed-Why:
christos fixed it.


From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/50527 CVS commit: [netbsd-7] src/sys/dev
Date: Fri, 26 Feb 2016 22:08:17 +0000

 Module Name:	src
 Committed By:	snj
 Date:		Fri Feb 26 22:08:17 UTC 2016

 Modified Files:
 	src/sys/dev/mii [netbsd-7]: igphy.c ukphy.c
 	src/sys/dev/pci [netbsd-7]: if_wm.c if_wmreg.h if_wmvar.h

 Log Message:
 Pull up following revision(s) (requested by msaitoh in ticket #1102):
 	sys/dev/mii/igphy.c: 1.25
 	sys/dev/mii/ukphy.c: 1.48
 	sys/dev/pci/if_wm.c: revisions 1.308, 1.318, 1.320, 1.324-1.332, 1.334, 1.336, 1.343-1.344, 1.347-1.348, 1.350, 1.376-1.382, 1.386-1.389 via patch
 	sys/dev/pci/if_wmreg.h: revisions 1.68-1.70, 1.73-1.77, 1.79-1.80, 1.82, 1.86-1.88 via patch
 	sys/dev/pci/if_wmvar.h: revisions 1.22-1.23, 1.25-1.30 via patch
 Sync wm(4) as of if_wm.c rev 1.389 except MSI/MSI-X, multiqueue and NET_MPSAFE:
 - Add C2000 KX and 2.5G support.
 - Set ICH9 and ICH10's PBA size to 14K if the RX buffer size is more than
   4096. Almost the same as other OSes.
 - For 82576 and newer devices, the PBA register is deleted. Don't write PBA
   for those chips. Also change the calculation of RX packet buffer size in
   new way.
 - Fix a lot of bugs to make 82575 and newer SERDES based systems work.
 - Print NVM image version and option ROM version.
 - Add workaround for I210 Errata 25 and I211 Errata 10 (PLL bug). This
   workaround is required if the NVM image version < 3.25.
 - Fix a bug that wm_detach() didn't unmap the FHASH's area. Now
   "drvct -d wm0" -> "drvctl -r pci0" works on ICH* and PCH*.
 - Add workaround for 82574 Errata 25 and 82583 Errata 12 "Dropped RX packets"
   and for 82573 (unknown). Set GCR_L1_ACT_WITHOUT_L0S_RX bit. The NVM Image
   version 2.1.4 and newer have this workaround.
 - Check PHY type correctly. This change is required to use igphy(4) device
   correctly.
 - Disable LPLU (Low Power Link Up) on D0 state on 82574, 82583 and ICH* too.
 - Call wm_get_hw_control() correctly. This change fixes a bug that some AMT
   based systems doesn't linkup at 1000BaseT. The problem was observed on HP
   Compaq dc7700. A lot of fixes have been done for wm(4) and igphy(4), so now
   PR#44893 should be fixed.
 - Call wm_get_wakeup(sc) before checking WM_F_HAS_AMT. It's required to
   check the existence of AMT correctly.
 - Fix a problem that wm_gate_hw_phy_config_ich8lan() isn't called in
   wm_reset() on PCH2.
 - Clear WMREG_WUC in wm_reset() if the chip >= 82544. This might fix the
   behavior on suspend/resume.
 - Fix logic of wm_check_reset_block() on ICH* and PCH*. This change might fix
   a problem that PHY's read/write functions can't get semaphore.
 - On ICH8, call wm_gig_downshift_workaround_ich8lan() when link changed down.
 - Drop PHY_CTRL_GBE_DIS explicitly in wm_lplu_d0_disable() in case BIOS sets
   this bit.
 - Fix two bugs in wm_kmrn_lock_loss_workaround_ich8lan(). Now the function
   checks the status correctly but it causes linkdown up to 10 times, so it's
   disabled for the time being.
 - PR/50527: David Binderman: Fix impossible code. Odd offsets need special
   treatment.
 - Fix RAL table's size of PCH2 and PCH_LPT.
 - PCH_LPT (and newer device) is required to check FWSM_WLOCK_MAC bit to
   determine the range of the RAL.
 - Use sc->sc_itr instead of hard-coded number.
 - Rename wm_tbi_check_link() to wm_tbi_tick() because this function acts as
   mii_tick().
 - ACK Accelerate Disable in the RFCTL register is not bit 13 but 12.
   No binary change because this definition has not used yet.
 - Add ACK data Disable bit's definition (not used yet).
 - PHY_CTRL_GBE_DIS is not bit 4 but bit 6. This change has no any effect by
   default because WM_WOL is not defined yet and
   m_kmrn_lock_loss_workaround_ich8lan() is broken.
 - Fix wm_check_mng_mode_ich8lan(). This function is used only when WM_WOL is
   defined and it's disabled by default.
 - Rename wm_check_reset_block() to wm_phy_resetisblocked() and make it returns
   bool. No functional change.
 - Reorder function definitions and macro definitions. No functional change.
 - Fix comment. Add comment. Update comment.
 - KNF.


 To generate a diff of this commit:
 cvs rdiff -u -r1.23 -r1.23.2.1 src/sys/dev/mii/igphy.c
 cvs rdiff -u -r1.46 -r1.46.8.1 src/sys/dev/mii/ukphy.c
 cvs rdiff -u -r1.289.2.8 -r1.289.2.9 src/sys/dev/pci/if_wm.c
 cvs rdiff -u -r1.60.2.4 -r1.60.2.5 src/sys/dev/pci/if_wmreg.h
 cvs rdiff -u -r1.19.2.3 -r1.19.2.4 src/sys/dev/pci/if_wmvar.h

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

From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/50527 CVS commit: [netbsd-6] src/sys/dev
Date: Fri, 6 May 2016 18:43:35 +0000

 Module Name:	src
 Committed By:	snj
 Date:		Fri May  6 18:43:35 UTC 2016

 Modified Files:
 	src/sys/dev/mii [netbsd-6]: igphy.c ukphy.c
 	src/sys/dev/pci [netbsd-6]: if_wm.c if_wmreg.h if_wmvar.h

 Log Message:
 Pull up following revision(s) (requested by msaitoh in ticket #1366):
 	sys/dev/pci/if_wm.c: 1.281, 1.318, 1.320, 1.324-1.332, 1.334, 1.336, 1.343-1.344, 1.347-1.348, 1.350, 1.376-1.382, 1.386-1.387, 1.389 via patch
 	sys/dev/pci/if_wmreg.h: 1.68-1.70, 1.73-1.77, 1.79-1.80, 1.82, 1.86-1.88 via patch
 	sys/dev/pci/if_wmvar.h: 1.22-1.23, 1.25-1.30 via patch
 	sys/dev/mii/igphy.c: 1.25
 	sys/dev/mii/ukphy.c: 1.48
 Sync wm(4) as of if_wm.c rev 1.389 except SERDES, MSI/MSI-X, multiqueue
 and NET_MPSAFE:
 - Set ICH9 and ICH10's PBA size to 14K if the RX buffer size is more
   than 4096. Almost the same as other OSes.
 - For 82576 and newer devices, the PBA register is deleted. Don't write
   PBA for those chips. Also change the calculation of RX packet buffer
   size in new way.
 - Print NVM image version and option ROM version.
 - Add workaround for I210 Errata 25 and I211 Errata 10 (PLL bug). This
   workaround is required if the NVM image version < 3.25.
 - Fix a bug that wm_detach() didn't unmap the FHASH's area. Now
   "drvctl -d wm0" -> "drvctl -r pci0" works on ICH* and PCH*.
 - Add workaround for 82574 Errata 25 and 82583 Errata 12 "Dropped RX
   packets" and for 82573 (unknown). Set GCR_L1_ACT_WITHOUT_L0S_RX bit.
   The NVM Image version 2.1.4 and newer have this workaround.
 - Check PHY type correctly. This change is required to use igphy(4)
   device correctly.
 - Disable LPLU (Low Power Link Up) on D0 state on 82574, 82583 and ICH*
   too.
 - Call wm_get_hw_control() correctly. This change fixes a bug that some
   AMT based systems doesn't linkup at 1000BaseT. The problem was
   observed on HP Compaq dc7700. A lot of fixes have been done for wm(4)
   and igphy(4), so now PR#44893 should be fixed.
 - Call wm_get_wakeup(sc) before checking WM_F_HAS_AMT. It's required to
   check the existence of AMT correctly.
 - Fix a problem that wm_gate_hw_phy_config_ich8lan() isn't called in
   wm_reset() on PCH2.
 - Clear WMREG_WUC in wm_reset() if the chip >= 82544. This might fix
   the behavior on suspend/resume.
 - Fix logic of wm_check_reset_block() on ICH* and PCH*. This change
   might fix a problem that PHY's read/write functions can't get
   semaphore.
 - On ICH8, call wm_gig_downshift_workaround_ich8lan() when link changed
   down.
 - Drop PHY_CTRL_GBE_DIS explicitly in wm_lplu_d0_disable() in case BIOS
   sets this bit.
 - Fix two bugs in wm_kmrn_lock_loss_workaround_ich8lan(). Now the
   function checks the status correctly but it causes linkdown up to 10
   times, so it's disabled for the time being.
 - PR/50527: David Binderman: Fix impossible code. Odd offsets need
   special treatment.
 - Fix RAL table's size of PCH2 and PCH_LPT.
 - PCH_LPT (and newer device) is required to check FWSM_WLOCK_MAC bit to
   determine the range of the RAL.
 - Use sc->sc_itr instead of hard-coded number.
 - Rename wm_tbi_check_link() to wm_tbi_tick() because this function
   acts as mii_tick().
 - ACK Accelerate Disable in the RFCTL register is not bit 13 but 12.
   No binary change because this definition has not used yet.
 - Add ACK data Disable bit's definition (not used yet).
 - PHY_CTRL_GBE_DIS is not bit 4 but bit 6. This change has no any
   effect by default because WM_WOL is not defined yet and
   m_kmrn_lock_loss_workaround_ich8lan() is broken.
 - Fix wm_check_mng_mode_ich8lan(). This function is used only when
   WM_WOL is defined and it's disabled by default.
 - Rename wm_check_reset_block() to wm_phy_resetisblocked() and make it
   returns bool. No functional change.
 - Reorder function definitions and macro definitions. No functional
   change.
 - Fix comment. Add comment. Update comment.
 - KNF.


 To generate a diff of this commit:
 cvs rdiff -u -r1.21.16.1 -r1.21.16.2 src/sys/dev/mii/igphy.c
 cvs rdiff -u -r1.43 -r1.43.14.1 src/sys/dev/mii/ukphy.c
 cvs rdiff -u -r1.227.2.18 -r1.227.2.19 src/sys/dev/pci/if_wm.c
 cvs rdiff -u -r1.46.2.8 -r1.46.2.9 src/sys/dev/pci/if_wmreg.h
 cvs rdiff -u -r1.12.10.6 -r1.12.10.7 src/sys/dev/pci/if_wmvar.h

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

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.