+cc Nicolas and Barry for their input.

In debugging why the TM Cunit tests weren't working, I discovered that one
of the issues was that they call odp_pktio_link_status() to verify that the
link is "up" and fail if it is not.  When running with a loopback interface
these tests always fail because we omitted having a link_status handler for
loopback devices so these calls always return -1.

Since loopback interfaces are purely internal (start and stop for them are
no-ops), it seems reasonable that they should always report link status
up.  Is there a reason why this isn't a good idea?

Thanks.

On Mon, Feb 29, 2016 at 2:53 PM, Bill Fischofer <[email protected]>
wrote:

> ODP loopback interfaces should always be considered up, so add a
> handler for odp_pktio_link_status() for this device type that always
> returns 1 to indicate the link is up.
>
> Signed-off-by: Bill Fischofer <[email protected]>
> ---
>  platform/linux-generic/pktio/loop.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/platform/linux-generic/pktio/loop.c
> b/platform/linux-generic/pktio/loop.c
> index dbb0e7b..0ea6d0e 100644
> --- a/platform/linux-generic/pktio/loop.c
> +++ b/platform/linux-generic/pktio/loop.c
> @@ -134,6 +134,12 @@ static int loopback_mac_addr_get(pktio_entry_t
> *pktio_entry ODP_UNUSED,
>         return ETH_ALEN;
>  }
>
> +static int loopback_link_status(pktio_entry_t *pktio_entry ODP_UNUSED)
> +{
> +       /* loopback interfaces are always up */
> +       return 1;
> +}
> +
>  static int loopback_promisc_mode_set(pktio_entry_t *pktio_entry,
>                                      odp_bool_t enable)
>  {
> @@ -176,6 +182,7 @@ const pktio_if_ops_t loopback_pktio_ops = {
>         .promisc_mode_set = loopback_promisc_mode_set,
>         .promisc_mode_get = loopback_promisc_mode_get,
>         .mac_get = loopback_mac_addr_get,
> +       .link_status = loopback_link_status,
>         .capability = NULL,
>         .input_queues_config = NULL,
>         .output_queues_config = NULL,
> --
> 2.5.0
>
>
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to