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

2000/0331/port/devbridge.c (diff list | history)

2000/0227/sys/src/9/port/devbridge.c:36,432000/0331/sys/src/9/port/devbridge.c:36,43 (short | long | prev | next)
1999/0316    
	CacheSize=	(CacheHash+CacheLook-1), 
	CacheTimeout=	5*60,		// timeout for cache entry in seconds 
 
2000/0205    
	TcpMssMax = 1360,			// max desirable Tcp MSS value 
1999/0826    
                 
2000/0331    
	TcpMssMax = 1300,			// max desirable Tcp MSS value 
	TunnelMtu = 1400, 
1999/0316    
}; 
 
1999/0824    
static Dirtab bridgedirtab[]={ 
2000/0227/sys/src/9/port/devbridge.c:128,1332000/0331/sys/src/9/port/devbridge.c:128,134
1999/0316    
	int	out;		// number of packets read 
	int	outmulti;	// multicast or broadcast 
	int	outunknown;	// unknown address 
2000/0331    
	int outfrag;	// fragmented the packet 
1999/0316    
	int	nentry;		// number of cache entries for this port 
}; 
 
2000/0227/sys/src/9/port/devbridge.c:183,1882000/0331/sys/src/9/port/devbridge.c:184,190
1999/0316    
static char	*cachedump(Bridge *b); 
static void	portfree(Port *port); 
static void	cacheflushport(Bridge *b, int port); 
2000/0331    
static void etherwrite(Port *port, Block *bp); 
1999/0316    
 
extern ulong	parseip(uchar*, char*); 
 
2000/0227/sys/src/9/port/devbridge.c:814,8202000/0331/sys/src/9/port/devbridge.c:816,822
1999/0316    
static void 
ethermultiwrite(Bridge *b, Block *bp, Port *port) 
{ 
	Chan *c; 
2000/0331    
	Port *oport; 
1999/0316    
	Block *bp2; 
	Etherpkt *ep; 
	int i, mcast, bcast; 
2000/0227/sys/src/9/port/devbridge.c:833,8452000/0331/sys/src/9/port/devbridge.c:835,846
1999/0316    
	else 
		bcast = 0; 
 
	c = nil; 
2000/0331    
	oport = nil; 
1999/0316    
	for(i=0; i<b->nport; i++) { 
		if(i == port->id || b->port[i] == nil) 
			continue; 
		if(mcast && !bcast && !b->port[i]->mcast) 
			continue; 
		b->port[i]->out++; 
		if(mcast) 
			b->port[i]->outmulti++; 
		else 
2000/0227/sys/src/9/port/devbridge.c:846,8672000/0331/sys/src/9/port/devbridge.c:847,868
1999/0316    
			b->port[i]->outunknown++; 
 
		// delay one so that the last write does not copy 
		if(c != nil) { 
2000/0331    
		if(oport != nil) { 
1999/0901    
			b->copy++; 
1999/0316    
			bp2 = copyblock(bp, blocklen(bp)); 
1999/0915    
			if(!waserror()) { 
				devtab[c->type]->bwrite(c, bp2, 0); 
2000/0331    
				etherwrite(oport, bp2); 
1999/0915    
				poperror(); 
			} 
1999/0316    
		} 
		c = b->port[i]->data[1]; 
2000/0331    
		oport = b->port[i]; 
1999/0316    
	} 
 
	// last write free block 
	if(c) { 
2000/0331    
	if(oport) { 
1999/0316    
		bp2 = bp; bp = nil; USED(bp); 
1999/0915    
		if(!waserror()) { 
			devtab[c->type]->bwrite(c, bp2, 0); 
2000/0331    
			etherwrite(oport, bp2); 
1999/0915    
			poperror(); 
		} 
1999/0316    
	} else 
2000/0227/sys/src/9/port/devbridge.c:961,9672000/0331/sys/src/9/port/devbridge.c:962,968
1999/0316    
static void 
etherread(void *a) 
{ 
	Port *port = a, *oport; 
2000/0331    
	Port *port = a; 
1999/0316    
	Bridge *b = port->bridge; 
	Block *bp, *bp2; 
	Etherpkt *ep; 
2000/0227/sys/src/9/port/devbridge.c:1016,10242000/0331/sys/src/9/port/devbridge.c:1017,1023
1999/0316    
			} else if (ce->port != port->id) { 
				b->hit++; 
				bp2 = bp; bp = nil; 
				oport = b->port[ce->port]; 
				oport->out++; 
				devtab[oport->data[1]->type]->bwrite(oport->data[1], bp2, 0); 
2000/0331    
				etherwrite(b->port[ce->port], bp2); 
1999/0316    
			} 
		} 
 
2000/0227/sys/src/9/port/devbridge.c:1031,10362000/0331/sys/src/9/port/devbridge.c:1030,1042
1999/0316    
	portfree(port); 
	qunlock(b); 
	pexit("hangup", 1); 
2000/0331    
} 
 
static void 
etherwrite(Port *port, Block *bp) 
{ 
	port->out++; 
	devtab[port->data[1]->type]->bwrite(port->data[1], bp, 0); 
1999/0316    
} 
 
// hold b lock 


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