> -----Original Message-----
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of Matias 
> Elo
> Sent: Monday, May 22, 2017 12:39 PM
> To: lng-odp@lists.linaro.org
> Subject: [lng-odp] [PATCH] linux-gen: sched: fix ordered enqueue to pktout 
> queue
> 
> Make sure packet order is maintained if enqueueing packets from an ordered
> queue.
> 
> Fixes https://bugs.linaro.org/show_bug.cgi?id=3002
> 
> Signed-off-by: Matias Elo <matias....@nokia.com>
> ---
>  platform/linux-generic/odp_packet_io.c       | 8 ++++++++
>  platform/linux-generic/odp_queue.c           | 1 +
>  platform/linux-generic/odp_schedule.c        | 5 ++++-
>  platform/linux-generic/odp_schedule_iquery.c | 5 ++++-
>  4 files changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-
> generic/odp_packet_io.c
> index 98460a5..7e45c63 100644
> --- a/platform/linux-generic/odp_packet_io.c
> +++ b/platform/linux-generic/odp_packet_io.c
> @@ -586,6 +586,10 @@ int pktout_enqueue(queue_entry_t *qentry, 
> odp_buffer_hdr_t *buf_hdr)
>       int len = 1;
>       int nbr;
> 
> +     if (sched_fn->ord_enq_multi(qentry->s.index, (void **)buf_hdr, len,
> +                                 &nbr))
> +             return nbr;
> +

The return value is not right here. If the ord_enq_multi() returns 1,
the packet was successfully enqueued and odp_queue_enq() should return 0,
not 1.

After this patch the default scheduler always returns 0 in this case so
the branch is never taken and the bug is not exposed.

>       nbr = odp_pktout_send(qentry->s.pktout, &pkt, len);
>       return (nbr == len ? 0 : -1);
>  }

        Janne


Reply via email to