while (priv->tx_tail < priv->tx_head) { 
while ((int) priv->tx_tail - (int) priv->tx_head < 0) { 
int ipoib_ib_dev_stop(struct net_device *dev){	struct ipoib_dev_priv *priv = netdev_priv(dev);	struct ib_qp_attr qp_attr;	int attr_mask;	unsigned long begin;	struct ipoib_buf *tx_req;	int i;	/* Kill the existing QP and allocate a new one */	qp_attr.qp_state = IB_QPS_ERR;	attr_mask        = IB_QP_STATE;	if (ib_modify_qp(priv->qp, &qp_attr, attr_mask))		ipoib_warn(priv, "Failed to modify QP to ERROR state\n");	/* Wait for all sends and receives to complete */	begin = jiffies;	while (priv->tx_head != priv->tx_tail || recvs_pending(dev)) {		if (time_after(jiffies, begin + 5 * HZ)) {			ipoib_warn(priv, "timing out; %d sends %d receives not completed\n",				   priv->tx_head - priv->tx_tail, recvs_pending(dev));			/*			 * assume the HW is wedged and just free up			 * all our pending work requests.			 */			while (priv->tx_tail < priv->tx_head) {				tx_req = &priv->tx_ring[priv->tx_tail &							(IPOIB_TX_RING_SIZE - 1)];				dma_unmap_single(priv->ca->dma_device,						 pci_unmap_addr(tx_req, mapping),						 tx_req->skb->len,						 DMA_TO_DEVICE);				dev_kfree_skb_any(tx_req->skb);				++priv->tx_tail;			}			for (i = 0; i < IPOIB_RX_RING_SIZE; ++i)				if (priv->rx_ring[i].skb) {					dma_unmap_single(priv->ca->dma_device,							 pci_unmap_addr(&priv->rx_ring[i],									mapping),							 IPOIB_BUF_SIZE,							 DMA_FROM_DEVICE);					dev_kfree_skb_any(priv->rx_ring[i].skb);					priv->rx_ring[i].skb = NULL;				}			goto timeout;		}		msleep(1);	}	ipoib_dbg(priv, "All sends and receives done.\n");timeout:	qp_attr.qp_state = IB_QPS_RESET;	attr_mask        = IB_QP_STATE;	if (ib_modify_qp(priv->qp, &qp_attr, attr_mask))		ipoib_warn(priv, "Failed to modify QP to RESET state\n");	/* Wait for all AHs to be reaped */	set_bit(IPOIB_STOP_REAPER, &priv->flags);	cancel_delayed_work(&priv->ah_reap_task);	flush_workqueue(ipoib_workqueue);	begin = jiffies;	while (!list_empty(&priv->dead_ahs)) {		__ipoib_reap_ah(dev);		if (time_after(jiffies, begin + HZ)) {			ipoib_warn(priv, "timing out; will leak address handles\n");			break;		}		msleep(1);	}	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/2181858bb814b51de8ec25b3ddd37cd06c53b0c9/ipoib_ib.c/buggy/drivers/infiniband/ulp/ipoib/ipoib_ib.c