diff mbox

[RFC] api: packet_io: return headroom when set new one

Message ID 1452704348-11818-1-git-send-email-ivan.khoronzhuk@linaro.org
State New
Headers show

Commit Message

Ivan Khoronzhuk Jan. 13, 2016, 4:59 p.m. UTC
It can be used to restore headroom later. Does it possible a headroom
to be > sizeof(int32)/2?

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
 include/odp/api/packet_io.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Balasubramanian Manoharan Jan. 14, 2016, 12:03 p.m. UTC | #1
Maximum headroom is defined in ODP_PACKET_MAX_HEADROOM and is an
implementation specific value and will not be greater than uint32/2.

Having said that the current definition of headroom in ODP is that it
will not exceed a single segment meaning the headroom will NOT
overflow by adding an empty segment before.

Regarding returning the previous allocated headroom, IMO it is a stale
value and is of no significance to the existing application. If you
have any use-case in mind for returning previous headroom pls share.

Regards,
Bala


On 13 January 2016 at 22:29, Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> wrote:
> It can be used to restore headroom later. Does it possible a headroom
> to be > sizeof(int32)/2?
>
> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
> ---
>  include/odp/api/packet_io.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
> index cf92751..7b9d82a 100644
> --- a/include/odp/api/packet_io.h
> +++ b/include/odp/api/packet_io.h
> @@ -356,12 +356,12 @@ int odp_pktio_skip_set(odp_pktio_t pktio, uint32_t offset);
>   *                             Must not exceed the implementation
>   *                             defined ODP_PACKET_MAX_HEADROOM.
>   *
> - * @retval                     0 on success
> + * @retval                     prevoius headroom
>   * @retval                     <0 on failure
>   *
>   * @note Optional.
>   */
> -int odp_pktio_headroom_set(odp_pktio_t pktio, uint32_t headroom);
> +int32_t  odp_pktio_headroom_set(odp_pktio_t pktio, int32_t headroom);
>
>  /**
>   * Get printable value for an odp_pktio_t
> --
> 1.9.1
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
Bill Fischofer Jan. 14, 2016, 12:09 p.m. UTC | #2
Once we add the ability to attach additional segments to a packet (as is
being discussed in other threads) we may wish to revisit the concept of
"extensible" headroom/tailroom.  As long as packets can be extended there's
no logical reason why headroom/tailroom need be limited to a single segment.

On Thu, Jan 14, 2016 at 6:03 AM, Bala Manoharan <bala.manoharan@linaro.org>
wrote:

> Maximum headroom is defined in ODP_PACKET_MAX_HEADROOM and is an

> implementation specific value and will not be greater than uint32/2.

>

> Having said that the current definition of headroom in ODP is that it

> will not exceed a single segment meaning the headroom will NOT

> overflow by adding an empty segment before.

>

> Regarding returning the previous allocated headroom, IMO it is a stale

> value and is of no significance to the existing application. If you

> have any use-case in mind for returning previous headroom pls share.

>

> Regards,

> Bala

>

>

> On 13 January 2016 at 22:29, Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>

> wrote:

> > It can be used to restore headroom later. Does it possible a headroom

> > to be > sizeof(int32)/2?

> >

> > Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>

> > ---

> >  include/odp/api/packet_io.h | 4 ++--

> >  1 file changed, 2 insertions(+), 2 deletions(-)

> >

> > diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h

> > index cf92751..7b9d82a 100644

> > --- a/include/odp/api/packet_io.h

> > +++ b/include/odp/api/packet_io.h

> > @@ -356,12 +356,12 @@ int odp_pktio_skip_set(odp_pktio_t pktio, uint32_t

> offset);

> >   *                             Must not exceed the implementation

> >   *                             defined ODP_PACKET_MAX_HEADROOM.

> >   *

> > - * @retval                     0 on success

> > + * @retval                     prevoius headroom

> >   * @retval                     <0 on failure

> >   *

> >   * @note Optional.

> >   */

> > -int odp_pktio_headroom_set(odp_pktio_t pktio, uint32_t headroom);

> > +int32_t  odp_pktio_headroom_set(odp_pktio_t pktio, int32_t headroom);

> >

> >  /**

> >   * Get printable value for an odp_pktio_t

> > --

> > 1.9.1

> >

> > _______________________________________________

> > 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

>
Ivan Khoronzhuk Jan. 14, 2016, 12:26 p.m. UTC | #3
On 14.01.16 14:03, Bala Manoharan wrote:
> Maximum headroom is defined in ODP_PACKET_MAX_HEADROOM and is an
> implementation specific value and will not be greater than uint32/2.
>
> Having said that the current definition of headroom in ODP is that it
> will not exceed a single segment meaning the headroom will NOT
> overflow by adding an empty segment before.
>
> Regarding returning the previous allocated headroom, IMO it is a stale
> value and is of no significance to the existing application. If you
> have any use-case in mind for returning previous headroom pls share.
>
> Regards,
> Bala
>
at least one usecase it's testing, when the same pktio can be used
farther after testing/changing headroom call. Yes, it can be tested with own pktio,
but it's simpler.

For instance, like it's done in classification_test_pktio_set_headroom)_ test case.
By a big account, headroom has to be restored.

>
> On 13 January 2016 at 22:29, Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> wrote:
>> It can be used to restore headroom later. Does it possible a headroom
>> to be > sizeof(int32)/2?
>>
>> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
>> ---
>>   include/odp/api/packet_io.h | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
>> index cf92751..7b9d82a 100644
>> --- a/include/odp/api/packet_io.h
>> +++ b/include/odp/api/packet_io.h
>> @@ -356,12 +356,12 @@ int odp_pktio_skip_set(odp_pktio_t pktio, uint32_t offset);
>>    *                             Must not exceed the implementation
>>    *                             defined ODP_PACKET_MAX_HEADROOM.
>>    *
>> - * @retval                     0 on success
>> + * @retval                     prevoius headroom
>>    * @retval                     <0 on failure
>>    *
>>    * @note Optional.
>>    */
>> -int odp_pktio_headroom_set(odp_pktio_t pktio, uint32_t headroom);
>> +int32_t  odp_pktio_headroom_set(odp_pktio_t pktio, int32_t headroom);
>>
>>   /**
>>    * Get printable value for an odp_pktio_t
>> --
>> 1.9.1
>>
>> _______________________________________________
>> lng-odp mailing list
>> 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 cf92751..7b9d82a 100644
--- a/include/odp/api/packet_io.h
+++ b/include/odp/api/packet_io.h
@@ -356,12 +356,12 @@  int odp_pktio_skip_set(odp_pktio_t pktio, uint32_t offset);
  *				Must not exceed the implementation
  *				defined ODP_PACKET_MAX_HEADROOM.
  *
- * @retval			0 on success
+ * @retval			prevoius headroom
  * @retval			<0 on failure
  *
  * @note Optional.
  */
-int odp_pktio_headroom_set(odp_pktio_t pktio, uint32_t headroom);
+int32_t  odp_pktio_headroom_set(odp_pktio_t pktio, int32_t headroom);
 
 /**
  * Get printable value for an odp_pktio_t