]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/infiniband/hw/ehca/ehca_main.c
IB/ehca: Move high-volume debug output to higher debug levels
[linux-2.6-omap-h63xx.git] / drivers / infiniband / hw / ehca / ehca_main.c
index 6a56d86a295105549c0a41205601f7b6c1fd8106..4379beff987f413f71d3db832c05a3986c65b4c8 100644 (file)
@@ -57,16 +57,17 @@ MODULE_AUTHOR("Christoph Raisch <raisch@de.ibm.com>");
 MODULE_DESCRIPTION("IBM eServer HCA InfiniBand Device Driver");
 MODULE_VERSION(HCAD_VERSION);
 
-int ehca_open_aqp1     = 0;
+static int ehca_open_aqp1     = 0;
+static int ehca_hw_level      = 0;
+static int ehca_poll_all_eqs  = 1;
+static int ehca_mr_largepage  = 1;
+
 int ehca_debug_level   = 0;
-int ehca_hw_level      = 0;
 int ehca_nr_ports      = 2;
 int ehca_use_hp_mr     = 0;
 int ehca_port_act_time = 30;
-int ehca_poll_all_eqs  = 1;
 int ehca_static_rate   = -1;
 int ehca_scaling_code  = 0;
-int ehca_mr_largepage  = 1;
 int ehca_lock_hcalls   = -1;
 
 module_param_named(open_aqp1,     ehca_open_aqp1,     int, S_IRUGO);
