linux-stable/include
Jakub Kicinski 71af6a2ddf mlx5-updates-2023-01-30
Add fast update encryption key
 
 Jianbo Liu Says:
 ================
 
 Data encryption keys (DEKs) are the keys used for data encryption and
 decryption operations. Starting from version 22.33.0783, firmware is
 optimized to accelerate the update of user keys into DEK object in
 hardware. The support for bulk allocation and destruction of DEK
 objects is added, and the bulk allocated DEKs are uninitialized, as
 the bulk creation requires no input key. When offload
 encryption/decryption, user gets one object from a bulk, and updates
 key by a new "modify DEK" command. This command is the same as create
 DEK object, but requires no heavy context memory allocation in
 firmware, which consumes most cpu cycles of the create DEK command.
 
 DEKs are cached internally by the NIC, so invalidating internal NIC
 caches is required before reusing DEKs. The SYNC_CRYPTO command is
 added to support it. DEK object can be reused, the keys in it can be
 updated after this command is executed.
 
 This patchset enhances the key creation and destruction flow, to get
 use of this new feature. Any user, for example, ktls, ipsec and
 macsec, can use it to offload keys. But, only ktls uses it, as others
 don't need many keys, and caching two many DEKs in pool is wasteful.
 
 There are two new data struts added:
     a. DEK pool. One pool is created for each key type. The bulks by
 the type, are placed in the pool's different bulk lists, according to
 the number of available and in_used DEKs in the bulk.
     b. DEK bulk. All DEKs in one bulk allocation are store here. There
 are two bitmaps to indicate the state of each DEK.
 
 New APIs are then added. When user need a DEK object,
     a. Fetch one bulk with avail DEKs, from the partial_list or
 avail_list, otherwise create new one.
     b. Pick one DEK, and set its need_sync and in_used bits to 1.
 Move the bulk to full_list if no more available keys, or put it to
 partial_list if the bulk is newly created.
     c. Update DEK object's key with user key, by the "modify DEK"
 command.
     d. Return DEK struct to user, then it gets the object id and fills
 it into the offload commands.
 When user free a DEK,
     a. Set in_use bit to 0. If all need_sync bits are 1 and all in_use
 bits of this bulk are 0, move it to sync_list.
     b. If the number of DEKs, which are freed by users, is over the
 threshold (128), schedule a workqueue to do the sync process.
 
 For the sync process, the SYNC_CRYPTO command is executed first. Then,
 for each bulks in partial_list, full_list and sync_list, reset
 need_sync bits of the freed DEK objects. If all need_sync bits in one
 bulk are zero, move it to avail_list.
 
 We already supported TIS pool to recycle the TISes. With this series
 and TIS pool, TLS CPS performance is improved greatly.
 And we tested https on the system:
     CPU: dual AMD EPYC 7763 64-Core processors
     RAM: 512G
     DEV: ConnectX-6 DX, with FW ver 22.33.0838 and TLS_OPTIMISE=true
 TLS CPS performance numbers are:
     Before: 11k connections/sec
     After: 101 connections/sec
 
 ================
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEEGhZs6bAKwk/OTgTpSD+KveBX+j4FAmPYho4ACgkQSD+KveBX
 +j4tmQf/UnDnj55lf7zxvDYCgIThSFeqIPCnwnbRRTPB85jsjsBMx+52ugYGJ5kZ
 Mci93QfkDoIEAAamBwj76X3skobmsdKZsOmFyLKpfWBz6K98EZVC7nAPPRO9o80Z
 YGQQAbUn8I/USC0cB2BICCnjkbcpeMUgYYqnLteBsKBiH3IkMoEtkeaWN0M3SHK/
 xKLZwlpX+2gIotr6h2ftd8B8ygL1CSyMTqIp0vrSQY69ucTpgtsbDufODbU58p7n
 JUOVtNM5irwi2QdfSJjPAc1vMkkVJYCGbE1mxMjbKyDOMEnK5vIiMgb7RWRSMbdC
 FzSY0/vQxFoOB21+CeiGN/rPvMnRCA==
 =/Cb4
 -----END PGP SIGNATURE-----

Merge tag 'mlx5-updates-2023-01-30' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux

Saeed Mahameed says:

====================
mlx5-updates-2023-01-30

Add fast update encryption key

Jianbo Liu Says:
================

Data encryption keys (DEKs) are the keys used for data encryption and
decryption operations. Starting from version 22.33.0783, firmware is
optimized to accelerate the update of user keys into DEK object in
hardware. The support for bulk allocation and destruction of DEK
objects is added, and the bulk allocated DEKs are uninitialized, as
the bulk creation requires no input key. When offload
encryption/decryption, user gets one object from a bulk, and updates
key by a new "modify DEK" command. This command is the same as create
DEK object, but requires no heavy context memory allocation in
firmware, which consumes most cpu cycles of the create DEK command.

