> -----Original Message-----
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of ext
> Zoltan Kiss
> Sent: Friday, June 05, 2015 8:51 PM
> To: lng-odp@lists.linaro.org
> Subject: [lng-odp] [API-NEXT PATCH v3 3/9] packet_io: release unsent
> packets after odp_pktio_send()
> 
> Signed-off-by: Zoltan Kiss <zoltan.k...@linaro.org>
> ---
>  example/packet/odp_pktio.c   | 10 +++++++++-
>  test/performance/odp_l2fwd.c | 12 ++++++++++--
>  2 files changed, 19 insertions(+), 3 deletions(-)
> 
> diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
> index f08d9f4..0b4a8f1 100644
> --- a/example/packet/odp_pktio.c
> +++ b/example/packet/odp_pktio.c
> @@ -282,9 +282,17 @@ static void *pktio_ifburst_thread(void *arg)
>                       /* Drop packets with errors */
>                       pkts_ok = drop_err_pkts(pkt_tbl, pkts);
>                       if (pkts_ok > 0) {
> +                             int sent;
> +
>                               /* Swap Eth MACs and IP-addrs */
>                               swap_pkt_addrs(pkt_tbl, pkts_ok);
> -                             odp_pktio_send(pktio, pkt_tbl, pkts_ok);
> +                             sent = odp_pktio_send(pktio, pkt_tbl, pkts_ok);
> +                             if (odp_unlikely(sent < pkts_ok)) {
> +                                     err_cnt += pkts_ok - sent;
> +                                     do
> +                                             odp_packet_free(pkt_tbl[sent]);
> +                                     while (++sent < pkts_ok);
> +                             }

Instead of dropping right away, application could retry couple of times (to 
demonstrate that congestion is part of normal operation).

-Petri

>                       }
> 
>                       if (odp_unlikely(pkts_ok != pkts))
> diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c
> index 5d4b833..dd0b4b1 100644
> --- a/test/performance/odp_l2fwd.c
> +++ b/test/performance/odp_l2fwd.c
> @@ -224,8 +224,16 @@ static void *pktio_ifburst_thread(void *arg)
> 
>               /* Drop packets with errors */
>               pkts_ok = drop_err_pkts(pkt_tbl, pkts);
> -             if (pkts_ok > 0)
> -                     odp_pktio_send(pktio_dst, pkt_tbl, pkts_ok);
> +             if (pkts_ok > 0) {
> +                     int sent = odp_pktio_send(pktio_dst, pkt_tbl, pkts_ok);
> +
> +                     if (odp_unlikely(sent < pkts_ok)) {
> +                             stats->drops += pkts_ok - sent;
> +                             do
> +                                     odp_packet_free(pkt_tbl[sent]);
> +                             while (++sent < pkts_ok);
> +                     }
> +             }
> 
>               if (odp_unlikely(pkts_ok != pkts))
>                       stats->drops += pkts - pkts_ok;
> --
> 1.9.1
> 
> _______________________________________________
> 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