IB/core: Change provider's API of create_cq to be extendible
authorMatan Barak <matanb@mellanox.com>
Thu, 11 Jun 2015 13:35:20 +0000 (16:35 +0300)
committerDoug Ledford <dledford@redhat.com>
Fri, 12 Jun 2015 18:49:10 +0000 (14:49 -0400)
Add a new ib_cq_init_attr structure which contains the
previous cqe (minimum number of CQ entries) and comp_vector
(completion vector) in addition to a new flags field.
All vendors' create_cq callbacks are changed in order
to work with the new API.

This commit does not change any functionality.

Signed-off-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-By: Devesh Sharma <devesh.sharma@avagotech.com> to patch #2
Signed-off-by: Doug Ledford <dledford@redhat.com>
24 files changed:
drivers/infiniband/core/uverbs_cmd.c
drivers/infiniband/core/verbs.c
drivers/infiniband/hw/amso1100/c2_provider.c
drivers/infiniband/hw/cxgb3/iwch_provider.c
drivers/infiniband/hw/cxgb4/cq.c
drivers/infiniband/hw/cxgb4/iw_cxgb4.h
drivers/infiniband/hw/ehca/ehca_cq.c
drivers/infiniband/hw/ehca/ehca_iverbs.h
drivers/infiniband/hw/ipath/ipath_cq.c
drivers/infiniband/hw/ipath/ipath_verbs.h
drivers/infiniband/hw/mlx4/cq.c
drivers/infiniband/hw/mlx4/mlx4_ib.h
drivers/infiniband/hw/mlx5/cq.c
drivers/infiniband/hw/mlx5/main.c
drivers/infiniband/hw/mlx5/mlx5_ib.h
drivers/infiniband/hw/mthca/mthca_provider.c
drivers/infiniband/hw/nes/nes_verbs.c
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
drivers/infiniband/hw/ocrdma/ocrdma_verbs.h
drivers/infiniband/hw/qib/qib_cq.c
drivers/infiniband/hw/qib/qib_verbs.h
drivers/infiniband/hw/usnic/usnic_ib_verbs.c
drivers/infiniband/hw/usnic/usnic_ib_verbs.h
include/rdma/ib_verbs.h

