IB/core: Pass hardware specific data in query_device
[deliverable/linux.git] / drivers / infiniband / hw / qib / qib_verbs.c
index 4a3599890ea5f114655a34e472bee9197d73bd2c..e1dad4558ed13cbf206c7a8452a91ac2c70d5b77 100644 (file)
@@ -1550,12 +1550,14 @@ full:
        }
 }
 
-static int qib_query_device(struct ib_device *ibdev,
-                           struct ib_device_attr *props)
+static int qib_query_device(struct ib_device *ibdev, struct ib_device_attr *props,
+                           struct ib_udata *uhw)
 {
        struct qib_devdata *dd = dd_from_ibdev(ibdev);
        struct qib_ibdev *dev = to_idev(ibdev);
 
+       if (uhw->inlen || uhw->outlen)
+               return -EINVAL;
        memset(props, 0, sizeof(*props));
 
        props->device_cap_flags = IB_DEVICE_BAD_PKEY_CNTR |
@@ -2040,6 +2042,23 @@ static void init_ibport(struct qib_pportdata *ppd)
        RCU_INIT_POINTER(ibp->qp1, NULL);
 }
 
+static int qib_port_immutable(struct ib_device *ibdev, u8 port_num,
+                             struct ib_port_immutable *immutable)
+{
+       struct ib_port_attr attr;
+       int err;
+
+       err = qib_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;
+
+       return 0;
+}
+
 /**
  * qib_register_ib_device - register our device with the infiniband core
  * @dd: the device data structure
@@ -2227,6 +2246,7 @@ int qib_register_ib_device(struct qib_devdata *dd)
        ibdev->process_mad = qib_process_mad;
        ibdev->mmap = qib_mmap;
        ibdev->dma_ops = &qib_dma_mapping_ops;
+       ibdev->get_port_immutable = qib_port_immutable;
 
        snprintf(ibdev->node_desc, sizeof(ibdev->node_desc),
                 "Intel Infiniband HCA %s", init_utsname()->nodename);
This page took 0.025134 seconds and 5 git commands to generate.