Subject: Re: [EXT] Re: Setting security path with IPsec packet offload mode

From: Leon Romanovsky <[email-masked]>
Date: Sun, 25 Jun 2023 10:27:50 +0300

On Fri, Jun 23, 2023 at 06:48:21AM +0000, Bharat Bhushan wrote:
> Hi Leon,
> 
> > -----Original Message-----
> > From: Leon Romanovsky <[email-masked]>
> > Sent: Thursday, June 22, 2023 2:05 PM
> > To: Bharat Bhushan <[email-masked]>
> > Cc: Steffen Klassert <[email-masked]>;
> > [email-masked]; David S. Miller <[email-masked]>; Eric
> > Dumazet <[email-masked]>; Jakub Kicinski <[email-masked]>; Paolo
> > Abeni <[email-masked]>; [email-masked]
> > Subject: [EXT] Re: Setting security path with IPsec packet offload mode
> > 
> > External Email
> > 
> > ----------------------------------------------------------------------
> > On Thu, Jun 22, 2023 at 06:58:06AM +0000, Bharat Bhushan wrote:
> > > Hi All,
> > >
> > > Have a query related to security patch (secpath_set()) with packet offload
> > mode on egress side. Working to enable ipsec packet offload while Crypto
> > offload is working.
> > > For packet offload xfrm_offload(*skb) returns false in driver. While looking in
> > xfrm framework, cannot find where security patch (secpath_set()) is set with
> > packet offload mode on egress side.
> > 
> > The idea of packet offload is to take plain text packets and perform all needed
> > magic in HW without need from driver and stack to make anything.
> 
> So driver does not know whether it normal packet and will be transmitted normally or this will undergo inline ipsec in hardware.

Yes, this is whole idea of packet offload. Such design allows natively
support tunnel and eswitch modes.

> 
> In our case packet transmit requires a different code flow in driver, to pass some extra details in transmit descriptor like state and policy pointers. 

It sounds like existing IPsec crypto mode to me, which does exactly that
- lookup in SW, while crypto in HW.

> So is there some way driver can find same and extra state and policy details from skb? 

I'm not aware, maybe Steffen can answer.

> Thanks
> -Bharat

Thanks