mbox series

[net-next,00/14] net: tls: various code cleanups and improvements

Message ID cover.1696596130.git.sd@queasysnail.net (mailing list archive)
Headers show
Series net: tls: various code cleanups and improvements | expand

Message

Sabrina Dubroca Oct. 9, 2023, 8:50 p.m. UTC
This series contains multiple cleanups and simplifications for the
config code of both TLS_SW and TLS_HW.

It also modifies the chcr_ktls driver to use driver_state like all
other drivers, so that we can then make driver_state fixed size
instead of a flex array always allocated to that same fixed size. As
reported by Gustavo A. R. Silva, the way chcr_ktls misuses
driver_state irritates GCC [1].

Patches 1 and 2 are follow-ups to my previous cipher_desc series.

[1] https://lore.kernel.org/netdev/ZRvzdlvlbX4+eIln@work/

Sabrina Dubroca (14):
  tls: get salt using crypto_info_salt in tls_enc_skb
  tls: drop unnecessary cipher_type checks in tls offload
  tls: store rec_seq directly within cipher_context
  tls: rename MAX_IV_SIZE to TLS_MAX_IV_SIZE
  tls: store iv directly within cipher_context
  tls: extract context alloc/initialization out of tls_set_sw_offload
  tls: move tls_prot_info initialization out of tls_set_sw_offload
  tls: also use init_prot_info in tls_set_device_offload
  tls: add a helper to allocate/initialize offload_ctx_tx
  tls: remove tls_context argument from tls_set_sw_offload
  tls: remove tls_context argument from tls_set_device_offload
  tls: validate crypto_info in a separate helper
  chcr_ktls: use tls_offload_context_tx and driver_state like other
    drivers
  tls: use fixed size for tls_offload_context_{tx,rx}.driver_state

 .../chelsio/inline_crypto/ch_ktls/chcr_ktls.c |  43 ++--
 .../chelsio/inline_crypto/ch_ktls/chcr_ktls.h |  36 +++-
 include/net/tls.h                             |  21 +-
 net/tls/tls.h                                 |  12 +-
 net/tls/tls_device.c                          | 101 ++++-----
 net/tls/tls_device_fallback.c                 |  23 +-
 net/tls/tls_main.c                            |  62 +++---
 net/tls/tls_sw.c                              | 198 +++++++++---------
 8 files changed, 244 insertions(+), 252 deletions(-)

Comments

Simon Horman Oct. 13, 2023, 9:47 a.m. UTC | #1
+ "David S. Miller" <davem@davemloft.net>
  Paolo Abeni <pabeni@redhat.com>
  Eric Dumazet <edumazet@google.com>

On Mon, Oct 09, 2023 at 10:50:40PM +0200, Sabrina Dubroca wrote:
> This series contains multiple cleanups and simplifications for the
> config code of both TLS_SW and TLS_HW.
> 
> It also modifies the chcr_ktls driver to use driver_state like all
> other drivers, so that we can then make driver_state fixed size
> instead of a flex array always allocated to that same fixed size. As
> reported by Gustavo A. R. Silva, the way chcr_ktls misuses
> driver_state irritates GCC [1].
> 
> Patches 1 and 2 are follow-ups to my previous cipher_desc series.
> 
> [1] https://lore.kernel.org/netdev/ZRvzdlvlbX4+eIln@work/
> 
> Sabrina Dubroca (14):
>   tls: get salt using crypto_info_salt in tls_enc_skb
>   tls: drop unnecessary cipher_type checks in tls offload
>   tls: store rec_seq directly within cipher_context
>   tls: rename MAX_IV_SIZE to TLS_MAX_IV_SIZE
>   tls: store iv directly within cipher_context
>   tls: extract context alloc/initialization out of tls_set_sw_offload
>   tls: move tls_prot_info initialization out of tls_set_sw_offload
>   tls: also use init_prot_info in tls_set_device_offload
>   tls: add a helper to allocate/initialize offload_ctx_tx
>   tls: remove tls_context argument from tls_set_sw_offload
>   tls: remove tls_context argument from tls_set_device_offload
>   tls: validate crypto_info in a separate helper
>   chcr_ktls: use tls_offload_context_tx and driver_state like other
>     drivers
>   tls: use fixed size for tls_offload_context_{tx,rx}.driver_state
> 
>  .../chelsio/inline_crypto/ch_ktls/chcr_ktls.c |  43 ++--
>  .../chelsio/inline_crypto/ch_ktls/chcr_ktls.h |  36 +++-
>  include/net/tls.h                             |  21 +-
>  net/tls/tls.h                                 |  12 +-
>  net/tls/tls_device.c                          | 101 ++++-----
>  net/tls/tls_device_fallback.c                 |  23 +-
>  net/tls/tls_main.c                            |  62 +++---
>  net/tls/tls_sw.c                              | 198 +++++++++---------
>  8 files changed, 244 insertions(+), 252 deletions(-)

