Skip to contentSkip to conversation

crypto/aesni_mb: use of archtecture independent macros

PATCH New Fan Zhang 4 participants 15 messages Nov 23, 2018 – Jan 9, 2019

Subsystems (2)
lore
Share & tools
lore

Fan Zhang

author
#0 lore raw

PATCH 1/1 crypto/aesni_mb: use of archtecture independent macros

This patch updates the aesni_mb to use IMB_* arch independent macros to reduce the code size and future maintaining effort.

---
This patch targets 19.02 release

 drivers/crypto/aesni_mb/aesni_mb_ops.h             | 302 ---------------------
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c         | 160 ++++++-----
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c     |  15 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |  33 ++-
 4 files changed, 118 insertions(+), 392 deletions(-)
 delete mode 100644 drivers/crypto/aesni_mb/aesni_mb_ops.h
drivers/crypto/aesni_mb/aesni_mb_ops.h deleted +0 -302
deleted file mode 100644
index 575d6a5b8..000000000
@@ -1,302 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2015 Intel Corporation
- */
-
-#ifndef _AESNI_MB_OPS_H_
-#define _AESNI_MB_OPS_H_
-
-#ifndef LINUX
-#define LINUX
-#endif
-
-#include <intel-ipsec-mb.h>
-
-/*
- * IMB_VERSION_NUM macro was introduced in version Multi-buffer 0.50,
- * so if macro is not defined, it means that the version is 0.49.
- */
-#if !defined(IMB_VERSION_NUM)
-#define IMB_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c))
-#define IMB_VERSION_NUM IMB_VERSION(0, 49, 0)
-#endif
-
-enum aesni_mb_vector_mode {
-	RTE_AESNI_MB_NOT_SUPPORTED = 0,
-	RTE_AESNI_MB_SSE,
-	RTE_AESNI_MB_AVX,
-	RTE_AESNI_MB_AVX2,
-	RTE_AESNI_MB_AVX512
-};
-
-typedef void (*md5_one_block_t)(const void *data, void *digest);
-
-typedef void (*sha1_one_block_t)(const void *data, void *digest);
-typedef void (*sha224_one_block_t)(const void *data, void *digest);
-typedef void (*sha256_one_block_t)(const void *data, void *digest);
-typedef void (*sha384_one_block_t)(const void *data, void *digest);
-typedef void (*sha512_one_block_t)(const void *data, void *digest);
-
-typedef void (*aes_keyexp_128_t)
-		(const void *key, void *enc_exp_keys, void *dec_exp_keys);
-typedef void (*aes_keyexp_192_t)
-		(const void *key, void *enc_exp_keys, void *dec_exp_keys);
-typedef void (*aes_keyexp_256_t)
-		(const void *key, void *enc_exp_keys, void *dec_exp_keys);
-typedef void (*aes_xcbc_expand_key_t)
-		(const void *key, void *exp_k1, void *k2, void *k3);
-typedef void (*aes_cmac_sub_key_gen_t)
-		(const void *exp_key, void *k2, void *k3);
-typedef void (*aes_cmac_keyexp_t)
-		(const void *key, void *keyexp);
-typedef void (*aes_gcm_keyexp_t)
-		(const void *key, struct gcm_key_data *keyexp);
-
-/** Multi-buffer library function pointer table */
-struct aesni_mb_op_fns {
-	struct {
-		init_mb_mgr_t init_mgr;
-		/**< Initialise scheduler  */
-		get_next_job_t get_next;
-		/**< Get next free job structure */
-		submit_job_t submit;
-		/**< Submit job to scheduler */
-		get_completed_job_t get_completed_job;
-		/**< Get completed job */
-		flush_job_t flush_job;
-		/**< flush jobs from manager */
-	} job;
-	/**< multi buffer manager functions */
-
-	struct {
-		struct {
-			md5_one_block_t md5;
-			/**< MD5 one block hash */
-			sha1_one_block_t sha1;
-			/**< SHA1 one block hash */
-			sha224_one_block_t sha224;
-			/**< SHA224 one block hash */
-			sha256_one_block_t sha256;
-			/**< SHA256 one block hash */
-			sha384_one_block_t sha384;
-			/**< SHA384 one block hash */
-			sha512_one_block_t sha512;
-			/**< SHA512 one block hash */
-		} one_block;
-		/**< one block hash functions */
-
-		struct {
-			aes_keyexp_128_t aes128;
-			/**< AES128 key expansions */
-			aes_keyexp_192_t aes192;
-			/**< AES192 key expansions */
-			aes_keyexp_256_t aes256;
-			/**< AES256 key expansions */
-			aes_xcbc_expand_key_t aes_xcbc;
-			/**< AES XCBC key epansions */
-			aes_cmac_sub_key_gen_t aes_cmac_subkey;
-			/**< AES CMAC subkey expansions */
-			aes_cmac_keyexp_t aes_cmac_expkey;
-			/**< AES CMAC key expansions */
-			aes_gcm_keyexp_t aes_gcm_128;
-			/**< AES GCM 128 key expansions */
-			aes_gcm_keyexp_t aes_gcm_192;
-			/**< AES GCM 192 key expansions */
-			aes_gcm_keyexp_t aes_gcm_256;
-			/**< AES GCM 256 key expansions */
-		} keyexp;
-		/**< Key expansion functions */
-#if IMB_VERSION_NUM >= IMB_VERSION(0, 50, 0)
-		struct {
-			hash_fn_t sha1;
-			hash_fn_t sha224;
-			hash_fn_t sha256;
-			hash_fn_t sha384;
-			hash_fn_t sha512;
-		} multi_block;
-		/** multi block hash functions */
-#endif
-	} aux;
-	/**< Auxiliary functions */
-};
-
-
-static const struct aesni_mb_op_fns job_ops[] = {
-		[RTE_AESNI_MB_NOT_SUPPORTED] = {
-			.job = {
-				NULL
-			},
-			.aux = {
-				.one_block = {
-					NULL
-				},
-				.keyexp = {
-					NULL
-				},
-#if IMB_VERSION_NUM >= IMB_VERSION(0, 50, 0)
-				.multi_block = {
-					NULL
-				}
-#endif
-
-			}
-		},
-		[RTE_AESNI_MB_SSE] = {
-			.job = {
-				init_mb_mgr_sse,
-				get_next_job_sse,
-				submit_job_sse,
-				get_completed_job_sse,
-				flush_job_sse
-			},
-			.aux = {
-				.one_block = {
-					md5_one_block_sse,
-					sha1_one_block_sse,
-					sha224_one_block_sse,
-					sha256_one_block_sse,
-					sha384_one_block_sse,
-					sha512_one_block_sse
-				},
-				.keyexp = {
-					aes_keyexp_128_sse,
-					aes_keyexp_192_sse,
-					aes_keyexp_256_sse,
-					aes_xcbc_expand_key_sse,
-					aes_cmac_subkey_gen_sse,
-					aes_keyexp_128_enc_sse,
-					aes_gcm_pre_128_sse,
-					aes_gcm_pre_192_sse,
-					aes_gcm_pre_256_sse
-				},
-#if IMB_VERSION_NUM >= IMB_VERSION(0, 50, 0)
-				.multi_block = {
-					sha1_sse,
-					sha224_sse,
-					sha256_sse,
-					sha384_sse,
-					sha512_sse
-				}
-#endif
-			}
-		},
-		[RTE_AESNI_MB_AVX] = {
-			.job = {
-				init_mb_mgr_avx,
-				get_next_job_avx,
-				submit_job_avx,
-				get_completed_job_avx,
-				flush_job_avx
-			},
-			.aux = {
-				.one_block = {
-					md5_one_block_avx,
-					sha1_one_block_avx,
-					sha224_one_block_avx,
-					sha256_one_block_avx,
-					sha384_one_block_avx,
-					sha512_one_block_avx
-				},
-				.keyexp = {
-					aes_keyexp_128_avx,
-					aes_keyexp_192_avx,
-					aes_keyexp_256_avx,
-					aes_xcbc_expand_key_avx,
-					aes_cmac_subkey_gen_avx,
-					aes_keyexp_128_enc_avx,
-					aes_gcm_pre_128_avx_gen2,
-					aes_gcm_pre_192_avx_gen2,
-					aes_gcm_pre_256_avx_gen2
-				},
-#if IMB_VERSION_NUM >= IMB_VERSION(0, 50, 0)
-				.multi_block = {
-					sha1_avx,
-					sha224_avx,
-					sha256_avx,
-					sha384_avx,
-					sha512_avx
-				}
-#endif
-			}
-		},
-		[RTE_AESNI_MB_AVX2] = {
-			.job = {
-				init_mb_mgr_avx2,
-				get_next_job_avx2,
-				submit_job_avx2,
-				get_completed_job_avx2,
-				flush_job_avx2
-			},
-			.aux = {
-				.one_block = {
-					md5_one_block_avx2,
-					sha1_one_block_avx2,
-					sha224_one_block_avx2,
-					sha256_one_block_avx2,
-					sha384_one_block_avx2,
-					sha512_one_block_avx2
-				},
-				.keyexp = {
-					aes_keyexp_128_avx2,
-					aes_keyexp_192_avx2,
-					aes_keyexp_256_avx2,
-					aes_xcbc_expand_key_avx2,
-					aes_cmac_subkey_gen_avx2,
-					aes_keyexp_128_enc_avx2,
-					aes_gcm_pre_128_avx_gen4,
-					aes_gcm_pre_192_avx_gen4,
-					aes_gcm_pre_256_avx_gen4
-				},
-#if IMB_VERSION_NUM >= IMB_VERSION(0, 50, 0)
-				.multi_block = {
-					sha1_avx2,
-					sha224_avx2,
-					sha256_avx2,
-					sha384_avx2,
-					sha512_avx2
-				}
-#endif
-			}
-		},
-		[RTE_AESNI_MB_AVX512] = {
-			.job = {
-				init_mb_mgr_avx512,
-				get_next_job_avx512,
-				submit_job_avx512,
-				get_completed_job_avx512,
-				flush_job_avx512
-			},
-			.aux = {
-				.one_block = {
-					md5_one_block_avx512,
-					sha1_one_block_avx512,
-					sha224_one_block_avx512,
-					sha256_one_block_avx512,
-					sha384_one_block_avx512,
-					sha512_one_block_avx512
-				},
-				.keyexp = {
-					aes_keyexp_128_avx512,
-					aes_keyexp_192_avx512,
-					aes_keyexp_256_avx512,
-					aes_xcbc_expand_key_avx512,
-					aes_cmac_subkey_gen_avx512,
-					aes_keyexp_128_enc_avx512,
-					aes_gcm_pre_128_avx_gen4,
-					aes_gcm_pre_192_avx_gen4,
-					aes_gcm_pre_256_avx_gen4
-				},
-#if IMB_VERSION_NUM >= IMB_VERSION(0, 50, 0)
-				.multi_block = {
-					sha1_avx512,
-					sha224_avx512,
-					sha256_avx512,
-					sha384_avx512,
-					sha512_avx512
-				}
-#endif
-			}
-		}
-};
-
-
-#endif /* _AESNI_MB_OPS_H_ */
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +89 -71

