diff mbox series

[API-NEXT,1/2] api: pktio: add parser configuration

Message ID 1487341207-31908-1-git-send-email-petri.savolainen@linaro.org
State Accepted
Commit 8c6ca3886ae4ffb111d3a81d09d21b68e0e11349
Headers show
Series [API-NEXT,1/2] api: pktio: add parser configuration | expand

Commit Message

Petri Savolainen Feb. 17, 2017, 2:20 p.m. UTC
Packet input parsing level configuration is added. An application
may express the maximum layer it is interested about.
Implementations may optimize packet input performance as parsing
can be stopped on the application required level. Implementations
are free to parse more layers than application requests.

Lazy parsing (e.g. in current odp-linux) does not work in practice.
The implementation cannot continue parsing after the application
has got access to packet data, since application may overwrite
some packet headers. Parse results must reflect the format of the
received packet.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

---
 include/odp/api/spec/packet_io.h | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

-- 
2.8.1

Comments

Bill Fischofer Feb. 17, 2017, 4:30 p.m. UTC | #1
On Fri, Feb 17, 2017 at 8:20 AM, Petri Savolainen
<petri.savolainen@linaro.org> wrote:
> Packet input parsing level configuration is added. An application

> may express the maximum layer it is interested about.

> Implementations may optimize packet input performance as parsing

> can be stopped on the application required level. Implementations

> are free to parse more layers than application requests.

>

> Lazy parsing (e.g. in current odp-linux) does not work in practice.

> The implementation cannot continue parsing after the application

> has got access to packet data, since application may overwrite

> some packet headers. Parse results must reflect the format of the

> received packet.

>

> Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

> ---

>  include/odp/api/spec/packet_io.h | 36 ++++++++++++++++++++++++++++++++++++

>  1 file changed, 36 insertions(+)

>

> diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h

> index 85cd6d1..cec1f22 100644

> --- a/include/odp/api/spec/packet_io.h

> +++ b/include/odp/api/spec/packet_io.h

> @@ -346,6 +346,39 @@ typedef union odp_pktout_config_opt_t {

>  } odp_pktout_config_opt_t;

>

>  /**

> + * Parser layers

> + */

> +typedef enum odp_pktio_parser_layer_t {

> +       /** No layers */

> +       ODP_PKTIO_PARSER_LAYER_NONE = 0,

> +

> +       /** Layer L2 protocols (Ethernet, VLAN, ARP, etc) */

> +       ODP_PKTIO_PARSER_LAYER_L2,

> +

> +       /** Layer L3 protocols (IPv4, IPv6, ICMP, IPsec, etc) */

> +       ODP_PKTIO_PARSER_LAYER_L3,

> +

> +       /** Layer L4 protocols (UDP, TCP, SCTP) */

> +       ODP_PKTIO_PARSER_LAYER_L4,

> +

> +       /** All layers */

> +       ODP_PKTIO_PARSER_LAYER_ALL

> +

> +} odp_pktio_parser_layer_t;

> +

> +/**

> + * Parser configuration

> + */

> +typedef struct odp_pktio_parser_config_t {

> +       /** Protocol parsing level in packet input

> +         *

> +         * Parse protocol layers in minimum up to this level during packet

> +         * input. The default value is ODP_PKTIO_PARSER_LAYER_ALL. */

> +       odp_pktio_parser_layer_t layer;

> +

> +} odp_pktio_parser_config_t;

> +

> +/**

>   * Packet IO configuration options

>   *

>   * Packet IO interface level configuration options. Use odp_pktio_capability()

> @@ -363,6 +396,9 @@ typedef struct odp_pktio_config_t {

>          *  Default value for all bits is zero. */

>         odp_pktout_config_opt_t pktout;

>

> +       /** Packet input parser configuration */

> +       odp_pktio_parser_config_t parser;

> +


It would be better to put this at the end of the structure rather than
in the middle for backwards compatibility. Should we have that as a
general rule?

>         /** Interface loopback mode

>          *

>          * In this mode the packets sent out through the interface is

> --

> 2.8.1

>
Savolainen, Petri (Nokia - FI/Espoo) Feb. 20, 2017, 11:39 a.m. UTC | #2
> > +/**

> >   * Packet IO configuration options

> >   *

> >   * Packet IO interface level configuration options. Use

> odp_pktio_capability()

> > @@ -363,6 +396,9 @@ typedef struct odp_pktio_config_t {

> >          *  Default value for all bits is zero. */

> >         odp_pktout_config_opt_t pktout;

> >

> > +       /** Packet input parser configuration */

> > +       odp_pktio_parser_config_t parser;

> > +

> 

> It would be better to put this at the end of the structure rather than

> in the middle for backwards compatibility. Should we have that as a

> general rule?


There's no compatibility issues as long as application is re-compiled between API versions. Binary compatibility over API versions is not required today. ABI compatibility with good performance is complex enough to support. Why ABI compat would be needed over different API versions?

-Petri
Bill Fischofer Feb. 23, 2017, 1:51 p.m. UTC | #3
For this series:

Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org>

On Fri, Feb 17, 2017 at 8:20 AM, Petri Savolainen <
petri.savolainen@linaro.org> wrote:

> Packet input parsing level configuration is added. An application

> may express the maximum layer it is interested about.

> Implementations may optimize packet input performance as parsing

> can be stopped on the application required level. Implementations

> are free to parse more layers than application requests.

>

> Lazy parsing (e.g. in current odp-linux) does not work in practice.

> The implementation cannot continue parsing after the application

> has got access to packet data, since application may overwrite

> some packet headers. Parse results must reflect the format of the

> received packet.

>

> Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

> ---

>  include/odp/api/spec/packet_io.h | 36 ++++++++++++++++++++++++++++++

