Skip to contentSkip to conversation

crypto/ccp: enable CCP crypto poll mode driver by default

PATCH In review Ravi Kumar 3 participants 17 messages May 3, 2018 – May 11, 2018

Subsystems (2)
lore
Share & tools
lore

Ravi Kumar

author
#0 lore raw

PATCH 1/2 crypto/ccp: enable CCP crypto poll mode driver by default

---
 config/common_base | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
config/common_base +1 -1
index 03a8688..802035b 100644
@@ -555,7 +555,7 @@ CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO=y
 #
 # Compile PMD for AMD CCP crypto device
 #
-CONFIG_RTE_LIBRTE_PMD_CCP=n
+CONFIG_RTE_LIBRTE_PMD_CCP=y
 CONFIG_RTE_LIBRTE_PMD_CCP_CPU_AUTH=n
 
 #
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 2/2 crypto/ccp: change to command line option from compile time

CCP PMD supports authentication offload to either of CCP or CPU. The earlier version of patch provided this option as compile time. This patch changes this option from compile time to run time. User can pass "ccp_auth_opt=1" as an additional argument to vdev parameter to enable authentication operations on CPU.

---
 config/common_base                   |   1 -
 doc/guides/cryptodevs/ccp.rst        |  13 +-
 drivers/crypto/ccp/ccp_crypto.c      | 413 +++++++++++++++++------------------
 drivers/crypto/ccp/ccp_crypto.h      |  10 +-
 drivers/crypto/ccp/ccp_pmd_ops.c     |   6 +-
 drivers/crypto/ccp/ccp_pmd_private.h |   6 +-
 drivers/crypto/ccp/rte_ccp_pmd.c     | 226 +++++++++++++++++--
 7 files changed, 421 insertions(+), 254 deletions(-)
config/common_base +0 -1
index 802035b..ad24402 100644
@@ -556,7 +556,6 @@ CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO=y
 # Compile PMD for AMD CCP crypto device
 #
 CONFIG_RTE_LIBRTE_PMD_CCP=y
-CONFIG_RTE_LIBRTE_PMD_CCP_CPU_AUTH=n
 
 #
 # Compile PMD for Marvell Crypto device
doc/guides/cryptodevs/ccp.rst +5 -8
index 1fcd462..cdb9374 100644
@@ -56,14 +56,11 @@ AEAD algorithms:
 Installation
 ------------
 
-To compile CCP PMD, it has to be enabled in the config/common_base file.
+To compile CCP PMD, ensure that following is enabled in your DPDK configuration file.
 * ``CONFIG_RTE_LIBRTE_PMD_CCP=y``
 
-The CCP PMD also supports computing authentication over CPU with cipher offloaded
-to CCP. To enable this feature, enable following in the configuration.
-* ``CONFIG_RTE_LIBRTE_PMD_CCP_CPU_AUTH=y``
-
-This code was verified on Ubuntu 16.04.
+The CCP PMD also supports computing authentication over CPU with cipher offloaded to CCP.
+To enable this feature, pass an additional argument as ccp_auth_opt=1 to --vdev parameters.
 
 Initialization
 --------------
@@ -98,5 +95,5 @@ To verify real traffic l2fwd-crypto example can be used with following command:
 Limitations
 -----------
 
-* Chained mbufs are not supported
-* MD5_HMAC is supported only if ``CONFIG_RTE_LIBRTE_PMD_CCP_CPU_AUTH=y`` is enabled in configuration
+* Chained mbufs are not supported.
+* MD5_HMAC is supported only for CPU based authentication.
drivers/crypto/ccp/ccp_crypto.c +201 -212

599 lines not on this page · raw message

drivers/crypto/ccp/ccp_crypto.h +5 -5
index dd89ad9..882b398 100644
@@ -42,10 +42,9 @@
 #define HMAC_IPAD_VALUE 0x36
 #define HMAC_OPAD_VALUE 0x5c
 
-#ifdef RTE_LIBRTE_PMD_CCP_CPU_AUTH
+/* MD5 */
 #define MD5_DIGEST_SIZE         16
 #define MD5_BLOCK_SIZE          64
-#endif
 
 /* SHA */
 #define SHA_COMMON_DIGEST_SIZE	32