416 lines not on this page · raw message

drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c +2 -13
index f3eff2685..bfbd97923 100644
@@ -509,8 +509,6 @@ aesni_mb_pmd_qp_release(struct rte_cryptodev *dev, uint16_t qp_id)
 		r = rte_ring_lookup(qp->name);
 		if (r)
 			rte_ring_free(r);
-		if (qp->mb_mgr)
-			free_mb_mgr(qp->mb_mgr);
 		rte_free(qp);
 		dev->data->queue_pairs[qp_id] = NULL;
 	}
@@ -589,13 +587,7 @@ aesni_mb_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 		goto qp_setup_cleanup;
 
 
-	qp->mb_mgr = alloc_mb_mgr(0);
-	if (qp->mb_mgr == NULL) {
-		ret = -ENOMEM;
-		goto qp_setup_cleanup;
-	}
-
-	qp->op_fns = &job_ops[internals->vector_mode];
+	qp->mb_mgr = internals->mb_mgr;
 
 	qp->ingress_queue = aesni_mb_pmd_qp_create_processed_ops_ring(qp,
 			qp_conf->nb_descriptors, socket_id);
@@ -612,9 +604,6 @@ aesni_mb_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 
 	snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
 				"digest_mp_%u_%u", dev->data->dev_id, qp_id);
