[2/2] crypto/octeontx2: add cpt kernel driver version check
diff mbox series

Message ID 1596203513-21124-2-git-send-email-adwivedi@marvell.com
State New
Delegated to: akhil goyal
Headers show
Series
  • [1/2] common/octeontx2: sync cpt mailbox
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Ankur Dwivedi July 31, 2020, 1:51 p.m. UTC
From: Tejasree Kondoj <ktejasree@marvell.com>

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>
---
 drivers/crypto/octeontx2/otx2_cryptodev.h      | 1 +
 drivers/crypto/octeontx2/otx2_cryptodev_mbox.c | 7 +++++++
 2 files changed, 8 insertions(+)

Patch
diff mbox series

diff --git a/drivers/crypto/octeontx2/otx2_cryptodev.h b/drivers/crypto/octeontx2/otx2_cryptodev.h
index a00f3d6..fba7222 100644
--- a/drivers/crypto/octeontx2/otx2_cryptodev.h
+++ b/drivers/crypto/octeontx2/otx2_cryptodev.h
@@ -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
diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_mbox.c b/drivers/crypto/octeontx2/otx2_cryptodev_mbox.c
index 6028439..75e610d 100644
--- a/drivers/crypto/octeontx2/otx2_cryptodev_mbox.c
+++ b/drivers/crypto/octeontx2/otx2_cryptodev_mbox.c
@@ -29,6 +29,13 @@ 
 	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);