crypto: crypto4xx - increase context and scatter ring buffer elements
authorChristian Lamparter <chunkeey@gmail.com>
Tue, 3 Oct 2017 23:00:08 +0000 (01:00 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Dec 2017 13:22:14 +0000 (14:22 +0100)
[ Upstream commit 778f81d6cdb7d25360f082ac0384d5103f04eca5 ]

If crypto4xx is used in conjunction with dm-crypt, the available
ring buffer elements are not enough to handle the load properly.

On an aes-cbc-essiv:sha256 encrypted swap partition the read
performance is abyssal: (tested with hdparm -t)

/dev/mapper/swap_crypt:
 Timing buffered disk reads:  14 MB in  3.68 seconds =   3.81 MB/sec

The patch increases both PPC4XX_NUM_SD and PPC4XX_NUM_PD to 256.
This improves the performance considerably:

/dev/mapper/swap_crypt:
 Timing buffered disk reads: 104 MB in  3.03 seconds =  34.31 MB/sec

Furthermore, PPC4XX_LAST_SD, PPC4XX_LAST_GD and PPC4XX_LAST_PD
can be easily calculated from their respective PPC4XX_NUM_*
constant.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/crypto/amcc/crypto4xx_core.h

index bac0bdeb4b5f9955c193e6896a7f5bb182c19e63..b6529b9fcbe25733018b4707982e457b3fa0885c 100644 (file)
 #define PPC405EX_CE_RESET                       0x00000008
 
 #define CRYPTO4XX_CRYPTO_PRIORITY              300
-#define PPC4XX_LAST_PD                         63
-#define PPC4XX_NUM_PD                          64
-#define PPC4XX_LAST_GD                         1023
+#define PPC4XX_NUM_PD                          256
+#define PPC4XX_LAST_PD                         (PPC4XX_NUM_PD - 1)
 #define PPC4XX_NUM_GD                          1024
-#define PPC4XX_LAST_SD                         63
-#define PPC4XX_NUM_SD                          64
+#define PPC4XX_LAST_GD                         (PPC4XX_NUM_GD - 1)
+#define PPC4XX_NUM_SD                          256
+#define PPC4XX_LAST_SD                         (PPC4XX_NUM_SD - 1)
 #define PPC4XX_SD_BUFFER_SIZE                  2048
 
 #define PD_ENTRY_INUSE                         1