-
-	/* Initialise multi-buffer manager */
-	(*qp->op_fns->job.init_mgr)(qp->mb_mgr);
 	return 0;
 
 qp_setup_cleanup:
@@ -663,7 +652,7 @@ aesni_mb_pmd_sym_session_configure(struct rte_cryptodev *dev,
 		return -ENOMEM;
 	}
 
-	ret = aesni_mb_set_session_parameters(&job_ops[internals->vector_mode],
+	ret = aesni_mb_set_session_parameters(internals->mb_mgr,
 			sess_private_data, xform);
 	if (ret != 0) {
 		AESNI_MB_LOG(ERR, "failed configure session parameters");
drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h +27 -6
index d8021cdaa..1dc2c5bf0 100644
@@ -5,7 +5,24 @@
 #ifndef _RTE_AESNI_MB_PMD_PRIVATE_H_
 #define _RTE_AESNI_MB_PMD_PRIVATE_H_
 
-#include "aesni_mb_ops.h"
+#include <intel-ipsec-mb.h>
+
+/*
+ * IMB_VERSION_NUM macro was introduced in version Multi-buffer 0.50,
+ * so if macro is not defined, it means that the version is 0.49.
+ */
+#if !defined(IMB_VERSION_NUM)
+#define IMB_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c))
+#define IMB_VERSION_NUM IMB_VERSION(0, 49, 0)
+#endif
+
+enum aesni_mb_vector_mode {
+	RTE_AESNI_MB_NOT_SUPPORTED = 0,
+	RTE_AESNI_MB_SSE,
+	RTE_AESNI_MB_AVX,
+	RTE_AESNI_MB_AVX2,
+	RTE_AESNI_MB_AVX512
+};
 
 #define CRYPTODEV_NAME_AESNI_MB_PMD	crypto_aesni_mb
 /**< AES-NI Multi buffer PMD device name */
@@ -83,7 +100,9 @@ static const unsigned auth_digest_byte_lengths[] = {
 		[AES_XCBC]	= 16,
 		[AES_CMAC]	= 16,
 		[AES_GMAC]	= 12,
-		[NULL_HASH]		= 0
+		[NULL_HASH]	= 0,
+	/**< Vector mode dependent pointer table of the multi-buffer APIs */
+
 };
 
 /**
@@ -115,6 +134,8 @@ struct aesni_mb_private {
 	/**< CPU vector instruction set mode */
 	unsigned max_nb_queue_pairs;
 	/**< Max number of queue pairs supported by device */
+	MB_MGR *mb_mgr;
+	/**< Multi-buffer instance */
 };
 
 /** AESNI Multi buffer queue pair */
@@ -123,8 +144,6 @@ struct aesni_mb_qp {
 	/**< Queue Pair Identifier */
 	char name[RTE_CRYPTODEV_NAME_MAX_LEN];
 	/**< Unique Queue Pair Name */
-	const struct aesni_mb_op_fns *op_fns;
-	/**< Vector mode dependent pointer table of the multi-buffer APIs */
 	MB_MGR *mb_mgr;
 	/**< Multi-buffer instance */
 	struct rte_ring *ingress_queue;
@@ -153,7 +172,9 @@ struct aesni_mb_session {
 	} iv;
 	/**< IV parameters */
 
-	/** Cipher Parameters */
+	/** Cipher Parameters */const struct aesni_mb_op_fns *op_fns;
+	/**< Vector mode dependent pointer table of the multi-buffer APIs */
+
 	struct {
 		/** Cipher direction - encrypt / decrypt */
 		JOB_CIPHER_DIRECTION direction;
@@ -238,7 +259,7 @@ struct aesni_mb_session {
  *
  */
 extern int
-aesni_mb_set_session_parameters(const struct aesni_mb_op_fns *mb_ops,
+aesni_mb_set_session_parameters(const MB_MGR *mb_mgr,
 		struct aesni_mb_session *sess,
 		const struct rte_crypto_sym_xform *xform);
 
Signature · 1 line
2.13.6
author
#1 lore raw

PATCH v2 1/1 crypto/aesni_mb: use architure independent marcos

From: Lukasz Krakowiak <[email protected]>

This patch updates the aesni_mb to use IMB_* arch independent macros to reduce the code size and future maintaining effort.

---
v2:
- making the PMD compatible with both new intel-ipsec-mb version 0.52 and older
- fixed a bug

 drivers/crypto/aesni_mb/Makefile                   |   24 +-
 drivers/crypto/aesni_mb/meson.build                |   14 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_next.c    | 1237 ++++++++++++++++++++
 .../crypto/aesni_mb/rte_aesni_mb_pmd_ops_next.c    |  681 +++++++++++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |   52 +-
 5 files changed, 1998 insertions(+), 10 deletions(-)
 create mode 100755 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_next.c
 create mode 100755 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops_next.c
drivers/crypto/aesni_mb/Makefile +21 -3
index 806a95eb8..24630a6ca 100644
@@ -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.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += rte_aesni_mb_pmd_ops.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.c
+	SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += rte_aesni_mb_pmd_ops.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_next.c
+		SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += rte_aesni_mb_pmd_ops_next.c
+	else
+		# files for older 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
+	endif
+endif
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/crypto/aesni_mb/meson.build +12 -2
index aae0995e5..490f68eaf 100644
@@ -1,6 +1,6 @@
 # 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
@@ -8,5 +8,15 @@ else
 	ext_deps += lib
 endif
 
-sources = files('rte_aesni_mb_pmd.c', 'rte_aesni_mb_pmd_ops.c')
+imb_version = cc.get_define('IMB_VERSION_STR',
+        prefix : '#include<intel-ipsec-mb.h>')
+
+if imb_version.version_compare('>=' + IPSec_MB_ver_0_52)
+	message('Build for a new version of library IPSec_MB[' + imb_version + ']')
+	sources = files('rte_aesni_mb_pmd_next.c', 'rte_aesni_mb_pmd_ops_next.c')
+else
+	message('Build for older version of library IPSec_MB[' + imb_version + ']')
+	sources = files('rte_aesni_mb_pmd.c', 'rte_aesni_mb_pmd_ops.c')
+endif
+
 deps += ['bus_vdev']
drivers/crypto/aesni_mb/rte_aesni_mb_pmd_next.c new file +1237 -0

1,237 lines not on this page · raw message

drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops_next.c new file +681 -0

681 lines not on this page · raw message

drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h +47 -5

101 lines not on this page · raw message

Signature · 1 line
2.13.6
Applied
#2 lore raw

Re: [PATCH v2] crypto/aesni_mb: use architure independent marcos

Quoted 5 lines · Fan Zhang

From: Lukasz Krakowiak <[email protected]>

This patch updates the aesni_mb to use IMB_* arch independent macros to reduce the code size and future maintaining effort.

Quoted 8 lines

---
v2:
- making the PMD compatible with both new intel-ipsec-mb version 0.52 and older
- fixed a bug

Applied to dpdk-next-crypto

Thanks

#3 lore raw

Re: [PATCH v2] crypto/aesni_mb: use architure independent marcos

In reply to Fan Zhang

11/12/2018 13:29, Fan Zhang:

Quoted 74 lines

From: Lukasz Krakowiak <[email protected]>

This patch updates the aesni_mb to use IMB_* arch independent macros to reduce the code size and future maintaining effort.

---
v2:
- making the PMD compatible with both new intel-ipsec-mb version 0.52 and older
- fixed a bug

 drivers/crypto/aesni_mb/Makefile                   |   24 +-
 drivers/crypto/aesni_mb/meson.build                |   14 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_next.c    | 1237 ++++++++++++++++++++
 .../crypto/aesni_mb/rte_aesni_mb_pmd_ops_next.c    |  681 +++++++++++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |   52 +-
 5 files changed, 1998 insertions(+), 10 deletions(-)
 create mode 100755 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_next.c
 create mode 100755 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops_next.c
drivers/crypto/aesni_mb/Makefile +21 -3
index 806a95eb8..24630a6ca 100644
@@ -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.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += rte_aesni_mb_pmd_ops.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.c
+	SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += rte_aesni_mb_pmd_ops.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_next.c
+		SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += rte_aesni_mb_pmd_ops_next.c
+	else
+		# files for older 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
+	endif
+endif
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/crypto/aesni_mb/meson.build +3 -2
index aae0995e5..490f68eaf 100644
@@ -1,6 +1,6 @@
 # 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
@@ -8,5 +8,15 @@ else
 	ext_deps += lib
 endif
 
-sources = files('rte_aesni_mb_pmd.c', 'rte_aesni_mb_pmd_ops.c')
+imb_version = cc.get_define('IMB_VERSION_STR',
+        prefix : '#include<intel-ipsec-mb.h>')

drivers/crypto/aesni_mb/meson.build else · line 22

Quoted 10 lines
drivers/crypto/aesni_mb/meson.build +9 -0
+
+if imb_version.version_compare('>=' + IPSec_MB_ver_0_52)
+	message('Build for a new version of library IPSec_MB[' + imb_version + ']')
+	sources = files('rte_aesni_mb_pmd_next.c', 'rte_aesni_mb_pmd_ops_next.c')
+else
+	message('Build for older version of library IPSec_MB[' + imb_version + ']')
+	sources = files('rte_aesni_mb_pmd.c', 'rte_aesni_mb_pmd_ops.c')
+endif
+
 deps += ['bus_vdev']

I don't know what you are trying to do, but I know it is not explained.
Adding files "*_next.c" looks to be a bad idea.
And worst: it does not compile with meson:
drivers/crypto/aesni_mb/meson.build:11:0: ERROR: Could not get define 'IMB_VERSION_STR'

This patch is a total mess which must be explained, tested and split in several patches. I drop it from the merge to master and update all related AES patches
to "Changes Requested" in patchwork.

#4 lore raw

Re: [PATCH v2] crypto/aesni_mb: use architure independent marcos

Hi Thomas,

Sorry the patch caused the problem.
I have tested the patch with intel-ipsec-mb 0.50/0.52 library with make and did not find problem.

Once switching between versions of ipsec-mb, a necessary "make uninstall" has to be done to clear old in /usr.

However I didn't test meson in 0.50, sorry about that.

The purpose of the patch is to fit the changes made to the latest intel-ipsec-mb code with newly introduced API.
Using the new APIs (macros) newly introduced have the benefit of way easier maintenance effort for different architectures and massively reduce the code size.

However using the new APIs only will cause the inconsistence compatibility to the user who uses older APIs.

Ferruh and I had the talk and come with the solution to prepare both old and new code for 19.02, and make the compiler selects which files to be compiled based on the detected ipsec-mb version. We also planned to make a deprecation notice for 19.05 to drop the support of older version of ipsec-mb library, along with replacing the *_new* files with the existing one.

Regards,
Fan

Quoted 122 lines

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Wednesday, December 19, 2018 1:09 PM
To: Zhang, Roy Fan <[email protected]>
Cc: [email protected]; [email protected]; Krakowiak, LukaszX <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] crypto/aesni_mb: use architure independent marcos

11/12/2018 13:29, Fan Zhang:

Quoted 13 lines

From: Lukasz Krakowiak <[email protected]>

This patch updates the aesni_mb to use IMB_* arch independent macros to reduce the code size and future maintaining effort.

---
v2:
- making the PMD compatible with both new intel-ipsec-mb version 0.52 and older
- fixed a bug

Quoted 3 lines
 drivers/crypto/aesni_mb/Makefile                   |   24 +-
 drivers/crypto/aesni_mb/meson.build                |   14 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_next.c    | 1237

++++++++++++++++++++

Quoted 1 line
 .../crypto/aesni_mb/rte_aesni_mb_pmd_ops_next.c    |  681

+++++++++++

Quoted 12 lines
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |   52 +-
 5 files changed, 1998 insertions(+), 10 deletions(-)  create mode
100755 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_next.c
 create mode 100755

drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops_next.c

drivers/crypto/aesni_mb/Makefile +0 -0
index 806a95eb8..24630a6ca 100644

drivers/crypto/aesni_mb/Makefile LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool · line 26

Quoted 5 lines
drivers/crypto/aesni_mb/Makefile +0 -4
@@ -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.c
-SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) +=

rte_aesni_mb_pmd_ops.c

drivers/crypto/aesni_mb/Makefile LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring

Quoted 10 lines
drivers/crypto/aesni_mb/Makefile +10 -0
+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.c

drivers/crypto/aesni_mb/Makefile LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool · line 33

Quoted 1 line
drivers/crypto/aesni_mb/Makefile +1 -0
+	SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) +=

rte_aesni_mb_pmd_ops.c

drivers/crypto/aesni_mb/Makefile LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring

Quoted 4 lines
drivers/crypto/aesni_mb/Makefile +4 -0
+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_next.c

drivers/crypto/aesni_mb/Makefile LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool · line 38

Quoted 1 line
drivers/crypto/aesni_mb/Makefile +1 -0
+		SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) +=

rte_aesni_mb_pmd_ops_next.c

drivers/crypto/aesni_mb/Makefile LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring

Quoted 3 lines
drivers/crypto/aesni_mb/Makefile +3 -0
+	else
+		# files for older version of IMB
+		SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) +=

