On 28/05/15 16:00, Mike Holmes wrote:


On 28 May 2015 at 10:38, Zoltan Kiss <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>>
    ---
      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,


You provide an example of usage above, can it be added between @code and
  @endcode in this documentation for others to see in the rendered docs?

Makes sense.



    but the application must call it periodically after send to make
    + * sure packets are released.


This is an important requirement and should be highlighted in the final
doc with @note:-
@note The application must call  odp_pktio_send_complete periodically
after send to make sure packets are released.
Ok

Also is there any guild line on "periodically" is once ok, I assume not,
but I also assume that it is not as frequent as for every send.
The only guideline that it should happen periodically, the period length can be arbitrary, but finite. Otherwise it's the applications decision what's the most optimal.

The odp_pktio_send  documentation could also do with a reference to
  odp_pktio_send_complete to ensure that readers will know of the
requirement, they may miss it otherwise.
Yes, I want to add a description there later on

    + *
    + * @param pktio        ODP packet IO handle
    + *
    + * @retval <0 on failure


Are there any specific failures you can define, specifics are nice
things to test in the validation suite to ensure all platforms behave
the same way

I don't have anything in mind, I'm actually not sure if we should return anything here. I can't come up with a scenario where releasing a buffer should ever fail.


    + */
    +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>
    https://lists.linaro.org/mailman/listinfo/lng-odp




--
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org <http://www.linaro.org/>***│ *Open source software for ARM SoCs

__


_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to