aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp
diff options
context:
space:
mode:
authorRoland Dreier <roland@eddore.topspincom.com>2005-07-27 17:41:32 -0400
committerRoland Dreier <roland@eddore.topspincom.com>2005-07-27 17:41:32 -0400
commit2181858bb814b51de8ec25b3ddd37cd06c53b0c9 (patch)
tree2fb09b6a44e17c0c3c85512a6c0ba7f5a983c0b0 /drivers/infiniband/ulp
parentabdf119b4dad015803819c3d046d20cfbd393e87 (diff)
[IB/ipoib]: Fix unsigned comparisons to handle wraparound
Fix handling of tx_head/tx_tail comparisons to handle wraparound. Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/ulp')
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_ib.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
index 8238766746b2..eee82363167d 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -81,7 +81,7 @@ void ipoib_free_ah(struct kref *kref)
81 81
82 unsigned long flags; 82 unsigned long flags;
83 83
84 if (ah->last_send <= priv->tx_tail) { 84 if ((int) priv->tx_tail - (int) ah->last_send >= 0) {
85 ipoib_dbg(priv, "Freeing ah %p\n", ah->ah); 85 ipoib_dbg(priv, "Freeing ah %p\n", ah->ah);
86 ib_destroy_ah(ah->ah); 86 ib_destroy_ah(ah->ah);
87 kfree(ah); 87 kfree(ah);
@@ -355,7 +355,7 @@ static void __ipoib_reap_ah(struct net_device *dev)
355 355
356 spin_lock_irq(&priv->lock); 356 spin_lock_irq(&priv->lock);
357 list_for_each_entry_safe(ah, tah, &priv->dead_ahs, list) 357 list_for_each_entry_safe(ah, tah, &priv->dead_ahs, list)
358 if (ah->last_send <= priv->tx_tail) { 358 if ((int) priv->tx_tail - (int) ah->last_send >= 0) {
359 list_del(&ah->list); 359 list_del(&ah->list);
360 list_add_tail(&ah->list, &remove_list); 360 list_add_tail(&ah->list, &remove_list);
361 } 361 }
@@ -486,7 +486,7 @@ int ipoib_ib_dev_stop(struct net_device *dev)
486 * assume the HW is wedged and just free up 486 * assume the HW is wedged and just free up
487 * all our pending work requests. 487 * all our pending work requests.
488 */ 488 */
489 while (priv->tx_tail < priv->tx_head) { 489 while ((int) priv->tx_tail - (int) priv->tx_head < 0) {
490 tx_req = &priv->tx_ring[priv->tx_tail & 490 tx_req = &priv->tx_ring[priv->tx_tail &
491 (IPOIB_TX_RING_SIZE - 1)]; 491 (IPOIB_TX_RING_SIZE - 1)];
492 dma_unmap_single(priv->ca->dma_device, 492 dma_unmap_single(priv->ca->dma_device,