[ofa-general] [PATCH v2] mlx4_core: Distinguish multiple IB cards in /proc/interrupts

Arputham Benjamin abenjamin at sgi.com
Mon Aug 3 20:00:00 PDT 2009


When the mlx4_core driver calls request_irq() to allocate interrupt
resources, it uses the fixed device name string "mlx4_core".
When multiple IB cards are present in the system, every instance of
the resource is named "mlx4_core" in /proc/interrupts.
This can make it very confusing trying to work out exactly where IB
interrupts are going and why.

The mlx4_core driver has been modified to use the PCI name of the IB
card for the purpose of allocating interrupt resources.

Signed-off-by: Arputham Benjamin <abenjamin at sgi.com>
---
diff -rup a/drivers/net/mlx4/eq.c b/drivers/net/mlx4/eq.c
--- a/drivers/net/mlx4/eq.c	2009-08-03 19:42:18.737707766 -0700
+++ b/drivers/net/mlx4/eq.c	2009-08-03 19:42:48.175515414 -0700
@@ -615,7 +615,8 @@ int mlx4_init_eq_table(struct mlx4_dev *
 	priv->eq_table.clr_int  = priv->clr_base +
 		(priv->eq_table.inta_pin < 32 ? 4 : 0);
 
-	priv->eq_table.irq_names = kmalloc(16 * dev->caps.num_comp_vectors, GFP_KERNEL);
+	priv->eq_table.irq_names = kmalloc(DEVICE_NAME_MAX *
+					   (dev->caps.num_comp_vectors + 1), GFP_KERNEL);
 	if (!priv->eq_table.irq_names) {
 		err = -ENOMEM;
 		goto err_out_bitmap;
@@ -638,17 +639,25 @@ int mlx4_init_eq_table(struct mlx4_dev *
 		goto err_out_comp;
 
 	if (dev->flags & MLX4_FLAG_MSI_X) {
-		static const char async_eq_name[] = "mlx4-async";
 		const char *eq_name;
 
 		for (i = 0; i < dev->caps.num_comp_vectors + 1; ++i) {
 			if (i < dev->caps.num_comp_vectors) {
-				snprintf(priv->eq_table.irq_names + i * 16, 16,
-					 "mlx4-comp-%d", i);
-				eq_name = priv->eq_table.irq_names + i * 16;
-			} else
-				eq_name = async_eq_name;
+				snprintf(priv->eq_table.irq_names +
+					 i * DEVICE_NAME_MAX,
+					 DEVICE_NAME_MAX,
+					 "mlx4-comp-%d at pci:%s", i,
+					 pci_name(dev->pdev));
+			} else {
+				snprintf(priv->eq_table.irq_names +
+					 i * DEVICE_NAME_MAX,
+					 DEVICE_NAME_MAX,
+					 "mlx4-async at pci:%s",
+					 pci_name(dev->pdev));
+			}
 
+			eq_name = priv->eq_table.irq_names +
+				  i * DEVICE_NAME_MAX;
 			err = request_irq(priv->eq_table.eq[i].irq,
 					  mlx4_msi_x_interrupt, 0, eq_name,
 					  priv->eq_table.eq + i);
@@ -658,8 +667,12 @@ int mlx4_init_eq_table(struct mlx4_dev *
 			priv->eq_table.eq[i].have_irq = 1;
 		}
 	} else {
+		snprintf(priv->eq_table.irq_names,
+			 DEVICE_NAME_MAX,
+			 DRV_NAME "@pci:%s",
+			 pci_name(dev->pdev));
 		err = request_irq(dev->pdev->irq, mlx4_interrupt,
-				  IRQF_SHARED, DRV_NAME, dev);
+				  IRQF_SHARED, priv->eq_table.irq_names, dev);
 		if (err)
 			goto err_out_async;
 
diff -rup a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h
--- a/drivers/net/mlx4/mlx4.h	2009-08-03 19:42:18.737707766 -0700
+++ b/drivers/net/mlx4/mlx4.h	2009-08-03 19:43:01.532335625 -0700
@@ -198,6 +198,8 @@ struct mlx4_cq_table {
 	struct mlx4_icm_table	cmpt_table;
 };
 
+#define DEVICE_NAME_MAX 64
+
 struct mlx4_eq_table {
 	struct mlx4_bitmap	bitmap;
 	char		       *irq_names;



More information about the general mailing list