[ofa-general] [PATCH 2.6.30] RDMA/cxgb3: Enforce required firmware during device discovery.

Steve Wise swise at opengridcomputing.com
Mon Mar 9 03:21:15 PDT 2009


The cxgb3 NIC driver no longer enforces this, so iw_cxgb3 must.  The FW
major number indicates a specific interface between the FW and iw_cxgb3.
Thus if the major number of the running firmware does not match the
required version compiled into iw_cxgb3, then iw_cxgb3 must not register
that device.

Signed-off-by: Steve Wise <swise at opengridcomputing.com>
---

 drivers/infiniband/hw/cxgb3/cxio_hal.c |   17 +++++++++++++++++
 drivers/infiniband/hw/cxgb3/cxio_hal.h |    3 +++
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.c b/drivers/infiniband/hw/cxgb3/cxio_hal.c
index 630e3f4..7a355d6 100644
--- a/drivers/infiniband/hw/cxgb3/cxio_hal.c
+++ b/drivers/infiniband/hw/cxgb3/cxio_hal.c
@@ -941,6 +941,23 @@ int cxio_rdev_open(struct cxio_rdev *rdev_p)
 	if (!rdev_p->t3cdev_p)
 		rdev_p->t3cdev_p = dev2t3cdev(netdev_p);
 	rdev_p->t3cdev_p->ulp = (void *) rdev_p;
+
+	err = rdev_p->t3cdev_p->ctl(rdev_p->t3cdev_p, GET_EMBEDDED_INFO,
+					 &(rdev_p->fw_info));
+	if (err) {
+		printk(KERN_ERR "%s t3cdev_p(%p)->ctl returned error %d.\n",
+		     __func__, rdev_p->t3cdev_p, err);
+		goto err1;
+	}
+	if (G_FW_VERSION_MAJOR(rdev_p->fw_info.fw_vers) != CXIO_FW_MAJ) {
+		printk(KERN_ERR MOD "fatal firmware version mismatch: "
+		       "need version %u but adapter has version %u\n",
+		       CXIO_FW_MAJ,
+		       G_FW_VERSION_MAJOR(rdev_p->fw_info.fw_vers));
+		err = -EINVAL;
+		goto err1;
+	}
+	
 	err = rdev_p->t3cdev_p->ctl(rdev_p->t3cdev_p, RDMA_GET_PARAMS,
 					 &(rdev_p->rnic_info));
 	if (err) {
diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.h b/drivers/infiniband/hw/cxgb3/cxio_hal.h
index 2fd5d03..4399b04 100644
--- a/drivers/infiniband/hw/cxgb3/cxio_hal.h
+++ b/drivers/infiniband/hw/cxgb3/cxio_hal.h
@@ -61,6 +61,8 @@
 
 #define T3_MAX_DEV_NAME_LEN 32
 
+#define CXIO_FW_MAJ 7
+
 struct cxio_hal_ctrl_qp {
 	u32 wptr;
 	u32 rptr;
@@ -110,6 +112,7 @@ struct cxio_rdev {
 	struct list_head entry;
 	u32	flags;
 #define	CXIO_ERROR_FATAL	1
+	struct ch_embedded_info fw_info;
 };
 
 static inline int cxio_fatal_error(struct cxio_rdev *rdev_p)




More information about the general mailing list