rte_aesni_mb_pmd.c

drivers/crypto/aesni_mb/Makefile LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool · line 42

Quoted 1 line
drivers/crypto/aesni_mb/Makefile +1 -0
+		SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) +=

rte_aesni_mb_pmd_ops.c

Quoted 18 lines
drivers/crypto/aesni_mb/Makefile +2 -0
+	endif
+endif
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/crypto/aesni_mb/meson.build +0 -0
index aae0995e5..490f68eaf 100644
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause  # Copyright(c) 2018 Intel

Corporation

drivers/crypto/aesni_mb/meson.build +1 -1
-
+IPSec_MB_ver_0_52 = '0.52.0'
 lib = cc.find_library('IPSec_MB', required: false)  if not

lib.found()

drivers/crypto/aesni_mb/meson.build +0 -0
 	build = false

drivers/crypto/aesni_mb/meson.build else · line 15

Quoted 9 lines
drivers/crypto/aesni_mb/meson.build +5 -1
@@ -8,5 +8,15 @@ else
 	ext_deps += lib
 endif
 
-sources = files('rte_aesni_mb_pmd.c', 'rte_aesni_mb_pmd_ops.c')
+imb_version = cc.get_define('IMB_VERSION_STR',
+        prefix : '#include<intel-ipsec-mb.h>')
+
+if imb_version.version_compare('>=' + IPSec_MB_ver_0_52)
+	message('Build for a new version of library IPSec_MB[' + imb_version

+ ']')