@@ -235,9 +234,7 @@ enum ccp_hash_algo {
 	CCP_AUTH_ALGO_SHA3_512_HMAC,
 	CCP_AUTH_ALGO_AES_CMAC,
 	CCP_AUTH_ALGO_AES_GCM,
-#ifdef RTE_LIBRTE_PMD_CCP_CPU_AUTH
 	CCP_AUTH_ALGO_MD5_HMAC,
-#endif
 };
 
 /**
@@ -250,6 +247,7 @@ enum ccp_hash_op {
 
 /* CCP crypto private session structure */
 struct ccp_session {
+	bool auth_opt;
 	enum ccp_cmd_order cmd_id;
 	/**< chain order mode */
 	struct {
@@ -321,6 +319,7 @@ struct ccp_session {
 extern uint8_t ccp_cryptodev_driver_id;
 
 struct ccp_qp;
+struct ccp_private;
 
 /**
  * Set and validate CCP crypto session parameters
@@ -330,7 +329,8 @@ struct ccp_qp;
  * @return 0 on success otherwise -1
  */
 int ccp_set_session_parameters(struct ccp_session *sess,
-			       const struct rte_crypto_sym_xform *xform);
+			       const struct rte_crypto_sym_xform *xform,
+			       struct ccp_private *internals);
 
 /**
  * Find count of slots
drivers/crypto/ccp/ccp_pmd_ops.c +3 -3
index 3d0d875..2c7496b 100644
@@ -13,7 +13,6 @@
 #include "ccp_crypto.h"
 
 static const struct rte_cryptodev_capabilities ccp_pmd_capabilities[] = {
-#ifdef RTE_LIBRTE_PMD_CCP_CPU_AUTH
 	{	/* MD5 HMAC */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
 		{.sym = {
@@ -35,7 +34,6 @@ static const struct rte_cryptodev_capabilities ccp_pmd_capabilities[] = {
 			}, }
 		}, }
 	},
