IB/core: Add per port immutable struct to ib_device
[linux-2.6-block.git] / drivers / infiniband / hw / ehca / ehca_main.c
index 982e3efd98d3ef6d1f6c3cbce6b894e494c0f870..8454186e16abe5d1b41b8513e297c66dca37fcb0 100644 (file)
@@ -211,6 +211,7 @@ static int ehca_create_slab_caches(void)
        if (!ctblk_cache) {
                ehca_gen_err("Cannot create ctblk SLAB cache.");
                ehca_cleanup_small_qp_cache();
+               ret = -ENOMEM;
                goto create_slab_caches6;
        }
 #endif
@@ -430,6 +431,22 @@ init_node_guid1:
        return ret;
 }
 
+static int ehca_port_immutable(struct ib_device *ibdev, u8 port_num,
+                              struct ib_port_immutable *immutable)
+{
+       struct ib_port_attr attr;
+       int err;
+
+       err = ehca_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;
+
+       return 0;
+}
+
 static int ehca_init_device(struct ehca_shca *shca)
 {
        int ret;
@@ -466,6 +483,7 @@ static int ehca_init_device(struct ehca_shca *shca)
        shca->ib_device.dma_device          = &shca->ofdev->dev;
        shca->ib_device.query_device        = ehca_query_device;
        shca->ib_device.query_port          = ehca_query_port;
+       shca->ib_device.query_protocol      = ehca_query_protocol;
        shca->ib_device.query_gid           = ehca_query_gid;
        shca->ib_device.query_pkey          = ehca_query_pkey;
        /* shca->in_device.modify_device    = ehca_modify_device    */
@@ -509,6 +527,7 @@ static int ehca_init_device(struct ehca_shca *shca)
        shca->ib_device.process_mad         = ehca_process_mad;
        shca->ib_device.mmap                = ehca_mmap;
        shca->ib_device.dma_ops             = &ehca_dma_mapping_ops;
+       shca->ib_device.get_port_immutable  = ehca_port_immutable;
 
        if (EHCA_BMASK_GET(HCA_CAP_SRQ, shca->hca_cap)) {
                shca->ib_device.uverbs_cmd_mask |=