Thanks Sabrina,

this was a nice set of cleanups to read.

Reviewed-by: Simon Horman <horms@kernel.org>
patchwork-bot+netdevbpf@kernel.org Oct. 13, 2023, 10:30 a.m. UTC | #2
Hello:

This series was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

On Mon,  9 Oct 2023 22:50:40 +0200 you wrote:
> This series contains multiple cleanups and simplifications for the
> config code of both TLS_SW and TLS_HW.
> 
> It also modifies the chcr_ktls driver to use driver_state like all
> other drivers, so that we can then make driver_state fixed size
> instead of a flex array always allocated to that same fixed size. As
> reported by Gustavo A. R. Silva, the way chcr_ktls misuses
> driver_state irritates GCC [1].
> 
> [...]

Here is the summary with links:
  - [net-next,01/14] tls: get salt using crypto_info_salt in tls_enc_skb
    https://git.kernel.org/netdev/net-next/c/3bab3ee0f95e
  - [net-next,02/14] tls: drop unnecessary cipher_type checks in tls offload
    https://git.kernel.org/netdev/net-next/c/8f1d532b4a49
  - [net-next,03/14] tls: store rec_seq directly within cipher_context
    https://git.kernel.org/netdev/net-next/c/6d5029e54700
  - [net-next,04/14] tls: rename MAX_IV_SIZE to TLS_MAX_IV_SIZE
    https://git.kernel.org/netdev/net-next/c/bee6b7b30706
  - [net-next,05/14] tls: store iv directly within cipher_context
    https://git.kernel.org/netdev/net-next/c/1c1cb3110d7e
  - [net-next,06/14] tls: extract context alloc/initialization out of tls_set_sw_offload
    https://git.kernel.org/netdev/net-next/c/615580cbc99a
  - [net-next,07/14] tls: move tls_prot_info initialization out of tls_set_sw_offload
    https://git.kernel.org/netdev/net-next/c/a9937816edde
  - [net-next,08/14] tls: also use init_prot_info in tls_set_device_offload
    https://git.kernel.org/netdev/net-next/c/1a074f7618e8
  - [net-next,09/14] tls: add a helper to allocate/initialize offload_ctx_tx
    https://git.kernel.org/netdev/net-next/c/013740799987
  - [net-next,10/14] tls: remove tls_context argument from tls_set_sw_offload
    https://git.kernel.org/netdev/net-next/c/b6a30ec9239a
  - [net-next,11/14] tls: remove tls_context argument from tls_set_device_offload
    https://git.kernel.org/netdev/net-next/c/4f4866991847
  - [net-next,12/14] tls: validate crypto_info in a separate helper
    https://git.kernel.org/netdev/net-next/c/1cf7fbcee60a
  - [net-next,13/14] chcr_ktls: use tls_offload_context_tx and driver_state like other drivers
    https://git.kernel.org/netdev/net-next/c/0700aa3a7503
  - [net-next,14/14] tls: use fixed size for tls_offload_context_{tx,rx}.driver_state
    https://git.kernel.org/netdev/net-next/c/9f0c8245516b

You are awesome, thank you!
Jakub Kicinski Oct. 13, 2023, 9:23 p.m. UTC | #3
On Mon,  9 Oct 2023 22:50:40 +0200 Sabrina Dubroca wrote:
> This series contains multiple cleanups and simplifications for the
> config code of both TLS_SW and TLS_HW.
> 
> It also modifies the chcr_ktls driver to use driver_state like all
> other drivers, so that we can then make driver_state fixed size
> instead of a flex array always allocated to that same fixed size. As
> reported by Gustavo A. R. Silva, the way chcr_ktls misuses
> driver_state irritates GCC [1].
> 
> Patches 1 and 2 are follow-ups to my previous cipher_desc series.

Nice cleanups FWIW! Sorry I didn't get to acking it in time :S