For this series: Reviewed-and-tested-by: Bill Fischofer <bill.fischo...@linaro.org>
On Fri, Feb 17, 2017 at 8:20 AM, Petri Savolainen < petri.savolai...@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.savolai...@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 > >