mbox series

[API-NEXT,0/2] IPSEC packet event

Message ID 20170609105143.11350-1-petri.savolainen@linaro.org
Headers show
Series IPSEC packet event | expand

Message

Petri Savolainen June 9, 2017, 10:51 a.m. UTC
Requires "[API-NEXT PATCH v2 0/2] IPsec API update". 

Input and output of IPSEC operations are packets. Parameter and
result structures are cleaner when packet arrays are direct
parameters to functions. Also API is more flexible for
application or API pipelining when output is packets with
additional metadata. Application or API pipeline stages which
do not care about IPSEC results may work on basic packet metadata.


Petri Savolainen (2):
  api: ipsec: change IPSEC result to packet
  api: ipsec: disable event is the last event

 include/odp/api/spec/event.h                       |  27 +-
 include/odp/api/spec/ipsec.h                       | 370 +++++++++++----------
 include/odp/arch/default/api/abi/event.h           |   6 +-
 .../include/odp/api/plat/event_types.h             |   7 +-
 platform/linux-generic/odp_ipsec.c                 |  67 +++-
 5 files changed, 283 insertions(+), 194 deletions(-)

-- 
2.13.0

Comments

Dmitry Eremin-Solenikov June 9, 2017, 11:48 a.m. UTC | #1
Petri,

On 09.06.2017 13:51, Petri Savolainen wrote:
> Requires "[API-NEXT PATCH v2 0/2] IPsec API update". 

> 

> Input and output of IPSEC operations are packets. Parameter and

> result structures are cleaner when packet arrays are direct

> parameters to functions. Also API is more flexible for

> application or API pipelining when output is packets with

> additional metadata. Application or API pipeline stages which

> do not care about IPSEC results may work on basic packet metadata.


Two generic issues:

- I thought that basic idea was to generate ODP_EVENT_PACKET and then
use API call to check if there is IPsec metadata associated with it?

- First patch contains several 'extra' changes. Can we work towards
splitting it into more manageable pieces?

-- 
With best wishes
Dmitry
Savolainen, Petri (Nokia - FI/Espoo) June 9, 2017, 12:06 p.m. UTC | #2
> -----Original Message-----

> From: Dmitry Eremin-Solenikov [mailto:dmitry.ereminsolenikov@linaro.org]

> Sent: Friday, June 09, 2017 2:49 PM

> To: Petri Savolainen <petri.savolainen@linaro.org>; lng-

> odp@lists.linaro.org

> Subject: Re: [lng-odp] [API-NEXT PATCH 0/2] IPSEC packet event

> 

> Petri,

> 

> On 09.06.2017 13:51, Petri Savolainen wrote:

> > Requires "[API-NEXT PATCH v2 0/2] IPsec API update".

> >

> > Input and output of IPSEC operations are packets. Parameter and

> > result structures are cleaner when packet arrays are direct

> > parameters to functions. Also API is more flexible for

> > application or API pipelining when output is packets with

> > additional metadata. Application or API pipeline stages which

> > do not care about IPSEC results may work on basic packet metadata.

> 

> Two generic issues:

> 

> - I thought that basic idea was to generate ODP_EVENT_PACKET and then

> use API call to check if there is IPsec metadata associated with it?

> 


We ended up with defining odp_event_type() to be the call to check if there's extra metadata. The reason is that when ipsec decrypt fails, data is garbage, so application needs to check ipsec status always for those packets. With single event type, application would need to do the ipsec check also for non-ipsec packets. This API keeps normal packets as is.


> - First patch contains several 'extra' changes. Can we work towards

> splitting it into more manageable pieces?


Which ones you feel disturbing? Some of those are consequence of editing the corresponding comment block anyway (e.g. for the event change). I would not want to edit the same comment block two times: first in the minimal way possible, and then rewrite it for better quality in a next patch. Just comment on those places you disagree with the new text.

-Petri
Bill Fischofer June 9, 2017, 3:26 p.m. UTC | #3
On Fri, Jun 9, 2017 at 7:06 AM, Savolainen, Petri (Nokia - FI/Espoo)
<petri.savolainen@nokia.com> wrote:
>

>

>> -----Original Message-----

>> From: Dmitry Eremin-Solenikov [mailto:dmitry.ereminsolenikov@linaro.org]

>> Sent: Friday, June 09, 2017 2:49 PM

>> To: Petri Savolainen <petri.savolainen@linaro.org>; lng-

>> odp@lists.linaro.org

>> Subject: Re: [lng-odp] [API-NEXT PATCH 0/2] IPSEC packet event

>>

>> Petri,

>>

>> On 09.06.2017 13:51, Petri Savolainen wrote:

>> > Requires "[API-NEXT PATCH v2 0/2] IPsec API update".

