On 2 July 2015 at 19:03, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolai...@nokia.com> wrote:

>
>
> > -----Original Message-----
> > From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of ext
> > Benoît Ganne
> > Sent: Thursday, June 18, 2015 9:53 PM
> > To: lng-odp@lists.linaro.org
> > Subject: [lng-odp] [API-NEXT PATCH 1/3] api: classification: add
> > ODP_PMR_OFFSET_ABS
> >
> > The application can now specify a packet offset
> > in PMR rules. This offset is absolute from the
> > frame start. It is used to extract the PMR value.
> >
> > This is useful to support arbitrary backplane
> > protocols and extensions.
> >
> > Signed-off-by: Benoît Ganne <bga...@kalray.eu>
> > ---
> >  include/odp/api/classification.h | 25 +++++++++++++++++++++++++
> >  1 file changed, 25 insertions(+)
> >
> > diff --git a/include/odp/api/classification.h
> > b/include/odp/api/classification.h
> > index f597b26..7b84e78 100644
> > --- a/include/odp/api/classification.h
> > +++ b/include/odp/api/classification.h
> > @@ -215,6 +215,8 @@ typedef enum odp_pmr_term {
> >       ODP_PMR_IPSEC_SPI,      /**< IPsec session
> > identifier(*val=uint32_t)*/
> >       ODP_PMR_LD_VNI,         /**< NVGRE/VXLAN network identifier
> >                               (*val=uint32_t)*/
> > +     ODP_PMR_OFFSET_ABS,     /**< User-defined offset/val_sz to match
> > +                             (*val=uint8_t[val_sz]*/
>
> This is user defined raw offset from first byte of the frame.
>
> There could be another ones for more structured user defined offsets e.g.
> ODP_PMR_OFFSET_ABS_L3/L4, offset from first byte of L3/L4 header.
>
>
> >       /** Inner header may repeat above values with this offset */
> >       ODP_PMR_INNER_HDR_OFF = 32
> > @@ -240,6 +242,27 @@ odp_pmr_t odp_pmr_create(odp_pmr_term_e term, const
> > void *val,
> >                        const void *mask, uint32_t val_sz);
> >   /**
> > + * Create a packet match rule with absolute offset, mask and value
> > + *
> > + * @param[in]        term    One of the enumerated values supported
>
> Is this needed? I thought this is custom match rule and defined only by:
> offset, val, mask, val_sz
>
>
> > + * @param[in]        offset  Absolute value in the packet
> > + * @param[in]        val     Value to match against the packet header
> > + *                   in native byte order.
> > + * @param[in]        mask    Mask to indicate which bits of the header
> > + *                   should be matched ('1') and
> > + *                   which should be ignored ('0')
> > + * @param[in]        val_sz  Size of the val and mask arguments,
> > + *                   that must match the value size requirement of the
> > + *                   specific term.
> > + *
> > + * @return           Handle of the matching rule
> > + * @retval           ODP_PMR_INVAL on failure
> > + */
> > +odp_pmr_t odp_pmr_create_offset_abs(odp_pmr_term_e term,
> > +                                 unsigned int offset, const void *val,
>
> packet offsets and lengths are in uint32_t.
>
> > +                                 const void *mask, uint32_t val_sz);
>
>
> I'd define it like this,
>
> odp_pmr_t odp_pmr_create_custom(uint32_t offset, const void *val, const
> void *mask, uint32_t val_sz);
>
> It would fail if the requested custom rule is not supported or too many
> custom rules are used.
>

This signature should work fine. Can we additionally add the pktio
interface information also to this API so that the implementation could
fail during creation itself if more than the supported numbers get attached
to the pktio interface.

Regards,
Bala

>
>
> -Petri
>
>
> > +
> > +/**
> >   * Invalidate a packet match rule and vacate its resources
> >   *
> >   * @param[in]        pmr_id  Identifier of the PMR to be destroyed
> > @@ -302,6 +325,8 @@ typedef struct odp_pmr_match_t {
> >       const void      *val;   /**< Value to be matched */
> >       const void      *mask;  /**< Masked set of bits to be matched */
> >       unsigned int    val_sz;  /**< Size of the term value */
> > +     unsigned int    offset;  /**< User-defined offset in packet
> > +                                                     only valid if term
> ==
> > ODP_PMR_OFFSET */
> >  } odp_pmr_match_t;
> >   /**
> > --
> > 2.1.4
> >
> > _______________________________________________
> > lng-odp mailing list
> > lng-odp@lists.linaro.org
> > https://lists.linaro.org/mailman/listinfo/lng-odp
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to