Subject: Re: [PATCH net-next] nfp: support IPsec offloading for NFP3800

From: Leon Romanovsky <[email-masked]>
Date: Sun, 22 Jan 2023 10:50:24 +0200

On Thu, Jan 19, 2023 at 12:38:42PM +0100, Simon Horman wrote:
> From: Huanhuan Wang <[email-masked]>
> 
> Add IPsec offloading support for NFP3800.
> Including data plane and control plane.
> 
> Data plane: add IPsec packet process flow in NFP3800 datapath (NFDK).
> 
> Control plane: add a algorithm support distinction of flow
> in xfrm hook function xdo_dev_state_add as NFP3800
> supports a different set of IPsec algorithms.
> 
> This matches existing support for the NFP6000/NFP4000 and
> their NFD3 datapath.
> 
> Signed-off-by: Huanhuan Wang <[email-masked]>
> Signed-off-by: Simon Horman <[email-masked]>
> ---
>  drivers/net/ethernet/netronome/nfp/Makefile   |  2 +-
>  .../net/ethernet/netronome/nfp/crypto/ipsec.c |  9 ++++
>  drivers/net/ethernet/netronome/nfp/nfd3/dp.c  |  5 +-
>  drivers/net/ethernet/netronome/nfp/nfdk/dp.c  | 47 +++++++++++++++++--
>  .../net/ethernet/netronome/nfp/nfdk/ipsec.c   | 17 +++++++
>  .../net/ethernet/netronome/nfp/nfdk/nfdk.h    |  8 ++++
>  6 files changed, 79 insertions(+), 9 deletions(-)
>  create mode 100644 drivers/net/ethernet/netronome/nfp/nfdk/ipsec.c

<...>

>  	md_bytes = sizeof(meta_id) +
>  		   !!md_dst * NFP_NET_META_PORTID_SIZE +
> -		   vlan_insert * NFP_NET_META_VLAN_SIZE;
> +		   vlan_insert * NFP_NET_META_VLAN_SIZE +
> +		   *ipsec * NFP_NET_META_IPSEC_FIELD_SIZE;

*ipsec is boolean variable, so you are assuming that true is always 1.
I'm not sure that it is always correct.

Thanks