-#endif
 	{	/* SHA1 */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
 		{.sym = {
@@ -770,6 +768,7 @@ ccp_pmd_session_configure(struct rte_cryptodev *dev,
 {
 	int ret;
 	void *sess_private_data;
+	struct ccp_private *internals;
 
 	if (unlikely(sess == NULL || xform == NULL)) {
 		CCP_LOG_ERR("Invalid session struct or xform");
@@ -780,7 +779,8 @@ ccp_pmd_session_configure(struct rte_cryptodev *dev,
 		CCP_LOG_ERR("Couldn't get object from session mempool");
 		return -ENOMEM;
 	}
-	ret = ccp_set_session_parameters(sess_private_data, xform);
+	internals = (struct ccp_private *)dev->data->dev_private;
+	ret = ccp_set_session_parameters(sess_private_data, xform, internals);
 	if (ret != 0) {
 		CCP_LOG_ERR("failed configure session parameters");
 
drivers/crypto/ccp/ccp_pmd_private.h +3 -3
index 560bed9..71677ee 100644
@@ -42,6 +42,8 @@ struct ccp_private {
 	unsigned int max_nb_qpairs;	/**< Max number of queue pairs */
 	unsigned int max_nb_sessions;	/**< Max number of sessions */
 	uint8_t crypto_num_dev;		/**< Number of working crypto devices */
+	bool auth_opt;			/**< Authentication offload option */
+	int die_num;			/**< Combine CCP devices of this die */
 	struct ccp_device *last_dev;	/**< Last working crypto device */
 };
 
@@ -62,10 +64,8 @@ struct ccp_batch_info {
 	phys_addr_t lsb_buf_phys;
 	/**< LSB intermediate buf for passthru */
 	int lsb_buf_idx;
-#ifdef RTE_LIBRTE_PMD_CCP_CPU_AUTH
 	uint16_t auth_ctr;
-	/**< auth only ops batch */
-#endif
+	/**< auth only ops batch for CPU based auth */
 } __rte_cache_aligned;
 
 /**< CCP crypto queue pair */
drivers/crypto/ccp/rte_ccp_pmd.c +204 -22

285 lines not on this page · raw message

Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH 2/2] crypto/ccp: change to command line option from compile time

Quoted 18 lines

-----Original Message-----
From: Ravi Kumar [mailto:[email protected]]
Sent: Thursday, May 3, 2018 6:57 AM
To: [email protected]
Cc: De Lara Guarch, Pablo <[email protected]>; [email protected]; [email protected]
Subject: [PATCH 2/2] crypto/ccp: change to command line option from compile time

CCP PMD supports authentication offload to either of CCP or CPU. The earlier version of patch provided this option as compile time. This patch changes this option from compile time to run time. User can pass "ccp_auth_opt=1" as an additional argument to vdev parameter to enable authentication operations on CPU.

...

Quoted 10 lines

+++ b/drivers/crypto/ccp/ccp_pmd_ops.c

drivers/crypto/ccp/ccp_pmd_ops.c +0 -0
@@ -13,7 +13,6 @@
 #include "ccp_crypto.h"
 
 static const struct rte_cryptodev_capabilities ccp_pmd_capabilities[] = { -#ifdef

RTE_LIBRTE_PMD_CCP_CPU_AUTH

drivers/crypto/ccp/ccp_pmd_ops.c +0 -0
 	{	/* MD5 HMAC */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
 		{.sym = {

drivers/crypto/ccp/ccp_pmd_ops.c static const struct rte_cryptodev_capabilities · line 39

Quoted 5 lines
drivers/crypto/ccp/ccp_pmd_ops.c +0 -1
@@ -35,7 +34,6 @@ static const struct rte_cryptodev_capabilities
 ccp_pmd_capabilities[] = {
 			}, }
 		}, }
 	},
-#endif

MD5 won't be supported unless the auth_opt is enabled. I would suggest doing something similar to what QAT does. You can have an array with the base capabilities and another one for the extended ones (with MD5).
When "auth_opt" is enabled, you can have the combination of both. When it is not, then you can just have the base capabilities.

Quoted 3 lines
drivers/crypto/ccp/ccp_pmd_ops.c +0 -0
 	{	/* SHA1 */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,

{.sym = {

...

Quoted 18 lines
drivers/crypto/ccp/rte_ccp_pmd.c +8 -4
 	RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
-			init_params.socket_id);
+		init_params.def_p.socket_id);
 	RTE_LOG(INFO, PMD, "Max number of queue pairs = %d\n",
-			init_params.max_nb_queue_pairs);
+		init_params.def_p.max_nb_queue_pairs);
 	RTE_LOG(INFO, PMD, "Max number of sessions = %d\n",
-			init_params.max_nb_sessions);
+		init_params.def_p.max_nb_sessions);
+	RTE_LOG(INFO, PMD, "Authentication offload to %s\n",
+		((init_params.auth_opt == 0) ? "CCP" : "CPU"));
+	snprintf(die_num, 20, "die_num-%d", init_params.die_num);
+	RTE_LOG(INFO, PMD, "Combining %s CCP devices\n",
+		((init_params.die_num == -1) ? "all" : die_num));
 
 	rc = cryptodev_ccp_create(name, vdev, &init_params);
 	if (rc)
--
Quoted 1 line

2.7.4

You are adding new parameters, so you should extend the parameters registration at the bottom of this file:

RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_CCP_PMD,

        "max_nb_queue_pairs=<int> max_nb_sessions=<int> socket_id=<int>");
#3 lore raw
In reply to Ravi Kumar

Hi Ravi,

Quoted 24 lines

-----Original Message-----
From: Ravi Kumar [mailto:[email protected]]
Sent: Thursday, May 3, 2018 6:57 AM
To: [email protected]
Cc: De Lara Guarch, Pablo <[email protected]>; [email protected]; [email protected]
Subject: [PATCH 1/2] crypto/ccp: enable CCP crypto poll mode driver by default

---
 config/common_base | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
config/common_base index renamed from config/common_base +0 -0

03a8688..802035b 100644

config/common_base +0 -0
@@ -555,7 +555,7 @@ CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO=y
 #
 # Compile PMD for AMD CCP crypto device  # -

CONFIG_RTE_LIBRTE_PMD_CCP=n
+CONFIG_RTE_LIBRTE_PMD_CCP=y
CONFIG_RTE_LIBRTE_PMD_CCP_CPU_AUTH=n

Quoted 3 lines

#
--
2.7.4

I think this cannot be enabled by default, since it has an external dependency on OpenSSL.

Pablo

#4 lore raw
Quoted 27 lines

Hi Ravi,

Quoted 25 lines

-----Original Message-----
From: Ravi Kumar [mailto:[email protected]]
Sent: Thursday, May 3, 2018 6:57 AM
To: [email protected]
Cc: De Lara Guarch, Pablo <[email protected]>; [email protected]; [email protected]
Subject: [PATCH 1/2] crypto/ccp: enable CCP crypto poll mode driver by default

---
 config/common_base | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
config/common_base index renamed from config/common_base +0 -0

03a8688..802035b 100644

config/common_base +0 -0
@@ -555,7 +555,7 @@ CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO=y
 #
 # Compile PMD for AMD CCP crypto device  # - 

CONFIG_RTE_LIBRTE_PMD_CCP=n
+CONFIG_RTE_LIBRTE_PMD_CCP=y
CONFIG_RTE_LIBRTE_PMD_CCP_CPU_AUTH=n

Quoted 5 lines
Quoted 3 lines

#
--
2.7.4

I think this cannot be enabled by default, since it has an external dependency on OpenSSL.

Hi Pablo,

We were asked to enable the PMD by default in one of the previous emails. Unfortunately, we can't remove the dependency on OpenSSL. Kindly suggest the option in this case. We could leave this patch-set and have the code as-is, I mean the older compile-time option. If not, then this is our only option.

Regards,
Ravi

Quoted 3 lines

Pablo

#5 lore raw

09/05/2018 07:53, Kumar, Ravi1:

Quoted 6 lines
Quoted 2 lines

I think this cannot be enabled by default, since it has an external dependency on OpenSSL.

Hi Pablo,

We were asked to enable the PMD by default in one of the previous emails. Unfortunately, we can't remove the dependency on OpenSSL. Kindly suggest the option in this case. We could leave this patch-set and have the code as-is, I mean the older compile-time option. If not, then this is our only option.

If you have a dependency, you cannot enable by default.

#6 lore raw
Quoted 10 lines

09/05/2018 07:53, Kumar, Ravi1:

Quoted 6 lines
Quoted 2 lines

I think this cannot be enabled by default, since it has an external dependency on OpenSSL.

Hi Pablo,

We were asked to enable the PMD by default in one of the previous emails. Unfortunately, we can't remove the dependency on OpenSSL. Kindly suggest the option in this case. We could leave this patch-set and have the code as-is, I mean the older compile-time option. If not, then this is our only option.

If you have a dependency, you cannot enable by default.

Hi Thomas,

Ok. Could we still submit the 2nd patch for changing compile time to run time option and remove the first one?

Regards,
Ravi

#7 lore raw

09/05/2018 10:11, Kumar, Ravi1:

Quoted 6 lines
Quoted 6 lines

09/05/2018 07:53, Kumar, Ravi1:

Quoted 5 lines
Quoted 2 lines

I think this cannot be enabled by default, since it has an external dependency on OpenSSL.

Hi Pablo,

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

We were asked to enable the PMD by default in one of the previous emails. Unfortunately, we can't remove the dependency on OpenSSL. Kindly suggest the option in this case. We could leave this patch-set and have the code as-is, I mean the older compile-time option. If not, then this is our only option.

If you have a dependency, you cannot enable by default.

Hi Thomas,

Ok. Could we still submit the 2nd patch for changing compile time to run time option and remove the first one?

Yes, sure

#8 lore raw
In reply to Kumar, Ravi1

Hi Ravi,

Quoted 21 lines

-----Original Message-----
From: Kumar, Ravi1 [mailto:[email protected]]
Sent: Wednesday, May 9, 2018 9:11 AM
To: Thomas Monjalon <[email protected]>
Cc: De Lara Guarch, Pablo <[email protected]>; [email protected]; [email protected]
Subject: RE: [PATCH 1/2] crypto/ccp: enable CCP crypto poll mode driver by default

Quoted 3 lines

09/05/2018 07:53, Kumar, Ravi1:

Quoted 2 lines
Quoted 2 lines

I think this cannot be enabled by default, since it has an external

dependency on OpenSSL.

Quoted 4 lines
Quoted 4 lines

Hi Pablo,

We were asked to enable the PMD by default in one of the previous emails.

Unfortunately, we can't remove the dependency on OpenSSL. Kindly suggest the option in this case. We could leave this patch-set and have the code as-is, I mean the older compile-time option. If not, then this is our only option.

Quoted 1 line
Quoted 6 lines
Quoted 2 lines

If you have a dependency, you cannot enable by default.

Hi Thomas,

Ok. Could we still submit the 2nd patch for changing compile time to run time option and remove the first one?

I have two comments on the other patch. Could you submit a v2 of that patch and drop this first patch?

Thanks,
Pablo

Quoted 3 lines

Regards,
Ravi

#9 lore raw
Quoted 28 lines

Hi Ravi,

Quoted 26 lines

-----Original Message-----
From: Kumar, Ravi1 [mailto:[email protected]]
Sent: Wednesday, May 9, 2018 9:11 AM
To: Thomas Monjalon <[email protected]>
Cc: De Lara Guarch, Pablo <[email protected]>; [email protected]; [email protected]
Subject: RE: [PATCH 1/2] crypto/ccp: enable CCP crypto poll mode driver by default

Quoted 4 lines

09/05/2018 07:53, Kumar, Ravi1:

Quoted 3 lines
Quoted 3 lines

I think this cannot be enabled by default, since it has an external

dependency on OpenSSL.

Quoted 4 lines
Quoted 4 lines

Hi Pablo,

We were asked to enable the PMD by default in one of the previous emails.

Unfortunately, we can't remove the dependency on OpenSSL. Kindly
suggest the option in this case. We could leave this patch-set and
have the code as-is, I mean the older compile-time option. If not, then this is our only option.

Quoted 3 lines

If you have a dependency, you cannot enable by default.

Hi Thomas,

Quoted 7 lines
Quoted 2 lines

Ok. Could we still submit the 2nd patch for changing compile time to run time option and remove the first one?

I have two comments on the other patch. Could you submit a v2 of that patch and drop this first patch?

Thanks,
Pablo

Hi Pablo,

Sure. I will submit v2 with the changes.

Regards,
Ravi

Quoted 6 lines
Quoted 4 lines

Regards,
Ravi

author
#10 lore raw

PATCH v2 1/1 crypto/ccp: support command line option to enable CPU based auth

In reply to Ravi Kumar

CCP PMD supports authentication offload to either of CCP or CPU. The earlier version of patch provides this option as compile time. This patch changes this option from compile time to run time. User can pass "ccp_auth_opt=1" as an additional arguments to vdev parameter to enable authentication operations on CPU.

---
 config/common_base                   |    1 -
 doc/guides/cryptodevs/ccp.rst        |   13 +-
 drivers/crypto/ccp/ccp_crypto.c      |  413 +++++++------
 drivers/crypto/ccp/ccp_crypto.h      |   10 +-
 drivers/crypto/ccp/ccp_pmd_ops.c     | 1081 +++++++++++++++++-----------------
 drivers/crypto/ccp/ccp_pmd_private.h |    6 +-
 drivers/crypto/ccp/rte_ccp_pmd.c     |  231 +++++++-
 7 files changed, 969 insertions(+), 786 deletions(-)
config/common_base +0 -1
index 0d181ac..66f157f 100644
@@ -556,7 +556,6 @@ CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO=y
 # Compile PMD for AMD CCP crypto device
 #
 CONFIG_RTE_LIBRTE_PMD_CCP=n
-CONFIG_RTE_LIBRTE_PMD_CCP_CPU_AUTH=n
 
 #
 # Compile PMD for Marvell Crypto device
doc/guides/cryptodevs/ccp.rst +5 -8
index 1fcd462..cdb9374 100644
@@ -56,14 +56,11 @@ AEAD algorithms:
 Installation
 ------------
 
-To compile CCP PMD, it has to be enabled in the config/common_base file.
+To compile CCP PMD, ensure that following is enabled in your DPDK configuration file.
 * ``CONFIG_RTE_LIBRTE_PMD_CCP=y``
 
-The CCP PMD also supports computing authentication over CPU with cipher offloaded
-to CCP. To enable this feature, enable following in the configuration.
-* ``CONFIG_RTE_LIBRTE_PMD_CCP_CPU_AUTH=y``
-
-This code was verified on Ubuntu 16.04.
+The CCP PMD also supports computing authentication over CPU with cipher offloaded to CCP.
+To enable this feature, pass an additional argument as ccp_auth_opt=1 to --vdev parameters.
 
 Initialization
 --------------
@@ -98,5 +95,5 @@ To verify real traffic l2fwd-crypto example can be used with following command:
 Limitations
 -----------
 
-* Chained mbufs are not supported
-* MD5_HMAC is supported only if ``CONFIG_RTE_LIBRTE_PMD_CCP_CPU_AUTH=y`` is enabled in configuration
+* Chained mbufs are not supported.
+* MD5_HMAC is supported only for CPU based authentication.
drivers/crypto/ccp/ccp_crypto.c +201 -212

599 lines not on this page · raw message

drivers/crypto/ccp/ccp_crypto.h +5 -5
index dd89ad9..882b398 100644
@@ -42,10 +42,9 @@
 #define HMAC_IPAD_VALUE 0x36
 #define HMAC_OPAD_VALUE 0x5c
 
-#ifdef RTE_LIBRTE_PMD_CCP_CPU_AUTH
+/* MD5 */
 #define MD5_DIGEST_SIZE         16
 #define MD5_BLOCK_SIZE          64
-#endif
 
 /* SHA */
 #define SHA_COMMON_DIGEST_SIZE	32
@@ -235,9 +234,7 @@ enum ccp_hash_algo {
 	CCP_AUTH_ALGO_SHA3_512_HMAC,
 	CCP_AUTH_ALGO_AES_CMAC,
 	CCP_AUTH_ALGO_AES_GCM,
-#ifdef RTE_LIBRTE_PMD_CCP_CPU_AUTH
 	CCP_AUTH_ALGO_MD5_HMAC,
-#endif
 };
 
 /**
@@ -250,6 +247,7 @@ enum ccp_hash_op {
 
 /* CCP crypto private session structure */
 struct ccp_session {
+	bool auth_opt;
 	enum ccp_cmd_order cmd_id;
 	/**< chain order mode */
 	struct {
@@ -321,6 +319,7 @@ struct ccp_session {
 extern uint8_t ccp_cryptodev_driver_id;
 
 struct ccp_qp;
+struct ccp_private;
 
 /**
  * Set and validate CCP crypto session parameters
@@ -330,7 +329,8 @@ struct ccp_qp;
  * @return 0 on success otherwise -1
  */
 int ccp_set_session_parameters(struct ccp_session *sess,
-			       const struct rte_crypto_sym_xform *xform);
+			       const struct rte_crypto_sym_xform *xform,
+			       struct ccp_private *internals);
 
 /**
  * Find count of slots
drivers/crypto/ccp/ccp_pmd_ops.c +547 -534

1,105 lines not on this page · raw message

drivers/crypto/ccp/ccp_pmd_private.h +3 -3
index 560bed9..71677ee 100644
@@ -42,6 +42,8 @@ struct ccp_private {
 	unsigned int max_nb_qpairs;	/**< Max number of queue pairs */
 	unsigned int max_nb_sessions;	/**< Max number of sessions */
 	uint8_t crypto_num_dev;		/**< Number of working crypto devices */
+	bool auth_opt;			/**< Authentication offload option */
+	int die_num;			/**< Combine CCP devices of this die */
 	struct ccp_device *last_dev;	/**< Last working crypto device */
 };
 
@@ -62,10 +64,8 @@ struct ccp_batch_info {
 	phys_addr_t lsb_buf_phys;
 	/**< LSB intermediate buf for passthru */
 	int lsb_buf_idx;
-#ifdef RTE_LIBRTE_PMD_CCP_CPU_AUTH
 	uint16_t auth_ctr;
-	/**< auth only ops batch */
-#endif
+	/**< auth only ops batch for CPU based auth */
 } __rte_cache_aligned;
 
 /**< CCP crypto queue pair */
drivers/crypto/ccp/rte_ccp_pmd.c +208 -23

295 lines not on this page · raw message

Signature · 1 line
2.7.4
#11 lore raw

Re: [PATCH v2] crypto/ccp: support command line option to enable CPU based auth

Hi Ravi,

Quoted 16 lines

-----Original Message-----
From: Ravi Kumar [mailto:[email protected]]
Sent: Wednesday, May 9, 2018 1:46 PM
To: [email protected]
Cc: De Lara Guarch, Pablo <[email protected]>; [email protected]; [email protected]
Subject: [PATCH v2] crypto/ccp: support command line option to enable CPU based auth

CCP PMD supports authentication offload to either of CCP or CPU. The earlier version of patch provides this option as compile time. This patch changes this option from compile time to run time. User can pass "ccp_auth_opt=1" as an additional arguments to vdev parameter to enable authentication operations on CPU.

...

drivers/crypto/ccp/rte_ccp_pmd.c static struct cryptodev_driver ccp_crypto_drv; · line 445

Quoted 8 lines

RTE_PMD_REGISTER_VDEV(CRYPTODEV_NAME_CCP_PMD,
cryptodev_ccp_pmd_drv);
RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_CCP_PMD,

drivers/crypto/ccp/rte_ccp_pmd.c +4 -1
-	"max_nb_queue_pairs=<int> max_nb_sessions=<int> socket_id=<int>");
+	"max_nb_queue_pairs=<int> "
+	"max_nb_sessions=<int> "
+	"socket_id=<int> "
+	"ccp_auth_opt=<int>");

Die_num is not in this list. I was going to add it myself, but then I realized that it is not actually used anywhere. Am I missing something?

Also, I think it is worth updating the documentation of the PMD with these parameters.

Thanks,
Pablo

#12 lore raw

Re: [PATCH v2] crypto/ccp: support command line option to enable CPU based auth

Quoted 34 lines

Hi Ravi,

Quoted 16 lines

-----Original Message-----
From: Ravi Kumar [mailto:[email protected]]
Sent: Wednesday, May 9, 2018 1:46 PM
To: [email protected]
Cc: De Lara Guarch, Pablo <[email protected]>; [email protected]; [email protected]
Subject: [PATCH v2] crypto/ccp: support command line option to enable CPU based auth

CCP PMD supports authentication offload to either of CCP or CPU. The earlier version of patch provides this option as compile time. This patch changes this option from compile time to run time. User can pass "ccp_auth_opt=1" as an additional arguments to vdev parameter to enable authentication operations on CPU.

...

drivers/crypto/ccp/rte_ccp_pmd.c static struct cryptodev_driver ccp_crypto_drv; · line 445

Quoted 8 lines

RTE_PMD_REGISTER_VDEV(CRYPTODEV_NAME_CCP_PMD,
cryptodev_ccp_pmd_drv);
RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_CCP_PMD,

drivers/crypto/ccp/rte_ccp_pmd.c +4 -1
-	"max_nb_queue_pairs=<int> max_nb_sessions=<int> socket_id=<int>");
+	"max_nb_queue_pairs=<int> "
+	"max_nb_sessions=<int> "
+	"socket_id=<int> "
+	"ccp_auth_opt=<int>");

Die_num is not in this list. I was going to add it myself, but then I realized that it is not actually used anywhere. Am I missing something?

Quoted 5 lines

Also, I think it is worth updating the documentation of the PMD with these parameters.

Thanks,
Pablo

Hi Pablo,

Die-num parameter is going to be used in future. Will remove for now and send an updated patch.

Thanks,
Ravi

#13 lore raw

Re: [PATCH v2] crypto/ccp: support command line option to enable CPU based auth

Quoted 48 lines

-----Original Message-----
From: Kumar, Ravi1 [mailto:[email protected]]
Sent: Thursday, May 10, 2018 9:43 AM
To: De Lara Guarch, Pablo <[email protected]>; [email protected]
Cc: [email protected]; [email protected]
Subject: RE: [PATCH v2] crypto/ccp: support command line option to enable CPU based auth

Quoted 21 lines

Hi Ravi,

Quoted 16 lines

-----Original Message-----
From: Ravi Kumar [mailto:[email protected]]
Sent: Wednesday, May 9, 2018 1:46 PM
To: [email protected]
Cc: De Lara Guarch, Pablo <[email protected]>; [email protected]; [email protected]
Subject: [PATCH v2] crypto/ccp: support command line option to enable CPU based auth

CCP PMD supports authentication offload to either of CCP or CPU. The earlier version of patch provides this option as compile time. This patch changes this option from compile time to run time. User can pass "ccp_auth_opt=1" as an additional arguments to vdev parameter to enable authentication operations on CPU.

...

Quoted 11 lines

drivers/crypto/ccp/rte_ccp_pmd.c static struct cryptodev_driver ccp_crypto_drv; · line 445

Quoted 8 lines

RTE_PMD_REGISTER_VDEV(CRYPTODEV_NAME_CCP_PMD,
cryptodev_ccp_pmd_drv);
RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_CCP_PMD,

drivers/crypto/ccp/rte_ccp_pmd.c +4 -1
-	"max_nb_queue_pairs=<int> max_nb_sessions=<int> socket_id=<int>");
+	"max_nb_queue_pairs=<int> "
+	"max_nb_sessions=<int> "
+	"socket_id=<int> "
+	"ccp_auth_opt=<int>");

