On 10/13/2015 15:52, Bill Fischofer wrote:
Is there a reason we want to aggregate this into a struct? These are independent bits of metadata and should have their own access functions for best application/implementation flexibility.


it was 2 separate function in my v1 patch. After that propose was to keep it simple and do one struct, so it's that v2 patch. There were no objections to do that.

I think that link state are not performance functions and used only for debug propose. Like - no packets for some time, let's check if cable is plugged or not. Link speed set up is also related to control plane, and data plane will read it probably only once. I still think it's good to aggregate it to one call.

Maxim.

On Tue, Oct 13, 2015 at 7:39 AM, Maxim Uvarov <maxim.uva...@linaro.org <mailto:maxim.uva...@linaro.org>> wrote:

    Define API to get pktio link state: seed, autoneg, link up/down,
    duplex, started/stopped state.

    Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org
    <mailto:maxim.uva...@linaro.org>>
    ---
     v2: - use simple struct to return pktio link state;
         - odp will not modify link, only ready it's state;


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

    diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
    index d8e69ed..6c77e8d 100644
    --- a/include/odp/api/packet_io.h
    +++ b/include/odp/api/packet_io.h
    @@ -96,6 +96,28 @@ typedef struct odp_pktio_param_t {
     } odp_pktio_param_t;

     /**
    + * Packet IO link state information
    + */
    +typedef struct odp_pktio_link_state_t {
    +       uint32_t speed;         /**< Speed in Mbps: 10, 100, 1000
    etc */
    +       odp_bool_t up;          /**< 1 - link up, 0 - link down */
    +       odp_bool_t autoneg;     /**< 1 - autoneg on, 0 - off */
    +       odp_bool_t fd;          /**< 1 - full duplex, 0 - half
    duplex */
    +       odp_bool_t stopped;     /**< 1 - pktio stopped, 0 - started */
    +} odp_pktio_link_state_t;
    +
    +/**
    + * Get packet IO link state
    + *
    + * @param[in] pktio    Packet IO handle
    + * @param[out] state   Buffer to save link state
    + *
    + * @retval 0 on success (state info updated)
    + * @retval <0 on failure (state info not updated)
    + */
    +int odp_pktio_link_state(odp_pktio_t pktio,
    odp_pktio_link_state_t *state);
    +
    +/**
      * Open a packet IO interface
      *
      * An ODP program can open a single packet IO interface per
    device, attempts
    --
    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



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

Reply via email to