diff mbox

[API-NEXT,1/2] api: pktio link

Message ID 1442498163-12390-1-git-send-email-maxim.uvarov@linaro.org
State New
Headers show

Commit Message

Maxim Uvarov Sept. 17, 2015, 1:56 p.m. UTC
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 include/odp/api/packet_io.h | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

Comments

Nicolas Morey-Chaisemartin Sept. 17, 2015, 4:03 p.m. UTC | #1
Polling the link status makes sense but isn't setting the link state a bit redundant with pktio start/stop ?

On 09/17/2015 03:56 PM, Maxim Uvarov wrote:
> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
> ---
>  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 9b930bd..631aec2 100644
> --- a/include/odp/api/packet_io.h
> +++ b/include/odp/api/packet_io.h
> @@ -345,6 +345,28 @@ int odp_pktio_headroom_set(odp_pktio_t pktio, uint32_t headroom);
>  uint64_t odp_pktio_to_u64(odp_pktio_t pktio);
>  
>  /**
> + * Determine if link is up or down for a packet IO interface.
> + *
> + * @param[in] pktio Packet IO handle.
> + *
> + * @retval  1 link is up.
> + * @retval  0 link is down.
> + * @retval <0 on failure
> +*/
> +int odp_pktio_link(odp_pktio_t pktio);
> +
> +/**
> + * Up/Down link on a packet IO interface.
> + *
> + * @param[in] pktio	Packet IO handle.
> + * @param[in] enable	1 to link up, 0 to link down.
> + *
> + * @retval 0 on success
> + * @retval <0 on failure
> + */
> +int odp_pktio_link_set(odp_pktio_t pktio, odp_bool_t up);
> +
> +/**
>   * @}
>   */
>
Ola Liljedahl Oct. 8, 2015, 12:26 p.m. UTC | #2
On 17 September 2015 at 18:03, Nicolas Morey-Chaisemartin <nmorey@kalray.eu>
wrote:

> Polling the link status makes sense but isn't setting the link state a bit
> redundant with pktio start/stop ?
>
I also think that applications should not be able to (attempt to) control
the link state. The link state is actually decided by the PHY per
auto-negotiation configurations and of course what the peer PHY (if any)
supports. Setting auto-neg configurations or requesting auto-neg is also
out of scope for ordinary applications.

An alternative API would have a call that returns the speed of a network
(pktio) interface, e.g. 10/100/1000/10000. Add some values for unknown
speed (0?) and link down (error code, -1?). When using a virtual network
interface (e.g. paravirtualised interface terminated by a
hypervisor/vSwitch), a nominal link speed could be returned or perhaps some
special value to indicate a virtual interface without any physical link
speed.



> On 09/17/2015 03:56 PM, Maxim Uvarov wrote:
> > Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
> > ---
> >  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 9b930bd..631aec2 100644
> > --- a/include/odp/api/packet_io.h
> > +++ b/include/odp/api/packet_io.h
> > @@ -345,6 +345,28 @@ int odp_pktio_headroom_set(odp_pktio_t pktio,
> uint32_t headroom);
> >  uint64_t odp_pktio_to_u64(odp_pktio_t pktio);
> >
> >  /**
> > + * Determine if link is up or down for a packet IO interface.
> > + *
> > + * @param[in] pktio Packet IO handle.
> > + *
> > + * @retval  1 link is up.
> > + * @retval  0 link is down.
> > + * @retval <0 on failure
> > +*/
> > +int odp_pktio_link(odp_pktio_t pktio);
> > +
> > +/**
> > + * Up/Down link on a packet IO interface.
> > + *
> > + * @param[in] pktio  Packet IO handle.
> > + * @param[in] enable 1 to link up, 0 to link down.
> > + *
> > + * @retval 0 on success
> > + * @retval <0 on failure
> > + */
> > +int odp_pktio_link_set(odp_pktio_t pktio, odp_bool_t up);
> > +
> > +/**
> >   * @}
> >   */
> >
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
Maxim Uvarov Oct. 9, 2015, 12:32 p.m. UTC | #3
On 10/08/15 15:26, Ola Liljedahl wrote:
> On 17 September 2015 at 18:03, Nicolas Morey-Chaisemartin 
> <nmorey@kalray.eu <mailto:nmorey@kalray.eu>> wrote:
>
>     Polling the link status makes sense but isn't setting the link
>     state a bit redundant with pktio start/stop ?
>
On meeting we figured out that someone can unplug cable and it's not 
related to pktio_start/ stop. Link status has to be separate.