Die_num is not in this list. I was going to add it myself, but then I realized that it

is not actually used anywhere.

Quoted 3 lines

Am I missing something?

Also, I think it is worth updating the documentation of the PMD with these

parameters.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

Thanks,
Pablo

Hi Pablo,

Die-num parameter is going to be used in future. Will remove for now and send an updated patch.

Thanks Ravi!

Pablo

Quoted 3 lines

Thanks,
Ravi

author
#14 lore raw

PATCH v3 1/1 crypto/ccp: support command line option to enable CPU based auth

In reply to Ravi Kumar

CCP PMD supports authentication offload to either of CCP or CPU. The earlier version of patch provides this option as compile time. This patch changes this option from compile time to run time. User can pass "ccp_auth_opt=1" as an additional arguments to vdev parameter to enable authentication operations on CPU.

---
 config/common_base                   |    1 -
 doc/guides/cryptodevs/ccp.rst        |   54 +-
 drivers/crypto/ccp/ccp_crypto.c      |  413 +++++++------
 drivers/crypto/ccp/ccp_crypto.h      |   10 +-
 drivers/crypto/ccp/ccp_pmd_ops.c     | 1081 +++++++++++++++++-----------------
 drivers/crypto/ccp/ccp_pmd_private.h |    5 +-
 drivers/crypto/ccp/rte_ccp_pmd.c     |  195 +++++-
 7 files changed, 973 insertions(+), 786 deletions(-)
