NetBSD Problem Report #40677

From www@NetBSD.org  Tue Feb 17 20:28:46 2009
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id D44F063BAB8
	for <gnats-bugs@gnats.netbsd.org>; Tue, 17 Feb 2009 20:28:46 +0000 (UTC)
Message-Id: <20090217202846.A51EB63B8C3@narn.NetBSD.org>
Date: Tue, 17 Feb 2009 20:28:46 +0000 (UTC)
From: thesing@gmx.de
Reply-To: thesing@gmx.de
To: gnats-bugs@NetBSD.org
Subject: Some fxp network cards no longer work
X-Send-Pr-Version: www-1.0

>Number:         40677
>Category:       port-i386
>Synopsis:       Some fxp network cards no longer work
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-i386-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 17 20:30:00 +0000 2009
>Closed-Date:    Fri Feb 20 06:22:32 +0000 2009
>Last-Modified:  Fri Feb 20 06:22:32 +0000 2009
>Originator:     Stephan Thesing
>Release:        5.99.7
>Organization:
>Environment:
>Description:
In revision 1.61 of sys/dev/pci/if_fxp_pci.c the determination of
card features, like flow-control, was moved into this frontend file.
Previously, these checks were made based on the chip revision sc->sc_rev
in the backend file dev/ic/i82557.c.

Unfortunately, the frontend file now uses the PCI Vendor/productID tags
to determine the features, which assign features that are not present to
some card (in my example the "Intel PRO/100 VM Network Controller with 82562ET/EZ PHY, rev 2" ).


>How-To-Repeat:
Compile 5.99.7 kernel with fxp in it and observe that no network traffic 
comes from the card and only randomly traffic is received by the card.

>Fix:
Mimic the feature determination by PCI_REVISION() as it was before by
changing if_fxp_pci.c


>Release-Note:

>Audit-Trail:
From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@NetBSD.org
Cc: port-i386-maintainer@netbsd.org, gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org
Subject: re: port-i386/40677: Some fxp network cards no longer work
Date: Wed, 18 Feb 2009 08:01:46 +1100

 i will back out the fxp changes.


 .mrg.

From: "Stephan Thesing" <thesing@gmx.de>
To: gnats-bugs@NetBSD.org, netbsd-bugs@netbsd.org, gnats-admin@netbsd.org,
 port-i386-maintainer@netbsd.org
