Skip to contentSkip to conversation

Parallel crypto/IPsec v5

PATCH In review Steffen Klassert 3 participants 7 messages Aug 31, 2009 – Oct 7, 2009

Subsystems (3)
lore
Share & tools
lore

Steffen Klassert

author maintainer
#0 lore raw

cover Parallel crypto/IPsec v5

This patchset adds the 'pcrypt' parallel crypto template. With this template it is possible to process the crypto requests of a transform in parallel without getting request reorder. This is in particular interesting for IPsec.

The parallel crypto template is based on a generic parallelization/serialization method. This method uses the remote softirq invocation infrastructure for parallelization and serialization. With this method data objects can be processed in parallel, starting at some given point.
After doing some expensive operations in parallel, it is possible to serialize again. The parallelized data objects return after serialization in the order as they were before the parallelization. In the case of IPsec, this makes it possible to run the expensive parts in parallel without getting packet reordering.

Changes from v4:

- Use the dynamic percpu allocator

- Drop of the obsolete eseqiv changes (eseqiv is the default IV generator for blockcipher algorithms on smp machines now).

Changes from v3:

- The generic aead wrapper is dropped.

- tcrypt is extended to test algorithms by name. So it is possible to instantiate pcrypt by doing e.g.:
modprobe tcrypt alg="pcrypt(authenc(hmac(sha1),cbc(aes)))" type=3

Changes from v2:

- The xfrm netlink configuration code is dropped,
this will be an extra patchset.

- Add generic aead wrapper interface to be able to wrap an aead algorithm with an arbitrary crypto template.

- Convert pcrypt to use the generic aead wrapper.

- Add support for aead algorithms to eseqiv.

- Add support for the pcrypt aead wrapper to authenc. It's now possible to choose for pcrypt as the default authenc wrapper with a module parameter.

- Patchset applies to linux-2.6 git current.

Changes from v1:

- cpu_chainiv is dropped, pcrypt uses eseqiv as it's IV generator now.

- Add a xfrm netlink message to be able to choose for pcrypt from userspace.

- Use pcrypt just if it is selected from userspace.

Steffen

author maintainer
#1 lore raw

PATCH 1/2 padata: generic interface for parallel processing

This patch introduces an interface to process data objects in parallel. On request it is possible to serialize again. The parallelized objects return after serialization in the same order as they were before the parallelization.

---
 include/linux/interrupt.h |    3 +-
 include/linux/padata.h    |  121 +++++++++++
 kernel/Makefile           |    2 +-
 kernel/padata.c           |  519 +++++++++++++++++++++++++++++++++++++++++++++
 kernel/softirq.c          |    2 +-
 5 files changed, 644 insertions(+), 3 deletions(-)
 create mode 100644 include/linux/padata.h
 create mode 100644 kernel/padata.c
include/linux/interrupt.h +2 -1
index 35e7df1..b648cca 100644
@@ -347,7 +347,8 @@ enum
 	TASKLET_SOFTIRQ,
 	SCHED_SOFTIRQ,
 	HRTIMER_SOFTIRQ,
-	RCU_SOFTIRQ,	/* Preferable RCU should always be the last softirq */
+	PADATA_SOFTIRQ,
+	RCU_SOFTIRQ, 	/* Preferable RCU should always be the last softirq */
 
 	NR_SOFTIRQS
 };
include/linux/padata.h new file +121 -0

121 lines not on this page · raw message

kernel/Makefile +1 -1
index 2093a69..6ff7f1a 100644
@@ -41,7 +41,7 @@ obj-$(CONFIG_RT_MUTEXES) += rtmutex.o
 obj-$(CONFIG_DEBUG_RT_MUTEXES) += rtmutex-debug.o
 obj-$(CONFIG_RT_MUTEX_TESTER) += rtmutex-tester.o
 obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
-obj-$(CONFIG_USE_GENERIC_SMP_HELPERS) += smp.o
+obj-$(CONFIG_USE_GENERIC_SMP_HELPERS) += smp.o padata.o
 ifneq ($(CONFIG_SMP),y)
 obj-y += up.o
 endif
kernel/padata.c new file +519 -0

519 lines not on this page · raw message

