Creates a sysfs entry for each MSI-X vector containing the IRQ value. This patch applies to the mthca 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/mthca/mthca_provider.c | 62 +++++++++++++++++++++++--- 1 files changed, 55 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c index 87ad889..70fc686 100644 --- a/drivers/infiniband/hw/mthca/mthca_provider.c +++ b/drivers/infiniband/hw/mthca/mthca_provider.c @@ -1232,10 +1232,40 @@ static ssize_t show_board(struct device *device, struct device_attribute *attr, return sprintf(buf, "%.*s\n", MTHCA_BOARD_ID_LEN, 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 mthca_dev *dev = + container_of(device, struct mthca_dev, ib_dev.dev); + return sprintf(buf, "%u\n", + dev->eq_table.eq[MTHCA_EQ_ASYNC].msi_x_vector); +} + +static ssize_t show_msix_cmd_irq(struct device *device, + struct device_attribute *attr, char *buf) +{ + struct mthca_dev *dev = + container_of(device, struct mthca_dev, ib_dev.dev); + return sprintf(buf, "%u\n", + dev->eq_table.eq[MTHCA_EQ_CMD].msi_x_vector); +} + +static ssize_t show_msix_comp_irq(struct device *device, + struct device_attribute *attr, char *buf) +{ + struct mthca_dev *dev = + container_of(device, struct mthca_dev, ib_dev.dev); + return sprintf(buf, "%u\n", + dev->eq_table.eq[MTHCA_EQ_COMP].msi_x_vector); +} + +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_cmd_irq, S_IRUGO, show_msix_cmd_irq, NULL); +static DEVICE_ATTR(msix_comp_irq, S_IRUGO, show_msix_comp_irq, NULL); static struct device_attribute *mthca_dev_attributes[] = { &dev_attr_hw_rev, @@ -1244,6 +1274,12 @@ static struct device_attribute *mthca_dev_attributes[] = { &dev_attr_board_id }; +static struct device_attribute *mthca_msix_attributes[] = { + &dev_attr_msix_async_irq, + &dev_attr_msix_cmd_irq, + &dev_attr_msix_comp_irq +}; + static int mthca_init_node_data(struct mthca_dev *dev) { struct ib_smp *in_mad = NULL; @@ -1406,15 +1442,27 @@ int mthca_register_device(struct mthca_dev *dev) for (i = 0; i < ARRAY_SIZE(mthca_dev_attributes); ++i) { ret = device_create_file(&dev->ib_dev.dev, mthca_dev_attributes[i]); - if (ret) { - ib_unregister_device(&dev->ib_dev); - return ret; + if (ret) + goto err_reg; + } + + /* Only create msix entries if msix is enabled */ + if (dev->pdev->msix_enabled) { + for (i = 0; i < ARRAY_SIZE(mthca_msix_attributes); ++i) { + ret = device_create_file(&dev->ib_dev.dev, + mthca_msix_attributes[i]); + if (ret) + goto err_reg; } } mthca_start_catas_poll(dev); return 0; + +err_reg: + ib_unregister_device(&dev->ib_dev); + return ret; } void mthca_unregister_device(struct mthca_dev *dev) _______________________________________________ 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