Skip to content

Commit

Permalink
crypto/aesni_mb: use architecture independent macros
Browse files Browse the repository at this point in the history
This patch duplicates the original rte_aesni_mb_pmd*.c files and replaces
the function calls provided by intel-ipsec-mb library into
architecture-independent macros. The build systems are updated to choose
compiling either rte_aesni_mb_pmd*.c or rte_aesni_mb_pmd*_compat.c based
on the installed intel-ipsec-mb version. For the intel-ipsec-mb older
than 0.52.0 rte_aesni_mb_pmd*_compat.c will be compiled, otherwise
rte_aesni_mb_pmd*.c will be compiled.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Signed-off-by: Lukasz Krakowiak <lukaszx.krakowiak@intel.com>
Acked-by: Damian Nowak <damianx.nowak@intel.com>
  • Loading branch information
Fan Zhang authored and pablodelara committed Jan 10, 2019
1 parent e82d0df commit c68d7aa
Show file tree
Hide file tree
Showing 5 changed files with 2,004 additions and 11 deletions.
26 changes: 22 additions & 4 deletions drivers/crypto/aesni_mb/Makefile
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2015 Intel Corporation
# Copyright(c) 2015-2018 Intel Corporation

include $(RTE_SDK)/mk/rte.vars.mk

Expand All @@ -22,8 +22,26 @@ LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_cryptodev
LDLIBS += -lrte_bus_vdev

# library source files
SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += rte_aesni_mb_pmd_compat.c
SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += rte_aesni_mb_pmd_ops_compat.c
IMB_HDR = /usr/include/intel-ipsec-mb.h

# Detect library version
IMB_VERSION = $(shell grep -e "IMB_VERSION_STR" $(IMB_HDR) | cut -d'"' -f2)
IMB_VERSION_NUM = $(shell grep -e "IMB_VERSION_NUM" $(IMB_HDR) | cut -d' ' -f3)

ifeq ($(IMB_VERSION),)
# files for older version of IMB
SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += rte_aesni_mb_pmd_compat.c
SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += rte_aesni_mb_pmd_ops_compat.c
else
ifeq ($(shell expr $(IMB_VERSION_NUM) \>= 0x3400), 1)
# files for a new version of IMB
SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += rte_aesni_mb_pmd.c
SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += rte_aesni_mb_pmd_ops.c
else
# files for older version of IMB
SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += rte_aesni_mb_pmd_compat.c
SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += rte_aesni_mb_pmd_ops_compat.c
endif
endif

include $(RTE_SDK)/mk/rte.lib.mk
19 changes: 17 additions & 2 deletions drivers/crypto/aesni_mb/meson.build
@@ -1,12 +1,27 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2018 Intel Corporation

IPSec_MB_ver_0_52 = '0.52.0'
lib = cc.find_library('IPSec_MB', required: false)
if not lib.found()
build = false
else
ext_deps += lib

imb_arr = cc.get_define('IMB_VERSION_STR',
prefix : '#include<intel-ipsec-mb.h>').split('"')

imb_ver =''.join(imb_arr)

if imb_ver.version_compare('>=' + IPSec_MB_ver_0_52)
message('Build for a new version of library IPSec_MB[' + imb_ver + ']')
sources = files('rte_aesni_mb_pmd.c',
'rte_aesni_mb_pmd_ops.c')
else
sources = files('rte_aesni_mb_pmd_compat.c',
'rte_aesni_mb_pmd_ops_compat.c')
message('Build for older version of library IPSec_MB[' + imb_ver + ']')
endif

endif

sources = files('rte_aesni_mb_pmd_compat.c', 'rte_aesni_mb_pmd_ops_compat.c')
deps += ['bus_vdev']

0 comments on commit c68d7aa

Please sign in to comment.