Date: Wed, 8 May 2019 10:33:09 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r347258 - in head/sys/dev: mlx4/mlx4_ib mlx5/mlx5_ib Message-ID: <201905081033.x48AX9MV044643@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Wed May 8 10:33:09 2019 New Revision: 347258 URL: https://svnweb.freebsd.org/changeset/base/347258 Log: Make sure to error out when arming the CQ fails in mlx4ib and mlx5ib. MFC after: 3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Modified: head/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c ============================================================================== --- head/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c Wed May 8 10:32:45 2019 (r347257) +++ head/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c Wed May 8 10:33:09 2019 (r347258) @@ -878,7 +878,8 @@ int mlx4_ib_poll_cq(struct ib_cq *ibcq, int num_entrie struct mlx4_ib_dev *mdev = to_mdev(cq->ibcq.device); spin_lock_irqsave(&cq->lock, flags); - if (mdev->dev->persist->state & MLX4_DEVICE_STATE_INTERNAL_ERROR) { + if (unlikely(mdev->dev->persist->state & + MLX4_DEVICE_STATE_INTERNAL_ERROR)) { mlx4_ib_poll_sw_comp(cq, num_entries, wc, &npolled); goto out; } @@ -898,11 +899,18 @@ out: int mlx4_ib_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags) { - mlx4_cq_arm(&to_mcq(ibcq)->mcq, + struct mlx4_ib_cq *cq = to_mcq(ibcq); + struct mlx4_ib_dev *mdev = to_mdev(cq->ibcq.device); + + if (unlikely(mdev->dev->persist->state & + MLX4_DEVICE_STATE_INTERNAL_ERROR)) + return -1; + + mlx4_cq_arm(&cq->mcq, (flags & IB_CQ_SOLICITED_MASK) == IB_CQ_SOLICITED ? MLX4_CQ_DB_REQ_NOT_SOL : MLX4_CQ_DB_REQ_NOT, - to_mdev(ibcq->device)->uar_map, - MLX4_GET_DOORBELL_LOCK(&to_mdev(ibcq->device)->uar_lock)); + mdev->uar_map, + MLX4_GET_DOORBELL_LOCK(&mdev->uar_lock)); return 0; } Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c ============================================================================== --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Wed May 8 10:32:45 2019 (r347257) +++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Wed May 8 10:33:09 2019 (r347258) @@ -673,7 +673,7 @@ int mlx5_ib_poll_cq(struct ib_cq *ibcq, int num_entrie int npolled; spin_lock_irqsave(&cq->lock, flags); - if (mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { + if (unlikely(mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)) { mlx5_ib_poll_sw_comp(cq, num_entries, wc, &npolled); goto out; } @@ -702,6 +702,9 @@ int mlx5_ib_arm_cq(struct ib_cq *ibcq, enum ib_cq_noti unsigned long irq_flags; int ret = 0; + if (unlikely(mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)) + return -1; + spin_lock_irqsave(&cq->lock, irq_flags); if (cq->notify_flags != IB_CQ_NEXT_COMP) cq->notify_flags = flags & IB_CQ_SOLICITED_MASK; @@ -715,7 +718,7 @@ int mlx5_ib_arm_cq(struct ib_cq *ibcq, enum ib_cq_noti MLX5_CQ_DB_REQ_NOT_SOL : MLX5_CQ_DB_REQ_NOT, uar_page, MLX5_GET_DOORBELL_LOCK(&mdev->priv.cq_uar_lock), - to_mcq(ibcq)->mcq.cons_index); + cq->mcq.cons_index); return ret; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905081033.x48AX9MV044643>