drivers/crypto/aesni_mb/meson.build else · line 18

Quoted 3 lines
drivers/crypto/aesni_mb/meson.build +3 -0
+	sources = files('rte_aesni_mb_pmd_next.c',
+'rte_aesni_mb_pmd_ops_next.c') else
+	message('Build for older version of library IPSec_MB[' + imb_version

+ ']')

drivers/crypto/aesni_mb/meson.build else · line 22

Quoted 4 lines
drivers/crypto/aesni_mb/meson.build +3 -0
+	sources = files('rte_aesni_mb_pmd.c', 'rte_aesni_mb_pmd_ops.c')
+endif
+
 deps += ['bus_vdev']

I don't know what you are trying to do, but I know it is not explained. Adding files "*_next.c" looks to be a bad idea.
And worst: it does not compile with meson:
drivers/crypto/aesni_mb/meson.build:11:0: ERROR: Could not get
define 'IMB_VERSION_STR'

This patch is a total mess which must be explained, tested and split in several patches.
I drop it from the merge to master and update all related AES patches to "Changes Requested" in patchwork.

author
#5 lore raw

v3 cover use architecure independent macros

In reply to Fan Zhang

This patch updates the aesni_mb to use IMB_* arch independent macros to reduce the code size and future maintaining effort.

In intel-ipsec-mb library 0.52 all supported algorithms now have the IMB_* arch independent macros enabled. The macros help reducing the application's code size and remove the burden of maintaining the support to different architectures such as SSE and AVX*, etc.