>> >

>> > Input and output of IPSEC operations are packets. Parameter and

>> > result structures are cleaner when packet arrays are direct

>> > parameters to functions. Also API is more flexible for

>> > application or API pipelining when output is packets with

>> > additional metadata. Application or API pipeline stages which

>> > do not care about IPSEC results may work on basic packet metadata.

>>

>> Two generic issues:

>>

>> - I thought that basic idea was to generate ODP_EVENT_PACKET and then

>> use API call to check if there is IPsec metadata associated with it?

>>

>

> We ended up with defining odp_event_type() to be the call to check if there's extra metadata. The reason is that when ipsec decrypt fails, data is garbage, so application needs to check ipsec status always for those packets. With single event type, application would need to do the ipsec check also for non-ipsec packets. This API keeps normal packets as is.


It's sufficient for this to be reflected in the general packet error
bits so application code that doesn't care about IPsec details simply
knows that this packet has an error. Please see my earlier post about
odp_packet_type().

>

>

>> - First patch contains several 'extra' changes. Can we work towards

>> splitting it into more manageable pieces?

>

> Which ones you feel disturbing? Some of those are consequence of editing the corresponding comment block anyway (e.g. for the event change). I would not want to edit the same comment block two times: first in the minimal way possible, and then rewrite it for better quality in a next patch. Just comment on those places you disagree with the new text.

>

> -Petri

>

>
Savolainen, Petri (Nokia - FI/Espoo) June 12, 2017, 7:51 a.m. UTC | #4
> -----Original Message-----

> From: Bill Fischofer [mailto:bill.fischofer@linaro.org]

> Sent: Friday, June 09, 2017 6:27 PM

> To: Savolainen, Petri (Nokia - FI/Espoo) <petri.savolainen@nokia.com>

> Cc: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>; lng-

> odp@lists.linaro.org

> Subject: Re: [lng-odp] [API-NEXT PATCH 0/2] IPSEC packet event

> 

> On Fri, Jun 9, 2017 at 7:06 AM, Savolainen, Petri (Nokia - FI/Espoo)

> <petri.savolainen@nokia.com> wrote:

> >

> >

> >> -----Original Message-----

> >> From: Dmitry Eremin-Solenikov

> [mailto:dmitry.ereminsolenikov@linaro.org]

> >> Sent: Friday, June 09, 2017 2:49 PM

> >> To: Petri Savolainen <petri.savolainen@linaro.org>; lng-

> >> odp@lists.linaro.org

> >> Subject: Re: [lng-odp] [API-NEXT PATCH 0/2] IPSEC packet event

> >>

> >> Petri,

> >>

> >> On 09.06.2017 13:51, Petri Savolainen wrote:

> >> > Requires "[API-NEXT PATCH v2 0/2] IPsec API update".

> >> >

> >> > Input and output of IPSEC operations are packets. Parameter and

> >> > result structures are cleaner when packet arrays are direct

> >> > parameters to functions. Also API is more flexible for

> >> > application or API pipelining when output is packets with

> >> > additional metadata. Application or API pipeline stages which

> >> > do not care about IPSEC results may work on basic packet metadata.

> >>

> >> Two generic issues:

> >>

> >> - I thought that basic idea was to generate ODP_EVENT_PACKET and then

> >> use API call to check if there is IPsec metadata associated with it?

> >>

> >

> > We ended up with defining odp_event_type() to be the call to check if

> there's extra metadata. The reason is that when ipsec decrypt fails, data

> is garbage, so application needs to check ipsec status always for those

> packets. With single event type, application would need to do the ipsec

> check also for non-ipsec packets. This API keeps normal packets as is.

> 

> It's sufficient for this to be reflected in the general packet error

> bits so application code that doesn't care about IPsec details simply

> knows that this packet has an error. Please see my earlier post about

> odp_packet_type().

>


Packet type would result two step check for every packet. At least for every ipsec/crypto/comp packet:

type = event_type(ev)

if (type == packet)
   pkt     = packet_from_event(ev)      // generic
   subtype = packet_type(pkt)
   if (subtype == packet_ipsec)         // 2nd branch
       foo();
   else
       bar();


Direct event type is more efficient for both application and implementation. Also implementation can e.g. finalize IPSEC processing during the IPSEC specific conversion function:

type = event_type(ev)

if (type == packet_ipsec)
       pkt = packet_ipsec_from_event(ev) // ipsec speficic
       foo();
else (type == packet_ipsec)
       pkt = packet_from_event(ev)       // basic pkt specific
       bar();


Class is a backward compatible addition later on:

class = event_class(ev)

if (class == packet)
       pkt = packet_from_class(ev)       // generic
       bar();
else



-Petri