Re: [PATCH] IB/mlx5: Unify CQ create flags check

2015-12-29 Thread Sagi Grimberg

Does this deserve a Fixes tag?
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] IB/mlx5: Unify CQ create flags check

2015-12-29 Thread Leon Romanovsky
From: Leon Romanovsky 

The create_cq() can receive creation flags which were used
differently by two following commits [1] and [2].

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

[1] commit 972ecb821379 ("IB/mlx5: Add create_cq extended command")
[2] commit 051f263098a9 ("IB/mlx5: Add driver cross-channel support")

Signed-off-by: Leon Romanovsky 
---
 drivers/infiniband/hw/mlx5/cq.c  | 9 +
 drivers/infiniband/hw/mlx5/mlx5_ib.h | 3 ++-
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/infiniband/hw/mlx5/cq.c b/drivers/infiniband/hw/mlx5/cq.c
index b14316603e44..7ddc790b1819 100644
--- a/drivers/infiniband/hw/mlx5/cq.c
+++ b/drivers/infiniband/hw/mlx5/cq.c
@@ -757,10 +757,6 @@ static void destroy_cq_kernel(struct mlx5_ib_dev *dev, 
struct mlx5_ib_cq *cq)
mlx5_db_free(dev->mdev, >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);
diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h 
b/drivers/infiniband/hw/mlx5/mlx5_ib.h
index d4b227126265..fbf14a768105 100644
--- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
+++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
@@ -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 */
-- 
1.7.12.4

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