A specific "is_up()" would not help if the call can fail (return <0). User 
would still need to check against 1 vs. 0 vs. <0. I think the current 
specification is logical in the way that "1" means (up and) OK, "0" (down and) 
try again later, "<0" (failure) no point to try again before something else is 
changed in system config. Additional down states can be added later with the 
same logic:


/**
 * Determine pktio link status.
 *
 * @param pktio Packet IO handle.
 *
 * @retval  1 link is up
 * @retval  0 link is down
 * @retval  -1 A HW component is not present
 * @retval  -2 Lower layer down
 * @retval <-2 on other failures
 */
 int odp_pktio_link_status(odp_pktio_t pktio); 


-Petri



> -----Original Message-----
> From: lng-odp [mailto:[email protected]] On Behalf Of EXT
> Maxim Uvarov
> Sent: Monday, December 14, 2015 10:43 AM
> To: Alexandru Badicioiu
> Cc: LNG ODP Mailman List
> Subject: Re: [lng-odp] [PATCH] api: pktio link status
> 
> 
> 
> _link_up() might be confused with setting command. Not with getting
> status command.
> 
> How about:
> odp_pktio_status_link_up()?
> 
> There might be some other statuses for pktio which we can extend later
> and use the same prefix odp_pktio_status_
> 
> Maxim.
> 
> 
> On 12/11/2015 15:53, Alexandru Badicioiu wrote:
> > Wouldn't be the application code more clear if the function is renamed
> > to _link_up()?
> > Return values clearly suggest this. The application has to remember
> > that 1 means link up and 0 means link down.
> >
> > Alex
> >
> >
> > On 11 December 2015 at 14:44, Maxim Uvarov <[email protected]
> > <mailto:[email protected]>> wrote:
> >
> >     Signed-off-by: Maxim Uvarov <[email protected]
> >     <mailto:[email protected]>>
> >     ---
> >      v1 was link_state(), now it's link_status().
> >
> >      include/odp/api/packet_io.h | 11 +++++++++++
> >      1 file changed, 11 insertions(+)
> >
> >     diff --git a/include/odp/api/packet_io.h
> b/include/odp/api/packet_io.h
> >     index 443841e..8999b2c 100644
> >     --- a/include/odp/api/packet_io.h
> >     +++ b/include/odp/api/packet_io.h
> >     @@ -673,6 +673,17 @@ void
> >     odp_pktio_output_queue_param_init(odp_pktio_output_queue_param_t
> >     *param);
> >      void odp_pktio_print(odp_pktio_t pktio);
> >
> >      /**
> >     + * Determine pktio link is up or down for a packet IO interface.
> >     + *
> >     + * @param pktio Packet IO handle.
> >     + *
> >     + * @retval  1 link is up
> >     + * @retval  0 link is down
> >     + * @retval <0 on failure
> >     +*/
> >     +int odp_pktio_link_status(odp_pktio_t pktio);
> >     +
> >     +/**
> >       * @}
> >       */
> >
> >     --
> >     1.9.1
> >
> >     _______________________________________________
> >     lng-odp mailing list
> >     [email protected] <mailto:[email protected]>
> >     https://lists.linaro.org/mailman/listinfo/lng-odp
> >
> >
> 
> _______________________________________________
> lng-odp mailing list
> [email protected]
> https://lists.linaro.org/mailman/listinfo/lng-odp
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to