if ((lp->xmt_upper_limit + 2 - last) <= XMT_HEADER) { 
if ((lp->xmt_upper_limit + 2 - last) <= XMT_HEADER) { 
hardware_send_packet(struct net_device *dev, void *buf, short length){	struct eepro_local *lp = netdev_priv(dev);	short ioaddr = dev->base_addr;	unsigned status, tx_available, last, end;	if (net_debug > 5)		printk(KERN_DEBUG "%s: entering hardware_send_packet routine.\n", dev->name);		/* determine how much of the transmit buffer space is available */		if (lp->tx_end > lp->tx_start)		tx_available = lp->xmt_ram - (lp->tx_end - lp->tx_start);		else if (lp->tx_end < lp->tx_start)			tx_available = lp->tx_start - lp->tx_end;	else tx_available = lp->xmt_ram;	if (((((length + 3) >> 1) << 1) + 2*XMT_HEADER) >= tx_available) {		/* No space available ??? */		return 1;		}		last = lp->tx_end;		end = last + (((length + 3) >> 1) << 1) + XMT_HEADER;	if (end >= lp->xmt_upper_limit + 2) { /* the transmit buffer is wrapped around */		if ((lp->xmt_upper_limit + 2 - last) <= XMT_HEADER) {					/* Arrrr!!!, must keep the xmt header together,				several days were lost to chase this one down. */			last = lp->xmt_lower_limit;				end = last + (((length + 3) >> 1) << 1) + XMT_HEADER;			}		else end = lp->xmt_lower_limit + (end -						lp->xmt_upper_limit + 2);		}		outw(last, ioaddr + HOST_ADDRESS_REG);		outw(XMT_CMD, ioaddr + IO_PORT);		outw(0, ioaddr + IO_PORT);		outw(end, ioaddr + IO_PORT);		outw(length, ioaddr + IO_PORT);		if (lp->version == LAN595)			outsw(ioaddr + IO_PORT, buf, (length + 3) >> 1);		else {	/* LAN595TX or LAN595FX, capable of 32-bit I/O processing */			unsigned short temp = inb(ioaddr + INT_MASK_REG);			outb(temp | IO_32_BIT, ioaddr + INT_MASK_REG);			outsl(ioaddr + IO_PORT_32_BIT, buf, (length + 3) >> 2);			outb(temp & ~(IO_32_BIT), ioaddr + INT_MASK_REG);		}		/* A dummy read to flush the DRAM write pipeline */		status = inw(ioaddr + IO_PORT);		if (lp->tx_start == lp->tx_end) {		outw(last, ioaddr + lp->xmt_bar);			outb(XMT_CMD, ioaddr);			lp->tx_start = last;   /* I don't like to change tx_start here */		}		else {			/* update the next address and the chain bit in the			last packet */			if (lp->tx_end != last) {				outw(lp->tx_last + XMT_CHAIN, ioaddr + HOST_ADDRESS_REG);				outw(last, ioaddr + IO_PORT);			}			outw(lp->tx_last + XMT_COUNT, ioaddr + HOST_ADDRESS_REG);			status = inw(ioaddr + IO_PORT);			outw(status | CHAIN_BIT, ioaddr + IO_PORT);			/* Continue the transmit command */			outb(RESUME_XMT_CMD, ioaddr);		}		lp->tx_last = last;		lp->tx_end = end;		if (net_debug > 5)			printk(KERN_DEBUG "%s: exiting hardware_send_packet routine.\n", dev->name);	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/d61780c0d384939ef31c46b47442854d5def4623/eepro.c/buggy/drivers/net/eepro.c