[ofa-general] Re: [PATCH] IB/ipoib: drain cq in dev_stop

Roland Dreier rdreier at cisco.com
Thu May 24 11:41:27 PDT 2007


 > +	if (unlikely(wc->status != IB_WC_SUCCESS || flush)) {

Now we have two things to test here, which means we hurt our fast path
for the rare case.

What if we overwrite any status of IB_WC_SUCCESS with IB_WC_FLUSH_ERR
if we're draining a CQ?  I don't see anything obviously wrong with
this (on top of the patches I just applied):

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
index 8404f05..e24ccb4 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -557,6 +557,14 @@ void ipoib_drain_cq(struct net_device *dev)
 	do {
 		n = ib_poll_cq(priv->cq, IPOIB_NUM_WC, priv->ibwc);
 		for (i = 0; i < n; ++i) {
+			/*
+			 * Convert any successful completions to flush
+			 * errors to avoid passing packets up the
+			 * stack after bringing the device down.
+			 */
+			if (priv->ibwc[i].status == IB_WC_SUCCESS)
+				priv->ibwc[i].status = IB_WC_WR_FLUSH_ERR;
+
 			if (priv->ibwc[i].wr_id & IPOIB_CM_OP_SRQ)
 				ipoib_cm_handle_rx_wc(dev, priv->ibwc + i);
 			else if (priv->ibwc[i].wr_id & IPOIB_OP_RECV)



More information about the general mailing list