DEKs are cached internally by the NIC, so invalidating internal NIC
caches is required before reusing DEKs. The SYNC_CRYPTO command is
added to support it. DEK object can be reused, the keys in it can be
updated after this command is executed.

This patchset enhances the key creation and destruction flow, to get
use of this new feature. Any user, for example, ktls, ipsec and
macsec, can use it to offload keys. But, only ktls uses it, as others
don't need many keys, and caching two many DEKs in pool is wasteful.

There are two new data struts added:
    a. DEK pool. One pool is created for each key type. The bulks by
the type, are placed in the pool's different bulk lists, according to
the number of available and in_used DEKs in the bulk.
    b. DEK bulk. All DEKs in one bulk allocation are store here. There
are two bitmaps to indicate the state of each DEK.

New APIs are then added. When user need a DEK object,
    a. Fetch one bulk with avail DEKs, from the partial_list or
avail_list, otherwise create new one.
    b. Pick one DEK, and set its need_sync and in_used bits to 1.
Move the bulk to full_list if no more available keys, or put it to
partial_list if the bulk is newly created.
    c. Update DEK object's key with user key, by the "modify DEK"
command.
    d. Return DEK struct to user, then it gets the object id and fills
it into the offload commands.
When user free a DEK,
    a. Set in_use bit to 0. If all need_sync bits are 1 and all in_use
bits of this bulk are 0, move it to sync_list.
    b. If the number of DEKs, which are freed by users, is over the
threshold (128), schedule a workqueue to do the sync process.

For the sync process, the SYNC_CRYPTO command is executed first. Then,
for each bulks in partial_list, full_list and sync_list, reset
need_sync bits of the freed DEK objects. If all need_sync bits in one
bulk are zero, move it to avail_list.

We already supported TIS pool to recycle the TISes. With this series
and TIS pool, TLS CPS performance is improved greatly.
And we tested https on the system:
    CPU: dual AMD EPYC 7763 64-Core processors
    RAM: 512G
    DEV: ConnectX-6 DX, with FW ver 22.33.0838 and TLS_OPTIMISE=true
TLS CPS performance numbers are:
    Before: 11k connections/sec
    After: 101 connections/sec

================

* tag 'mlx5-updates-2023-01-30' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux:
  net/mlx5e: kTLS, Improve connection rate by using fast update encryption key
  net/mlx5: Keep only one bulk of full available DEKs
  net/mlx5: Add async garbage collector for DEK bulk
  net/mlx5: Reuse DEKs after executing SYNC_CRYPTO command
  net/mlx5: Use bulk allocation for fast update encryption key
  net/mlx5: Add bulk allocation and modify_dek operation
  net/mlx5: Add support SYNC_CRYPTO command
  net/mlx5: Add new APIs for fast update encryption key
  net/mlx5: Refactor the encryption key creation
  net/mlx5: Add const to the key pointer of encryption key creation
  net/mlx5: Prepare for fast crypto key update if hardware supports it
  net/mlx5: Change key type to key purpose
  net/mlx5: Add IFC bits and enums for crypto key
  net/mlx5: Add IFC bits for general obj create param
  net/mlx5: Header file for crypto
====================

Link: https://lore.kernel.org/r/20230131031201.35336-1-saeed@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2023-01-31 21:35:34 -08:00
..
acpi ACPI: Fix selecting wrong ACPI fwnode for the iGPU on some Dell laptops 2023-01-10 20:23:48 +01:00
asm-generic arch: fix broken BuildID for arm64 and riscv 2022-12-30 17:21:51 +09:00
clocksource
crypto
drm Merge drm/drm-fixes into drm-misc-fixes 2023-01-03 08:32:12 +01:00
dt-bindings remoteproc updates for v6.2 2022-12-21 09:37:14 -08:00
keys
kunit
kvm
linux net/mlx5: Prepare for fast crypto key update if hardware supports it 2023-01-30 19:10:05 -08:00
math-emu
media
memory
misc
net devlink: remove devlink features 2023-01-30 08:37:46 +00:00
pcmcia
ras
rdma
rv
scsi scsi: iscsi_tcp: Fix UAF during logout when accessing the shost ipaddress 2023-01-18 19:14:56 -05:00
soc net: mscc: ocelot: expose vsc7514_regmap definition 2023-01-30 21:07:20 -08:00
sound
target
trace net/sock: Introduce trace_sk_data_ready() 2023-01-23 11:26:50 +00:00
uapi This feature/cleanup patchset includes the following patches: 2023-01-30 07:33:06 +00:00
ufs scsi: ufs: core: Fix devfreq deadlocks 2023-01-18 19:08:37 -05:00
vdso
video fbdev: omapfb: connector-analog-tv: remove support for platform data 2022-12-14 20:01:49 +01:00
xen xen: make remove callback of xen driver void returned 2022-12-15 16:06:10 +01:00