[ofa-general] [PATCH 2 of 2] mlx4: mlx4__QUERY_ADAPTER reads fields which are reserved

Jack Morgenstein jackm at dev.mellanox.co.il
Sun Jan 27 08:13:25 PST 2008


mlx4: remove eliminated fields from QUERY_ADAPTER. Get rev_id from MAD_IFC.

The firmware QUERY_ADAPTER command does not return vendor_id, device_id,
and revision_id; eliminate these fields from the query.

In addition, initialize the rev_id field of the mlx4 device via init_node_data
(MAD IFC query), as is done in the query_device verb implementation.

Signed-off-by: Jack Morgenstein <jackm at dev.mellanox.co.il>

---

Index: ofed_kernel/drivers/net/mlx4/fw.h
===================================================================
--- ofed_kernel.orig/drivers/net/mlx4/fw.h	2008-01-27 15:56:27.000000000 +0200
+++ ofed_kernel/drivers/net/mlx4/fw.h	2008-01-27 16:00:46.997316000 +0200
@@ -102,9 +102,6 @@ struct mlx4_dev_cap {
 };
 
 struct mlx4_adapter {
-	u32  vendor_id;
-	u32  device_id;
-	u32  revision_id;
 	char board_id[MLX4_BOARD_ID_LEN];
 	u8   inta_pin;
 };
Index: ofed_kernel/drivers/net/mlx4/main.c
===================================================================
--- ofed_kernel.orig/drivers/net/mlx4/main.c	2008-01-27 15:56:28.000000000 +0200
+++ ofed_kernel/drivers/net/mlx4/main.c	2008-01-27 16:01:39.420447000 +0200
@@ -590,7 +590,6 @@ static int mlx4_init_hca(struct mlx4_dev
 	}
 
 	priv->eq_table.inta_pin = adapter.inta_pin;
-	dev->rev_id		= adapter.revision_id;
 	memcpy(dev->board_id, adapter.board_id, sizeof dev->board_id);
 
 	return 0;
Index: ofed_kernel/drivers/infiniband/hw/mlx4/main.c
===================================================================
--- ofed_kernel.orig/drivers/infiniband/hw/mlx4/main.c	2008-01-27 16:19:43.000000000 +0200
+++ ofed_kernel/drivers/infiniband/hw/mlx4/main.c	2008-01-27 16:20:04.365703000 +0200
@@ -550,6 +550,7 @@ static int init_node_data(struct mlx4_ib
 	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: ofed_kernel/drivers/net/mlx4/fw.c
===================================================================
--- ofed_kernel.orig/drivers/net/mlx4/fw.c	2008-01-27 15:56:29.000000000 +0200
+++ ofed_kernel/drivers/net/mlx4/fw.c	2008-01-27 16:21:15.835110000 +0200
@@ -637,9 +637,6 @@ int mlx4_QUERY_ADAPTER(struct mlx4_dev *
 	int err;
 
 #define QUERY_ADAPTER_OUT_SIZE             0x100
-#define QUERY_ADAPTER_VENDOR_ID_OFFSET     0x00
-#define QUERY_ADAPTER_DEVICE_ID_OFFSET     0x04
-#define QUERY_ADAPTER_REVISION_ID_OFFSET   0x08
 #define QUERY_ADAPTER_INTA_PIN_OFFSET      0x10
 #define QUERY_ADAPTER_VSD_OFFSET           0x20
 
@@ -653,9 +650,6 @@ int mlx4_QUERY_ADAPTER(struct mlx4_dev *
 	if (err)
 		goto out;
 
-	MLX4_GET(adapter->vendor_id, outbox,   QUERY_ADAPTER_VENDOR_ID_OFFSET);
-	MLX4_GET(adapter->device_id, outbox,   QUERY_ADAPTER_DEVICE_ID_OFFSET);
-	MLX4_GET(adapter->revision_id, outbox, QUERY_ADAPTER_REVISION_ID_OFFSET);
 	MLX4_GET(adapter->inta_pin, outbox,    QUERY_ADAPTER_INTA_PIN_OFFSET);
 
 	get_board_id(outbox + QUERY_ADAPTER_VSD_OFFSET / 4,



More information about the general mailing list