These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / infiniband / hw / mthca / mthca_provider.c
index 415f8e1..dc2d48c 100644 (file)
@@ -57,14 +57,17 @@ static void init_query_mad(struct ib_smp *mad)
        mad->method        = IB_MGMT_METHOD_GET;
 }
 
-static int mthca_query_device(struct ib_device *ibdev,
-                             struct ib_device_attr *props)
+static int mthca_query_device(struct ib_device *ibdev, struct ib_device_attr *props,
+                             struct ib_udata *uhw)
 {
        struct ib_smp *in_mad  = NULL;
        struct ib_smp *out_mad = NULL;
        int err = -ENOMEM;
        struct mthca_dev *mdev = to_mdev(ibdev);
 
+       if (uhw->inlen || uhw->outlen)
+               return -EINVAL;
+
        in_mad  = kzalloc(sizeof *in_mad, GFP_KERNEL);
        out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
        if (!in_mad || !out_mad)
@@ -94,6 +97,7 @@ static int mthca_query_device(struct ib_device *ibdev,
        props->max_qp              = mdev->limits.num_qps - mdev->limits.reserved_qps;
        props->max_qp_wr           = mdev->limits.max_wqes;
        props->max_sge             = mdev->limits.max_sg;
+       props->max_sge_rd          = props->max_sge;
        props->max_cq              = mdev->limits.num_cqs - mdev->limits.reserved_cqs;
        props->max_cqe             = mdev->limits.max_cqes;
        props->max_mr              = mdev->limits.num_mpts - mdev->limits.reserved_mrws;
@@ -641,16 +645,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);
 
@@ -1244,6 +1252,24 @@ out:
        return err;
 }
 
+static int mthca_port_immutable(struct ib_device *ibdev, u8 port_num,
+                               struct ib_port_immutable *immutable)
+{
+       struct ib_port_attr attr;
+       int err;
+
+       err = mthca_query_port(ibdev, port_num, &attr);
+       if (err)
+               return err;
+
+       immutable->pkey_tbl_len = attr.pkey_tbl_len;
+       immutable->gid_tbl_len = attr.gid_tbl_len;
+       immutable->core_cap_flags = RDMA_CORE_PORT_IBA_IB;
+       immutable->max_mad_size = IB_MGMT_MAD_SIZE;
+
+       return 0;
+}
+
 int mthca_register_device(struct mthca_dev *dev)
 {
        int ret;
@@ -1323,6 +1349,7 @@ int mthca_register_device(struct mthca_dev *dev)
        dev->ib_dev.reg_phys_mr          = mthca_reg_phys_mr;
        dev->ib_dev.reg_user_mr          = mthca_reg_user_mr;
        dev->ib_dev.dereg_mr             = mthca_dereg_mr;
+       dev->ib_dev.get_port_immutable   = mthca_port_immutable;
 
        if (dev->mthca_flags & MTHCA_FLAG_FMR) {
                dev->ib_dev.alloc_fmr            = mthca_alloc_fmr;