crypto/octeontx2: check cpt kernel driver version
authorTejasree Kondoj <ktejasree@marvell.com>
Fri, 31 Jul 2020 13:51:53 +0000 (19:21 +0530)
committerAkhil Goyal <akhil.goyal@nxp.com>
Wed, 14 Oct 2020 19:34:04 +0000 (21:34 +0200)
This patch checks if cpt pmd is compatible with kernel
cpt driver.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
drivers/crypto/octeontx2/otx2_cryptodev.h
drivers/crypto/octeontx2/otx2_cryptodev_mbox.c

index a00f3d6..fba7222 100644 (file)
@@ -15,6 +15,7 @@
 
 #define OTX2_CPT_MAX_LFS               64
 #define OTX2_CPT_MAX_QUEUES_PER_VF     64
+#define OTX2_CPT_PMD_VERSION           3
 
 /**
  * Device private data
index 6028439..75e610d 100644 (file)
@@ -29,6 +29,13 @@ otx2_cpt_hardware_caps_get(const struct rte_cryptodev *dev,
        if (ret)
                return -EIO;
 
+       if (rsp->cpt_pf_drv_version != OTX2_CPT_PMD_VERSION) {
+               otx2_err("Incompatible CPT PMD version"
+                        "(Kernel: 0x%04x DPDK: 0x%04x)",
+                         rsp->cpt_pf_drv_version, OTX2_CPT_PMD_VERSION);
+               return -EPIPE;
+       }
+
        memcpy(hw_caps, rsp->eng_caps,
                sizeof(union cpt_eng_caps) * CPT_MAX_ENG_TYPES);