* This could be done faster if (for example) the 
* This could be done faster if (for example) the 
static void sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d){	int curidx;	int hwidx;	sbdmadscr_t *dsc;	struct sk_buff *sb;	int len;		for (;;) {		/* 		 * figure out where we are (as an index) and where		 * the hardware is (also as an index)		 *		 * This could be done faster if (for example) the 		 * descriptor table was page-aligned and contiguous in		 * both virtual and physical memory -- you could then		 * just compare the low-order bits of the virtual address		 * (sbdma_remptr) and the physical address (sbdma_curdscr CSR)		 */				curidx = d->sbdma_remptr - d->sbdma_dscrtable;		hwidx = (int) (((__raw_readq(d->sbdma_curdscr) & M_DMA_CURDSCR_ADDR) -				d->sbdma_dscrtable_phys) / sizeof(sbdmadscr_t));				/*		 * If they're the same, that means we've processed all		 * of the descriptors up to (but not including) the one that		 * the hardware is working on right now.		 */				if (curidx == hwidx)			break;				/*		 * Otherwise, get the packet's sk_buff ptr back		 */				dsc = &(d->sbdma_dscrtable[curidx]);		sb = d->sbdma_ctxtable[curidx];		d->sbdma_ctxtable[curidx] = NULL;				len = (int)G_DMA_DSCRB_PKT_SIZE(dsc->dscr_b) - 4;				/*		 * Check packet status.  If good, process it.		 * If not, silently drop it and put it back on the		 * receive ring.		 */				if (!(dsc->dscr_a & M_DMA_ETHRX_BAD)) {						/*			 * Add a new buffer to replace the old one.  If we fail			 * to allocate a buffer, we're going to drop this			 * packet and put it right back on the receive ring.			 */						if (sbdma_add_rcvbuffer(d,NULL) == -ENOBUFS) {				sc->sbm_stats.rx_dropped++;				sbdma_add_rcvbuffer(d,sb); /* re-add old buffer */			} else {				/*				 * Set length into the packet				 */				skb_put(sb,len);								/*				 * Buffer has been replaced on the				 * receive ring.  Pass the buffer to				 * the kernel				 */				sc->sbm_stats.rx_bytes += len;				sc->sbm_stats.rx_packets++;				sb->protocol = eth_type_trans(sb,d->sbdma_eth->sbm_dev);				/* Check hw IPv4/TCP checksum if supported */				if (sc->rx_hw_checksum == ENABLE) {					if (!((dsc->dscr_a) & M_DMA_ETHRX_BADIP4CS) &&					    !((dsc->dscr_a) & M_DMA_ETHRX_BADTCPCS)) {						sb->ip_summed = CHECKSUM_UNNECESSARY;						/* don't need to set sb->csum */					} else {						sb->ip_summed = CHECKSUM_NONE;					}				}								netif_rx(sb);			}		} else {			/*			 * Packet was mangled somehow.  Just drop it and			 * put it back on the receive ring.			 */			sc->sbm_stats.rx_errors++;			sbdma_add_rcvbuffer(d,sb);		}						/* 		 * .. and advance to the next buffer.		 */				d->sbdma_remptr = SBDMA_NEXTBUF(d,sbdma_remptr);			}}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/74b0247fbd4b6ed1693a420d85cf50267d840ef4/sb1250-mac.c/buggy/drivers/net/sb1250-mac.c