hw_cons = bp->status_blk->status_rx_quick_consumer_index0; 
hw_cons = bp->hw_rx_cons = sblk->status_rx_quick_consumer_index0; 
bnx2_rx_int(struct bnx2 *bp, int budget){	u16 hw_cons, sw_cons, sw_ring_cons, sw_prod, sw_ring_prod;	struct l2_fhdr *rx_hdr;	int rx_pkt = 0;	hw_cons = bp->status_blk->status_rx_quick_consumer_index0;	if ((hw_cons & MAX_RX_DESC_CNT) == MAX_RX_DESC_CNT) {		hw_cons++;	}	sw_cons = bp->rx_cons;	sw_prod = bp->rx_prod;	/* Memory barrier necessary as speculative reads of the rx	 * buffer can be ahead of the index in the status block	 */	rmb();	while (sw_cons != hw_cons) {		unsigned int len;		u16 status;		struct sw_bd *rx_buf;		struct sk_buff *skb;		sw_ring_cons = RX_RING_IDX(sw_cons);		sw_ring_prod = RX_RING_IDX(sw_prod);		rx_buf = &bp->rx_buf_ring[sw_ring_cons];		skb = rx_buf->skb;		pci_dma_sync_single_for_cpu(bp->pdev,			pci_unmap_addr(rx_buf, mapping),			bp->rx_offset + RX_COPY_THRESH, PCI_DMA_FROMDEVICE);		rx_hdr = (struct l2_fhdr *) skb->data;		len = rx_hdr->l2_fhdr_pkt_len - 4;		if (rx_hdr->l2_fhdr_errors &			(L2_FHDR_ERRORS_BAD_CRC |			L2_FHDR_ERRORS_PHY_DECODE |			L2_FHDR_ERRORS_ALIGNMENT |			L2_FHDR_ERRORS_TOO_SHORT |			L2_FHDR_ERRORS_GIANT_FRAME)) {			goto reuse_rx;		}		/* Since we don't have a jumbo ring, copy small packets		 * if mtu > 1500		 */		if ((bp->dev->mtu > 1500) && (len <= RX_COPY_THRESH)) {			struct sk_buff *new_skb;			new_skb = dev_alloc_skb(len + 2);			if (new_skb == NULL)				goto reuse_rx;			/* aligned copy */			memcpy(new_skb->data,				skb->data + bp->rx_offset - 2,				len + 2);			skb_reserve(new_skb, 2);			skb_put(new_skb, len);			new_skb->dev = bp->dev;			bnx2_reuse_rx_skb(bp, skb,				sw_ring_cons, sw_ring_prod);			skb = new_skb;		}		else if (bnx2_alloc_rx_skb(bp, sw_ring_prod) == 0) {			pci_unmap_single(bp->pdev,				pci_unmap_addr(rx_buf, mapping),				bp->rx_buf_use_size, PCI_DMA_FROMDEVICE);			skb_reserve(skb, bp->rx_offset);			skb_put(skb, len);		}		else {reuse_rx:			bnx2_reuse_rx_skb(bp, skb,				sw_ring_cons, sw_ring_prod);			goto next_rx;		}		skb->protocol = eth_type_trans(skb, bp->dev);		if ((len > (bp->dev->mtu + ETH_HLEN)) &&			(htons(skb->protocol) != 0x8100)) {			dev_kfree_skb_irq(skb);			goto next_rx;		}		status = rx_hdr->l2_fhdr_status;		skb->ip_summed = CHECKSUM_NONE;		if (bp->rx_csum &&			(status & (L2_FHDR_STATUS_TCP_SEGMENT |			L2_FHDR_STATUS_UDP_DATAGRAM))) {			u16 cksum = rx_hdr->l2_fhdr_tcp_udp_xsum;			if (cksum == 0xffff)				skb->ip_summed = CHECKSUM_UNNECESSARY;		}#ifdef BCM_VLAN		if ((status & L2_FHDR_STATUS_L2_VLAN_TAG) && (bp->vlgrp != 0)) {			vlan_hwaccel_receive_skb(skb, bp->vlgrp,				rx_hdr->l2_fhdr_vlan_tag);		}		else#endif			netif_receive_skb(skb);		bp->dev->last_rx = jiffies;		rx_pkt++;next_rx:		rx_buf->skb = NULL;		sw_cons = NEXT_RX_BD(sw_cons);		sw_prod = NEXT_RX_BD(sw_prod);		if ((rx_pkt == budget))			break;	}	bp->rx_cons = sw_cons;	bp->rx_prod = sw_prod;	REG_WR16(bp, MB_RX_CID_ADDR + BNX2_L2CTX_HOST_BDIDX, sw_prod);	REG_WR(bp, MB_RX_CID_ADDR + BNX2_L2CTX_HOST_BSEQ, bp->rx_prod_bseq);	mmiowb();	return rx_pkt;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/f4e418f7f3286f854883f9f7e3bbf7005340d2de/bnx2.c/buggy/drivers/net/bnx2.c