netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Steffen Klassert <steffen.klassert@secunet.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
	Saeed Mahameed <saeed@kernel.org>,
	Jason Gunthorpe <jgg@nvidia.com>,
	"David S . Miller" <davem@davemloft.net>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	netdev@vger.kernel.org, Raed Salem <raeds@nvidia.com>,
	ipsec-devel <devel@linux-ipsec.org>
Subject: Re: [PATCH xfrm-next v2 0/6] Extend XFRM core to allow full offload configuration
Date: Tue, 23 Aug 2022 17:06:58 +0300	[thread overview]
Message-ID: <YwTfAg/Fq4m85+u/@unreal> (raw)
In-Reply-To: <20220823052203.GI2950045@gauss3.secunet.de>

On Tue, Aug 23, 2022 at 07:22:03AM +0200, Steffen Klassert wrote:
> On Mon, Aug 22, 2022 at 05:17:06PM -0700, Jakub Kicinski wrote:
> > On Mon, 22 Aug 2022 14:27:16 -0700 Saeed Mahameed wrote:
> > > >My questions about performance were more about where does
> > > >the performance loss originate. Is it because of loss of GRO?  
> > > 
> > > Performance loss between full and baseline ? it's hardly measurable .. 
> > > less than 3% in the worst case.
> > 
> > The loss for crypto only vs baseline is what I meant. Obviously if we
> > offload everything the CPU perf may look great but we're giving up
> > flexibility and ability to fix problems in SW. 
> 
> The main difference between baseline TCP and crypto offload
> is the policy/state lookup and ESP encapsulation/decapsulation.
> 
> We don't loose GRO on crypto offload. The ESP header/trailer
> is stripped away in the GRO layer so that the inner TCP
> packet gets GRO. But we loose hardware LRO, as the ESP
> headers are not stripped in HW.
> 
> It would be really good to see where the bottlenecks are
> with crypto offload (RX or TX).
> 
> Also, it would be good to see why the full offload performs
> better. Some perf traces would be helpfull.
> 
> When I thought about possible offloads, I came to three
> different types:
> 
> 1. encapsulation offload:
>    - Kernel does policy enforcement
>    - NIC does encapsulation
>    - NIC manages anti replay window and lifetime of SAs
>    - NIC sends lifetime and anti replay notifications to the kernel
>    - The Kernel talks to the keymanager
> 
> 2. statefull offload with fallback:
>    - NIC handles the full datapath, but kernel can take over (fragments
>      etc.)
>    - Kernel and NIC hold the full SA and policy database
>    - Kernel and NIC must sync the state (lifetime, replay window etc.)
>      of SAs and policies
>    - The Kernel talks to the keymanager
> 
> 3. statefull offload:
>    - NIC handles the full datapath
>    - NIC talks directly with the keymanager
>    - Kernel xfrm acts as a stub layer to pass messages from
>      userspace to the NIC.
> 
> The offload that is implemented here comes option 2 closest.
> The statefull handling is shared between host and NIC.
> Unfortunalely, this is the most complicated one.

Our implementation something like option 2 but without fallback.

1. I didn't implement fallback for a number of reasons:
 * It is almost impossible to keep in sync HW and SW states in linerate.
 * IPv6 sets (require???) do-not-fragment bit.
2. NIC and kernel keep their SA and policy databases in sync to make
sure that they both see coherent picture and for users to be able to
use existing iproute2 tools.
3. Like any other offload, I want to make sure that kernel in the middle
between our HW and user. This includes keymanager.

> 
> If just encapsulation/decapsulation brings the performance
> we could also go with option 1. That would be still a
> stateless offload.

Option 1 isn't sufficient for us as it doesn't support combination of TC
and eswitch manager. In that mode, packets that arrive to uplink forwarded
directly to representor without kernel involvement,

> 
> Option 3 is what I would consider as a full offload.
> Kernel acts as a stateless stub layer, NIC does
> statefull IPsec.

  reply	other threads:[~2022-08-23 17:07 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-16  8:59 [PATCH xfrm-next v2 0/6] Extend XFRM core to allow full offload configuration Leon Romanovsky
2022-08-16  8:59 ` [PATCH xfrm-next v2 1/6] xfrm: add new full offload flag Leon Romanovsky
2022-08-16  8:59 ` [PATCH xfrm-next v2 2/6] xfrm: allow state full offload mode Leon Romanovsky
2022-08-18 10:12   ` Steffen Klassert
2022-08-18 13:28     ` Leon Romanovsky
2022-08-22  8:01       ` Steffen Klassert
2022-08-22  8:46         ` Leon Romanovsky
2022-08-16  8:59 ` [PATCH xfrm-next v2 3/6] xfrm: add an interface to offload policy Leon Romanovsky
2022-08-16  8:59 ` [PATCH xfrm-next v2 4/6] xfrm: add TX datapath support for IPsec full offload mode Leon Romanovsky
2022-08-18 10:24   ` Steffen Klassert
2022-08-18 13:34     ` Leon Romanovsky
2022-08-22  8:04       ` Steffen Klassert
2022-08-22  8:50         ` Leon Romanovsky
2022-08-16  8:59 ` [PATCH xfrm-next v2 5/6] xfrm: add RX datapath protection " Leon Romanovsky
2022-08-18 10:27   ` Steffen Klassert
2022-08-18 13:36     ` Leon Romanovsky
2022-08-22  8:06       ` Steffen Klassert
2022-08-22  9:35         ` Leon Romanovsky
2022-08-16  8:59 ` [PATCH xfrm-next v2 6/6] xfrm: enforce separation between priorities of HW/SW policies Leon Romanovsky
2022-08-17  2:54 ` [PATCH xfrm-next v2 0/6] Extend XFRM core to allow full offload configuration Jakub Kicinski
2022-08-17  5:22   ` Leon Romanovsky
2022-08-17 18:10     ` Jakub Kicinski
2022-08-18  5:24       ` Leon Romanovsky
2022-08-18 10:10         ` Steffen Klassert
2022-08-18 12:51           ` Leon Romanovsky
2022-08-19  1:54           ` Jakub Kicinski
2022-08-19  2:34         ` Jakub Kicinski
2022-08-19  5:52           ` Leon Romanovsky
2022-08-19 15:47             ` Jakub Kicinski
2022-08-19 16:01               ` Jason Gunthorpe
2022-08-19 17:53                 ` Jakub Kicinski
2022-08-22  8:41                   ` Steffen Klassert
2022-08-22  8:54                     ` Leon Romanovsky
2022-08-22 16:33                       ` Jakub Kicinski
2022-08-22 21:27                         ` Saeed Mahameed
2022-08-23  0:17                           ` Jakub Kicinski
2022-08-23  5:22                             ` Steffen Klassert
2022-08-23 14:06                               ` Leon Romanovsky [this message]
2022-08-23  4:48                           ` Leon Romanovsky
2022-08-26 12:20                             ` Jason Gunthorpe
2022-08-23  5:34                         ` Leon Romanovsky
2022-08-18 10:09 ` Steffen Klassert
2022-08-18 13:26   ` Leon Romanovsky
2022-08-22  8:34     ` Steffen Klassert
2022-08-22  9:34       ` Leon Romanovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YwTfAg/Fq4m85+u/@unreal \
    --to=leon@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devel@linux-ipsec.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=jgg@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=raeds@nvidia.com \
    --cc=saeed@kernel.org \
    --cc=steffen.klassert@secunet.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).