Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Dec 2018 11:35:00 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r341891 - stable/11/sys/ofed/drivers/infiniband/ulp/ipoib
Message-ID:  <201812121135.wBCBZ0g9051615@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Wed Dec 12 11:35:00 2018
New Revision: 341891
URL: https://svnweb.freebsd.org/changeset/base/341891

Log:
  MFC r341538:
  ipoib: Notify on modify QP failure only when relevant
  
  Modify QP can fail and it can be acceptable, like when moving from RST to
  ERR state, all the rest are not acceptable and a message to the log
  should be printed.
  
  The current code prints on all failures and many messages like:
  "Failed to modify QP to ERROR state" appear, even when supported by the
  state machine of the QP object.
  
  Linux commit:
  5dc78ad1904db597bdb4427f3ead437aae86f54c
  
  MFC after:      1 week
  Sponsored by:   Mellanox Technologies

Modified:
  stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c
==============================================================================
--- stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c	Wed Dec 12 11:33:50 2018	(r341890)
+++ stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c	Wed Dec 12 11:35:00 2018	(r341891)
@@ -708,6 +708,30 @@ static int recvs_pending(struct ipoib_dev_priv *priv)
 	return pending;
 }
 
+static void check_qp_movement_and_print(struct ipoib_dev_priv *priv,
+					struct ib_qp *qp,
+					enum ib_qp_state new_state)
+{
+	struct ib_qp_attr qp_attr;
+	struct ib_qp_init_attr query_init_attr;
+	int ret;
+
+	ret = ib_query_qp(qp, &qp_attr, IB_QP_STATE, &query_init_attr);
+	if (ret) {
+		ipoib_warn(priv, "%s: Failed to query QP (%d)\n", __func__, ret);
+		return;
+	}
+
+	/* print according to the new-state and the previous state */
+	if (new_state == IB_QPS_ERR && qp_attr.qp_state == IB_QPS_RESET) {
+		ipoib_dbg(priv, "Failed to modify QP %d->%d, acceptable\n",
+			  qp_attr.qp_state, new_state);
+	} else {
+		ipoib_warn(priv, "Failed to modify QP %d->%d\n",
+			   qp_attr.qp_state, new_state);
+	}
+}
+
 void ipoib_drain_cq(struct ipoib_dev_priv *priv)
 {
 	int i, n;
@@ -759,7 +783,7 @@ int ipoib_ib_dev_stop(struct ipoib_dev_priv *priv, int
 	 */
 	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");
+		check_qp_movement_and_print(priv, priv->qp, IB_QPS_ERR);
 
 	/* Wait for all sends and receives to complete */
 	begin = jiffies;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201812121135.wBCBZ0g9051615>