aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErez Shitrit <erezsh@mellanox.com>2017-07-13 07:29:08 -0400
committerLeon Romanovsky <leonro@mellanox.com>2017-07-23 03:52:00 -0400
commit5dc78ad1904db597bdb4427f3ead437aae86f54c (patch)
treefad5bec2f1964683798e90535610e4a55823632b
parentb287b76e89503ef1d403cc5cc8bd74b035d25bfa (diff)
IB/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. Signed-off-by: Erez Shitrit <erezsh@mellanox.com> Signed-off-by: Leon Romanovsky <leon@kernel.org>
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_ib.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
index 02eda1f53a67..2e075377242e 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -711,6 +711,27 @@ static int recvs_pending(struct net_device *dev)
711 return pending; 711 return pending;
712} 712}
713 713
714static void check_qp_movement_and_print(struct ipoib_dev_priv *priv,
715 struct ib_qp *qp,
716 enum ib_qp_state new_state)
717{
718 struct ib_qp_attr qp_attr;
719 struct ib_qp_init_attr query_init_attr;
720 int ret;
721
722 ret = ib_query_qp(qp, &qp_attr, IB_QP_STATE, &query_init_attr);
723 if (ret) {
724 ipoib_warn(priv, "%s: Failed to query QP\n", __func__);
725 return;
726 }
727 /* print according to the new-state and the previous state.*/
728 if (new_state == IB_QPS_ERR && qp_attr.qp_state == IB_QPS_RESET)
729 ipoib_dbg(priv, "Failed modify QP, IB_QPS_RESET to IB_QPS_ERR, acceptable\n");
730 else
731 ipoib_warn(priv, "Failed to modify QP to state: %d from state: %d\n",
732 new_state, qp_attr.qp_state);
733}
734
714int ipoib_ib_dev_stop_default(struct net_device *dev) 735int ipoib_ib_dev_stop_default(struct net_device *dev)
715{ 736{
716 struct ipoib_dev_priv *priv = ipoib_priv(dev); 737 struct ipoib_dev_priv *priv = ipoib_priv(dev);
@@ -730,7 +751,7 @@ int ipoib_ib_dev_stop_default(struct net_device *dev)
730 */ 751 */
731 qp_attr.qp_state = IB_QPS_ERR; 752 qp_attr.qp_state = IB_QPS_ERR;
732 if (ib_modify_qp(priv->qp, &qp_attr, IB_QP_STATE)) 753 if (ib_modify_qp(priv->qp, &qp_attr, IB_QP_STATE))
733 ipoib_warn(priv, "Failed to modify QP to ERROR state\n"); 754 check_qp_movement_and_print(priv, priv->qp, IB_QPS_ERR);
734 755
735 /* Wait for all sends and receives to complete */ 756 /* Wait for all sends and receives to complete */
736 begin = jiffies; 757 begin = jiffies;