[1/2] crypto/aesni_gcm: add dependency version check

Message ID 20190419100113.31284-1-bruce.richardson@intel.com
State Superseded, archived
Delegated to: akhil goyal
Headers show
Series
  • [1/2] crypto/aesni_gcm: add dependency version check
Related show

Checks

Context Check Description
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Bruce Richardson April 19, 2019, 10:01 a.m.
The aesni_mb driver and the aesni_gcm driver both require the same version
of the IPSec_MB library, but only the former has a check of the library
found to see if it's the correct version. Add a similar check to the
aesni_gcm library's meson.build file, so that the auto-detection of
dependencies works correctly.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/crypto/aesni_gcm/meson.build | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

De Lara Guarch, Pablo April 23, 2019, 2:38 p.m. | #1
> -----Original Message-----
> From: Richardson, Bruce
> Sent: Friday, April 19, 2019 11:01 AM
> To: dev@dpdk.org
> Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Doherty,
> Declan <declan.doherty@intel.com>; Richardson, Bruce
> <bruce.richardson@intel.com>
> Subject: [PATCH 1/2] crypto/aesni_gcm: add dependency version check
> 
> The aesni_mb driver and the aesni_gcm driver both require the same version
> of the IPSec_MB library, but only the former has a check of the library found
> to see if it's the correct version. Add a similar check to the aesni_gcm
> library's meson.build file, so that the auto-detection of dependencies works
> correctly.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>  drivers/crypto/aesni_gcm/meson.build | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/crypto/aesni_gcm/meson.build
> b/drivers/crypto/aesni_gcm/meson.build
> index 70f57ad73..7183cfcba 100644
> --- a/drivers/crypto/aesni_gcm/meson.build
> +++ b/drivers/crypto/aesni_gcm/meson.build

The patch looks good, but we should broaden its scope and also modify the Makefile,
to check for the library version, like in the aesni_mb PMD.

Could you add that check too?

Thanks!
Pablo
Bruce Richardson April 23, 2019, 2:45 p.m. | #2
On Tue, Apr 23, 2019 at 03:38:58PM +0100, De Lara Guarch, Pablo wrote:
> 
> 
> > -----Original Message-----
> > From: Richardson, Bruce
> > Sent: Friday, April 19, 2019 11:01 AM
> > To: dev@dpdk.org
> > Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Doherty,
> > Declan <declan.doherty@intel.com>; Richardson, Bruce
> > <bruce.richardson@intel.com>
> > Subject: [PATCH 1/2] crypto/aesni_gcm: add dependency version check
> > 
> > The aesni_mb driver and the aesni_gcm driver both require the same version
> > of the IPSec_MB library, but only the former has a check of the library found
> > to see if it's the correct version. Add a similar check to the aesni_gcm
> > library's meson.build file, so that the auto-detection of dependencies works
> > correctly.
> > 
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > ---
> >  drivers/crypto/aesni_gcm/meson.build | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> > 
> > diff --git a/drivers/crypto/aesni_gcm/meson.build
> > b/drivers/crypto/aesni_gcm/meson.build
> > index 70f57ad73..7183cfcba 100644
> > --- a/drivers/crypto/aesni_gcm/meson.build
> > +++ b/drivers/crypto/aesni_gcm/meson.build
> 
> The patch looks good, but we should broaden its scope and also modify the Makefile,
> to check for the library version, like in the aesni_mb PMD.
> 
> Could you add that check too?
> 
I thought about doing so, but decided not to do so because the driver isn't
enabled by default. Therefore the default out-of-the-box build is not
broken when using an old version, as it is with meson. That being said,
I'll look to see if the aesni_mb checks can be easiest ported over for a
V2.

Regards,
/Bruce

Patch

diff --git a/drivers/crypto/aesni_gcm/meson.build b/drivers/crypto/aesni_gcm/meson.build
index 70f57ad73..7183cfcba 100644
--- a/drivers/crypto/aesni_gcm/meson.build
+++ b/drivers/crypto/aesni_gcm/meson.build
@@ -1,11 +1,22 @@ 
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Intel Corporation
 
+IMB_required_ver = '0.52.0'
 lib = cc.find_library('IPSec_MB', required: false)
 if not lib.found()
 	build = false
 else
 	ext_deps += lib
+
+	# version comes with quotes, so we split based on " and take the middle
+	imb_ver = cc.get_define('IMB_VERSION_STR',
+		prefix : '#include<intel-ipsec-mb.h>').split('"')[1]
+
+	if (imb_ver == '') or (imb_ver.version_compare('<' + IMB_required_ver))
+		message('IPSec_MB version >= @0@ is required, found version @1@'.format(
+				IMB_required_ver, imb_ver))
+		build = false
+	endif
 endif
 
 allow_experimental_apis = true