kernel/softirq.c +1 -1
index eb5e131..769ffc4 100644
@@ -58,7 +58,7 @@ static DEFINE_PER_CPU(struct task_struct *, ksoftirqd);
 
 char *softirq_to_name[NR_SOFTIRQS] = {
 	"HI", "TIMER", "NET_TX", "NET_RX", "BLOCK",
-	"TASKLET", "SCHED", "HRTIMER",	"RCU"
+	"TASKLET", "SCHED", "HRTIMER", "PADATA", "RCU"
 };
 
 /*
Signature · 1 line
1.5.4.2
maintainer Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] padata: generic interface for parallel processing

Quoted 6 lines · Steffen Klassert

This patch introduces an interface to process data objects in parallel. On request it is possible to serialize again. The parallelized objects return after serialization in the same order as they were before the parallelization.

Looks good to me. Dave, do you want to pick this one up?

Thanks,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
author maintainer
#3 lore raw

Re: [PATCH 1/2] padata: generic interface for parallel processing

Quoted 6 lines · Herbert Xu
Quoted 5 lines · Steffen Klassert

This patch introduces an interface to process data objects in parallel. On request it is possible to serialize again. The parallelized objects return after serialization in the same order as they were before the parallelization.

Quoted 6 lines
Quoted 1 line

Looks good to me. Dave, do you want to pick this one up?

I plan to send a rebased patchset tomorrow,
so who wants to take this one?

maintainer
#4 lore raw

Re: [PATCH 1/2] padata: generic interface for parallel processing

From: Steffen Klassert <[email protected]>
Date: Wed, 7 Oct 2009 16:22:41 +0200

Quoted 9 lines · Herbert Xu
Quoted 8 lines · Steffen Klassert
Quoted 6 lines

This patch introduces an interface to process data objects in parallel. On request it is possible to serialize again. The parallelized objects return after serialization in the same order as they were before the parallelization.

Quoted 7 lines
Quoted 4 lines

Looks good to me. Dave, do you want to pick this one up?

I plan to send a rebased patchset tomorrow,
so who wants to take this one?

I'll take the padata change, as I agreed with Herbert to do. But the rest goes to Herbert.

author maintainer
#5 lore raw

PATCH 2/2 crypto: pcrypt - Add pcrypt crypto parallelization wrapper

In reply to Steffen Klassert

This patch adds a parallel crypto template that takes a crypto algorithm and converts it to process the crypto transforms in parallel. For the moment only aead is supported.

---
 crypto/Kconfig            |   13 ++
 crypto/Makefile           |    2 +
 crypto/pcrypt.c           |  409 +++++++++++++++++++++++++++++++++++++++++++++
 crypto/pcrypt_core.c      |  106 ++++++++++++
 include/crypto/pcrypt.h   |   51 ++++++
 include/linux/interrupt.h |    2 +
 6 files changed, 583 insertions(+), 0 deletions(-)
 create mode 100644 crypto/pcrypt.c
 create mode 100644 crypto/pcrypt_core.c
 create mode 100644 include/crypto/pcrypt.h
crypto/Kconfig +13 -0
index 7623442..dbb1ec0 100644
@@ -114,6 +114,19 @@ config CRYPTO_NULL
 	help
 	  These are 'Null' algorithms, used by IPsec, which do nothing.
 
+config CRYPTO_PCRYPT_CORE
+	bool
+
+config CRYPTO_PCRYPT
+	tristate "Parallel crypto engine (EXPERIMENTAL)"
+	depends on USE_GENERIC_SMP_HELPERS && EXPERIMENTAL
+	select CRYPTO_MANAGER
+	select CRYPTO_PCRYPT_CORE
+	select CRYPTO_AEAD
+	help
+	  This converts an arbitrary crypto algorithm into a parallel
+	  algorithm that is executed in a softirq.
+
 config CRYPTO_WORKQUEUE
        tristate
 
crypto/Makefile +2 -0
index c2ca721..48345da 100644
@@ -55,6 +55,8 @@ obj-$(CONFIG_CRYPTO_XTS) += xts.o
 obj-$(CONFIG_CRYPTO_CTR) += ctr.o
 obj-$(CONFIG_CRYPTO_GCM) += gcm.o
 obj-$(CONFIG_CRYPTO_CCM) += ccm.o
+obj-$(CONFIG_CRYPTO_PCRYPT_CORE) += pcrypt_core.o
+obj-$(CONFIG_CRYPTO_PCRYPT) += pcrypt.o
 obj-$(CONFIG_CRYPTO_CRYPTD) += cryptd.o
 obj-$(CONFIG_CRYPTO_DES) += des_generic.o
 obj-$(CONFIG_CRYPTO_FCRYPT) += fcrypt.o
crypto/pcrypt.c new file +409 -0

409 lines not on this page · raw message

crypto/pcrypt_core.c new file +106 -0

106 lines not on this page · raw message

include/crypto/pcrypt.h new file +51 -0

51 lines not on this page · raw message

include/linux/interrupt.h +2 -0
index b648cca..41ef14b 100644
@@ -347,6 +347,8 @@ enum
 	TASKLET_SOFTIRQ,
 	SCHED_SOFTIRQ,
 	HRTIMER_SOFTIRQ,
+	AEAD_ENC_SOFTIRQ,
+	AEAD_DEC_SOFTIRQ,
 	PADATA_SOFTIRQ,
 	RCU_SOFTIRQ, 	/* Preferable RCU should always be the last softirq */
 
Signature · 1 line
1.5.4.2
maintainer
#6 lore raw

Re: [PATCH 2/2] crypto: pcrypt - Add pcrypt crypto parallelization wrapper

Quoted 5 lines · Steffen Klassert

This patch adds a parallel crypto template that takes a crypto algorithm and converts it to process the crypto transforms in parallel. For the moment only aead is supported.

I'll pick this up once we get the first patch through.

Thanks,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt