From: Leon Romanovsky <leon@kernel.org>
To: Steffen Klassert <steffen.klassert@secunet.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
"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>,
Jason Gunthorpe <jgg@nvidia.com>
Subject: Re: [PATCH xfrm-next v2 0/6] Extend XFRM core to allow full offload configuration
Date: Thu, 18 Aug 2022 15:51:12 +0300 [thread overview]
Message-ID: <Yv41wPd11Sg8WU1F@unreal> (raw)
In-Reply-To: <20220818101031.GC566407@gauss3.secunet.de>
On Thu, Aug 18, 2022 at 12:10:31PM +0200, Steffen Klassert wrote:
> On Thu, Aug 18, 2022 at 08:24:13AM +0300, Leon Romanovsky wrote:
> > On Wed, Aug 17, 2022 at 11:10:52AM -0700, Jakub Kicinski wrote:
> > > On Wed, 17 Aug 2022 08:22:02 +0300 Leon Romanovsky wrote:
> > > > On Tue, Aug 16, 2022 at 07:54:08PM -0700, Jakub Kicinski wrote:
> > > > > This is making a precedent for full tunnel offload in netdev, right?
> > > >
> > > > Not really. SW IPsec supports two modes: tunnel and transport.
> > > >
> > > > However HW and SW stack supports only offload of transport mode.
> > > > This is the case for already merged IPsec crypto offload mode and
> > > > the case for this full offload.
> > >
> > > My point is on what you called "full offload" vs "crypto offload".
> > > The policy so far has always been that Linux networking stack should
> > > populate all the headers and instruct the device to do crypto, no
> > > header insertion. Obviously we do header insertion in switch/router
> > > offloads but that's different and stateless.
> > >
> > > I believe the reasoning was to provide as much flexibility and control
> > > to the software as possible while retaining most of the performance
> > > gains.
> >
> > I honestly don't know the reasoning, but "performance gains" are very
> > limited as long as IPsec stack involved with various policy/state
> > lookups. These lookups are expensive in terms of CPU and they can't
> > hold 400 Gb/s line rate.
>
> Can you provide some performance results that show the difference
> between crypto and full offload? In particular because on the TX
> path, the full policy and state offload is done twice (in software
> to find the offloading device and then in hardware to match policy
> to state).
I will prepare the numbers.
>
> >
> > https://docs.nvidia.com/networking/display/connectx7en/Introduction#Introduction-ConnectX-7400GbEAdapterCards
> >
> > >
> > > You must provide a clear analysis (as in examination in data) and
> > > discussion (as in examination in writing) if you're intending to
> > > change the "let's keep packet formation in the SW" policy. What you
> > > got below is a good start but not sufficient.
>
> I'm still a bit unease about this approach. I fear that doing parts
> of statefull IPsec procesing in software and parts in hardware will
> lead to all sort of problems. E.g. with this implementation
> the software has no stats, liftetime, lifebyte and packet count
> information but is responsible to do the IKE communication.
>
> We might be able to sort out all problems during the upstraming
> process, but I still have no clear picture how this should work
> in the end with all corener cases this creates.
Like we discussed in IPsec coffee hour, there is no reliable way
to synchronize SW and HW. This is why we offload both policy and state
and skip stack completely.
>
> Also the name full offload is a bit missleading, because the
> software still has to hold all offloaded states and policies.
> In a full offload, the stack would IMO just act as a stub
> layer between IKE and hardware.
It is just a name, I'm open to change it to any other name.
>
> > > > Some of them:
> > > > 1. Request to have reqid for policy and state. I use reqid for HW
> > > > matching between policy and state.
> > >
> > > reqid?
> >
> > Policy and state are matched based on their selectors (src/deet IP, direction ...),
> > but they independent. The reqid is XFRM identification that this specific policy
> > is connected to this specific state.
> > https://www.man7.org/linux/man-pages/man8/ip-xfrm.8.html
> > https://docs.kernel.org/networking/xfrm_device.html
> > ip x s add ....
> > reqid 0x07 ...
> > offload dev eth4 dir in
>
> Can you elaborate this a bit more? Does that matching happen in
> hardware? The reqid is not a unique identifyer to match between
> policy and state. You MUST match the selectors as defined in
> https://www.rfc-editor.org/rfc/rfc4301
The reqid is needed for TX path and part of mlx5 flow steering logic.
https://lore.kernel.org/netdev/51ee028577396c051604703c46bd31d706b4b387.1660641154.git.leonro@nvidia.com/
I'm relying on it to make sure that both policy and state exist.
For everything else, I rely on selectors.
Thanks
>
next prev parent reply other threads:[~2022-08-18 12:51 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 [this message]
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
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=Yv41wPd11Sg8WU1F@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=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).