[ofa-general] [PATCH 5/7] IB/ipath -- fix count of packets received by kernel

Ralph Campbell ralph.campbell at qlogic.com
Tue May 6 11:36:41 PDT 2008


From: Michael Albaugh <Michael.Albaugh at Qlogic.com>

The loop in ipath_kreceive() that processes packets
increments the loop-index 'i' once too often, because
the exit condition does not depend on it, and is checked
after the increment. By adding a check for !last to
the iterator in the for loop, we correct that in a way
that is not so likely to be re-broken by changes in the
loop body.

Signed-off-by: Michael Albaugh <micheal.albaugh at qlogic.com>
---

 drivers/infiniband/hw/ipath/ipath_driver.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c
index acf30c0..f81dd4a 100644
--- a/drivers/infiniband/hw/ipath/ipath_driver.c
+++ b/drivers/infiniband/hw/ipath/ipath_driver.c
@@ -1197,7 +1197,7 @@ void ipath_kreceive(struct ipath_portdata *pd)
 	}
 
 reloop:
-	for (last = 0, i = 1; !last; i++) {
+	for (last = 0, i = 1; !last; i += !last) {
 		hdr = dd->ipath_f_get_msgheader(dd, rhf_addr);
 		eflags = ipath_hdrget_err_flags(rhf_addr);
 		etype = ipath_hdrget_rcv_type(rhf_addr);




More information about the general mailing list