Reviewed-by: Balasubramanian Manoharan <[email protected]>

On 13 April 2016 at 19:50, Zoltan Kiss <[email protected]> wrote:

> In case of error the 'pkt' should be released by the calling function.
> Currently loopback gives it back to the receiver and report it as success
> in the stats.
>
> Signed-off-by: Zoltan Kiss <[email protected]>
> ---
>
> v2: handle release in caller instead, and adjust stats.
>
>  platform/linux-generic/odp_classification.c | 10 +++-------
>  platform/linux-generic/pktio/loop.c         |  9 ++++++---
>  2 files changed, 9 insertions(+), 10 deletions(-)
>
> diff --git a/platform/linux-generic/odp_classification.c
> b/platform/linux-generic/odp_classification.c
> index 8522023..3a18a78 100644
> --- a/platform/linux-generic/odp_classification.c
> +++ b/platform/linux-generic/odp_classification.c
> @@ -745,21 +745,17 @@ int _odp_packet_classifier(pktio_entry_t *entry,
> odp_packet_t pkt)
>         if (cos == NULL)
>                 return -1;
>
> -       if (cos->s.pool == NULL) {
> -               odp_packet_free(pkt);
> +       if (cos->s.pool == NULL)
>                 return -1;
> -       }
>
> -       if (cos->s.queue == NULL) {
> -               odp_packet_free(pkt);
> +       if (cos->s.queue == NULL)
>                 return -1;
> -       }
>
>         if (odp_packet_pool(pkt) != cos->s.pool->s.pool_hdl) {
>                 new_pkt = odp_packet_copy(pkt, cos->s.pool->s.pool_hdl);
> -               odp_packet_free(pkt);
>                 if (new_pkt == ODP_PACKET_INVALID)
>                         return -1;
> +               odp_packet_free(pkt);
>         } else {
>                 new_pkt = pkt;
>         }
> diff --git a/platform/linux-generic/pktio/loop.c
> b/platform/linux-generic/pktio/loop.c
> index 0ea6d0e..f6a8c1d 100644
> --- a/platform/linux-generic/pktio/loop.c
> +++ b/platform/linux-generic/pktio/loop.c
> @@ -70,10 +70,13 @@ static int loopback_recv(pktio_entry_t *pktio_entry,
> odp_packet_t pkts[],
>                         pkt_hdr = odp_packet_hdr(pkt);
>                         packet_parse_reset(pkt_hdr);
>                         packet_parse_l2(pkt_hdr);
> -                       if (0 > _odp_packet_classifier(pktio_entry, pkt)) {
> -                               pkts[j++] = pkt;
> +                       if (!_odp_packet_classifier(pktio_entry, pkt)) {
>                                 pktio_entry->s.stats.in_octets +=
> -                                       odp_packet_len(pkts[i]);
> +                                       odp_packet_len(pkt);
> +                       } else {
> +                               pktio_entry->s.stats.in_errors +=
> +                                       odp_packet_len(pkt);
> +                               odp_packet_free(pkt);
>                         }
>                 }
>                 nbr = j;
> --
> 1.9.1
>
>
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to