On 29/05/15 11:27, Savolainen, Petri (Nokia - FI/Espoo) wrote:
Agree with Ola. Completed TX ring resources can be freed in the next
odp_pktio_send/odp_pktio_recv/odp_schedule/etc calls.
I've explained it in my previous reply to Ola, but that wouldn't be good enough: receive and schedule can't do anything with packets on sent out on other interfaces. odp_pktio_send could be a solution, but then you have to make sure that you call it in a finite time, even if there is nothing to send. That wouldn't differ too much from what I proposed, only that we won't have a separate function call for TX completion, but odp_pktio_send(len=0)


 Application should
not care how and when those resources are freed.
ODP API is defined in C, so we don't have a garbage collector, and the whole point of poll mode applications is to avoid interrupts, so we won't have TX completion interrupts as well. That leaves the application to make sure TX completion happens in a finite time.


 It would be awkward if
implementation requires application to call the flush function e.g.
every 1ms, or otherwise some send calls may start failing, etc.
It's not about send fails, it's that without making sure TX completion happens after a finite period of time, no matter what, you are in the danger that your application blocks somewhere else because of those buffers are missing. You can mitigate that problem by providing plenty of buffers, and making sure different users will limit their usage so the pool is never exhausted, but this second part is probably much harder than you think: the app don't know how many RX/TX descriptors are used in the platform, and the platform doesn't know how many packets are in the pools where the packets coming from, and when is the time to give them back because that pool is exhausted.
Again, see that reply to Ola's mail for more details.


-Petri

*From:*lng-odp [mailto:lng-odp-boun...@lists.linaro.org] *On Behalf Of
*ext Ola Liljedahl
*Sent:* Thursday, May 28, 2015 7:41 PM
*To:* Zoltan Kiss
*Cc:* LNG ODP Mailman List
*Subject:* Re: [lng-odp] [API-NEXT PATCH] api-next: pktio: add
odp_pktio_send_complete() definition

On 28 May 2015 at 17:23, Zoltan Kiss <zoltan.k...@linaro.org
<mailto:zoltan.k...@linaro.org>> wrote:



On 28/05/15 16:00, Ola Liljedahl wrote:

I disprove of this solution. TX completion processing (cleaning TX
descriptor rings after transmission complete) is an implementation
(hardware) aspect and should be hidden from the application.


Unfortunately you can't, if you want your pktio application work with
poll mode drivers. In that case TX completion interrupt (can be)
disabled and the application has to control that as well. In case of
DPDK you just call the send function (with 0 packets, if you don't have
anything to send at the time)

Why do you have to retire transmitted packet if you are not transmitting
new packets (and need those descriptors in the TX ring)? Does the
application have too few packets in the pool so that reception will suffer?



      There isn't

    any corresponding call that refills the RX descriptor rings with fresh
    buffers.

    You can do that in the receive function, I think that's how the
    drivers are doing it generally.


    The completion processing can be performed from any ODP call, not
    necessary odp_pktio_send().


    I think "any" is not specific enough. Which one?

odp_pktio_recv, odp_schedule. Wherever the application blocks or busy
waits waiting for more packets.


    Can you provide a vague draft how would you fix the l2fwd example below?

I don't think anything needs fixing on the application level.


        -- Ola


        On 28 May 2015 at 16:38, Zoltan Kiss <zoltan.k...@linaro.org
        <mailto:zoltan.k...@linaro.org>
        <mailto:zoltan.k...@linaro.org <mailto:zoltan.k...@linaro.org>>>
        wrote:

             A pktio interface can be used with poll mode drivers, where TX
             completion often
             has to be done manually. This turned up as a problem with
        ODP-DPDK and
             odp_l2fwd:

             while (!exit_threads) {
                      pkts = odp_pktio_recv(pktio_src,...);
                      if (pkts <= 0)
                              continue;
             ...
                      if (pkts_ok > 0)
                              odp_pktio_send(pktio_dst, pkt_tbl, pkts_ok);
             ...
             }

             In this example we never call odp_pktio_send() on pktio_dst
        if there
             wasn't
             any new packets received on pktio_src. DPDK needs manual TX
             completion. The
             above example should have an
        odp_pktio_send_completion(pktio_dst)
             right at the
             beginning of the loop.

             Signed-off-by: Zoltan Kiss <zoltan.k...@linaro.org
        <mailto:zoltan.k...@linaro.org>
             <mailto:zoltan.k...@linaro.org
        <mailto:zoltan.k...@linaro.org>>>


             ---
               include/odp/api/packet_io.h | 16 ++++++++++++++++
               1 file changed, 16 insertions(+)

             diff --git a/include/odp/api/packet_io.h
        b/include/odp/api/packet_io.h
             index b97b2b8..3a4054c 100644
             --- a/include/odp/api/packet_io.h
             +++ b/include/odp/api/packet_io.h
             @@ -119,6 +119,22 @@ int odp_pktio_recv(odp_pktio_t pktio,
             odp_packet_t pkt_table[], int len);
               int odp_pktio_send(odp_pktio_t pktio, odp_packet_t
        pkt_table[],
             int len);

               /**
             + * Release sent packets
             + *
             + * This function should be called after sending on a
        pktio. If the
             platform
             + * doesn't implement send completion in other ways, this
        function
             should call
             + * odp_packet_free() on packets where transmission is already
             completed. It can
             + * be a no-op if the platform guarantees that the packets
        will be
             released upon
             + * completion, but the application must call it
        periodically after
             send to make
             + * sure packets are released.
             + *
             + * @param pktio        ODP packet IO handle
             + *
             + * @retval <0 on failure
             + */
             +int odp_pktio_send_complete(odp_pktio_t pktio);
             +
             +/**
                * Set the default input queue to be associated with a
        pktio handle
                *
                * @param pktio                ODP packet IO handle
             --
             1.9.1

             _______________________________________________
             lng-odp mailing list

        lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
        <mailto:lng-odp@lists.linaro.org <mailto: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