mlx4_en: Reporting HW revision in ethtool -i
authorYevgeny Petrilin <yevgenyp@mellanox.co.il>
Tue, 22 Mar 2011 22:38:07 +0000 (22:38 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 23 Mar 2011 19:24:20 +0000 (12:24 -0700)
HW revision is derived from device ID and rev id.

Signed-off-by: Eugenia Emantayev <eugenia@mellanox.co.il>
Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/infiniband/hw/mlx4/main.c
drivers/net/mlx4/en_ethtool.c
drivers/net/mlx4/main.c
drivers/net/mlx4/mlx4_en.h
include/linux/mlx4/device.h

index c7a6213c6996df1202f9b42b4011a348f992fbb3..66e3eecfd0db86f62d4704cfbcc5293a174140ab 100644 (file)
@@ -721,7 +721,6 @@ static int init_node_data(struct mlx4_ib_dev *dev)
        if (err)
                goto out;
 
-       dev->dev->rev_id = be32_to_cpup((__be32 *) (out_mad->data + 32));
        memcpy(&dev->ib_dev.node_guid, out_mad->data + 12, 8);
 
 out:
index c1f351f6ae574349a5eb2044e1a8e835be04dad8..62ace6c72b42b49959328dc178460eab1e23c872 100644 (file)
@@ -45,7 +45,20 @@ mlx4_en_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo)
        struct mlx4_en_priv *priv = netdev_priv(dev);
        struct mlx4_en_dev *mdev = priv->mdev;
 
-       sprintf(drvinfo->driver, DRV_NAME " (%s)", mdev->dev->board_id);
+       switch (mdev->dev->rev_id) {
+       case 0xa0:
+               if (dev->dev_id >= MLX4_EN_CX3_LOW_ID && dev->dev_id <= MLX4_EN_CX3_HIGH_ID)
+                       sprintf(drvinfo->driver, DRV_NAME " (%s_CX-3)", mdev->dev->board_id);
+               else
+                       sprintf(drvinfo->driver, DRV_NAME " (%s_CX)", mdev->dev->board_id);
+               break;
+       case 0xb0:
+               sprintf(drvinfo->driver, DRV_NAME " (%s_CX-2)", mdev->dev->board_id);
+               break;
+       default:
+               sprintf(drvinfo->driver, DRV_NAME " (%s)", mdev->dev->board_id);
+               break;
+       }
        strncpy(drvinfo->version, DRV_VERSION " (" DRV_RELDATE ")", 32);
        sprintf(drvinfo->fw_version, "%d.%d.%d",
                (u16) (mdev->dev->caps.fw_ver >> 32),
index 42d4fb47787083cbcaf335357a00a9442db6f990..5bebb8800ab2e39d6b8c5cdeb25d67ccec33ed9c 100644 (file)
@@ -1139,6 +1139,8 @@ static int __mlx4_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
        INIT_LIST_HEAD(&priv->pgdir_list);
        mutex_init(&priv->pgdir_mutex);
 
+       pci_read_config_byte(pdev, PCI_REVISION_ID, &dev->rev_id);
+
        /*
         * Now reset the HCA before we touch the PCI capabilities or
         * attempt a firmware command, since a boot ROM may have left
index 07aea8d0beeb11e7a9b376bf07fdff38db8a9be9..ad4df66750bc86bcd6ec992713a33e2c36b780d3 100644 (file)
@@ -216,6 +216,9 @@ struct mlx4_en_tx_desc {
 
 #define MLX4_EN_USE_SRQ                0x01000000
 
+#define MLX4_EN_CX3_LOW_ID     0x1000
+#define MLX4_EN_CX3_HIGH_ID    0x1005
+
 struct mlx4_en_rx_alloc {
        struct page *page;
        u16 offset;
index 2460356d2c724b2de66c1f7114db342c4ca0b3ef..fe2a3a3f046cfa3e5fd227dcd1a860b004a2c799 100644 (file)
@@ -422,7 +422,7 @@ struct mlx4_dev {
        unsigned long           flags;
        struct mlx4_caps        caps;
        struct radix_tree_root  qp_table_tree;
-       u32                     rev_id;
+       u                     rev_id;
        char                    board_id[MLX4_BOARD_ID_LEN];
 };