On Wed, Nov 19, 2014 at 2:18 PM, Bill Fischofer
<[email protected]> wrote:
>
> I disagree.  The setters for booleans are simpler, cleaner, and more 
> programmer-friendly as a single API.  We don't need to create more APIs.  It 
> makes for more test cases and more complicated code since with little benefit.


I second Bill on this. As soon as you look at the API and see the
second argument you should start wondering what it's needed for.

>
>
> On Wed, Nov 19, 2014 at 3:54 AM, Anders Roxell <[email protected]> 
> wrote:
>>
>> On 2014-11-14 12:30, Maxim Uvarov wrote:
>> > Define API and implement promisc functions:
>> >  odp_pktio_set_promisc()
>> >  odp_pktio_promisc()
>> >
>> > Signed-off-by: Maxim Uvarov <[email protected]>
>> > ---
>> >  platform/linux-generic/include/api/odp_packet_io.h | 25 +++++++
>> >  platform/linux-generic/odp_packet_io.c             | 77 
>> > ++++++++++++++++++++++
>> >  2 files changed, 102 insertions(+)
>> >
>> > diff --git a/platform/linux-generic/include/api/odp_packet_io.h 
>> > b/platform/linux-generic/include/api/odp_packet_io.h
>> > index e5cf320..87589ce 100644
>> > --- a/platform/linux-generic/include/api/odp_packet_io.h
>> > +++ b/platform/linux-generic/include/api/odp_packet_io.h
>> > @@ -159,6 +159,31 @@ int odp_pktio_set_mtu(odp_pktio_t id, int mtu);
>> >  int odp_pktio_mtu(odp_pktio_t id);
>> >
>> >  /**
>> > + * Set promiscuous mode on a packet IO interface.
>> > + *
>> > + * @param[in] id     ODP packet IO handle.
>> > + * @param[in] enable 1 to enable promiscuous mode, 0 to disable
>> > + *
>> > + * @retval  0 on success.
>> > + * @retval -1 on a bad pktio id
>> > + * @retval -1 ilegal enable value
>> > + * @retval -1 any other error
>> > + */
>> > +int odp_pktio_set_promisc(odp_pktio_t id, int enable);
>>
>> I think it is clearer with two functions.
>>
>> void odp_pktio_set_promisc(odp_pktio_t id) and
>> odp_pktio_clear_promisc(odp_pktio_t id)
>>
>> we should do this also for other functions of this kind.
>>
>> The main problem of the present approach is that we don't know if val is
>> a boolean without looking at the documentation.
>>
>> Cheers,
>> Anders
>>
>> > +
>> > +/**
>> > + * Determine if promiscuous mode is enabled for a packet IO interface.
>> > + *
>> > + * @param[in] id ODP packet IO handle.
>> > + *
>> > + * @retval  1 if promiscuous mode is enabled.
>> > + * @retval  0 if promiscuous mode is disabled.
>> > + * @retval -1 on a bad pktio id
>> > + * @retval -1 any other error
>> > +*/
>> > +int odp_pktio_promisc(odp_pktio_t id);
>>
>> odp_pktio_is_promisc
>>
>> Cheers,
>> Anders
>>
>> _______________________________________________
>> lng-odp mailing list
>> [email protected]
>> http://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
> _______________________________________________
> lng-odp mailing list
> [email protected]
> http://lists.linaro.org/mailman/listinfo/lng-odp
>

_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to