index a9f048990dfcd833de09978c0448ad979749e4c9..1954ebb0285996989f2473e68b44a34b8c3ce5c1 100644 (file)
@@ -1341,6 +1341,7 @@ ssize_t ib_uverbs_create_cq(struct ib_uverbs_file *file,
        struct ib_uverbs_event_file    *ev_file = NULL;
        struct ib_cq                   *cq;
        int                             ret;
+       struct ib_cq_init_attr attr = {};
 
        if (out_len < sizeof resp)
                return -ENOSPC;
@@ -1376,8 +1377,9 @@ ssize_t ib_uverbs_create_cq(struct ib_uverbs_file *file,
        INIT_LIST_HEAD(&obj->comp_list);
        INIT_LIST_HEAD(&obj->async_list);
 
-       cq = file->device->ib_dev->create_cq(file->device->ib_dev, cmd.cqe,
-                                            cmd.comp_vector,
+       attr.cqe = cmd.cqe;
+       attr.comp_vector = cmd.comp_vector;
+       cq = file->device->ib_dev->create_cq(file->device->ib_dev, &attr,
                                             file->ucontext, &udata);
        if (IS_ERR(cq)) {
                ret = PTR_ERR(cq);
index 658c2835a11d79e7b462a76bee556c370a05babe..7bffdbe6afe98e2c554e4bb793055aca0185cea6 100644 (file)
@@ -1079,8 +1079,9 @@ struct ib_cq *ib_create_cq(struct ib_device *device,
                           void *cq_context, int cqe, int comp_vector)
 {
        struct ib_cq *cq;
+       struct ib_cq_init_attr attr = {.cqe = cqe, .comp_vector = comp_vector};
 
-       cq = device->create_cq(device, cqe, comp_vector, NULL, NULL);
+       cq = device->create_cq(device, &attr, NULL, NULL);
 
        if (!IS_ERR(cq)) {
                cq->device        = device;
index 0f007a6b188ba4698de4f36dce59cb8662caef77..8ea569f2cfa687dc56b4172015ca23e23db8a069 100644 (file)
@@ -286,13 +286,18 @@ static int c2_destroy_qp(struct ib_qp *ib_qp)
        return 0;
 }
 
-static struct ib_cq *c2_create_cq(struct ib_device *ibdev, int entries, int vector,
+static struct ib_cq *c2_create_cq(struct ib_device *ibdev,
+                                 const struct ib_cq_init_attr *attr,
                                  struct ib_ucontext *context,
                                  struct ib_udata *udata)
 {
+       int entries = attr->cqe;
        struct c2_cq *cq;
        int err;
 
+       if (attr->flags)
+               return ERR_PTR(-EINVAL);
+
        cq = kmalloc(sizeof(*cq), GFP_KERNEL);
        if (!cq) {
                pr_debug("%s: Unable to allocate CQ\n", __func__);
index 19c830ecbb673aae2918317c68f288f2db422eae..b3b847c3d24b67988706b527665b546278e247e0 100644 (file)
@@ -138,10 +138,12 @@ static int iwch_destroy_cq(struct ib_cq *ib_cq)
        return 0;
 }
 
-static struct ib_cq *iwch_create_cq(struct ib_device *ibdev, int entries, int vector,
-                            struct ib_ucontext *ib_context,
-                            struct ib_udata *udata)
+static struct ib_cq *iwch_create_cq(struct ib_device *ibdev,
+                                   const struct ib_cq_init_attr *attr,
+                                   struct ib_ucontext *ib_context,
+                                   struct ib_udata *udata)
 {
+       int entries = attr->cqe;
        struct iwch_dev *rhp;
        struct iwch_cq *chp;
        struct iwch_create_cq_resp uresp;
@@ -151,6 +153,9 @@ static struct ib_cq *iwch_create_cq(struct ib_device *ibdev, int entries, int ve
        size_t resplen;
 
        PDBG("%s ib_dev %p entries %d\n", __func__, ibdev, entries);
+       if (attr->flags)
+               return ERR_PTR(-EINVAL);
+
        rhp = to_iwch_dev(ibdev);
        chp = kzalloc(sizeof(*chp), GFP_KERNEL);
        if (!chp)
index b5596faebcf1dad8f18e204f9109aad6e2c768f2..c7aab48f07cdfcdebf3efb6374416619c9095e04 100644 (file)
@@ -864,10 +864,13 @@ int c4iw_destroy_cq(struct ib_cq *ib_cq)
        return 0;
 }
 
-struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, int entries,
-                            int vector, struct ib_ucontext *ib_context,
+struct ib_cq *c4iw_create_cq(struct ib_device *ibdev,
+                            const struct ib_cq_init_attr *attr,
+                            struct ib_ucontext *ib_context,
                             struct ib_udata *udata)
 {
+       int entries = attr->cqe;
+       int vector = attr->comp_vector;
        struct c4iw_dev *rhp;
        struct c4iw_cq *chp;
        struct c4iw_create_cq_resp uresp;
@@ -877,6 +880,8 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, int entries,
        struct c4iw_mm_entry *mm, *mm2;
 
        PDBG("%s ib_dev %p entries %d\n", __func__, ibdev, entries);
+       if (attr->flags)
+               return ERR_PTR(-EINVAL);
 
        rhp = to_c4iw_dev(ibdev);
 
index 595f808f709b8032e8834a1889d30669c85df261..cc77844fada38e2f3b00e51223e38dbbb7e29434 100644 (file)
@@ -990,10 +990,10 @@ int c4iw_reregister_phys_mem(struct ib_mr *mr,
                                     int acc, u64 *iova_start);
 int c4iw_dereg_mr(struct ib_mr *ib_mr);
 int c4iw_destroy_cq(struct ib_cq *ib_cq);
-struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, int entries,
-                                       int vector,
-                                       struct ib_ucontext *ib_context,
-                                       struct ib_udata *udata);
+struct ib_cq *c4iw_create_cq(struct ib_device *ibdev,
+                            const struct ib_cq_init_attr *attr,
+                            struct ib_ucontext *ib_context,
+                            struct ib_udata *udata);
 int c4iw_resize_cq(struct ib_cq *cq, int cqe, struct ib_udata *udata);
 int c4iw_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags);
 int c4iw_destroy_qp(struct ib_qp *ib_qp);
index 8cc837537768f97f99041ec7ab69d2e111dba0c0..9b68b175069b9a1b6f95bfc1beae065b9ee6b682 100644 (file)
@@ -113,10 +113,12 @@ struct ehca_qp *ehca_cq_get_qp(struct ehca_cq *cq, int real_qp_num)
        return ret;
 }
 
-struct ib_cq *ehca_create_cq(struct ib_device *device, int cqe, int comp_vector,
+struct ib_cq *ehca_create_cq(struct ib_device *device,
+                            const struct ib_cq_init_attr *attr,
                             struct ib_ucontext *context,
                             struct ib_udata *udata)
 {
+       int cqe = attr->cqe;
        static const u32 additional_cqe = 20;
        struct ib_cq *cq;
        struct ehca_cq *my_cq;
@@ -131,6 +133,9 @@ struct ib_cq *ehca_create_cq(struct ib_device *device, int cqe, int comp_vector,
        int ipz_rc, i;
        unsigned long flags;
 
+       if (attr->flags)
+               return ERR_PTR(-EINVAL);
+
        if (cqe >= 0xFFFFFFFF - 64 - additional_cqe)
                return ERR_PTR(-EINVAL);
 
index 582fc71a84882820b6ffdc941a82f58aaa734fe7..62caf2ee020913bba03d6145662c9bb7c8d56fc8 100644 (file)
@@ -129,7 +129,8 @@ int ehca_destroy_eq(struct ehca_shca *shca, struct ehca_eq *eq);
 void *ehca_poll_eq(struct ehca_shca *shca, struct ehca_eq *eq);
 
 
-struct ib_cq *ehca_create_cq(struct ib_device *device, int cqe, int comp_vector,
+struct ib_cq *ehca_create_cq(struct ib_device *device,
+                            const struct ib_cq_init_attr *attr,
                             struct ib_ucontext *context,
                             struct ib_udata *udata);
 
index 0416c6c0e126f3dd8728fe2518b0d1ce018ce6dc..e9dd9112e7184cd20a48e6ec6b2a58f3c9d602ed 100644 (file)
@@ -188,7 +188,7 @@ static void send_complete(unsigned long data)
 /**
  * ipath_create_cq - create a completion queue
  * @ibdev: the device this completion queue is attached to
- * @entries: the minimum size of the completion queue
+ * @attr: creation attributes
  * @context: unused by the InfiniPath driver
  * @udata: unused by the InfiniPath driver
  *
@@ -197,16 +197,21 @@ static void send_complete(unsigned long data)
  *
  * Called by ib_create_cq() in the generic verbs code.
  */
-struct ib_cq *ipath_create_cq(struct ib_device *ibdev, int entries, int comp_vector,
+struct ib_cq *ipath_create_cq(struct ib_device *ibdev,
+                             const struct ib_cq_init_attr *attr,
                              struct ib_ucontext *context,
                              struct ib_udata *udata)
 {
+       int entries = attr->cqe;
        struct ipath_ibdev *dev = to_idev(ibdev);
        struct ipath_cq *cq;
        struct ipath_cq_wc *wc;
        struct ib_cq *ret;
        u32 sz;
 
+       if (attr->flags)
+               return ERR_PTR(-EINVAL);
+
        if (entries < 1 || entries > ib_ipath_max_cqes) {
                ret = ERR_PTR(-EINVAL);
                goto done;
index 7a2b6a17f84437cce444a2dc743e683a942f2d8c..8a9b0787c187e4812d4379c46cc3cd37ceac4033 100644 (file)
@@ -807,7 +807,8 @@ void ipath_cq_enter(struct ipath_cq *cq, struct ib_wc *entry, int sig);
 
 int ipath_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *entry);
 
-struct ib_cq *ipath_create_cq(struct ib_device *ibdev, int entries, int comp_vector,
+struct ib_cq *ipath_create_cq(struct ib_device *ibdev,
+                             const struct ib_cq_init_attr *attr,
                              struct ib_ucontext *context,
                              struct ib_udata *udata);
 
index 0176caa5792c4576276470c2c3f86f0fca16a7bd..8e44aaa5225be245d5fc3707cd5fcfd4a8878975 100644 (file)
@@ -166,15 +166,21 @@ err_buf:
        return err;
 }
 
-struct ib_cq *mlx4_ib_create_cq(struct ib_device *ibdev, int entries, int vector,
+struct ib_cq *mlx4_ib_create_cq(struct ib_device *ibdev,
+                               const struct ib_cq_init_attr *attr,
                                struct ib_ucontext *context,
                                struct ib_udata *udata)
 {
+       int entries = attr->cqe;
+       int vector = attr->comp_vector;
        struct mlx4_ib_dev *dev = to_mdev(ibdev);
        struct mlx4_ib_cq *cq;
        struct mlx4_uar *uar;
        int err;
 
+       if (attr->flags)
+               return ERR_PTR(-EINVAL);
+
        if (entries < 1 || entries > dev->dev->caps.max_cqes)
                return ERR_PTR(-EINVAL);
 
index 645d55ef06040babcfb6d6c229411e9095d886ac..340424525b469d0b69954245d73d8cefb78a70e6 100644 (file)
@@ -668,7 +668,8 @@ void mlx4_ib_free_fast_reg_page_list(struct ib_fast_reg_page_list *page_list);
 
 int mlx4_ib_modify_cq(struct ib_cq *cq, u16 cq_count, u16 cq_period);
 int mlx4_ib_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata);
-struct ib_cq *mlx4_ib_create_cq(struct ib_device *ibdev, int entries, int vector,
+struct ib_cq *mlx4_ib_create_cq(struct ib_device *ibdev,
+                               const struct ib_cq_init_attr *attr,
                                struct ib_ucontext *context,
                                struct ib_udata *udata);
 int mlx4_ib_destroy_cq(struct ib_cq *cq);
index 2ee6b105197544abb2799e552b129d37eff53906..09fbae618d35d7c486beb63066bae3abdd3873dc 100644 (file)
@@ -736,10 +736,13 @@ static void destroy_cq_kernel(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *cq)
        mlx5_db_free(dev->mdev, &cq->db);
 }
 
-struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibdev, int entries,
-                               int vector, struct ib_ucontext *context,
+struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibdev,
+                               const struct ib_cq_init_attr *attr,
+                               struct ib_ucontext *context,
                                struct ib_udata *udata)
 {
+       int entries = attr->cqe;
+       int vector = attr->comp_vector;
        struct mlx5_create_cq_mbox_in *cqb = NULL;
        struct mlx5_ib_dev *dev = to_mdev(ibdev);
        struct mlx5_ib_cq *cq;
@@ -750,6 +753,9 @@ struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibdev, int entries,
        int eqn;
        int err;
 
+       if (attr->flags)
+               return ERR_PTR(-EINVAL);
+
        if (entries < 0)
                return ERR_PTR(-EINVAL);
 
index b2fdb9cfa6458d664be1ae934aeaab6e11d8d00b..9565c203a497b1b145e951845bf30dc0ef697873 100644 (file)
@@ -1087,6 +1087,7 @@ static int create_dev_resources(struct mlx5_ib_resources *devr)
 {
        struct ib_srq_init_attr attr;
        struct mlx5_ib_dev *dev;
+       struct ib_cq_init_attr cq_attr = {.cqe = 1};
        int ret = 0;
 
        dev = container_of(devr, struct mlx5_ib_dev, devr);
@@ -1100,7 +1101,7 @@ static int create_dev_resources(struct mlx5_ib_resources *devr)
        devr->p0->uobject = NULL;
        atomic_set(&devr->p0->usecnt, 0);
 
-       devr->c0 = mlx5_ib_create_cq(&dev->ib_dev, 1, 0, NULL, NULL);
+       devr->c0 = mlx5_ib_create_cq(&dev->ib_dev, &cq_attr, NULL, NULL);
        if (IS_ERR(devr->c0)) {
                ret = PTR_ERR(devr->c0);
                goto error1;
index c6219032d00cc75cb25c0860773e4df95d185e59..2f72f326d5c2db179a53d2b36819933834558465 100644 (file)
@@ -556,8 +556,9 @@ int mlx5_ib_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr,
 void *mlx5_get_send_wqe(struct mlx5_ib_qp *qp, int n);
 int mlx5_ib_read_user_wqe(struct mlx5_ib_qp *qp, int send, int wqe_index,
                          void *buffer, u32 length);
-struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibdev, int entries,
-                               int vector, struct ib_ucontext *context,
+struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibdev,
+                               const struct ib_cq_init_attr *attr,
+                               struct ib_ucontext *context,
                                struct ib_udata *udata);
 int mlx5_ib_destroy_cq(struct ib_cq *cq);
 int mlx5_ib_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc);
index 509d59e7a15a4ae31cb84a58974563e5dda9274f..f1b04bd102d107181a8f5ad407b257a9ef6a8a44 100644 (file)
@@ -641,16 +641,20 @@ static int mthca_destroy_qp(struct ib_qp *qp)
        return 0;
 }
 
-static struct ib_cq *mthca_create_cq(struct ib_device *ibdev, int entries,
-                                    int comp_vector,
+static struct ib_cq *mthca_create_cq(struct ib_device *ibdev,
+                                    const struct ib_cq_init_attr *attr,
                                     struct ib_ucontext *context,
                                     struct ib_udata *udata)
 {
+       int entries = attr->cqe;
        struct mthca_create_cq ucmd;
        struct mthca_cq *cq;
        int nent;
        int err;
 
+       if (attr->flags)
+               return ERR_PTR(-EINVAL);
+
        if (entries < 1 || entries > to_mdev(ibdev)->limits.max_cqes)
                return ERR_PTR(-EINVAL);
 
index 0099e419e24f02e350d58a91a4e166423357d718..a3d3d8172f9aef4ab286a2db0f7c8a1cf9e8f46c 100644 (file)
@@ -1526,10 +1526,12 @@ static int nes_destroy_qp(struct ib_qp *ibqp)
 /**
  * nes_create_cq
  */
-static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries,
-               int comp_vector,
-               struct ib_ucontext *context, struct ib_udata *udata)
+static struct ib_cq *nes_create_cq(struct ib_device *ibdev,
+                                  const struct ib_cq_init_attr *attr,
+                                  struct ib_ucontext *context,
+                                  struct ib_udata *udata)
 {
+       int entries = attr->cqe;
        u64 u64temp;
        struct nes_vnic *nesvnic = to_nesvnic(ibdev);
        struct nes_device *nesdev = nesvnic->nesdev;
@@ -1549,6 +1551,9 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries,
        unsigned long flags;
        int ret;
 
+       if (attr->flags)
+               return ERR_PTR(-EINVAL);
+
        if (entries > nesadapter->max_cqe)
                return ERR_PTR(-EINVAL);
 
index 19566907b4d25bac0710bfe7b354e8175e64a5ae..787058dc8d1818fbfb05cbfd52d3c6ca0bc4b6fb 100644 (file)
@@ -1004,10 +1004,12 @@ err:
        return status;
 }
 
-struct ib_cq *ocrdma_create_cq(struct ib_device *ibdev, int entries, int vector,
+struct ib_cq *ocrdma_create_cq(struct ib_device *ibdev,
+                              const struct ib_cq_init_attr *attr,
                               struct ib_ucontext *ib_ctx,
                               struct ib_udata *udata)
 {
+       int entries = attr->cqe;
        struct ocrdma_cq *cq;
        struct ocrdma_dev *dev = get_ocrdma_dev(ibdev);
        struct ocrdma_ucontext *uctx = NULL;
@@ -1015,6 +1017,9 @@ struct ib_cq *ocrdma_create_cq(struct ib_device *ibdev, int entries, int vector,
        int status;
        struct ocrdma_create_cq_ureq ureq;
 
+       if (attr->flags)
+               return ERR_PTR(-EINVAL);
+
        if (udata) {
                if (ib_copy_from_udata(&ureq, udata, sizeof(ureq)))
                        return ERR_PTR(-EFAULT);
index 3cdc81e6ae9b75e36a41761e0a5148b8186120d0..e853195e005bfa280d820c95d725e8f1dc14121c 100644 (file)
@@ -59,8 +59,10 @@ struct ib_pd *ocrdma_alloc_pd(struct ib_device *,
                              struct ib_ucontext *, struct ib_udata *);
 int ocrdma_dealloc_pd(struct ib_pd *pd);
 
-struct ib_cq *ocrdma_create_cq(struct ib_device *, int entries, int vector,
-                              struct ib_ucontext *, struct ib_udata *);
+struct ib_cq *ocrdma_create_cq(struct ib_device *ibdev,
+                              const struct ib_cq_init_attr *attr,
+                              struct ib_ucontext *ib_ctx,
+                              struct ib_udata *udata);
 int ocrdma_resize_cq(struct ib_cq *, int cqe, struct ib_udata *);
 int ocrdma_destroy_cq(struct ib_cq *);
 
index ab4e11cfab15e3f5f4cb0fbfce159747e150ddda..2b45d0b023007dc7b6b14d44c7649cac2d5ac572 100644 (file)
@@ -203,7 +203,7 @@ static void send_complete(struct kthread_work *work)
 /**
  * qib_create_cq - create a completion queue
  * @ibdev: the device this completion queue is attached to
- * @entries: the minimum size of the completion queue
+ * @attr: creation attributes
  * @context: unused by the QLogic_IB driver
  * @udata: user data for libibverbs.so
  *
@@ -212,16 +212,21 @@ static void send_complete(struct kthread_work *work)
  *
  * Called by ib_create_cq() in the generic verbs code.
  */
-struct ib_cq *qib_create_cq(struct ib_device *ibdev, int entries,
-                           int comp_vector, struct ib_ucontext *context,
+struct ib_cq *qib_create_cq(struct ib_device *ibdev,
+                           const struct ib_cq_init_attr *attr,
+                           struct ib_ucontext *context,
                            struct ib_udata *udata)
 {
+       int entries = attr->cqe;
        struct qib_ibdev *dev = to_idev(ibdev);
        struct qib_cq *cq;
        struct qib_cq_wc *wc;
        struct ib_cq *ret;
        u32 sz;
 
+       if (attr->flags)
+               return ERR_PTR(-EINVAL);
+
        if (entries < 1 || entries > ib_qib_max_cqes) {
                ret = ERR_PTR(-EINVAL);
                goto done;
index f2f57749c07d4de1e9d44c2bf7865a1f9aa53f0f..6e4e3d9bd86a1101a93ba3404a29aa4e29d9624a 100644 (file)
@@ -1007,8 +1007,9 @@ void qib_cq_enter(struct qib_cq *cq, struct ib_wc *entry, int sig);
 
 int qib_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *entry);
 
-struct ib_cq *qib_create_cq(struct ib_device *ibdev, int entries,
-                           int comp_vector, struct ib_ucontext *context,
+struct ib_cq *qib_create_cq(struct ib_device *ibdev,
+                           const struct ib_cq_init_attr *attr,
+                           struct ib_ucontext *context,
                            struct ib_udata *udata);
 
 int qib_destroy_cq(struct ib_cq *ibcq);
index 53bd6a2d9cdbbae4545a70d1d070b17eafb18154..2b3f7e3fe1aab658da2c092bae7d103e883586ab 100644 (file)
@@ -570,13 +570,17 @@ int usnic_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
        return status;
 }
 
-struct ib_cq *usnic_ib_create_cq(struct ib_device *ibdev, int entries,
-                                       int vector, struct ib_ucontext *context,
-                                       struct ib_udata *udata)
+struct ib_cq *usnic_ib_create_cq(struct ib_device *ibdev,
+                                const struct ib_cq_init_attr *attr,
+                                struct ib_ucontext *context,
+                                struct ib_udata *udata)
 {
        struct ib_cq *cq;
 
        usnic_dbg("\n");
+       if (attr->flags)
+               return ERR_PTR(-EINVAL);
+
        cq = kzalloc(sizeof(*cq), GFP_KERNEL);
        if (!cq)
                return ERR_PTR(-EBUSY);
index 57ddba5035acd7ced97424bbf871355d4fa2ad5e..2ab84270b83da6346c23b2e6e6d73f208539b7ca 100644 (file)
@@ -46,9 +46,10 @@ struct ib_qp *usnic_ib_create_qp(struct ib_pd *pd,
 int usnic_ib_destroy_qp(struct ib_qp *qp);
 int usnic_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
                                int attr_mask, struct ib_udata *udata);
-struct ib_cq *usnic_ib_create_cq(struct ib_device *ibdev, int entries,
-                                       int vector, struct ib_ucontext *context,
-                                       struct ib_udata *udata);
+struct ib_cq *usnic_ib_create_cq(struct ib_device *ibdev,
+                                const struct ib_cq_init_attr *attr,
+                                struct ib_ucontext *context,
+                                struct ib_udata *udata);
 int usnic_ib_destroy_cq(struct ib_cq *cq);
 struct ib_mr *usnic_ib_reg_mr(struct ib_pd *pd, u64 start, u64 length,
                                u64 virt_addr, int access_flags,
index 7725ceea7864da5d081166e79070363b9f652e09..b25ffa05e3384b504893a7f3f2d79a9305a8fa67 100644 (file)
@@ -173,6 +173,12 @@ struct ib_odp_caps {
        } per_transport_caps;
 };
 
+struct ib_cq_init_attr {
+       unsigned int    cqe;
+       int             comp_vector;
+       u32             flags;
+};
+
 struct ib_device_attr {
        u64                     fw_ver;
        __be64                  sys_image_guid;
@@ -1613,8 +1619,8 @@ struct ib_device {
        int                        (*post_recv)(struct ib_qp *qp,
                                                struct ib_recv_wr *recv_wr,
                                                struct ib_recv_wr **bad_recv_wr);
-       struct ib_cq *             (*create_cq)(struct ib_device *device, int cqe,
-                                               int comp_vector,
+       struct ib_cq *             (*create_cq)(struct ib_device *device,
+                                               const struct ib_cq_init_attr *attr,
                                                struct ib_ucontext *context,
                                                struct ib_udata *udata);
        int                        (*modify_cq)(struct ib_cq *cq, u16 cq_count,