Good catch.  The classifier can be completely bypassed only if there are no
classification rules (default or PMRs) in effect.  Presumably the
classifier itself can contain fastpath processing if only a default CoS is
in effect.

On Fri, Sep 18, 2015 at 5:25 AM, Bala Manoharan <bala.manoha...@linaro.org>
wrote:

> In this case the packet will not be dispatched to the default CoS in
> the scenario when the application configures only the default CoS and
> not the PMRs.
> Is this the expected behaviour? in case not then
> pktio_cls_enabled_set() should be configured in the
> odp_pktio_default_cos_set() function also.
>
>
> Regards,
> Bala
>
> On 18 September 2015 at 17:17, Petri Savolainen
> <petri.savolai...@nokia.com> wrote:
> > Skip packet_classifier function as long as there's no pmr
> > set for an pktio interface.
> >
> > Signed-off-by: Petri Savolainen <petri.savolai...@nokia.com>
> > ---
> >  platform/linux-generic/include/odp_packet_io_internal.h | 10 ++++++++++
> >  platform/linux-generic/odp_classification.c             |  2 ++
> >  platform/linux-generic/odp_packet_io.c                  |  6 ++----
> >  3 files changed, 14 insertions(+), 4 deletions(-)
> >
> > diff --git a/platform/linux-generic/include/odp_packet_io_internal.h
> b/platform/linux-generic/include/odp_packet_io_internal.h
> > index a21c683..6b03051 100644
> > --- a/platform/linux-generic/include/odp_packet_io_internal.h
> > +++ b/platform/linux-generic/include/odp_packet_io_internal.h
> > @@ -109,6 +109,16 @@ static inline pktio_entry_t
> *get_pktio_entry(odp_pktio_t pktio)
> >         return pktio_entry_ptr[pktio_to_id(pktio)];
> >  }
> >
> > +static inline int pktio_cls_enabled(pktio_entry_t *entry)
> > +{
> > +       return entry->s.cls_enabled;
> > +}
> > +
> > +static inline void pktio_cls_enabled_set(pktio_entry_t *entry, int ena)
> > +{
> > +       entry->s.cls_enabled = ena;
> > +}
> > +
> >  int pktin_poll(pktio_entry_t *entry);
> >
> >  extern const pktio_if_ops_t sock_mmsg_pktio_ops;
> > diff --git a/platform/linux-generic/odp_classification.c
> b/platform/linux-generic/odp_classification.c
> > index 6c1aff4..7809a42 100644
> > --- a/platform/linux-generic/odp_classification.c
> > +++ b/platform/linux-generic/odp_classification.c
> > @@ -488,6 +488,7 @@ int odp_pktio_pmr_cos(odp_pmr_t pmr_id,
> >         pktio_entry->s.cls.pmr[num_pmr] = pmr;
> >         pktio_entry->s.cls.cos[num_pmr] = cos;
> >         pktio_entry->s.cls.num_pmr++;
> > +       pktio_cls_enabled_set(pktio_entry, 1);
> >         UNLOCK(&pktio_entry->s.cls.lock);
> >
> >         return 0;
> > @@ -625,6 +626,7 @@ int odp_pktio_pmr_match_set_cos(odp_pmr_set_t
> pmr_set_id, odp_pktio_t src_pktio,
> >         pktio_entry->s.cls.pmr[num_pmr] = pmr;
> >         pktio_entry->s.cls.cos[num_pmr] = cos;
> >         pktio_entry->s.cls.num_pmr++;
> > +       pktio_cls_enabled_set(pktio_entry, 1);
> >         UNLOCK(&pktio_entry->s.cls.lock);
> >
> >         return 0;
> > diff --git a/platform/linux-generic/odp_packet_io.c
> b/platform/linux-generic/odp_packet_io.c
> > index d724933..aa2b566 100644
> > --- a/platform/linux-generic/odp_packet_io.c
> > +++ b/platform/linux-generic/odp_packet_io.c
> > @@ -154,9 +154,7 @@ static void unlock_entry_classifier(pktio_entry_t
> *entry)
> >  static void init_pktio_entry(pktio_entry_t *entry)
> >  {
> >         set_taken(entry);
> > -       /* Currently classifier is enabled by default. It should be
> enabled
> > -          only when used. */
> > -       entry->s.cls_enabled = 1;
> > +       pktio_cls_enabled_set(entry, 0);
> >         entry->s.inq_default = ODP_QUEUE_INVALID;
> >
> >         pktio_classifier_init(entry);
> > @@ -642,7 +640,7 @@ int pktin_poll(pktio_entry_t *entry)
> >                 buf = _odp_packet_to_buffer(pkt_tbl[i]);
> >                 hdr = odp_buf_to_hdr(buf);
> >
> > -               if (entry->s.cls_enabled) {
> > +               if (pktio_cls_enabled(entry)) {
> >                         if (packet_classifier(entry->s.handle,
> pkt_tbl[i]) < 0)
> >                                 hdr_tbl[num_enq++] = hdr;
> >                 } else {
> > --
> > 2.5.3
> >
> > _______________________________________________
> > 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