* [PATCH] IPoIB: Modify QP to error only if not in reset
@ 2011-03-17 12:13 Eli Cohen
0 siblings, 0 replies; only message in thread
From: Eli Cohen @ 2011-03-17 12:13 UTC (permalink / raw)
To: roland-DgEjT+Ai2ygdnm+yROfE0A; +Cc: RDMA list, ronniz-VPRAkNaXOzVS1MOuV/RT9w
An ipoib interface may be moved UP but its QP may still not be modified to a
state higher than IB_QPS_RESET since it did not find the pkey assigned to it in
the port. When we later call ipoib_ib_dev_stop() the modification to IB_QPS_ERR
will fail and warning message printed. The problem can be reproduced easily in
the following stpes:
- Create a child interface using a pkey that does not exist in the port's table
- Confiugre an IP address for the child interface
- delete the child interface
This patch queries the QP before attempting to modify it.
Found by: Ronni Zimmermann <ronniz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Eli Cohen <eli-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org>
---
drivers/infiniband/ulp/ipoib/ipoib_ib.c | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
index 806d029..ceff2bc 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -806,6 +806,8 @@ int ipoib_ib_dev_stop(struct net_device *dev, int flush)
unsigned long begin;
struct ipoib_tx_buf *tx_req;
int i;
+ struct ib_qp_init_attr qp_init_attr;
+ int err;
if (test_and_clear_bit(IPOIB_FLAG_INITIALIZED, &priv->flags))
napi_disable(&priv->napi);
@@ -813,12 +815,24 @@ int ipoib_ib_dev_stop(struct net_device *dev, int flush)
ipoib_cm_dev_stop(dev);
/*
+ * if we fail to query the QP we continue as if it was in
+ * a state different than RESET so we carry any cleanup possible
+ */
+ err = ib_query_qp(priv->qp, &qp_attr, IB_QP_CUR_STATE, &qp_init_attr);
+ if (err) {
+ ipoib_warn(priv, "Failed to query QP state, err %d\n", err);
+ qp_attr.cur_qp_state = IB_QPS_INIT;
+ }
+
+ /*
* Move our QP to the error state and then reinitialize in
* when all work requests have completed or have been flushed.
*/
- qp_attr.qp_state = IB_QPS_ERR;
- if (ib_modify_qp(priv->qp, &qp_attr, IB_QP_STATE))
- ipoib_warn(priv, "Failed to modify QP to ERROR state\n");
+ if (qp_attr.cur_qp_state != IB_QPS_RESET) {
+ qp_attr.qp_state = IB_QPS_ERR;
+ if (ib_modify_qp(priv->qp, &qp_attr, IB_QP_STATE))
+ ipoib_warn(priv, "Failed to modify QP to ERROR state\n");
+ }
/* Wait for all sends and receives to complete */
begin = jiffies;
--
1.6.0.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-03-17 12:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-17 12:13 [PATCH] IPoIB: Modify QP to error only if not in reset Eli Cohen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox