Skip to contentSkip to conversation

IB/mlx5: Unify CQ create flags check

PATCH Superseded Leon Romanovsky 2 participants 4 messages Dec 29, 2015 3 messages not in the archive

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 IB/mlx5: Unify CQ create flags check

From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>

The create_cq() can receive creation flags which were used differently by two following commits [1] and [2]. The current code caused to not accept any flags at all.

This patch unifies the check into one function and one return error code.

Fixes 972ecb821379 ("IB/mlx5: Add create_cq extended command")
Fixes 051f263098a9 ("IB/mlx5: Add driver cross-channel support")

[1] http://www.spinics.net/lists/linux-rdma/msg31430.html
[2] http://www.spinics.net/lists/linux-rdma/msg31658.html

Changes from v0:
* Add Fixes tag

---
 drivers/infiniband/hw/mlx5/cq.c      | 9 +--------
 drivers/infiniband/hw/mlx5/mlx5_ib.h | 3 ++-
 2 files changed, 3 insertions(+), 9 deletions(-)
drivers/infiniband/hw/mlx5/cq.c +1 -8
index b14316603e44..7ddc790b1819 100644
@@ -757,10 +757,6 @@ static void destroy_cq_kernel(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *cq)
 	mlx5_db_free(dev->mdev, &cq->db);
 }
 
-enum {
-	CQ_CREATE_FLAGS_SUPPORTED = IB_CQ_FLAGS_TIMESTAMP_COMPLETION
-};
-
 struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibdev,
 				const struct ib_cq_init_attr *attr,
 				struct ib_ucontext *context,
@@ -778,13 +774,10 @@ struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibdev,
 	int eqn;
 	int err;
 
-	if (check_cq_create_flags(attr->flags))
-		return ERR_PTR(-EINVAL);
-
 	if (entries < 0)
 		return ERR_PTR(-EINVAL);
 
-	if (attr->flags & ~CQ_CREATE_FLAGS_SUPPORTED)
+	if (check_cq_create_flags(attr->flags))
 		return ERR_PTR(-EOPNOTSUPP);
 
 	entries = roundup_pow_of_two(entries + 1);
drivers/infiniband/hw/mlx5/mlx5_ib.h +2 -1
index d4b227126265..fbf14a768105 100644
@@ -692,6 +692,7 @@ static inline u32 check_cq_create_flags(u32 flags)
 	 * It returns non-zero value for unsupported CQ
 	 * create flags, otherwise it returns zero.
 	 */
-	return (flags & ~IB_CQ_FLAGS_IGNORE_OVERRUN);
+	return (flags & ~(IB_CQ_FLAGS_IGNORE_OVERRUN |
+			  IB_CQ_FLAGS_TIMESTAMP_COMPLETION));
 }
 #endif /* MLX5_IB_H */
Signature · 6 lines
1.7.12.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1451388884-11673-1-git-send-email-leon-2ukJVAZIZ/[email protected]

#2 lore raw
Quoted 5 lines

From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>

The create_cq() can receive creation flags which were used differently by two following commits [1] and [2]. The current code caused to not accept any flags at all.

We can skip referencing the linux-rdma mailing list.

Quoted 4 lines

This patch unifies the check into one function and one return error code.

Quoted 8 lines
Fixes 972ecb821379 ("IB/mlx5: Add create_cq extended command")
Fixes 051f263098a9 ("IB/mlx5: Add driver cross-channel support")

[1] http://www.spinics.net/lists/linux-rdma/msg31430.html
[2] http://www.spinics.net/lists/linux-rdma/msg31658.html

Changes from v0:
* Add Fixes tag

Umm, the above ([1], [2], Changes) usually go under the "---" separator so we won't see them in git log forever.

Quoted 6 lines
---
  drivers/infiniband/hw/mlx5/cq.c      | 9 +--------
  drivers/infiniband/hw/mlx5/mlx5_ib.h | 3 ++-
  2 files changed, 3 insertions(+), 9 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 56828FF3.7010904-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org

#4 lore raw
Quoted 15 lines · Sagi Grimberg
Quoted 5 lines

From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>

The create_cq() can receive creation flags which were used differently by two following commits [1] and [2]. The current code caused to not accept any flags at all.

We can skip referencing the linux-rdma mailing list.

Quoted 7 lines

This patch unifies the check into one function and one return error code.

Fixes 972ecb821379 ("IB/mlx5: Add create_cq extended command")
Fixes 051f263098a9 ("IB/mlx5: Add driver cross-channel support")
Quoted 8 lines
Quoted 5 lines

[1] http://www.spinics.net/lists/linux-rdma/msg31430.html
[2] http://www.spinics.net/lists/linux-rdma/msg31658.html

Changes from v0:
* Add Fixes tag

Umm, the above ([1], [2], Changes) usually go under the "---" separator so we won't see them in git log forever.

Doug,
Do you want me resend the patch?

Quoted 7 lines
Quoted 7 lines
---
 drivers/infiniband/hw/mlx5/cq.c      | 9 +--------
 drivers/infiniband/hw/mlx5/mlx5_ib.h | 3 ++-
 2 files changed, 3 insertions(+), 9 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20151229140341.GE17694-2ukJVAZIZ/[email protected]

#6 lore raw
Quoted 19 lines · Leon Romanovsky
Quoted 18 lines · Sagi Grimberg
Quoted 5 lines

From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>

The create_cq() can receive creation flags which were used differently by two following commits [1] and [2]. The current code caused to not accept any flags at all.

We can skip referencing the linux-rdma mailing list.

Quoted 10 lines

This patch unifies the check into one function and one return error code.

Fixes 972ecb821379 ("IB/mlx5: Add create_cq extended command")
Fixes 051f263098a9 ("IB/mlx5: Add driver cross-channel support")

[1] http://www.spinics.net/lists/linux-rdma/msg31430.html
[2] http://www.spinics.net/lists/linux-rdma/msg31658.html

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Changes from v0:
* Add Fixes tag

Umm, the above ([1], [2], Changes) usually go under the "---" separator so we won't see them in git log forever.

Doug,
Do you want me resend the patch?

I sent new version.
Thanks.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
---
 drivers/infiniband/hw/mlx5/cq.c      | 9 +--------
 drivers/infiniband/hw/mlx5/mlx5_ib.h | 3 ++-
 2 files changed, 3 insertions(+), 9 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html