This patch adds this support into AESNI-MB PMD. Meanwhile to keep supporting the older version of intel-ipsec-mb library, the existing rte_aesni_mb_pmd*.c are renamed to rte_aesni_mb_pmd*_compat.c and the compiler will check the version number in /usr/include/inte-ipsec-mb.h and decides which files to be compiled. For intel-ipsec-mb library 0.52 the rte_aesni_mb_pmd*.c will be compiled. For the older version rte_aesni_mb_pmd*_compat.c will be compiled.

It is planned to change the minimum intel-ipsec-mb support version to 0.52 in DPDK 19.05 release. By then all code intended for supporting older version will be removed, including rte_aesni_mb_pmd*_compat.c.

v3:
- patch split.
- fixed meson build bug.
- updated commit message.
- updated documentation.

v2:
- making the PMD compatible with both new intel-ipsec-mb version 0.52 and older
- fixed a bug

Fan Zhang (4):
crypto/aesni_mb: rename files to compatible crypto/aesni_mb: use architecture independent macros
doc: update library support version
doc: update deprecation notice

 doc/guides/cryptodevs/aesni_mb.rst                 |    4 +-
 doc/guides/rel_notes/deprecation.rst               |    3 +
 drivers/crypto/aesni_mb/Makefile                   |   26 +-
 drivers/crypto/aesni_mb/meson.build                |   18 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c         |  190 ++-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_compat.c  | 1239 ++++++++++++++++++++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c     |   86 +-
 .../crypto/aesni_mb/rte_aesni_mb_pmd_ops_compat.c  |  719 ++++++++++++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |   52 +-
 9 files changed, 2166 insertions(+), 171 deletions(-)
 create mode 100644 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_compat.c
 create mode 100644 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops_compat.c
Signature · 1 line
2.13.6
author
#6 lore raw

PATCH v3 1/4 crypto/aesni_mb: rename files to compatible

This patch renames the rte_aesni_mb_pmd*.c to rte_aesni_mb_pmd*_compat.c to indicate those files are for compatible with older versoin of intel-ipsec-mb library only.

---
 drivers/crypto/aesni_mb/Makefile                                      | 4 ++--
 drivers/crypto/aesni_mb/meson.build                                   | 2 +-
 .../crypto/aesni_mb/{rte_aesni_mb_pmd.c => rte_aesni_mb_pmd_compat.c} | 0
 .../{rte_aesni_mb_pmd_ops.c => rte_aesni_mb_pmd_ops_compat.c}         | 0
 4 files changed, 3 insertions(+), 3 deletions(-)
 rename drivers/crypto/aesni_mb/{rte_aesni_mb_pmd.c => rte_aesni_mb_pmd_compat.c} (100%)
 rename drivers/crypto/aesni_mb/{rte_aesni_mb_pmd_ops.c => rte_aesni_mb_pmd_ops_compat.c} (100%)
drivers/crypto/aesni_mb/Makefile +2 -2
index 806a95eb8..5a8671cd4 100644
@@ -23,7 +23,7 @@ LDLIBS += -lrte_cryptodev
 LDLIBS += -lrte_bus_vdev
 
 # library source files
-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
+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
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/crypto/aesni_mb/meson.build +1 -1
index aae0995e5..ed68c7f39 100644
@@ -8,5 +8,5 @@ else
 	ext_deps += lib
 endif
 
-sources = files('rte_aesni_mb_pmd.c', 'rte_aesni_mb_pmd_ops.c')
+sources = files('rte_aesni_mb_pmd_compat.c', 'rte_aesni_mb_pmd_ops_compat.c')
 deps += ['bus_vdev']
drivers/crypto/aesni_mb/rte_aesni_mb_pmd_compat.c renamed from drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +0 -0
similarity index 100%
rename from drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
rename to drivers/crypto/aesni_mb/rte_aesni_mb_pmd_compat.c
drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops_compat.c renamed from drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c +0 -0
similarity index 100%
rename from drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
rename to drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops_compat.c
Signature · 1 line
2.13.6
author
#7 lore raw

PATCH v3 2/4 crypto/aesni_mb: use architecture independent macros

In reply to Fan Zhang

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.

---
 drivers/crypto/aesni_mb/Makefile                   |   26 +-
 drivers/crypto/aesni_mb/meson.build                |   18 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c         | 1237 ++++++++++++++++++++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c     |  681 +++++++++++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |   52 +-
 5 files changed, 2003 insertions(+), 11 deletions(-)
 create mode 100644 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
 create mode 100644 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
drivers/crypto/aesni_mb/Makefile +22 -4
index 5a8671cd4..c2bda5838 100644
@@ -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
 
@@ -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
drivers/crypto/aesni_mb/meson.build +16 -2
index ed68c7f39..b5a7fa7f7 100644
@@ -1,6 +1,6 @@
 # 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
@@ -8,5 +8,19 @@ else
 	ext_deps += lib
 endif
 
-sources = files('rte_aesni_mb_pmd_compat.c', 'rte_aesni_mb_pmd_ops_compat.c')
+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
+
 deps += ['bus_vdev']
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c new file +1237 -0

1,237 lines not on this page · raw message

drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c new file +681 -0

681 lines not on this page · raw message

drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h +47 -5

101 lines not on this page · raw message

Signature · 1 line
2.13.6
author
#8 lore raw

PATCH v3 3/4 doc: update library support version

