]> err.no Git - linux-2.6/commitdiff
RDMA/cxgb3: Fix up some ib_device_attr fields
authorSteve Wise <swise@opengridcomputing.com>
Tue, 15 Jul 2008 06:48:47 +0000 (23:48 -0700)
committerRoland Dreier <rolandd@cisco.com>
Tue, 15 Jul 2008 06:48:47 +0000 (23:48 -0700)
- set fw_ver
- set hw_ver
- set max_qp_wr to something reasonable
- set max_cqe to something reasonable

Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/cxgb3/cxio_hal.h
drivers/infiniband/hw/cxgb3/iwch.c
drivers/infiniband/hw/cxgb3/iwch_provider.c

index 25a880664e6b83e61736a1d2cef1a6bf76854cf9..a9ff32c36211617f73f08e2b4678a0b785529101 100644 (file)
 #define T3_CTRL_QP_SIZE_LOG2  8
 #define T3_CTRL_CQ_ID    0
 
-/* TBD */
 #define T3_MAX_NUM_RI (1<<15)
 #define T3_MAX_NUM_QP (1<<15)
 #define T3_MAX_NUM_CQ (1<<15)
 #define T3_MAX_NUM_PD (1<<15)
 #define T3_MAX_PBL_SIZE 256
 #define T3_MAX_RQ_SIZE 1024
+#define T3_MAX_QP_DEPTH (T3_MAX_RQ_SIZE-1)
+#define T3_MAX_CQ_DEPTH 8192
 #define T3_MAX_NUM_STAG (1<<15)
 #define T3_MAX_MR_SIZE 0x100000000ULL
 
index 71554eacb13ce3f87d19b8bd582f05eabde6a8f9..e09cc1a8199986ed8981e8746d7363cc8a4e181c 100644 (file)
@@ -74,11 +74,11 @@ static void rnic_init(struct iwch_dev *rnicp)
        rnicp->attr.vendor_id = 0x168;
        rnicp->attr.vendor_part_id = 7;
        rnicp->attr.max_qps = T3_MAX_NUM_QP - 32;
-       rnicp->attr.max_wrs = (1UL << 24) - 1;
+       rnicp->attr.max_wrs = T3_MAX_QP_DEPTH;
        rnicp->attr.max_sge_per_wr = T3_MAX_SGE;
        rnicp->attr.max_sge_per_rdma_write_wr = T3_MAX_SGE;
        rnicp->attr.max_cqs = T3_MAX_NUM_CQ - 1;
-       rnicp->attr.max_cqes_per_cq = (1UL << 24) - 1;
+       rnicp->attr.max_cqes_per_cq = T3_MAX_CQ_DEPTH;
        rnicp->attr.max_mem_regs = cxio_num_stags(&rnicp->rdev);
        rnicp->attr.max_phys_buf_entries = T3_MAX_PBL_SIZE;
        rnicp->attr.max_pds = T3_MAX_NUM_PD - 1;
index 5d504f3ed68ba91c7578f0dfb898277e06c23f08..5f4380657392d990eb0864c49b9ee441944bda0a 100644 (file)
@@ -1093,6 +1093,29 @@ static int iwch_query_gid(struct ib_device *ibdev, u8 port,
        return 0;
 }
 
+static u64 fw_vers_string_to_u64(struct iwch_dev *iwch_dev)
+{
+       struct ethtool_drvinfo info;
+       struct net_device *lldev = iwch_dev->rdev.t3cdev_p->lldev;
+       char *cp, *next;
+       unsigned fw_maj, fw_min, fw_mic;
+
+       rtnl_lock();
+       lldev->ethtool_ops->get_drvinfo(lldev, &info);
+       rtnl_unlock();
+
+       next = info.fw_version + 1;
+       cp = strsep(&next, ".");
+       sscanf(cp, "%i", &fw_maj);
+       cp = strsep(&next, ".");
+       sscanf(cp, "%i", &fw_min);
+       cp = strsep(&next, ".");
+       sscanf(cp, "%i", &fw_mic);
+
+       return (((u64)fw_maj & 0xffff) << 32) | ((fw_min & 0xffff) << 16) |
+              (fw_mic & 0xffff);
+}
+
 static int iwch_query_device(struct ib_device *ibdev,
                             struct ib_device_attr *props)
 {
@@ -1103,6 +1126,8 @@ static int iwch_query_device(struct ib_device *ibdev,
        dev = to_iwch_dev(ibdev);
        memset(props, 0, sizeof *props);
        memcpy(&props->sys_image_guid, dev->rdev.t3cdev_p->lldev->dev_addr, 6);
+       props->hw_ver = dev->rdev.t3cdev_p->type;
+       props->fw_ver = fw_vers_string_to_u64(dev);
        props->device_cap_flags = dev->device_cap_flags;
        props->vendor_id = (u32)dev->rdev.rnic_info.pdev->vendor;
        props->vendor_part_id = (u32)dev->rdev.rnic_info.pdev->device;