Cc: 
Subject: Re: re: port-i386/40677: Some fxp network cards no longer work
Date: Tue, 17 Feb 2009 22:23:04 +0100

 I think the general idea of moving feature determination to the
 frontend file is good.

 It should be sufficient to change in fxp_pci_attach() in if_fxp_pci.c
 the default: branch of the switch, along the lines of the attached patch
 (compile tested only).

 Index: if_fxp_pci.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/pci/if_fxp_pci.c,v
 retrieving revision 1.61
 diff -b -u -r1.61 if_fxp_pci.c
 --- if_fxp_pci.c        18 Jan 2009 10:37:04 -0000      1.61
 +++ if_fxp_pci.c        17 Feb 2009 21:22:09 -0000
 @@ -373,16 +373,29 @@
         case PCI_PRODUCT_INTEL_82562EH_HPNA_2:
         case PCI_PRODUCT_INTEL_PRO_100_VM_2:
                 aprint_normal(": %s, rev %d\n", fpp->fpp_name, sc->sc_rev);
 +
 +               if (sc->sc_rev >= FXP_REV_82558_A4)
                 sc->sc_flags |= FXPF_FC|FXPF_EXT_TXCB;
 +
 +               if (sc->sc_rev == FXP_REV_82550 || sc->sc_rev == FXP_REV_82550_C)
 +                       sc->sc_flags |= FXPF_EXT_RFA|FXPF_IPCB;
                 /*
                  * The ICH-2 and ICH-3 have the "resume bug".
                  */
                 sc->sc_flags |= FXPF_HAS_RESUME_BUG;
                 break;

 +
         default:
                 aprint_normal(": %s, rev %d\n", fpp->fpp_name, sc->sc_rev);
 -               sc->sc_flags |= FXPF_FC|FXPF_EXT_TXCB|FXPF_EXT_RFA|FXPF_IPCB;
 +
 +
 +               if (sc->sc_rev >= FXP_REV_82558_A4)
 +                       sc->sc_flags |= FXPF_FC|FXPF_EXT_TXCB;
 +
 +if (sc->sc_rev == FXP_REV_82550 || sc->sc_rev == FXP_REV_82550_C)
 +                       sc->sc_flags |= FXPF_EXT_RFA|FXPF_IPCB;
 +
                 break;
         }



 -------- Original-Nachricht --------
 > Datum: Tue, 17 Feb 2009 21:05:03 +0000 (UTC)
 > Von: matthew green <mrg@eterna.com.au>
 > An: port-i386-maintainer@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, thesing@gmx.de
 > Betreff: re: port-i386/40677: Some fxp network cards no longer work

 > The following reply was made to PR port-i386/40677; it has been noted by
 > GNATS.
 > 
 > From: matthew green <mrg@eterna.com.au>
 > To: gnats-bugs@NetBSD.org
 > Cc: port-i386-maintainer@netbsd.org, gnats-admin@netbsd.org,
 >     netbsd-bugs@netbsd.org
 > Subject: re: port-i386/40677: Some fxp network cards no longer work
 > Date: Wed, 18 Feb 2009 08:01:46 +1100
 > 
 >  i will back out the fxp changes.
 >  
 >  
 >  .mrg.
 >  

 -- 
 Dr.-Ing. Stephan Thesing
 Elektrastr. 50
 81925 München
 GERMANY

 Jetzt 1 Monat kostenlos! GMX FreeDSL - Telefonanschluss + DSL 
 für nur 17,95 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a

From: matthew green <mrg@eterna.com.au>
To: "Stephan Thesing" <thesing@gmx.de>
Cc: gnats-bugs@NetBSD.org, netbsd-bugs@netbsd.org,
    gnats-admin@netbsd.org, port-i386-maintainer@netbsd.org
Subject: re: port-i386/40677: Some fxp network cards no longer work
Date: Thu, 19 Feb 2009 18:41:35 +1100

    I think the general idea of moving feature determination to the
    frontend file is good.

 yeah.  i just don't have the hardware to test the changes and there
 is another bug already from them.  but maybe you can help fix me fix
 them :-)

    It should be sufficient to change in fxp_pci_attach() in if_fxp_pci.c
    the default: branch of the switch, along the lines of the attached patch
    (compile tested only).

 so, your card matches the first patch of this change:

    Index: if_fxp_pci.c
    ===================================================================
    RCS file: /cvsroot/src/sys/dev/pci/if_fxp_pci.c,v
    retrieving revision 1.61
    diff -b -u -r1.61 if_fxp_pci.c
    --- if_fxp_pci.c        18 Jan 2009 10:37:04 -0000      1.61
    +++ if_fxp_pci.c        17 Feb 2009 21:22:09 -0000
    @@ -373,16 +373,29 @@
            case PCI_PRODUCT_INTEL_82562EH_HPNA_2:
            case PCI_PRODUCT_INTEL_PRO_100_VM_2:
                    aprint_normal(": %s, rev %d\n", fpp->fpp_name, sc->sc_rev);
    +
    +               if (sc->sc_rev >= FXP_REV_82558_A4)
                    sc->sc_flags |= FXPF_FC|FXPF_EXT_TXCB;
    +
    +               if (sc->sc_rev == FXP_REV_82550 || sc->sc_rev == FXP_REV_82550_C)
    +                       sc->sc_flags |= FXPF_EXT_RFA|FXPF_IPCB;
                    /*
                     * The ICH-2 and ICH-3 have the "resume bug".
                     */
                    sc->sc_flags |= FXPF_HAS_RESUME_BUG;
                    break;

 but what sort of testing did this part get?

    +
            default:
                    aprint_normal(": %s, rev %d\n", fpp->fpp_name, sc->sc_rev);
    -               sc->sc_flags |= FXPF_FC|FXPF_EXT_TXCB|FXPF_EXT_RFA|FXPF_IPCB;
    +
    +
    +               if (sc->sc_rev >= FXP_REV_82558_A4)
    +                       sc->sc_flags |= FXPF_FC|FXPF_EXT_TXCB;
    +
    +if (sc->sc_rev == FXP_REV_82550 || sc->sc_rev == FXP_REV_82550_C)
    +                       sc->sc_flags |= FXPF_EXT_RFA|FXPF_IPCB;
    +
                    break;
            }



 thanks for your help,


 .mrg.

