Commit 9af57b7a authored by Sean Hefty's avatar Sean Hefty Committed by Roland Dreier

IB/cm: Add basic performance counters

Add performance/debug counters to track sent/received messages, retries,
and duplicates.  Counters are tracked per CM message type, per port.

The counters are always enabled, so intrusive state tracking is not done.
Signed-off-by: default avatarSean Hefty <sean.hefty@intel.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 4fc8cd49
This diff is collapsed.
...@@ -106,6 +106,9 @@ enum { ...@@ -106,6 +106,9 @@ enum {
IB_UCM_MAX_DEVICES = 32 IB_UCM_MAX_DEVICES = 32
}; };
/* ib_cm and ib_user_cm modules share /sys/class/infiniband_cm */
extern struct class cm_class;
#define IB_UCM_BASE_DEV MKDEV(IB_UCM_MAJOR, IB_UCM_BASE_MINOR) #define IB_UCM_BASE_DEV MKDEV(IB_UCM_MAJOR, IB_UCM_BASE_MINOR)
static void ib_ucm_add_one(struct ib_device *device); static void ib_ucm_add_one(struct ib_device *device);
...@@ -1199,7 +1202,7 @@ static int ib_ucm_close(struct inode *inode, struct file *filp) ...@@ -1199,7 +1202,7 @@ static int ib_ucm_close(struct inode *inode, struct file *filp)
return 0; return 0;
} }
static void ib_ucm_release_class_dev(struct class_device *class_dev) static void ucm_release_class_dev(struct class_device *class_dev)
{ {
struct ib_ucm_device *dev; struct ib_ucm_device *dev;
...@@ -1217,11 +1220,6 @@ static const struct file_operations ucm_fops = { ...@@ -1217,11 +1220,6 @@ static const struct file_operations ucm_fops = {
.poll = ib_ucm_poll, .poll = ib_ucm_poll,
}; };
static struct class ucm_class = {
.name = "infiniband_cm",
.release = ib_ucm_release_class_dev
};
static ssize_t show_ibdev(struct class_device *class_dev, char *buf) static ssize_t show_ibdev(struct class_device *class_dev, char *buf)
{ {
struct ib_ucm_device *dev; struct ib_ucm_device *dev;
...@@ -1257,9 +1255,10 @@ static void ib_ucm_add_one(struct ib_device *device) ...@@ -1257,9 +1255,10 @@ static void ib_ucm_add_one(struct ib_device *device)
if (cdev_add(&ucm_dev->dev, IB_UCM_BASE_DEV + ucm_dev->devnum, 1)) if (cdev_add(&ucm_dev->dev, IB_UCM_BASE_DEV + ucm_dev->devnum, 1))
goto err; goto err;
ucm_dev->class_dev.class = &ucm_class; ucm_dev->class_dev.class = &cm_class;
ucm_dev->class_dev.dev = device->dma_device; ucm_dev->class_dev.dev = device->dma_device;
ucm_dev->class_dev.devt = ucm_dev->dev.dev; ucm_dev->class_dev.devt = ucm_dev->dev.dev;
ucm_dev->class_dev.release = ucm_release_class_dev;
snprintf(ucm_dev->class_dev.class_id, BUS_ID_SIZE, "ucm%d", snprintf(ucm_dev->class_dev.class_id, BUS_ID_SIZE, "ucm%d",
ucm_dev->devnum); ucm_dev->devnum);
if (class_device_register(&ucm_dev->class_dev)) if (class_device_register(&ucm_dev->class_dev))
...@@ -1306,40 +1305,34 @@ static int __init ib_ucm_init(void) ...@@ -1306,40 +1305,34 @@ static int __init ib_ucm_init(void)
"infiniband_cm"); "infiniband_cm");
if (ret) { if (ret) {
printk(KERN_ERR "ucm: couldn't register device number\n"); printk(KERN_ERR "ucm: couldn't register device number\n");
goto err; goto error1;
} }
ret = class_register(&ucm_class); ret = class_create_file(&cm_class, &class_attr_abi_version);
if (ret) {
printk(KERN_ERR "ucm: couldn't create class infiniband_cm\n");
goto err_chrdev;
}
ret = class_create_file(&ucm_class, &class_attr_abi_version);
if (ret) { if (ret) {
printk(KERN_ERR "ucm: couldn't create abi_version attribute\n"); printk(KERN_ERR "ucm: couldn't create abi_version attribute\n");
goto err_class; goto error2;
} }
ret = ib_register_client(&ucm_client); ret = ib_register_client(&ucm_client);
if (ret) { if (ret) {
printk(KERN_ERR "ucm: couldn't register client\n"); printk(KERN_ERR "ucm: couldn't register client\n");
goto err_class; goto error3;
} }
return 0; return 0;
err_class: error3:
class_unregister(&ucm_class); class_remove_file(&cm_class, &class_attr_abi_version);
err_chrdev: error2:
unregister_chrdev_region(IB_UCM_BASE_DEV, IB_UCM_MAX_DEVICES); unregister_chrdev_region(IB_UCM_BASE_DEV, IB_UCM_MAX_DEVICES);
err: error1:
return ret; return ret;
} }
static void __exit ib_ucm_cleanup(void) static void __exit ib_ucm_cleanup(void)
{ {
ib_unregister_client(&ucm_client); ib_unregister_client(&ucm_client);
class_unregister(&ucm_class); class_remove_file(&cm_class, &class_attr_abi_version);
unregister_chrdev_region(IB_UCM_BASE_DEV, IB_UCM_MAX_DEVICES); unregister_chrdev_region(IB_UCM_BASE_DEV, IB_UCM_MAX_DEVICES);
idr_destroy(&ctx_id_table); idr_destroy(&ctx_id_table);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment