Skip to content

Commit bf8baa5

Browse files
Automatic dependency clone & build using make depend.
Add openssl, ipp-crypto, intel-ipsec-mb as submodules which will clone dependencies when submodules are inited. `make depend` will build and install dependant libraries from the submodule path. Refer Build QAT Engine section Example 5. Signed-off-by: Nagha Abirami <naghax.abirami@intel.com> Co-authored-by: Yogaraj Alamenda <yogarajx.alamenda@intel.com>
1 parent 2f392e5 commit bf8baa5

File tree

10 files changed

+174
-11
lines changed

10 files changed

+174
-11
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ TAGS
1717
cscope.out
1818
/.dir-locals.el
1919
testapp.log
20+
QAT_HW.tar.gz
21+
QAT_HW/
2022

2123
# Top level and qat_contig_mem excludes
2224
*.mod*

.gitmodules

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[submodule "openssl"]
2+
path = openssl
3+
url = https://github.com/openssl/openssl.git
4+
[submodule "intel-ipsec-mb"]
5+
path = intel-ipsec-mb
6+
url = https://github.com/intel/intel-ipsec-mb.git
7+
[submodule "ipp-crypto"]
8+
path = ipp-crypto
9+
url = https://github.com/intel/ipp-crypto

Makefile.am

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,29 @@ intkat:
222222
endif
223223
include test.am
224224

225+
if QAT_HW
226+
depend: OpenSSL qat_hw_driver
227+
endif
228+
if QAT_SW
229+
depend: OpenSSL ipsec_mb crypto_mb
230+
endif
231+
OpenSSL:
232+
cd openssl && ./config -Wl,-rpath,$(with_openssl_install_dir)/lib64 --prefix=$(with_openssl_install_dir) && make clean && make -j$(nproc) && make install -j$(nproc)
233+
234+
if QAT_HW
235+
qat_hw_driver:
236+
bash ./driver_install.sh $(with_qat_hw_dir)
237+
if QAT_4XXX
238+
if !QAT_HW_INTREE
239+
cflags_qat_hw += "-DQAT20_OOT"
240+
endif
241+
endif
242+
endif
243+
244+
if QAT_SW
245+
ipsec_mb:
246+
cd intel-ipsec-mb && make uninstall && make clean && make -j$(nproc) && make install -j$(nproc)
247+
248+
crypto_mb:
249+
cd ipp-crypto/sources/ippcp/crypto_mb && rm -rf build && cmake . -B"build" -DOPENSSL_INCLUDE_DIR=$(with_openssl_install_dir)/include -DOPENSSL_LIBRARIES=$(with_openssl_install_dir) -DOPENSSL_ROOT_DIR=$(PWD)/openssl && cd build && make clean && make -j$(nproc) && make install -j$(nproc)
250+
endif

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ Installation consists of the following:
4242
<details>
4343
<summary markdown="span">Install Prerequisites</summary>
4444

45+
<br> Switch to Build the Intel® QuickAssist Technology OpenSSL* Engine - Example 5 and use the `make depend` target to clone and build the latest compatible versions of the dependant libraries automatically based on the target in the QAT Engine build configure.
46+
4547
<details>
4648
<summary markdown="span">qat_hw Prerequisites </summary>
4749

@@ -395,6 +397,42 @@ is not installed then their corresponding algorithm support is disabled
395397
<br><br>
396398
</details>
397399

400+
<details>
401+
<summary>Example 5: Using `make depend` for building dependant libraries and build QAT Engine
402+
<br>
403+
404+
This QAT Engine supports building and installing the dependant libraries automatically when
405+
the make option `make depend` is specified before make which clones the latest release of
406+
dependant libraries (OpenSSL, QAT_HW(QAT1.7, QAT1.8 & QAT2.0 OOT Linux driver),
407+
QAT_SW(ipp-crypto & ipsec_mb) based on the flags enabled in the QAT Engine build configure.
408+
409+
```bash
410+
cd /QAT_Engine
411+
git submodule update --init
412+
./configure \
413+
--with-qat_hw_dir=/QAT \ #For QAT_HW supported platforms
414+
--enable-qat_sw \ #For QAT_SW supported platforms
415+
--with-openssl_install_dir=/usr/local/ssl # OpenSSL install path
416+
make depend
417+
make
418+
make install
419+
```
420+
421+
In the above example this will clone and install QAT Engine(qat_hw + qat_sw)
422+
along with their dependant libraries installed in the path specifed for QAT_HW
423+
and default path for QAT_SW (`/usr/local` for ipp-crypto & `/usr` for ipsec_mb) with
424+
qatengine.so library installed in the path `/usr/local/ssl/lib64/engines-3`.
425+
The dependant libaries are built and installed based on the QAT Engine build configure
426+
flags provided for qat_hw, qat_sw or qat_hw + qat_sw target using OpenSSL3.0.
427+
428+
Please note `make depend` target is not supported in FreeBSD OS, Virtualized environment,
429+
BoringSSL, BabaSSL and qatlib dependency build. The Dependant library versions used are updated in
430+
[Software Requirements section](https://github.com/intel/QAT_Engine/blob/master/docs/software_requirements.md)
431+
and OpenSSL version is latest of 3.0
432+
433+
<br>
434+
</details>
435+
398436
<details>
399437
<summary>Enable plock optimization in QAT Engine for Multithread applications</summary>
400438
<br>

configure.ac

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ then
325325
AC_MSG_NOTICE([QAT intree driver using QATlib in ${with_qat_hw_dir}])
326326
fi
327327
fi
328+
AM_CONDITIONAL([QAT_HW_INTREE], [test "x$cflags_qat_hw_intree" != "x"])
328329

329330
# ERROR message if mandatory options are not provided
330331
if test "x$cflags_qat_hw_intree" = "x"
@@ -357,9 +358,14 @@ then
357358
fi
358359
else
359360
ac_default_prefix=$with_openssl_install_dir
360-
#OPENSSL 3.0
361-
if test "`grep "define OPENSSL_VERSION_MAJOR" $with_openssl_install_dir/include/openssl/opensslv.h | awk '{print $4}'`" = "3"
361+
if test "`grep "define OPENSSL_VERSION_NUMBER 0x1010" $with_openssl_install_dir/include/openssl/opensslv.h | wc -l`" = "1"
362362
then
363+
#OPENSSL 1.1.1
364+
AC_MSG_NOTICE([Build QAT engine against OpenSSL 1.1.1])
365+
libdir="\$(with_openssl_install_dir)/lib/engines-1.1"
366+
AC_SUBST([OPENSSL_LIB], ["-Wl,-rpath,\$(with_openssl_install_dir)/lib -L\$(with_openssl_install_dir)/lib -lcrypto"])
367+
else
368+
#OPENSSL 3.0
363369
if test "x$enable_qat_provider" = "xyes"
364370
then
365371
AC_MSG_NOTICE([Build QAT Provider against OpenSSL 3.0])
@@ -373,11 +379,6 @@ then
373379
AC_SUBST([cflags_openssl_3], ["-DQAT_OPENSSL_3 -DOPENSSL_SUPPRESS_DEPRECATED"])
374380
AC_SUBST([OPENSSL_LIB], ["-Wl,-rpath,\$(with_openssl_install_dir)/\$(openssl3_lib) -L\$(with_openssl_install_dir)/\$(openssl3_lib) -lcrypto"])
375381
fi
376-
else
377-
#OPENSSL 1.1.1
378-
AC_MSG_NOTICE([Build QAT engine against OpenSSL 1.1.1])
379-
libdir="\$(with_openssl_install_dir)/lib/engines-1.1"
380-
AC_SUBST([OPENSSL_LIB], ["-Wl,-rpath,\$(with_openssl_install_dir)/lib -L\$(with_openssl_install_dir)/lib -lcrypto"])
381382
fi
382383
fi
383384
AC_SUBST([includes_openssl], ["-I\$(with_openssl_install_dir)/include"])
@@ -387,16 +388,18 @@ else
387388
AS_IF([test "x$PKGCONFIG" = "x"], [AC_MSG_ERROR(pkg-config not found.)], )
388389
libdir="`pkg-config --variable=enginesdir libcrypto`"
389390
includes_openssl="`pkg-config --variable=includedir libcrypto`"
390-
if test "`grep "define OPENSSL_VERSION_MAJOR" $includes_openssl/openssl/opensslv.h | awk '{print $4}'`" = "3"
391+
if test "`grep "define OPENSSL_VERSION_NUMBER 0x1010" $includes_openssl/openssl/opensslv.h | wc -l`" = "1"
391392
then
393+
AC_MSG_NOTICE([Build QAT Engine against system OpenSSL 1.1.1])
394+
else
392395
if test "x$enable_qat_provider" = "xyes"
393396
then
394-
AC_MSG_NOTICE([Build QAT Provider against OpenSSL 3.0])
397+
AC_MSG_NOTICE([Build QAT Provider against system OpenSSL 3.0])
395398
AC_SUBST([cflags_openssl_3], ["-DQAT_OPENSSL_3 -DOPENSSL_SUPPRESS_DEPRECATED -DQAT_OPENSSL_PROVIDER"])
396399
openssl3_lib="`pkg-config --variable=libdir libcrypto`"
397400
libdir="\$(openssl3_lib)/ossl-modules"
398401
else
399-
AC_MSG_NOTICE([Build QAT Engine against OpenSSL 3.0])
402+
AC_MSG_NOTICE([Build QAT Engine against system OpenSSL 3.0])
400403
AC_SUBST([cflags_openssl_3], ["-DQAT_OPENSSL_3 -DOPENSSL_SUPPRESS_DEPRECATED"])
401404
libdir="`pkg-config --variable=enginesdir libcrypto`"
402405
fi
@@ -424,6 +427,11 @@ then
424427
fi
425428
fi
426429
AM_CONDITIONAL([QAT_HW], [test "x$cflags_qat_hw" != "x"])
430+
case "$host_os" in
431+
linux*)
432+
AS_IF([test `lspci -vnd 8086: | grep -c 4940` != "0"], [AC_SUBST([enable_qat20_oot], ["-DQAT20_OOT"])])
433+
esac
434+
AM_CONDITIONAL([QAT_4XXX], [test "x$enable_qat20_oot" != "x"])
427435

428436
# QAT_SW acceleration enabled
429437
if test "x$enable_qat_sw" = "xyes"
@@ -445,6 +453,7 @@ then
445453
[AC_SUBST([QAT_SW_CRYPTO_MB_LIB], ["-Wl,-rpath,/usr/local/lib -L/usr/local/lib -lcrypto_mb"])],
446454
[AC_SUBST([QAT_SW_CRYPTO_MB_LIB], ["-lcrypto_mb"])])
447455
fi
456+
AC_SUBST([cflags_qat_sw], ["-DQAT_SW"])
448457
fi
449458

450459
#IPSEC_MB install path provided

driver_install.sh

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#!/bin/sh
2+
3+
#QAT_HW OOT driver Location
4+
QAT17_DRIVER=https://downloadmirror.intel.com/780675/QAT.L.4.22.0-00001.tar.gz
5+
QAT20_DRIVER=https://downloadmirror.intel.com/783270/QAT20.L.1.0.50-00003.tar.gz
6+
7+
#Supported Devices
8+
numC62xDevice=`lspci -vnd 8086: | grep -c "37c8\|37c9"`
9+
numDh895xDevice=`lspci -vnd 8086: | grep -c "0435\|0443"`
10+
numC3xxxDevice=`lspci -vnd 8086: | grep -c "19e2\|19e3"`
11+
num200xxDevice=`lspci -vnd 8086: | grep -c "18ee\|18ef"`
12+
numC4xxxDevice=`lspci -vnd 8086: | grep -c "18a0\|18a1"`
13+
num4xxxDevice=`lspci -vnd 8086: | grep -c "4940"`
14+
15+
QAT_ENGINE_ROOT=$PWD
16+
17+
#Install QAT_HW OOT Driver and copy config files
18+
if [ "$numC62xDevice" -gt 0 -o "$numDh895xDevice" -gt 0 -o "$numC3xxxDevice" -gt 0 -o "$numC4xxxDevice" -gt 0 -o "$num200xxDevice" -gt 0 -o "$num4xxxDevice" -gt 0 ]
19+
then
20+
if [ "$num4xxxDevice" -gt 0 ]
21+
then
22+
echo "QAT2.0 Driver"
23+
wget -O QAT_HW.tar.gz $QAT20_DRIVER
24+
else
25+
echo "QAT1.7 Driver"
26+
wget -O QAT_HW.tar.gz $QAT17_DRIVER
27+
fi
28+
mkdir -p $1
29+
tar -zxvf QAT_HW.tar.gz -C $1
30+
unset ICP_ROOT
31+
unset ICP_BUILD_OUTPUT
32+
cd $1
33+
./configure
34+
make uninstall; make clean; make install -j
35+
if [ "$numC62xDevice" -gt 0 ]
36+
then
37+
for(( i=0; i<$numC62xDevice; i++ ))
38+
do
39+
sudo cp -rf $QAT_ENGINE_ROOT/qat_hw_config/c6xx/multi_process/c6xx_dev0.conf /etc/c6xx_dev$i.conf
40+
done
41+
elif [ "$numDh895xDevice" -gt 0 ]
42+
then
43+
for(( i=0; i<"$numDh895xDevice"; i++ ))
44+
do
45+
sudo cp -rf $QAT_ENGINE_ROOT/qat_hw_config/dh895xcc/multi_process/dh895xcc_dev0.conf /etc/dh895xcc_dev$i.conf
46+
done
47+
elif [ "$numC3xxxDevice" -gt 0 ]
48+
then
49+
for(( i=0; i<"$numC3xxxDevice"; i++ ))
50+
do
51+
sudo cp -rf $QAT_ENGINE_ROOT/qat_hw_config/c3xxx/multi_process/c3xxx_dev0.conf /etc/c3xxx_dev$i.conf
52+
done
53+
elif [ "$numC4xxxDevice" -gt 0 ]
54+
then
55+
for(( i=0; i<"$numC4xxxDevice"; i++ ))
56+
do
57+
sudo cp -rf $QAT_ENGINE_ROOT/qat_hw_config/c4xxx/multi_process/c4xxx_dev0.conf /etc/c4xxx_dev$i.conf
58+
done
59+
elif [ "$num200xxDevice" -gt 0 ]
60+
then
61+
for(( i=0; i<"$num200xxDevice"; i++ ))
62+
do
63+
sudo cp -rf $QAT_ENGINE_ROOT/qat_hw_config/200xx/multi_process/200xx_dev0.conf /etc/200xx_dev$i.conf
64+
done
65+
elif [ "$num4xxxDevice" -gt 0 ]
66+
then
67+
for(( i=0; i<$num4xxxDevice; i++ ))
68+
do
69+
sudo cp -rf $QAT_ENGINE_ROOT/qat_hw_config/4xxx/multi_process/4xxx_dev0.conf /etc/4xxx_dev$i.conf
70+
done
71+
fi
72+
adf_ctl restart
73+
echo "QAT_HW Driver installed successfully!"
74+
else
75+
echo "QAT_HW Device not supported to install from make depend ! Install driver manually"
76+
fi

e_qat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,7 @@ int bind_qat(ENGINE *e, const char *id)
10611061

10621062
/* For QAT_HW, Check if the QAT_HW device is available */
10631063
#ifdef QAT_HW
1064-
# if defined(QAT20_OOT) || defined(__FreeBSD__)
1064+
# if !defined(QAT_HW_INTREE) && (defined(QAT20_OOT) || defined(__FreeBSD__))
10651065
if (icp_adf_get_numDevices(&dev_count) == CPA_STATUS_SUCCESS) {
10661066
if (dev_count > 0) {
10671067
qat_hw_offload = 1;

intel-ipsec-mb

Submodule intel-ipsec-mb added at 902533c

ipp-crypto

Submodule ipp-crypto added at 97d2971

openssl

Submodule openssl added at 245cb02

0 commit comments

Comments
 (0)