From: matthew green <mrg@eterna.com.au>
To: "Stephan Thesing" <thesing@gmx.de>, yamt@netbsd.org
Cc: gnats-bugs@NetBSD.org, netbsd-bugs@netbsd.org,
    gnats-admin@netbsd.org, port-i386-maintainer@netbsd.org
Subject: re: port-i386/40677: Some fxp network cards no longer work
Date: Thu, 19 Feb 2009 18:57:53 +1100

 stephan and yamt,

 could you please try this patch?  it incorporates the ideas from
 stephans patch with other feedback i've had, but i can't test this
 myself.

 thanks.


 .mrg.


 Index: pci/if_fxp_pci.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/pci/if_fxp_pci.c,v
 retrieving revision 1.61
 diff -p -u -r1.61 if_fxp_pci.c
 --- pci/if_fxp_pci.c	18 Jan 2009 10:37:04 -0000	1.61
 +++ pci/if_fxp_pci.c	19 Feb 2009 07:56:17 -0000
 @@ -348,7 +348,7 @@ fxp_pci_attach(device_t parent, device_t
  			chipname = "i82559S Ethernet";
  		if (sc->sc_rev >= FXP_REV_82550) {
  			chipname = "i82550 Ethernet";
 -			sc->sc_flags |= FXPF_EXT_RFA|FXPF_IPCB;
 +			sc->sc_flags |= FXPF_EXT_RFA;
  		}

  		/*
 @@ -372,17 +372,19 @@ fxp_pci_attach(device_t parent, device_t
  	case PCI_PRODUCT_INTEL_82562EH_HPNA_1:
  	case PCI_PRODUCT_INTEL_82562EH_HPNA_2:
  	case PCI_PRODUCT_INTEL_PRO_100_VM_2:
 -		aprint_normal(": %s, rev %d\n", fpp->fpp_name, sc->sc_rev);
 -		sc->sc_flags |= FXPF_FC|FXPF_EXT_TXCB;
  		/*
  		 * The ICH-2 and ICH-3 have the "resume bug".
  		 */
  		sc->sc_flags |= FXPF_HAS_RESUME_BUG;
 -		break;
 +		/* FALLTHROUGH */

  	default:
  		aprint_normal(": %s, rev %d\n", fpp->fpp_name, sc->sc_rev);
 -		sc->sc_flags |= FXPF_FC|FXPF_EXT_TXCB|FXPF_EXT_RFA|FXPF_IPCB;
 +		if (sc->sc_rev >= FXP_REV_82558_A4)
 +			sc->sc_flags |= FXPF_FC|FXPF_EXT_TXCB;
 +		if (sc->sc_rev == FXP_REV_82550 || sc->sc_rev == FXP_REV_82550_C)
 +			sc->sc_flags |= FXPF_EXT_RFA;
 +
  		break;
  	}

 Index: ic/i82557.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/ic/i82557.c,v
 retrieving revision 1.122
 diff -p -u -r1.122 i82557.c
 --- ic/i82557.c	18 Jan 2009 10:37:04 -0000	1.122
 +++ ic/i82557.c	19 Feb 2009 07:56:17 -0000
 @@ -268,7 +268,7 @@ fxp_attach(struct fxp_softc *sc)
  	 * too, but that's already enabled by the code above.
  	 * Be careful to do this only on the right devices.
  	 */
 -	if (sc->sc_flags & FXPF_IPCB)
 +	if (sc->sc_flags & FXPF_EXT_TXCB)
  		sc->sc_txcmd = htole16(FXP_CB_COMMAND_IPCBXMIT);
  	else
  		sc->sc_txcmd = htole16(FXP_CB_COMMAND_XMIT);
 @@ -324,7 +324,7 @@ fxp_attach(struct fxp_softc *sc)
  	 */
  	for (i = 0; i < FXP_NTXCB; i++) {
  		if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES,
 -		    (sc->sc_flags & FXPF_IPCB) ? FXP_IPCB_NTXSEG : FXP_NTXSEG,
 +		    (sc->sc_flags & FXPF_EXT_TXCB) ? FXP_IPCB_NTXSEG : FXP_NTXSEG,
  		    MCLBYTES, 0, 0, &FXP_DSTX(sc, i)->txs_dmamap)) != 0) {
  			aprint_error_dev(sc->sc_dev,
  			    "unable to create tx DMA map %d, error = %d\n",
 @@ -374,7 +374,7 @@ fxp_attach(struct fxp_softc *sc)
  	ifp->if_stop = fxp_stop;
  	IFQ_SET_READY(&ifp->if_snd);

 -	if (sc->sc_flags & FXPF_IPCB) {
 +	if (sc->sc_flags & FXPF_EXT_TXCB) {
  		KASSERT(sc->sc_flags & FXPF_EXT_RFA); /* we have both or none */
  		/*
  		 * IFCAP_CSUM_IPv4_Tx seems to have a problem,
 @@ -896,7 +896,7 @@ fxp_start(struct ifnet *ifp)
  		tbdp = txd->txd_tbd;
  		len = m0->m_pkthdr.len;
  		nsegs = dmamap->dm_nsegs;
 -		if (sc->sc_flags & FXPF_IPCB)
 +		if (sc->sc_flags & FXPF_EXT_TXCB)
  			tbdp++;
  		for (seg = 0; seg < nsegs; seg++) {
  			tbdp[seg].tb_addr =
 @@ -940,7 +940,7 @@ fxp_start(struct ifnet *ifp)
  		txd->txd_txcb.tbd_number = nsegs;

  		KASSERT((csum_flags & (M_CSUM_TCPv6 | M_CSUM_UDPv6)) == 0);
 -		if (sc->sc_flags & FXPF_IPCB) {
 +		if (sc->sc_flags & FXPF_EXT_TXCB) {
  			struct m_tag *vtag;
  			struct fxp_ipcb *ipcb;
  			/*
 Index: ic/i82557reg.h
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/ic/i82557reg.h,v
 retrieving revision 1.21
 diff -p -u -r1.21 i82557reg.h
 --- ic/i82557reg.h	3 Dec 2008 15:34:38 -0000	1.21
 +++ ic/i82557reg.h	19 Feb 2009 07:56:17 -0000
 @@ -370,7 +370,7 @@ struct fxp_tbd {
  #define FXP_CB_STATUS_C		0x8000

  /* commands */
 -#define FXP_CB_COMMAND_CMD	0x0007	/* XXX how about FXPF_IPCB case? */
 +#define FXP_CB_COMMAND_CMD	0x0007
  #define FXP_CB_COMMAND_NOP	0x0
  #define FXP_CB_COMMAND_IAS	0x1
  #define FXP_CB_COMMAND_CONFIG	0x2
 Index: ic/i82557var.h
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/ic/i82557var.h,v
 retrieving revision 1.42
 diff -p -u -r1.42 i82557var.h
 --- ic/i82557var.h	18 Jan 2009 10:37:04 -0000	1.42
 +++ ic/i82557var.h	19 Feb 2009 07:56:17 -0000
 @@ -222,7 +222,6 @@ struct fxp_softc {
  #define	FXPF_EXT_TXCB		0x0080	/* enable extended TxCB */
  #define	FXPF_UCODE_LOADED	0x0100	/* microcode is loaded */
  #define	FXPF_EXT_RFA		0x0200	/* enable extended RFD */
 -#define	FXPF_IPCB		0x0400	/* use IPCB */
  #define	FXPF_RECV_WORKAROUND	0x0800	/* receiver lock-up workaround */
  #define	FXPF_FC			0x1000	/* has flow control */

 Index: cardbus/if_fxp_cardbus.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/cardbus/if_fxp_cardbus.c,v
 retrieving revision 1.35
 diff -p -u -r1.35 if_fxp_cardbus.c
 --- cardbus/if_fxp_cardbus.c	18 Jan 2009 10:37:03 -0000	1.35
 +++ cardbus/if_fxp_cardbus.c	19 Feb 2009 07:56:17 -0000
 @@ -168,7 +168,7 @@ fxp_cardbus_attach(struct device *parent
  	if (sc->sc_rev >= FXP_REV_82558_A4)
  		sc->sc_flags |= FXPF_FC|FXPF_EXT_TXCB;
  	if (sc->sc_rev >= FXP_REV_82550)
 -		sc->sc_flags |= FXPF_EXT_RFA|FXPF_IPCB;
 +		sc->sc_flags |= FXPF_EXT_RFA;

  	sc->sc_dmat = ca->ca_dmat;
  	sc->sc_enable = fxp_cardbus_enable;

From: "Stephan Thesing" <thesing@gmx.de>
To: gnats-bugs@NetBSD.org, netbsd-bugs@netbsd.org, gnats-admin@netbsd.org,
 port-i386-maintainer@netbsd.org
Cc: 
Subject: Re: re: port-i386/40677: Some fxp network cards no longer work
Date: Thu, 19 Feb 2009 20:55:11 +0100

 Hi,

 works for me (Intel PRO/100 VM Network Controller with 82562ET/EZ PHY, rev 2,
   PCI Vend/Prod 0x8086/0x1050).

 Best regards....
    Stephan

 > Datum: Thu, 19 Feb 2009 08:00:07 +0000 (UTC)
 > Von: matthew green <mrg@eterna.com.au>
 > An: port-i386-maintainer@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, thesing@gmx.de
 > Betreff: re: port-i386/40677: Some fxp network cards no longer work
 [...]
 >  could you please try this patch?  it incorporates the ideas from
 >  stephans patch with other feedback i've had, but i can't test this
 >  myself.

 -- 
 Dr.-Ing. Stephan Thesing
 Elektrastr. 50
 81925 München
 GERMANY

 Jetzt 1 Monat kostenlos! GMX FreeDSL - Telefonanschluss + DSL 
 für nur 17,95 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a

From: matthew green <mrg@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/40677 CVS commit: src/sys/dev
Date: Fri, 20 Feb 2009 05:49:34 +0000 (UTC)

 Module Name:	src
 Committed By:	mrg
 Date:		Fri Feb 20 05:49:34 UTC 2009

 Modified Files:
 	src/sys/dev/cardbus: if_fxp_cardbus.c
 	src/sys/dev/ic: i82557.c i82557reg.h i82557var.h
 	src/sys/dev/pci: if_fxp_pci.c

 Log Message:
 - remove FXPF_IPCB flag.  it should always/only be used with the code
   conditional on FXPF_EXT_TXCB, so, replace all uses with that
 - for the pci frontend, reestablish some flags lost the the prior
   changes and simplify one of the cases

 this fixes PR 40677 and may fix PR 40431.


 To generate a diff of this commit:
 cvs rdiff -r1.35 -r1.36 src/sys/dev/cardbus/if_fxp_cardbus.c
 cvs rdiff -r1.122 -r1.123 src/sys/dev/ic/i82557.c
 cvs rdiff -r1.21 -r1.22 src/sys/dev/ic/i82557reg.h
 cvs rdiff -r1.42 -r1.43 src/sys/dev/ic/i82557var.h
 cvs rdiff -r1.61 -r1.62 src/sys/dev/pci/if_fxp_pci.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: mrg@NetBSD.org
State-Changed-When: Fri, 20 Feb 2009 06:22:32 +0000
State-Changed-Why:
fixed, thanks.


>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-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.