config/common_base +0 -1
index 0d181ac..66f157f 100644
@@ -556,7 +556,6 @@ CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO=y
 # Compile PMD for AMD CCP crypto device
 #
 CONFIG_RTE_LIBRTE_PMD_CCP=n
-CONFIG_RTE_LIBRTE_PMD_CCP_CPU_AUTH=n
 
 #
 # Compile PMD for Marvell Crypto device
doc/guides/cryptodevs/ccp.rst +46 -8

78 lines not on this page · raw message

drivers/crypto/ccp/ccp_crypto.c +201 -212

599 lines not on this page · raw message

drivers/crypto/ccp/ccp_crypto.h +5 -5
index dd89ad9..882b398 100644
@@ -42,10 +42,9 @@
 #define HMAC_IPAD_VALUE 0x36
 #define HMAC_OPAD_VALUE 0x5c
 
-#ifdef RTE_LIBRTE_PMD_CCP_CPU_AUTH
+/* MD5 */
 #define MD5_DIGEST_SIZE         16
 #define MD5_BLOCK_SIZE          64
-#endif
 
 /* SHA */
 #define SHA_COMMON_DIGEST_SIZE	32
@@ -235,9 +234,7 @@ enum ccp_hash_algo {
 	CCP_AUTH_ALGO_SHA3_512_HMAC,
 	CCP_AUTH_ALGO_AES_CMAC,
 	CCP_AUTH_ALGO_AES_GCM,
-#ifdef RTE_LIBRTE_PMD_CCP_CPU_AUTH
 	CCP_AUTH_ALGO_MD5_HMAC,
-#endif
 };
 
 /**
@@ -250,6 +247,7 @@ enum ccp_hash_op {
 
 /* CCP crypto private session structure */
 struct ccp_session {
+	bool auth_opt;
 	enum ccp_cmd_order cmd_id;
 	/**< chain order mode */
 	struct {
@@ -321,6 +319,7 @@ struct ccp_session {
 extern uint8_t ccp_cryptodev_driver_id;
 
 struct ccp_qp;
+struct ccp_private;
 
 /**
  * Set and validate CCP crypto session parameters
@@ -330,7 +329,8 @@ struct ccp_qp;
  * @return 0 on success otherwise -1
  */
 int ccp_set_session_parameters(struct ccp_session *sess,
-			       const struct rte_crypto_sym_xform *xform);
+			       const struct rte_crypto_sym_xform *xform,
+			       struct ccp_private *internals);
 
 /**
  * Find count of slots
drivers/crypto/ccp/ccp_pmd_ops.c +547 -534

1,105 lines not on this page · raw message

drivers/crypto/ccp/ccp_pmd_private.h +2 -3
index 560bed9..f449804 100644
@@ -42,6 +42,7 @@ struct ccp_private {
 	unsigned int max_nb_qpairs;	/**< Max number of queue pairs */
 	unsigned int max_nb_sessions;	/**< Max number of sessions */
 	uint8_t crypto_num_dev;		/**< Number of working crypto devices */
+	bool auth_opt;			/**< Authentication offload option */
 	struct ccp_device *last_dev;	/**< Last working crypto device */
 };
 
@@ -62,10 +63,8 @@ struct ccp_batch_info {
 	phys_addr_t lsb_buf_phys;
 	/**< LSB intermediate buf for passthru */
 	int lsb_buf_idx;
-#ifdef RTE_LIBRTE_PMD_CCP_CPU_AUTH
 	uint16_t auth_ctr;
-	/**< auth only ops batch */
-#endif
+	/**< auth only ops batch for CPU based auth */
 } __rte_cache_aligned;
 
 /**< CCP crypto queue pair */
drivers/crypto/ccp/rte_ccp_pmd.c +172 -23

259 lines not on this page · raw message

Signature · 1 line
2.7.4
#15 lore raw

Re: [PATCH v3] crypto/ccp: support command line option to enable CPU based auth

Quoted 11 lines

-----Original Message-----
From: Ravi Kumar [mailto:[email protected]]
Sent: Thursday, May 10, 2018 10:20 AM
To: [email protected]
Cc: De Lara Guarch, Pablo <[email protected]>; [email protected]; [email protected]
Subject: [PATCH v3] crypto/ccp: support command line option to enable CPU based auth

Quoted 7 lines

CCP PMD supports authentication offload to either of CCP or CPU. The earlier version of patch provides this option as compile time. This patch changes this option from compile time to run time. User can pass "ccp_auth_opt=1" as an additional arguments to vdev parameter to enable authentication operations on CPU.

Applied to dpdk-next-crypto.
Thanks,

Pablo

#16 lore raw

Re: [PATCH v3] crypto/ccp: support command line option to enable CPU based auth

Quoted 16 lines
Quoted 16 lines

-----Original Message-----
From: Ravi Kumar [mailto:[email protected]]
Sent: Thursday, May 10, 2018 10:20 AM
To: [email protected]
Cc: De Lara Guarch, Pablo <[email protected]>; [email protected]; [email protected]
Subject: [PATCH v3] crypto/ccp: support command line option to enable CPU based auth

CCP PMD supports authentication offload to either of CCP or CPU. The earlier version of patch provides this option as compile time. This patch changes this option from compile time to run time. User can pass "ccp_auth_opt=1" as an additional arguments to vdev parameter to enable authentication operations on CPU.

Quoted 7 lines
Quoted 1 line

Applied to dpdk-next-crypto.
Thanks,

Pablo

Thanks a lot Pablo.

Regards,
Ravi