Message ID | 1433526691-20058-4-git-send-email-zoltan.kiss@linaro.org |
---|---|
State | Superseded |
Headers | show |
On 09/06/15 13:52, Savolainen, Petri (Nokia - FI/Espoo) wrote: >> --- 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). I think that should be introduced in a separate patch. This one just tries to fix a bug, not introducing a new feature. Zoli
On 22 June 2015 at 18:53, Zoltan Kiss <zoltan.kiss@linaro.org> wrote: > > > On 09/06/15 13:52, Savolainen, Petri (Nokia - FI/Espoo) wrote: > >> --- 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). >> > > I think that should be introduced in a separate patch. This one just tries > to fix a bug, not introducing a new feature. > Agree. > > Zoli > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/lng-odp >
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); + } } 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;
Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org> --- example/packet/odp_pktio.c | 10 +++++++++- test/performance/odp_l2fwd.c | 12 ++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-)