diff mbox

linux-generic: timer: correct definition of ODP_TIMEOUT_INVALID

Message ID 1465517368-12536-1-git-send-email-bill.fischofer@linaro.org
State Accepted
Commit 4cf18bb4f799e6601c20e54fafbdb58da538de89
Headers show

Commit Message

Bill Fischofer June 10, 2016, 12:09 a.m. UTC
Resolve bug https://bugs.linaro.org/show_bug.cgi?id=2316 by changing the
typedef of ODP_TIMEOUT_INVALID to be 0xffffffff to be consistent with other
buffer types. This enables pool 0 to be used as a timeout pool.

Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 platform/linux-generic/include/odp/api/plat/timer_types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Maxim Uvarov June 15, 2016, 11:14 a.m. UTC | #1
Merged,
Maxim.

On 06/10/16 03:09, Bill Fischofer wrote:
> Resolve bug https://bugs.linaro.org/show_bug.cgi?id=2316 by changing the
> typedef of ODP_TIMEOUT_INVALID to be 0xffffffff to be consistent with other
> buffer types. This enables pool 0 to be used as a timeout pool.
>
> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
> ---
>   platform/linux-generic/include/odp/api/plat/timer_types.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/platform/linux-generic/include/odp/api/plat/timer_types.h b/platform/linux-generic/include/odp/api/plat/timer_types.h
> index 93ea162..68d6f6f 100644
> --- a/platform/linux-generic/include/odp/api/plat/timer_types.h
> +++ b/platform/linux-generic/include/odp/api/plat/timer_types.h
> @@ -36,7 +36,7 @@ typedef ODP_HANDLE_T(odp_timer_t);
>   
>   typedef ODP_HANDLE_T(odp_timeout_t);
>   
> -#define ODP_TIMEOUT_INVALID  _odp_cast_scalar(odp_timeout_t, 0)
> +#define ODP_TIMEOUT_INVALID  _odp_cast_scalar(odp_timeout_t, 0xffffffff)
>   
>   /**
>    * @}
Zoltan Kiss June 15, 2016, 3:22 p.m. UTC | #2
Hi,

ODP-DPDK uses 0 or NULL for all _INVALID constants, because that's what 
rte_mbuf's using for that purpose. How could this fix work there? I 
mean, simply just applying this patch doesn't work, because then this 
value will be in conflict with ODP_EVENT_INVALID et all.

Zoli

On 10/06/16 01:09, Bill Fischofer wrote:
> Resolve bug https://bugs.linaro.org/show_bug.cgi?id=2316 by changing the
> typedef of ODP_TIMEOUT_INVALID to be 0xffffffff to be consistent with other
> buffer types. This enables pool 0 to be used as a timeout pool.
>
> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
> ---
>   platform/linux-generic/include/odp/api/plat/timer_types.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/platform/linux-generic/include/odp/api/plat/timer_types.h b/platform/linux-generic/include/odp/api/plat/timer_types.h
> index 93ea162..68d6f6f 100644
> --- a/platform/linux-generic/include/odp/api/plat/timer_types.h
> +++ b/platform/linux-generic/include/odp/api/plat/timer_types.h
> @@ -36,7 +36,7 @@ typedef ODP_HANDLE_T(odp_timer_t);
>
>   typedef ODP_HANDLE_T(odp_timeout_t);
>
> -#define ODP_TIMEOUT_INVALID  _odp_cast_scalar(odp_timeout_t, 0)
> +#define ODP_TIMEOUT_INVALID  _odp_cast_scalar(odp_timeout_t, 0xffffffff)
>
>   /**
>    * @}
>
Bill Fischofer June 16, 2016, 4:21 a.m. UTC | #3
odp-dpdk doesn't need this patch because you're using pointers as the
handle values, so NULL is always a distinguished pointer. In odp-linux, 0
is a valid buffer token, which is why this caused problems in that
implementation.



On Wed, Jun 15, 2016 at 10:22 PM, Zoltan Kiss <zoltan.kiss@linaro.org>
wrote:

> Hi,
>
> ODP-DPDK uses 0 or NULL for all _INVALID constants, because that's what
> rte_mbuf's using for that purpose. How could this fix work there? I mean,
> simply just applying this patch doesn't work, because then this value will
> be in conflict with ODP_EVENT_INVALID et all.
>
> Zoli
>
>
> On 10/06/16 01:09, Bill Fischofer wrote:
>
>> Resolve bug https://bugs.linaro.org/show_bug.cgi?id=2316 by changing the
>> typedef of ODP_TIMEOUT_INVALID to be 0xffffffff to be consistent with
>> other
>> buffer types. This enables pool 0 to be used as a timeout pool.
>>
>> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
>> ---
>>   platform/linux-generic/include/odp/api/plat/timer_types.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/platform/linux-generic/include/odp/api/plat/timer_types.h
>> b/platform/linux-generic/include/odp/api/plat/timer_types.h
>> index 93ea162..68d6f6f 100644
>> --- a/platform/linux-generic/include/odp/api/plat/timer_types.h
>> +++ b/platform/linux-generic/include/odp/api/plat/timer_types.h
>> @@ -36,7 +36,7 @@ typedef ODP_HANDLE_T(odp_timer_t);
>>
>>   typedef ODP_HANDLE_T(odp_timeout_t);
>>
>> -#define ODP_TIMEOUT_INVALID  _odp_cast_scalar(odp_timeout_t, 0)
>> +#define ODP_TIMEOUT_INVALID  _odp_cast_scalar(odp_timeout_t, 0xffffffff)
>>
>>   /**
>>    * @}
>>
>>
Maxim Uvarov June 16, 2016, 7:38 a.m. UTC | #4
On 06/16/16 07:21, Bill Fischofer wrote:
> odp-dpdk doesn't need this patch because you're using pointers as the
> handle values, so NULL is always a distinguished pointer. In odp-linux, 0
> is a valid buffer token, which is why this caused problems in that
> implementation.
>
I assume if there is pointer than:

#define ODP_TIMEOUT_INVALID NULL

if some platform define, than you should use it:

#define ODP_TIMEOUT_INVALID   SDK_INTERNAL_DEFINE_FOR_INVALID_TMO


Maxim.

>
> On Wed, Jun 15, 2016 at 10:22 PM, Zoltan Kiss <zoltan.kiss@linaro.org>
> wrote:
>
>> Hi,
>>
>> ODP-DPDK uses 0 or NULL for all _INVALID constants, because that's what
>> rte_mbuf's using for that purpose. How could this fix work there? I mean,
>> simply just applying this patch doesn't work, because then this value will
>> be in conflict with ODP_EVENT_INVALID et all.
>>
>> Zoli
>>
>>
>> On 10/06/16 01:09, Bill Fischofer wrote:
>>
>>> Resolve bug https://bugs.linaro.org/show_bug.cgi?id=2316 by changing the
>>> typedef of ODP_TIMEOUT_INVALID to be 0xffffffff to be consistent with
>>> other
>>> buffer types. This enables pool 0 to be used as a timeout pool.
>>>
>>> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
>>> ---
>>>    platform/linux-generic/include/odp/api/plat/timer_types.h | 2 +-
>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/platform/linux-generic/include/odp/api/plat/timer_types.h
>>> b/platform/linux-generic/include/odp/api/plat/timer_types.h
>>> index 93ea162..68d6f6f 100644
>>> --- a/platform/linux-generic/include/odp/api/plat/timer_types.h
>>> +++ b/platform/linux-generic/include/odp/api/plat/timer_types.h
>>> @@ -36,7 +36,7 @@ typedef ODP_HANDLE_T(odp_timer_t);
>>>
>>>    typedef ODP_HANDLE_T(odp_timeout_t);
>>>
>>> -#define ODP_TIMEOUT_INVALID  _odp_cast_scalar(odp_timeout_t, 0)
>>> +#define ODP_TIMEOUT_INVALID  _odp_cast_scalar(odp_timeout_t, 0xffffffff)
>>>
>>>    /**
>>>     * @}
>>>
>>>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
Bill Fischofer June 20, 2016, 12:27 p.m. UTC | #5
On Thu, Jun 16, 2016 at 2:38 PM, Maxim Uvarov <maxim.uvarov@linaro.org>
wrote:

> On 06/16/16 07:21, Bill Fischofer wrote:
>
>> odp-dpdk doesn't need this patch because you're using pointers as the
>> handle values, so NULL is always a distinguished pointer. In odp-linux, 0
>> is a valid buffer token, which is why this caused problems in that
>> implementation.
>>
>> I assume if there is pointer than:
>
> #define ODP_TIMEOUT_INVALID NULL
>
> if some platform define, than you should use it:
>
> #define ODP_TIMEOUT_INVALID   SDK_INTERNAL_DEFINE_FOR_INVALID_TMO


No, that doesn't work because ODP uses strong types. You so if you try to
say:

if (timeout == ODP_BUFFER_INVALID)

the compiler will flag that as a type mismatch, even though
ODP_BUFFER_INVALID and ODP_TIMEOUT_INVALID use the same bit pattern.  This
patch simply makes ODP_TIMEOUT_INVALID use the same designated "INVALID"
bit pattern as the other event types in odp-linux use.


>
>
>
> Maxim.
>
>
>> On Wed, Jun 15, 2016 at 10:22 PM, Zoltan Kiss <zoltan.kiss@linaro.org>
>> wrote:
>>
>> Hi,
>>>
>>> ODP-DPDK uses 0 or NULL for all _INVALID constants, because that's what
>>> rte_mbuf's using for that purpose. How could this fix work there? I mean,
>>> simply just applying this patch doesn't work, because then this value
>>> will
>>> be in conflict with ODP_EVENT_INVALID et all.
>>>
>>> Zoli
>>>
>>>
>>> On 10/06/16 01:09, Bill Fischofer wrote:
>>>
>>> Resolve bug https://bugs.linaro.org/show_bug.cgi?id=2316 by changing the
>>>> typedef of ODP_TIMEOUT_INVALID to be 0xffffffff to be consistent with
>>>> other
>>>> buffer types. This enables pool 0 to be used as a timeout pool.
>>>>
>>>> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
>>>> ---
>>>>    platform/linux-generic/include/odp/api/plat/timer_types.h | 2 +-
>>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/platform/linux-generic/include/odp/api/plat/timer_types.h
>>>> b/platform/linux-generic/include/odp/api/plat/timer_types.h
>>>> index 93ea162..68d6f6f 100644
>>>> --- a/platform/linux-generic/include/odp/api/plat/timer_types.h
>>>> +++ b/platform/linux-generic/include/odp/api/plat/timer_types.h
>>>> @@ -36,7 +36,7 @@ typedef ODP_HANDLE_T(odp_timer_t);
>>>>
>>>>    typedef ODP_HANDLE_T(odp_timeout_t);
>>>>
>>>> -#define ODP_TIMEOUT_INVALID  _odp_cast_scalar(odp_timeout_t, 0)
>>>> +#define ODP_TIMEOUT_INVALID  _odp_cast_scalar(odp_timeout_t,
>>>> 0xffffffff)
>>>>
>>>>    /**
>>>>     * @}
>>>>
>>>>
>>>> _______________________________________________
>> lng-odp mailing list
>> 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
>
Maxim Uvarov June 20, 2016, 12:41 p.m. UTC | #6
On 06/20/16 15:27, Bill Fischofer wrote:
>
> On Thu, Jun 16, 2016 at 2:38 PM, Maxim Uvarov <maxim.uvarov@linaro.org 
> <mailto:maxim.uvarov@linaro.org>> wrote:
>
>     On 06/16/16 07:21, Bill Fischofer wrote:
>
>         odp-dpdk doesn't need this patch because you're using pointers
>         as the
>         handle values, so NULL is always a distinguished pointer. In
>         odp-linux, 0
>         is a valid buffer token, which is why this caused problems in that
>         implementation.
>
>     I assume if there is pointer than:
>
>     #define ODP_TIMEOUT_INVALID NULL
>
>     if some platform define, than you should use it:
>
>     #define ODP_TIMEOUT_INVALID  SDK_INTERNAL_DEFINE_FOR_INVALID_TMO
>
>
> No, that doesn't work because ODP uses strong types. You so if you try 
> to say:
>
> if (timeout == ODP_BUFFER_INVALID)
>
> the compiler will flag that as a type mismatch, even though 
> ODP_BUFFER_INVALID and ODP_TIMEOUT_INVALID use the same bit pattern.  
> This patch simply makes ODP_TIMEOUT_INVALID use the same designated 
> "INVALID" bit pattern as the other event types in odp-linux use.

btw, if you are on ofp mailing list this patch also fixed some internal 
ofp test.

Maxim.



>
>
>
>     Maxim.
>
>
>         On Wed, Jun 15, 2016 at 10:22 PM, Zoltan Kiss
>         <zoltan.kiss@linaro.org <mailto:zoltan.kiss@linaro.org>>
>         wrote:
>
>             Hi,
>
>             ODP-DPDK uses 0 or NULL for all _INVALID constants,
>             because that's what
>             rte_mbuf's using for that purpose. How could this fix work
>             there? I mean,
>             simply just applying this patch doesn't work, because then
>             this value will
>             be in conflict with ODP_EVENT_INVALID et all.
>
>             Zoli
>
>
>             On 10/06/16 01:09, Bill Fischofer wrote:
>
>                 Resolve bug
>                 https://bugs.linaro.org/show_bug.cgi?id=2316 by
>                 changing the
>                 typedef of ODP_TIMEOUT_INVALID to be 0xffffffff to be
>                 consistent with
>                 other
>                 buffer types. This enables pool 0 to be used as a
>                 timeout pool.
>
>                 Signed-off-by: Bill Fischofer
>                 <bill.fischofer@linaro.org
>                 <mailto:bill.fischofer@linaro.org>>
>                 ---
>                  platform/linux-generic/include/odp/api/plat/timer_types.h
>                 | 2 +-
>                    1 file changed, 1 insertion(+), 1 deletion(-)
>
>                 diff --git
>                 a/platform/linux-generic/include/odp/api/plat/timer_types.h
>                 b/platform/linux-generic/include/odp/api/plat/timer_types.h
>                 index 93ea162..68d6f6f 100644
>                 ---
>                 a/platform/linux-generic/include/odp/api/plat/timer_types.h
>                 +++
>                 b/platform/linux-generic/include/odp/api/plat/timer_types.h
>                 @@ -36,7 +36,7 @@ typedef ODP_HANDLE_T(odp_timer_t);
>
>                    typedef ODP_HANDLE_T(odp_timeout_t);
>
>                 -#define ODP_TIMEOUT_INVALID
>                 _odp_cast_scalar(odp_timeout_t, 0)
>                 +#define ODP_TIMEOUT_INVALID
>                 _odp_cast_scalar(odp_timeout_t, 0xffffffff)
>
>                    /**
>                     * @}
>
>
>         _______________________________________________
>         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 <mailto:lng-odp@lists.linaro.org>
>     https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
diff mbox

Patch

diff --git a/platform/linux-generic/include/odp/api/plat/timer_types.h b/platform/linux-generic/include/odp/api/plat/timer_types.h
index 93ea162..68d6f6f 100644
--- a/platform/linux-generic/include/odp/api/plat/timer_types.h
+++ b/platform/linux-generic/include/odp/api/plat/timer_types.h
@@ -36,7 +36,7 @@  typedef ODP_HANDLE_T(odp_timer_t);
 
 typedef ODP_HANDLE_T(odp_timeout_t);
 
-#define ODP_TIMEOUT_INVALID  _odp_cast_scalar(odp_timeout_t, 0)
+#define ODP_TIMEOUT_INVALID  _odp_cast_scalar(odp_timeout_t, 0xffffffff)
 
 /**
  * @}