be2net: Add abi version between be2net and ocrdma
authorDevesh Sharma <devesh.sharma@emulex.com>
Tue, 4 Feb 2014 06:26:59 +0000 (11:56 +0530)
committerRoland Dreier <roland@purestorage.com>
Thu, 3 Apr 2014 15:29:55 +0000 (08:29 -0700)
This patch adds abi versioning between be2net and ocrdma driver modules
to catch functional incompatibilities in the two drivers.

Signed-off-by: Devesh Sharma <devesh.sharma@emulex.com>
Signed-off-by: Selvin Xavier <selvin.xavier@emulex.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/net/ethernet/emulex/benet/be_roce.c
drivers/net/ethernet/emulex/benet/be_roce.h

index 9cd5415fe017dc359d2aae2e679eddc40e75f5e0..aa7f94375108dd661774fd30339341fa4c1fe1f8 100644 (file)
@@ -35,6 +35,12 @@ static void _be_roce_dev_add(struct be_adapter *adapter)
 
        if (!ocrdma_drv)
                return;
+
+       if (ocrdma_drv->be_abi_version != BE_ROCE_ABI_VERSION) {
+               dev_warn(&pdev->dev, "Cannot initialize RoCE due to ocrdma ABI mismatch\n");
+               return;
+       }
+
        if (pdev->device == OC_DEVICE_ID5) {
                /* only msix is supported on these devices */
                if (!msix_enabled(adapter))
index 2cd1129e19af960185a3f706d9ab5ed165e409a7..1bfb16164df88c80cde462555a0e1cf07445f0e5 100644 (file)
@@ -21,6 +21,8 @@
 #include <linux/pci.h>
 #include <linux/netdevice.h>
 
+#define BE_ROCE_ABI_VERSION    1
+
 struct ocrdma_dev;
 
 enum be_interrupt_mode {
@@ -52,6 +54,7 @@ struct be_dev_info {
 /* ocrdma driver register's the callback functions with nic driver. */
 struct ocrdma_driver {
        unsigned char name[32];
+       u32 be_abi_version;
        struct ocrdma_dev *(*add) (struct be_dev_info *dev_info);
        void (*remove) (struct ocrdma_dev *);
        void (*state_change_handler) (struct ocrdma_dev *, u32 new_state);