plan 9 kernel history: overview | file list | diff list

2000/0713/pc/devether.c (diff list | history)

2000/0713/sys/src/9/pc/devether.c:244,2542000/0817/sys/src/9/pc/devether.c:244,263 (short | long | prev | next)
1992/0407    
{ 
1997/0327    
	Ether *ether; 
	Block *bp; 
2000/0817    
	int nn; 
1992/0407    
 
1997/0327    
	ether = etherxx[chan->dev]; 
	if(NETTYPE(chan->qid.path) != Ndataqid) 
		return netifwrite(ether, chan, buf, n); 
2000/0817    
	if(NETTYPE(chan->qid.path) != Ndataqid) { 
		nn = netifwrite(ether, chan, buf, n); 
		if(nn >= 0) 
			return nn; 
1992/0403    
 
2000/0817    
		if(ether->ctl!=nil) 
			return ether->ctl(ether,buf,n); 
			 
		error(Ebadctl); 
	} 
 
1997/1101    
	if(n > ETHERMAXTU) 
		error(Etoobig); 
	if(n < ETHERMINTU) 
2000/0713/sys/src/9/pc/devether.c:255,2672000/0817/sys/src/9/pc/devether.c:264,271
1997/1101    
		error(Etoosmall); 
 
1997/0327    
	bp = allocb(n); 
1992/0403    
	if(waserror()){ 
1997/0327    
		freeb(bp); 
1992/0403    
		nexterror(); 
	} 
1997/0327    
	memmove(bp->rp, buf, n); 
	memmove(bp->rp+Eaddrlen, ether->ea, Eaddrlen); 
1995/0822    
	poperror(); 
1997/0327    
	bp->wp += n; 
1992/0403    
 
1997/0327    
	return etheroq(ether, bp); 
2000/0713/sys/src/9/pc/devether.c:274,2852000/0817/sys/src/9/pc/devether.c:278,293
1997/0327    
	long n; 
 
	n = BLEN(bp); 
	ether = etherxx[chan->dev]; 
	if(NETTYPE(chan->qid.path) != Ndataqid){ 
		n = netifwrite(ether, chan, bp->rp, n); 
2000/0817    
		if(waserror()) { 
			freeb(bp); 
			nexterror(); 
		} 
		n = etherwrite(chan, bp->rp, n, 0); 
1997/0327    
		freeb(bp); 
		return n; 
	} 
2000/0817    
	ether = etherxx[chan->dev]; 
1997/0327    
 
1997/1101    
	if(n > ETHERMAXTU){ 
		freeb(bp); 
2000/0713/sys/src/9/pc/devether.c:369,3752000/0817/sys/src/9/pc/devether.c:377,388
1997/0327    
			if(ether->irq == 2) 
				ether->irq = 9; 
1999/0819    
			snprint(name, sizeof(name), "ether%d", ctlrno); 
			intrenable(ether->irq, ether->interrupt, ether, ether->tbdf, name); 
2000/0817    
 
			/* If ether->irq is less than 0, it is a hack to indicate no interrupt 
			 * used for the seocnd logical ethernet for the wavelan card 
			 */ 
			if(ether->irq >= 0) 
				intrenable(ether->irq, ether->interrupt, ether, ether->tbdf, name); 
1993/0212    
 
1998/0825    
			i = sprint(buf, "#l%d: %s: %dMbps port 0x%luX irq %lud", 
1997/0327    
				ctlrno, ether->type, ether->mbps, ether->port, ether->irq); 


source code copyright © 1990-2005 Lucent Technologies; see license
Plan 9 distribution
comments to russ cox (rsc@swtch.com)