Creates a sysfs entry for each MSI-X vector containing the IRQ value. This
patch applies to the mlx4 infiniband driver.

Signed-off-by: Vincent Rizza <[EMAIL PROTECTED]>
Signed-off-by: Brett Grandbois <[EMAIL PROTECTED]>
Signed-off-by: Greg Banks <[EMAIL PROTECTED]>
Signed-off-by: Max Matveev <[EMAIL PROTECTED]>
Signed-off-by: Ken Sandars <[EMAIL PROTECTED]>
---
drivers/infiniband/hw/mlx4/main.c |   39 +++++++++++++++++++++++++++++++++---
drivers/net/mlx4/eq.c             |    1 +
drivers/net/mlx4/mlx4.h           |    6 -----
include/linux/mlx4/device.h       |    7 ++++++
4 files changed, 43 insertions(+), 10 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/main.c 
b/drivers/infiniband/hw/mlx4/main.c
index a3c2851..323ab89 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -527,10 +527,28 @@ static ssize_t show_board(struct device *device, struct 
device_attribute *attr,
                       dev->dev->board_id);
}

-static DEVICE_ATTR(hw_rev,   S_IRUGO, show_rev,    NULL);
-static DEVICE_ATTR(fw_ver,   S_IRUGO, show_fw_ver, NULL);
-static DEVICE_ATTR(hca_type, S_IRUGO, show_hca,    NULL);
-static DEVICE_ATTR(board_id, S_IRUGO, show_board,  NULL);
+static ssize_t show_msix_async_irq(struct device *device,
+                                  struct device_attribute *attr, char *buf)
+{
+       struct mlx4_ib_dev *dev =
+               container_of(device, struct mlx4_ib_dev, ib_dev.dev);
+       return sprintf(buf, "%u\n", dev->dev->msix_irqs[MLX4_EQ_ASYNC]);
+}
+
+static ssize_t show_msix_comp_irq(struct device *device,
+                                 struct device_attribute *attr, char *buf)
+{
+       struct mlx4_ib_dev *dev =
+               container_of(device, struct mlx4_ib_dev, ib_dev.dev);
+       return sprintf(buf, "%u\n", dev->dev->msix_irqs[MLX4_EQ_COMP]);
+}
+
+static DEVICE_ATTR(hw_rev,             S_IRUGO, show_rev,              NULL);
+static DEVICE_ATTR(fw_ver,             S_IRUGO, show_fw_ver,           NULL);
+static DEVICE_ATTR(hca_type,           S_IRUGO, show_hca,              NULL);
+static DEVICE_ATTR(board_id,           S_IRUGO, show_board,            NULL);
+static DEVICE_ATTR(msix_async_irq,     S_IRUGO, show_msix_async_irq,   NULL);
+static DEVICE_ATTR(msix_comp_irq,      S_IRUGO, show_msix_comp_irq,    NULL);

static struct device_attribute *mlx4_class_attributes[] = {
        &dev_attr_hw_rev,
@@ -539,6 +557,11 @@ static struct device_attribute *mlx4_class_attributes[] = {
        &dev_attr_board_id
};

+static struct device_attribute *mlx4_msix_attributes[] = {
+       &dev_attr_msix_async_irq,
+       &dev_attr_msix_comp_irq
+};
+
static void *mlx4_ib_add(struct mlx4_dev *dev)
{
        static int mlx4_ib_version_printed;
@@ -666,6 +689,14 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
                        goto err_reg;
        }

+       if (dev->pdev->msix_enabled) {
+               for (i = 0; i < ARRAY_SIZE(mlx4_msix_attributes); i++) {
+                       if (device_create_file(&ibdev->ib_dev.dev,
+                                              mlx4_msix_attributes[i]))
+                               goto err_reg;
+               }
+       }
+
        return ibdev;

err_reg:
diff --git a/drivers/net/mlx4/eq.c b/drivers/net/mlx4/eq.c
index 8a8b561..00d0357 100644
--- a/drivers/net/mlx4/eq.c
+++ b/drivers/net/mlx4/eq.c
@@ -600,6 +600,7 @@ int mlx4_init_eq_table(struct mlx4_dev *dev)
                                goto err_out_async;

                        priv->eq_table.eq[i].have_irq = 1;
+                       dev->msix_irqs[i] = priv->eq_table.eq[i].irq;
                }

        } else {
diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h
index 5337e3a..712a294 100644
--- a/drivers/net/mlx4/mlx4.h
+++ b/drivers/net/mlx4/mlx4.h
@@ -63,12 +63,6 @@ enum {
};

enum {
-       MLX4_EQ_ASYNC,
-       MLX4_EQ_COMP,
-       MLX4_NUM_EQ
-};
-
-enum {
        MLX4_NUM_PDS            = 1 << 15
};

diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index b2f9444..9b0c633 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -53,6 +53,12 @@ enum {
};

enum {
+       MLX4_EQ_ASYNC,
+       MLX4_EQ_COMP,
+       MLX4_NUM_EQ
+};
+
+enum {
        MLX4_DEV_CAP_FLAG_RC            = 1 <<  0,
        MLX4_DEV_CAP_FLAG_UC            = 1 <<  1,
        MLX4_DEV_CAP_FLAG_UD            = 1 <<  2,
@@ -339,6 +345,7 @@ struct mlx4_dev {
        struct radix_tree_root  qp_table_tree;
        u32                     rev_id;
        char                    board_id[MLX4_BOARD_ID_LEN];
+       u16                     msix_irqs[MLX4_NUM_EQ];
};

struct mlx4_init_port_param {

_______________________________________________
general mailing list
general@lists.openfabrics.org
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to