@@ -84,13 +85,14 @@ module_param_named(lock_hcalls,   ehca_lock_hcalls,   bool, S_IRUGO);
 MODULE_PARM_DESC(open_aqp1,
                 "AQP1 on startup (0: no (default), 1: yes)");
 MODULE_PARM_DESC(debug_level,
-                "debug level"
-                " (0: no debug traces (default), 1: with debug traces)");
+                "Amount of debug output (0: none (default), 1: traces, "
+                "2: some dumps, 3: lots)");
 MODULE_PARM_DESC(hw_level,
                 "hardware level"
                 " (0: autosensing (default), 1: v. 0.20, 2: v. 0.21)");
 MODULE_PARM_DESC(nr_ports,
-                "number of connected ports (default: 2)");
+                "number of connected ports (-1: autodetect, 1: port one only, "
+                "2: two ports (default)");
 MODULE_PARM_DESC(use_hp_mr,
                 "high performance MRs (0: no (default), 1: yes)");
 MODULE_PARM_DESC(port_act_time,
@@ -273,6 +275,7 @@ static int ehca_sense_attributes(struct ehca_shca *shca)
        u64 h_ret;
        struct hipz_query_hca *rblock;
        struct hipz_query_port *port;
+       const char *loc_code;
 
        static const u32 pgsize_map[] = {
                HCA_CAP_MR_PGSIZE_4K,  0x1000,
@@ -281,6 +284,12 @@ static int ehca_sense_attributes(struct ehca_shca *shca)
                HCA_CAP_MR_PGSIZE_16M, 0x1000000,
        };
 
+       ehca_gen_dbg("Probing adapter %s...",
+                    shca->ofdev->node->full_name);
+       loc_code = of_get_property(shca->ofdev->node, "ibm,loc-code", NULL);
+       if (loc_code)
+               ehca_gen_dbg(" ... location lode=%s", loc_code);
+
        rblock = ehca_alloc_fw_ctrlblock(GFP_KERNEL);
        if (!rblock) {
                ehca_gen_err("Cannot allocate rblock memory.");
@@ -395,7 +404,7 @@ init_node_guid1:
        return ret;
 }
 
-int ehca_init_device(struct ehca_shca *shca)
+static int ehca_init_device(struct ehca_shca *shca)
 {
        int ret;
 
@@ -471,7 +480,7 @@ int ehca_init_device(struct ehca_shca *shca)
        shca->ib_device.dealloc_fmr         = ehca_dealloc_fmr;
        shca->ib_device.attach_mcast        = ehca_attach_mcast;
        shca->ib_device.detach_mcast        = ehca_detach_mcast;
-       /* shca->ib_device.process_mad      = ehca_process_mad;     */
+       shca->ib_device.process_mad         = ehca_process_mad;
        shca->ib_device.mmap                = ehca_mmap;
 
        if (EHCA_BMASK_GET(HCA_CAP_SRQ, shca->hca_cap)) {
@@ -511,7 +520,7 @@ static int ehca_create_aqp1(struct ehca_shca *shca, u32 port)
        }
        sport->ibcq_aqp1 = ibcq;
 
-       if (sport->ibqp_aqp1) {
+       if (sport->ibqp_sqp[IB_QPT_GSI]) {
                ehca_err(&shca->ib_device, "AQP1 QP is already created.");
                ret = -EPERM;
                goto create_aqp1;
@@ -537,7 +546,7 @@ static int ehca_create_aqp1(struct ehca_shca *shca, u32 port)
                ret = PTR_ERR(ibqp);
                goto create_aqp1;
        }
-       sport->ibqp_aqp1 = ibqp;
+       sport->ibqp_sqp[IB_QPT_GSI] = ibqp;
 
        return 0;
 
@@ -550,7 +559,7 @@ static int ehca_destroy_aqp1(struct ehca_sport *sport)
 {
        int ret;
 
-       ret = ib_destroy_qp(sport->ibqp_aqp1);
+       ret = ib_destroy_qp(sport->ibqp_sqp[IB_QPT_GSI]);
        if (ret) {
                ehca_gen_err("Cannot destroy AQP1 QP. ret=%i", ret);
                return ret;
@@ -565,8 +574,7 @@ static int ehca_destroy_aqp1(struct ehca_sport *sport)
 
 static ssize_t ehca_show_debug_level(struct device_driver *ddp, char *buf)
 {
-       return snprintf(buf, PAGE_SIZE, "%d\n",
-                       ehca_debug_level);
+       return snprintf(buf, PAGE_SIZE, "%d\n", ehca_debug_level);
 }
 
 static ssize_t ehca_store_debug_level(struct device_driver *ddp,
@@ -578,8 +586,8 @@ static ssize_t ehca_store_debug_level(struct device_driver *ddp,
        return 1;
 }
 
-DRIVER_ATTR(debug_level, S_IRUSR | S_IWUSR,
-           ehca_show_debug_level, ehca_store_debug_level);
+static DRIVER_ATTR(debug_level, S_IRUSR | S_IWUSR,
+                  ehca_show_debug_level, ehca_store_debug_level);
 
 static struct attribute *ehca_drv_attrs[] = {
        &driver_attr_debug_level.attr,
@@ -590,6 +598,11 @@ static struct attribute_group ehca_drv_attr_grp = {
        .attrs = ehca_drv_attrs
 };
 
+static struct attribute_group *ehca_drv_attr_groups[] = {
+       &ehca_drv_attr_grp,
+       NULL,
+};
+
 #define EHCA_RESOURCE_ATTR(name)                                           \
 static ssize_t  ehca_show_##name(struct device *dev,                       \
                                 struct device_attribute *attr,            \
@@ -688,7 +701,7 @@ static int __devinit ehca_probe(struct of_device *dev,
        struct ehca_shca *shca;
        const u64 *handle;
        struct ib_pd *ibpd;
-       int ret;
+       int ret, i;
 
        handle = of_get_property(dev->node, "ibm,hca-handle", NULL);
        if (!handle) {
@@ -709,6 +722,8 @@ static int __devinit ehca_probe(struct of_device *dev,
                return -ENOMEM;
        }
        mutex_init(&shca->modify_mutex);
+       for (i = 0; i < ARRAY_SIZE(shca->sport); i++)
+               spin_lock_init(&shca->sport[i].mod_sqp_lock);
 
        shca->ofdev = dev;
        shca->ipz_hca_handle.handle = *handle;
@@ -899,6 +914,9 @@ static struct of_platform_driver ehca_driver = {
        .match_table = ehca_device_table,
        .probe       = ehca_probe,
        .remove      = ehca_remove,
+       .driver      = {
+               .groups = ehca_drv_attr_groups,
+       },
 };
 
 void ehca_poll_eqs(unsigned long data)
@@ -926,11 +944,11 @@ void ehca_poll_eqs(unsigned long data)
                                ehca_process_eq(shca, 0);
                }
        }
-       mod_timer(&poll_eqs_timer, jiffies + HZ);
+       mod_timer(&poll_eqs_timer, round_jiffies(jiffies + HZ));
        spin_unlock(&shca_list_lock);
 }
 
-int __init ehca_module_init(void)
+static int __init ehca_module_init(void)
 {
        int ret;
 
@@ -957,10 +975,6 @@ int __init ehca_module_init(void)
                goto module_init2;
        }
 
-       ret = sysfs_create_group(&ehca_driver.driver.kobj, &ehca_drv_attr_grp);
-       if (ret) /* only complain; we can live without attributes */
-               ehca_gen_err("Cannot create driver attributes  ret=%d", ret);
-
        if (ehca_poll_all_eqs != 1) {
                ehca_gen_err("WARNING!!!");
                ehca_gen_err("It is possible to lose interrupts.");
@@ -981,12 +995,11 @@ module_init1:
        return ret;
 };
 
-void __exit ehca_module_exit(void)
+static void __exit ehca_module_exit(void)
 {
        if (ehca_poll_all_eqs == 1)
                del_timer_sync(&poll_eqs_timer);
 
-       sysfs_remove_group(&ehca_driver.driver.kobj, &ehca_drv_attr_grp);
        ibmebus_unregister_driver(&ehca_driver);
 
        ehca_destroy_slab_caches();