RDMA/cxgb3: Enforce required firmware
authorSteve Wise <swise@opengridcomputing.com>
Wed, 25 Mar 2009 03:44:18 +0000 (20:44 -0700)
committerRoland Dreier <rolandd@cisco.com>
Wed, 25 Mar 2009 03:44:18 +0000 (20:44 -0700)
The cxgb3 NIC driver can handle more firmware versions than iw_cxgb3,
and since commit 8207befa ("cxgb3: untie strict FW matching") cxgb3
will load with firmware versions that iw_cxgb3 can't handle.  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@opengridcomputing.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/cxgb3/cxio_hal.c
drivers/infiniband/hw/cxgb3/cxio_hal.h

index c2740e7..d4d7204 100644 (file)
@@ -938,6 +938,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) {
index 656fe47..e44dc22 100644 (file)
@@ -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;
@@ -108,6 +110,7 @@ struct cxio_rdev {
        struct gen_pool *pbl_pool;
        struct gen_pool *rqt_pool;
        struct list_head entry;
+       struct ch_embedded_info fw_info;
 };
 
 static inline int cxio_num_stags(struct cxio_rdev *rdev_p)