In reply to Fan Zhang

This patch updates the AESNI-MB PMD document with the new intel-ipsec-mb version number.

---
 doc/guides/cryptodevs/aesni_mb.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
doc/guides/cryptodevs/aesni_mb.rst +2 -2
index 63e060d75..12532c63e 100644
@@ -59,8 +59,8 @@ Installation
 To build DPDK with the AESNI_MB_PMD the user is required to download the multi-buffer
 library from `here <https://github.com/01org/intel-ipsec-mb>`_
 and compile it on their user system before building DPDK.
-The latest version of the library supported by this PMD is v0.50, which
-can be downloaded from `<https://github.com/01org/intel-ipsec-mb/archive/v0.50.zip>`_.
+The latest version of the library supported by this PMD is v0.52, which
+can be downloaded from `<https://github.com/01org/intel-ipsec-mb/archive/v0.52.zip>`_.
 
 .. code-block:: console
 
Signature · 1 line
2.13.6
author
#9 lore raw

PATCH v3 4/4 doc: update deprecation notice

In reply to Fan Zhang
Quoted 1 line

From 19.05 the AESNI-MB PMD will not support the intel-ipsec-mb library

version older than 0.52.0.

---
 doc/guides/rel_notes/deprecation.rst | 3 +++
 1 file changed, 3 insertions(+)
doc/guides/rel_notes/deprecation.rst +3 -0
index ac7fb29a7..0578978d8 100644
@@ -98,3 +98,6 @@ Deprecation Notices
   - The size and layout of ``rte_cryptodev_qp_conf`` and syntax of
     ``rte_cryptodev_queue_pair_setup`` will change to to allow to use
     two different mempools for crypto and device private sessions.
+
+ * aesni_mb: the minimum supported intel-ipsec-mb library version will be
+   changed from 0.49.0 to 0.52.0.
Signature · 1 line
2.13.6
author
#10 lore raw

v4 cover use architecure independent macros

In reply to Fan Zhang

This patch updates the aesni_mb to use IMB_* arch independent macros to reduce the code size and future maintaining effort.

In intel-ipsec-mb library 0.52 all supported algorithms now have the IMB_* arch independent macros enabled. The macros help reducing the application's code size and remove the burden of maintaining the support to different architectures such as SSE and AVX*, etc.

This patch adds this support into AESNI-MB PMD. Meanwhile to keep supporting the older version of intel-ipsec-mb library, the existing rte_aesni_mb_pmd*.c are renamed to rte_aesni_mb_pmd*_compat.c and the compiler will check the version number in /usr/include/inte-ipsec-mb.h and decides which files to be compiled. For intel-ipsec-mb library 0.52 the rte_aesni_mb_pmd*.c will be compiled. For the older version rte_aesni_mb_pmd*_compat.c will be compiled.

It is planned to change the minimum intel-ipsec-mb support version to 0.52 in DPDK 19.05 release. By then all code intended for supporting older version will be removed, including rte_aesni_mb_pmd*_compat.c.

v4:
- combined documentation patches into one.
- updated release note.

v3:
- patch split.
- fixed meson build bug.
- updated commit message.
- updated documentation.

v2:
- making the PMD compatible with both new intel-ipsec-mb version 0.52 and older
- fixed a bug

Fan Zhang (3):
crypto/aesni_mb: rename files crypto/aesni_mb: use architecture independent macros
doc: update documentation

 doc/guides/cryptodevs/aesni_mb.rst                 |    4 +-
 doc/guides/rel_notes/deprecation.rst               |    3 +
 doc/guides/rel_notes/release_19_02.rst             |    3 +
 drivers/crypto/aesni_mb/Makefile                   |   26 +-
 drivers/crypto/aesni_mb/meson.build                |   18 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c         |  190 ++-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_compat.c  | 1239 ++++++++++++++++++++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c     |   86 +-
 .../crypto/aesni_mb/rte_aesni_mb_pmd_ops_compat.c  |  719 ++++++++++++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |   52 +-
 10 files changed, 2169 insertions(+), 171 deletions(-)
 create mode 100644 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_compat.c
 create mode 100644 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops_compat.c
Signature · 1 line
2.13.6
author
#11 lore raw

PATCH v4 1/3 crypto/aesni_mb: rename files

This patch renames the rte_aesni_mb_pmd*.c to rte_aesni_mb_pmd*_compat.c to indicate those files are for compatible with older versoin of intel-ipsec-mb library only.

---
 drivers/crypto/aesni_mb/Makefile                                      | 4 ++--
 drivers/crypto/aesni_mb/meson.build                                   | 2 +-
 .../crypto/aesni_mb/{rte_aesni_mb_pmd.c => rte_aesni_mb_pmd_compat.c} | 0
 .../{rte_aesni_mb_pmd_ops.c => rte_aesni_mb_pmd_ops_compat.c}         | 0
 4 files changed, 3 insertions(+), 3 deletions(-)
 rename drivers/crypto/aesni_mb/{rte_aesni_mb_pmd.c => rte_aesni_mb_pmd_compat.c} (100%)
 rename drivers/crypto/aesni_mb/{rte_aesni_mb_pmd_ops.c => rte_aesni_mb_pmd_ops_compat.c} (100%)
drivers/crypto/aesni_mb/Makefile +2 -2
index 806a95eb8..5a8671cd4 100644
@@ -23,7 +23,7 @@ LDLIBS += -lrte_cryptodev
 LDLIBS += -lrte_bus_vdev
 
 # library source files
-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
+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
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/crypto/aesni_mb/meson.build +1 -1
index aae0995e5..ed68c7f39 100644
@@ -8,5 +8,5 @@ else
 	ext_deps += lib
 endif
 
