Subject: Re: PCnet-PCI ethernet card success
To: Thomas Eberhardt <thomas@mathematik.uni-Bremen.de>
From: Paul Richards <paul@isl.cf.ac.uk>
List: current-users
Date: 12/11/1994 19:58:58
In reply to Thomas Eberhardt who said
> 
> 
> After some fiddling around and looking at the linux driver, I got
> our ethernet card (a PCI card based on an AMD Am79C970 chip) to work.
> The important change was to reset the bcnt field.
> 
> Configuration file entry I use:
> 
> le0 at isa? port 0xd000 irq 10
> 
> Changes to netbsd-current driver:
> 
> *** if_le.c-	Mon Nov 21 22:59:36 1994
> --- if_le.c	Fri Dec  9 17:56:13 1994
> ***************
> *** 399,405 ****
>   	ifp->if_flags =
>   	    IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS | IFF_MULTICAST;
>   
> ! 	if (sc->sc_card != DEPCA)
>   		isa_dmacascade(ia->ia_drq);
>   
>   	/* Attach the interface. */
> --- 399,405 ----
>   	ifp->if_flags =
>   	    IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS | IFF_MULTICAST;
>   
> ! 	if (ia->ia_drq != DRQUNK && sc->sc_card != DEPCA)
>   		isa_dmacascade(ia->ia_drq);
>   
>   	/* Attach the interface. */
> ***************
> *** 872,877 ****
> --- 872,878 ----
>   			sc->sc_arpcom.ac_if.if_ipackets++;
>   		}
>   			
> + 		cdm->bcnt = -BUFSIZE;
>   		cdm->mcnt = 0;
>   		cdm->flags |= LE_OWN;
>   		NEXTRDS;
> 

Weird, from some debugging code it looks like the BCNT field
is getting cleared and it shouldn't be.

>From the docs,

	BUFFER BYTE COUNT is the length of the buffer
	pointed to by this descriptor, expressed as the
	two's complement of the length of the buffer.
	This field is written by the host and unchanged
	by the PCnet-32 controller.


Since this works for PCnet-ISA and Lance cards then it's either a
bug in the PCNet-32 chips or there's a problem with the 32->16 bit
mapping. Since resetting that field fixes the problem I'd be inclined
to say it's a PCnet-32 bug since if the mapping was wrong then I
doubt it would work at all.

I'll ask AMD if they know of a bug that would cause this.

-- 
  Paul Richards, FreeBSD core team member. 
  Phone: +44 1222 874000 x5958 (work), +44 1222 457651 (home)
  Dept. Mechanical Engineering, University of Wales, College Cardiff.
  Internet: paul@FreeBSD.org,  JANET(UK): RICHARDSDP@CARDIFF.AC.UK