Yes, good catch, but I think the fix is not quite right.  When we fill
up the table, we'll set nent = 0, and then do ++nent at the end of the
loop.  So the second time around we'll start with nent = 1.

Something like this is better, right?

--- linux-kernel/infiniband/hw/mthca/mthca_cmd.c        (revision 3544)
+++ linux-kernel/infiniband/hw/mthca/mthca_cmd.c        (working copy)
@@ -605,7 +605,7 @@ static int mthca_map_cmd(struct mthca_de
                        err = -EINVAL;
                        goto out;
                }
-               for (i = 0; i < mthca_icm_size(&iter) / (1 << lg); ++i, ++nent) 
{
+               for (i = 0; i < mthca_icm_size(&iter) / (1 << lg); ++i) {
                        if (virt != -1) {
                                pages[nent * 2] = cpu_to_be64(virt);
                                virt += 1 << lg;
@@ -616,7 +616,7 @@ static int mthca_map_cmd(struct mthca_de
                        ts += 1 << (lg - 10);
                        ++tc;
 
-                       if (nent == MTHCA_MAILBOX_SIZE / 16) {
+                       if (++nent == MTHCA_MAILBOX_SIZE / 16) {
                                err = mthca_cmd(dev, mailbox->dma, nent, 0, op,
                                                CMD_TIME_CLASS_B, status);
                                if (err || *status)
_______________________________________________
openib-general mailing list
[email protected]
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to