-sources = files('rte_aesni_mb_pmd.c', 'rte_aesni_mb_pmd_ops.c')
+sources = files('rte_aesni_mb_pmd_compat.c', 'rte_aesni_mb_pmd_ops_compat.c')
 deps += ['bus_vdev']
drivers/crypto/aesni_mb/rte_aesni_mb_pmd_compat.c renamed from drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +0 -0
similarity index 100%
rename from drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
rename to drivers/crypto/aesni_mb/rte_aesni_mb_pmd_compat.c
drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops_compat.c renamed from drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c +0 -0
similarity index 100%
rename from drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
rename to drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops_compat.c
Signature · 1 line
2.13.6
author
#12 lore raw

PATCH v4 2/3 crypto/aesni_mb: use architecture independent macros

In reply to Fan Zhang

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.

---
 drivers/crypto/aesni_mb/Makefile                   |   26 +-
 drivers/crypto/aesni_mb/meson.build                |   18 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c         | 1237 ++++++++++++++++++++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c     |  681 +++++++++++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |   52 +-
 5 files changed, 2003 insertions(+), 11 deletions(-)
 create mode 100644 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
 create mode 100644 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
drivers/crypto/aesni_mb/Makefile +22 -4
index 5a8671cd4..c2bda5838 100644
@@ -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
 
@@ -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
drivers/crypto/aesni_mb/meson.build +16 -2
index ed68c7f39..f292edcfc 100644
@@ -1,6 +1,6 @@
 # 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
@@ -8,5 +8,19 @@ else
 	ext_deps += lib
 endif
 
-sources = files('rte_aesni_mb_pmd_compat.c', 'rte_aesni_mb_pmd_ops_compat.c')
+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
+
 deps += ['bus_vdev']
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c new file +1237 -0

1,237 lines not on this page · raw message

drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c new file +681 -0

681 lines not on this page · raw message

drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h +47 -5

101 lines not on this page · raw message

Signature · 1 line
2.13.6
author
#13 lore raw

PATCH v4 3/3 doc: update documentation

In reply to Fan Zhang

This patch updates the AESNI-MB PMD document with the new intel-ipsec-mb version number, the release note with new library version support, and the deprecation notice for removing some library version support in 19.05 release.

---
 doc/guides/cryptodevs/aesni_mb.rst     | 4 ++--
 doc/guides/rel_notes/deprecation.rst   | 3 +++
 doc/guides/rel_notes/release_19_02.rst | 3 +++
 3 files changed, 8 insertions(+), 2 deletions(-)
doc/guides/cryptodevs/aesni_mb.rst +2 -2
index 63e060d75..12532c63e 100644
@@ -59,8 +59,8 @@ Installation
 To build DPDK with the AESNI_MB_PMD the user is required to download the multi-buffer
 library from `here <https://github.com/01org/intel-ipsec-mb>`_
 and compile it on their user system before building DPDK.
-The latest version of the library supported by this PMD is v0.50, which
-can be downloaded from `<https://github.com/01org/intel-ipsec-mb/archive/v0.50.zip>`_.
+The latest version of the library supported by this PMD is v0.52, which
+can be downloaded from `<https://github.com/01org/intel-ipsec-mb/archive/v0.52.zip>`_.
 
 .. code-block:: console
 
doc/guides/rel_notes/deprecation.rst +3 -0
index ac7fb29a7..0578978d8 100644
@@ -98,3 +98,6 @@ Deprecation Notices
   - The size and layout of ``rte_cryptodev_qp_conf`` and syntax of
     ``rte_cryptodev_queue_pair_setup`` will change to to allow to use
     two different mempools for crypto and device private sessions.
+
+ * aesni_mb: the minimum supported intel-ipsec-mb library version will be
+   changed from 0.49.0 to 0.52.0.
doc/guides/rel_notes/release_19_02.rst +3 -0
index 069f429a7..161974c77 100644
@@ -65,6 +65,9 @@ New Features
   Added a new performance test tool to test the compressdev PMD. The tool tests
   compression ratio and compression throughput.
 
+* **updated the AESNI-MB PMD.**
+  * Added support for intel-ipsec-mb version 0.52.
+
 
 Removed Items
 -------------
Signature · 1 line
2.13.6
#14 lore raw

Re: [PATCH v4 0/3] use architecure independent macros

In reply to Fan Zhang
Quoted 26 lines

-----Original Message-----
From: Zhang, Roy Fan
Sent: Thursday, December 20, 2018 11:57 AM
To: [email protected]
Cc: [email protected]; De Lara Guarch, Pablo <[email protected]>
Subject: [PATCH v4 0/3] use architecure independent macros

This patch updates the aesni_mb to use IMB_* arch independent macros to reduce the code size and future maintaining effort.

In intel-ipsec-mb library 0.52 all supported algorithms now have the IMB_* arch independent macros enabled. The macros help reducing the application's code size and remove the burden of maintaining the support to different architectures such as SSE and AVX*, etc.

This patch adds this support into AESNI-MB PMD. Meanwhile to keep supporting the older version of intel-ipsec-mb library, the existing rte_aesni_mb_pmd*.c are renamed to rte_aesni_mb_pmd*_compat.c and the compiler will check the version number in /usr/include/inte-ipsec-mb.h and decides which files to be compiled. For intel-ipsec-mb library 0.52 the rte_aesni_mb_pmd*.c will be compiled. For the older version rte_aesni_mb_pmd*_compat.c will be compiled.

Quoted 5 lines

It is planned to change the minimum intel-ipsec-mb support version to 0.52 in DPDK 19.05 release. By then all code intended for supporting older version will be removed, including rte_aesni_mb_pmd*_compat.c.

Series applied to dpdk-next-crypto.

Thanks,
Pablo