]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
IB/mlx5: Unify CQ create flags check
authorLeon Romanovsky <leonro@mellanox.com>
Tue, 29 Dec 2015 15:01:30 +0000 (17:01 +0200)
committerDoug Ledford <dledford@redhat.com>
Thu, 21 Jan 2016 17:05:37 +0000 (12:05 -0500)
The create_cq() can receive creation flags which were used
differently by two commits which added create_cq extended
command and cross-channel. The merged 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")
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/mlx5/cq.c
drivers/infiniband/hw/mlx5/mlx5_ib.h

index b14316603e44f87f14978e8ad28e760018ef328c..7ddc790b1819a913d6a9a621f92e9cd7a46bdcb7 100644 (file)
@@ -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);
index 726e31de59d55647393031c638091e137629226d..d475f83c295b83d443e1b1b9235f406ee3071623 100644 (file)
@@ -739,7 +739,8 @@ 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));
 }
 
 static inline int verify_assign_uidx(u8 cqe_version, u32 cmd_uidx,