> ++++++

>  1 file changed, 36 insertions(+)

>

> diff --git a/include/odp/api/spec/packet_io.h

> b/include/odp/api/spec/packet_io.h

> index 85cd6d1..cec1f22 100644

> --- a/include/odp/api/spec/packet_io.h

> +++ b/include/odp/api/spec/packet_io.h

> @@ -346,6 +346,39 @@ typedef union odp_pktout_config_opt_t {

>  } odp_pktout_config_opt_t;

>

>  /**

> + * Parser layers

> + */

> +typedef enum odp_pktio_parser_layer_t {

> +       /** No layers */

> +       ODP_PKTIO_PARSER_LAYER_NONE = 0,

> +

> +       /** Layer L2 protocols (Ethernet, VLAN, ARP, etc) */

> +       ODP_PKTIO_PARSER_LAYER_L2,

> +

> +       /** Layer L3 protocols (IPv4, IPv6, ICMP, IPsec, etc) */

> +       ODP_PKTIO_PARSER_LAYER_L3,

> +

> +       /** Layer L4 protocols (UDP, TCP, SCTP) */

> +       ODP_PKTIO_PARSER_LAYER_L4,

> +

> +       /** All layers */

> +       ODP_PKTIO_PARSER_LAYER_ALL

> +

> +} odp_pktio_parser_layer_t;

> +

> +/**

> + * Parser configuration

> + */

> +typedef struct odp_pktio_parser_config_t {

> +       /** Protocol parsing level in packet input

> +         *

> +         * Parse protocol layers in minimum up to this level during packet

> +         * input. The default value is ODP_PKTIO_PARSER_LAYER_ALL. */

> +       odp_pktio_parser_layer_t layer;

> +

> +} odp_pktio_parser_config_t;

> +

> +/**

>   * Packet IO configuration options

>   *

>   * Packet IO interface level configuration options. Use

> odp_pktio_capability()

> @@ -363,6 +396,9 @@ typedef struct odp_pktio_config_t {

>          *  Default value for all bits is zero. */

>         odp_pktout_config_opt_t pktout;

>

> +       /** Packet input parser configuration */

> +       odp_pktio_parser_config_t parser;

> +

>         /** Interface loopback mode

>          *

>          * In this mode the packets sent out through the interface is

> --

> 2.8.1

>

>
Savolainen, Petri (Nokia - FI/Espoo) Feb. 28, 2017, 8:15 a.m. UTC | #4
Ping. We'd like to start implementation == fix the broken lazy parsing.

-Petri


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

Sent: Thursday, February 23, 2017 3:52 PM
To: Petri Savolainen <petri.savolainen@linaro.org>
Cc: lng-odp-forward <lng-odp@lists.linaro.org>
Subject: Re: [lng-odp] [API-NEXT PATCH 1/2] api: pktio: add parser configuration

For this series:

Reviewed-and-tested-by: Bill Fischofer <mailto:bill.fischofer@linaro.org>

On Fri, Feb 17, 2017 at 8:20 AM, Petri Savolainen <mailto:petri.savolainen@linaro.org> wrote:
Packet input parsing level configuration is added. An application
may express the maximum layer it is interested about.
Implementations may optimize packet input performance as parsing
can be stopped on the application required level. Implementations
are free to parse more layers than application requests.

Lazy parsing (e.g. in current odp-linux) does not work in practice.
The implementation cannot continue parsing after the application
has got access to packet data, since application may overwrite
some packet headers. Parse results must reflect the format of the
received packet.

Signed-off-by: Petri Savolainen <mailto:petri.savolainen@linaro.org>

---
 include/odp/api/spec/packet_io.h | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
diff mbox series

Patch

diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h
index 85cd6d1..cec1f22 100644
--- a/include/odp/api/spec/packet_io.h
+++ b/include/odp/api/spec/packet_io.h
@@ -346,6 +346,39 @@  typedef union odp_pktout_config_opt_t {
 } odp_pktout_config_opt_t;
 
 /**
+ * Parser layers
+ */
+typedef enum odp_pktio_parser_layer_t {
+	/** No layers */
+	ODP_PKTIO_PARSER_LAYER_NONE = 0,
+
+	/** Layer L2 protocols (Ethernet, VLAN, ARP, etc) */
+	ODP_PKTIO_PARSER_LAYER_L2,
+
+	/** Layer L3 protocols (IPv4, IPv6, ICMP, IPsec, etc) */
+	ODP_PKTIO_PARSER_LAYER_L3,
+
+	/** Layer L4 protocols (UDP, TCP, SCTP) */
+	ODP_PKTIO_PARSER_LAYER_L4,
+
+	/** All layers */
+	ODP_PKTIO_PARSER_LAYER_ALL
+
+} odp_pktio_parser_layer_t;
+
+/**
+ * Parser configuration
+ */
+typedef struct odp_pktio_parser_config_t {
+	/** Protocol parsing level in packet input
+	  *
+	  * Parse protocol layers in minimum up to this level during packet
+	  * input. The default value is ODP_PKTIO_PARSER_LAYER_ALL. */
+	odp_pktio_parser_layer_t layer;
+
+} odp_pktio_parser_config_t;
+
+/**
  * Packet IO configuration options
  *
  * Packet IO interface level configuration options. Use odp_pktio_capability()
@@ -363,6 +396,9 @@  typedef struct odp_pktio_config_t {
 	 *  Default value for all bits is zero. */
 	odp_pktout_config_opt_t pktout;
 
+	/** Packet input parser configuration */
+	odp_pktio_parser_config_t parser;
+
 	/** Interface loopback mode
 	 *
 	 * In this mode the packets sent out through the interface is