> I also think that applications should not be able to (attempt to) 
> control the link state. The link state is actually decided by the PHY 
> per auto-negotiation configurations and of course what the peer PHY 
> (if any) supports. Setting auto-neg configurations or requesting 
> auto-neg is also out of scope for ordinary applications.
>
> An alternative API would have a call that returns the speed of a 
> network (pktio) interface, e.g. 10/100/1000/10000. Add some values for 
> unknown speed (0?) and link down (error code, -1?). When using a 
> virtual network interface (e.g. paravirtualised interface terminated 
> by a hypervisor/vSwitch), a nominal link speed could be returned or 
> perhaps some special value to indicate a virtual interface without any 
> physical link speed.
>
>
If we do not need to modify link state/speed then it's reasonable to 
return simple struct as Petri wrote.

Ola, from my view app should not know if it's running on virtual 
environment or on real hw. If odp call says that link is down that means 
that current pktio link is down. And app has no idea is it's virtual or 
physical. For that reason I think Petris structure works well.

Maxim.

>
>     On 09/17/2015 03:56 PM, Maxim Uvarov wrote:
>     > Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org
>     <mailto:maxim.uvarov@linaro.org>>
>     > ---
>     >  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 9b930bd..631aec2 100644
>     > --- a/include/odp/api/packet_io.h
>     > +++ b/include/odp/api/packet_io.h
>     > @@ -345,6 +345,28 @@ int odp_pktio_headroom_set(odp_pktio_t
>     pktio, uint32_t headroom);
>     >  uint64_t odp_pktio_to_u64(odp_pktio_t pktio);
>     >
>     >  /**
>     > + * Determine if link is up or down for a packet IO interface.
>     > + *
>     > + * @param[in] pktio Packet IO handle.
>     > + *
>     > + * @retval  1 link is up.
>     > + * @retval  0 link is down.
>     > + * @retval <0 on failure
>     > +*/
>     > +int odp_pktio_link(odp_pktio_t pktio);
>     > +
>     > +/**
>     > + * Up/Down link on a packet IO interface.
>     > + *
>     > + * @param[in] pktio  Packet IO handle.
>     > + * @param[in] enable 1 to link up, 0 to link down.
>     > + *
>     > + * @retval 0 on success
>     > + * @retval <0 on failure
>     > + */
>     > +int odp_pktio_link_set(odp_pktio_t pktio, odp_bool_t up);
>     > +
>     > +/**
>     >   * @}
>     >   */
>     >
>
>     _______________________________________________
>     lng-odp mailing list
>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>     https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
diff mbox

Patch

diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
index 9b930bd..631aec2 100644
--- a/include/odp/api/packet_io.h
+++ b/include/odp/api/packet_io.h
@@ -345,6 +345,28 @@  int odp_pktio_headroom_set(odp_pktio_t pktio, uint32_t headroom);
 uint64_t odp_pktio_to_u64(odp_pktio_t pktio);
 
 /**
+ * Determine if link is up or down for a packet IO interface.
+ *
+ * @param[in] pktio Packet IO handle.
+ *
+ * @retval  1 link is up.
+ * @retval  0 link is down.
+ * @retval <0 on failure
+*/
+int odp_pktio_link(odp_pktio_t pktio);
+
+/**
+ * Up/Down link on a packet IO interface.
+ *
+ * @param[in] pktio	Packet IO handle.
+ * @param[in] enable	1 to link up, 0 to link down.
+ *
+ * @retval 0 on success
+ * @retval <0 on failure
+ */
+int odp_pktio_link_set(odp_pktio_t pktio, odp_bool_t up);
+
+/**
  * @}
  */