diff mbox

[PATCHv2] Don't reparse on add/rem data for payload changes

Message ID 1418770214-17990-1-git-send-email-bill.fischofer@linaro.org
State New
Headers show

Commit Message

Bill Fischofer Dec. 16, 2014, 10:50 p.m. UTC
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---
v2 Ensures that parser metadata is copied if we're not reparsing

 platform/linux-generic/include/odp_packet_internal.h | 20 ++++++++++++++++++++
 platform/linux-generic/odp_packet.c                  | 12 ++++++++++--
 2 files changed, 30 insertions(+), 2 deletions(-)

Comments

Anders Roxell Dec. 16, 2014, 11:34 p.m. UTC | #1
An earlier email described the a template for the short description:
(linux-generic|api|doc|validation|example): file/func: short desc.

This is the long description!

Signed-off-by: ...
"---"

say whatever you like down here that shouldn't be in the commit message.


Cheers,
Anders

On 16 December 2014 at 23:50, Bill Fischofer <bill.fischofer@linaro.org> wrote:
> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
> ---
> v2 Ensures that parser metadata is copied if we're not reparsing
>
>  platform/linux-generic/include/odp_packet_internal.h | 20 ++++++++++++++++++++
>  platform/linux-generic/odp_packet.c                  | 12 ++++++++++--
>  2 files changed, 30 insertions(+), 2 deletions(-)
>
> diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h
> index 068f969..54a12b5 100644
> --- a/platform/linux-generic/include/odp_packet_internal.h
> +++ b/platform/linux-generic/include/odp_packet_internal.h
> @@ -187,6 +187,26 @@ static inline void packet_init(pool_entry_t *pool,
>                 (pool->s.headroom + size);
>  }
>
> +static inline void copy_packet_parser_metadata(odp_packet_hdr_t *src_hdr,
> +                                              odp_packet_hdr_t *dst_hdr)
> +{
> +       dst_hdr->input_flags    = src_hdr->input_flags;
> +       dst_hdr->error_flags    = src_hdr->error_flags;
> +       dst_hdr->output_flags   = src_hdr->output_flags;
> +
> +       dst_hdr->l2_offset      = src_hdr->l2_offset;
> +       dst_hdr->l3_offset      = src_hdr->l3_offset;
> +       dst_hdr->l4_offset      = src_hdr->l4_offset;
> +       dst_hdr->payload_offset = src_hdr->payload_offset;
> +
> +       dst_hdr->vlan_s_tag     = src_hdr->vlan_s_tag;
> +       dst_hdr->vlan_c_tag     = src_hdr->vlan_c_tag;
> +       dst_hdr->l3_protocol    = src_hdr->l3_protocol;
> +       dst_hdr->l3_len         = src_hdr->l3_len;
> +       dst_hdr->l4_protocol    = src_hdr->l4_protocol;
> +       dst_hdr->l4_len         = src_hdr->l4_len;
> +}
> +
>  static inline void *packet_map(odp_packet_hdr_t *pkt_hdr,
>                                uint32_t offset, uint32_t *seglen)
>  {
> diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c
> index 65e6288..43a9419 100644
> --- a/platform/linux-generic/odp_packet.c
> +++ b/platform/linux-generic/odp_packet.c
> @@ -396,12 +396,16 @@ odp_packet_t odp_packet_add_data(odp_packet_t pkt, uint32_t offset,
>                         newpkt = ODP_PACKET_INVALID;
>                 } else {
>                         odp_packet_hdr_t *new_hdr = odp_packet_hdr(newpkt);
> +                       new_hdr->input = pkt_hdr->input;
>                         new_hdr->buf_hdr.buf_u64 = pkt_hdr->buf_hdr.buf_u64;
>                         odp_atomic_store_u32(
>                                 &new_hdr->buf_hdr.ref_count,
>                                 odp_atomic_load_u32(
>                                         &pkt_hdr->buf_hdr.ref_count));
> -                       _odp_packet_parse(newpkt);
> +                       if (offset < pkt_hdr->payload_offset)
> +                               _odp_packet_parse(newpkt);
> +                       else
> +                               copy_packet_parser_metadata(pkt_hdr, new_hdr);
>                         odp_packet_free(pkt);
>                 }
>         }
> @@ -431,12 +435,16 @@ odp_packet_t odp_packet_rem_data(odp_packet_t pkt, uint32_t offset,
>                         newpkt = ODP_PACKET_INVALID;
>                 } else {
>                         odp_packet_hdr_t *new_hdr = odp_packet_hdr(newpkt);
> +                       new_hdr->input = pkt_hdr->input;
>                         new_hdr->buf_hdr.buf_u64 = pkt_hdr->buf_hdr.buf_u64;
>                         odp_atomic_store_u32(
>                                 &new_hdr->buf_hdr.ref_count,
>                                 odp_atomic_load_u32(
>                                         &pkt_hdr->buf_hdr.ref_count));
> -                       _odp_packet_parse(newpkt);
> +                       if (offset < pkt_hdr->payload_offset)
> +                               _odp_packet_parse(newpkt);
> +                       else
> +                               copy_packet_parser_metadata(pkt_hdr, new_hdr);
>                         odp_packet_free(pkt);
>                 }
>         }
> --
> 1.8.3.2
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
Bill Fischofer Dec. 17, 2014, 1:58 a.m. UTC | #2
I've resent the last two patches with better subject lines.

Bill

On Tue, Dec 16, 2014 at 5:34 PM, Anders Roxell <anders.roxell@linaro.org>
wrote:
>
> An earlier email described the a template for the short description:
> (linux-generic|api|doc|validation|example): file/func: short desc.
>
> This is the long description!
>
> Signed-off-by: ...
> "---"
>
> say whatever you like down here that shouldn't be in the commit message.
>
>
> Cheers,
> Anders
>
> On 16 December 2014 at 23:50, Bill Fischofer <bill.fischofer@linaro.org>
> wrote:
> > Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
> > ---
> > v2 Ensures that parser metadata is copied if we're not reparsing
> >
> >  platform/linux-generic/include/odp_packet_internal.h | 20
> ++++++++++++++++++++
> >  platform/linux-generic/odp_packet.c                  | 12 ++++++++++--
> >  2 files changed, 30 insertions(+), 2 deletions(-)
> >
> > diff --git a/platform/linux-generic/include/odp_packet_internal.h
> b/platform/linux-generic/include/odp_packet_internal.h
> > index 068f969..54a12b5 100644
> > --- a/platform/linux-generic/include/odp_packet_internal.h
> > +++ b/platform/linux-generic/include/odp_packet_internal.h
> > @@ -187,6 +187,26 @@ static inline void packet_init(pool_entry_t *pool,
> >                 (pool->s.headroom + size);
> >  }
> >
> > +static inline void copy_packet_parser_metadata(odp_packet_hdr_t
> *src_hdr,
> > +                                              odp_packet_hdr_t *dst_hdr)
> > +{
> > +       dst_hdr->input_flags    = src_hdr->input_flags;
> > +       dst_hdr->error_flags    = src_hdr->error_flags;
> > +       dst_hdr->output_flags   = src_hdr->output_flags;
> > +
> > +       dst_hdr->l2_offset      = src_hdr->l2_offset;
> > +       dst_hdr->l3_offset      = src_hdr->l3_offset;
> > +       dst_hdr->l4_offset      = src_hdr->l4_offset;
> > +       dst_hdr->payload_offset = src_hdr->payload_offset;
> > +
> > +       dst_hdr->vlan_s_tag     = src_hdr->vlan_s_tag;
> > +       dst_hdr->vlan_c_tag     = src_hdr->vlan_c_tag;
> > +       dst_hdr->l3_protocol    = src_hdr->l3_protocol;
> > +       dst_hdr->l3_len         = src_hdr->l3_len;
> > +       dst_hdr->l4_protocol    = src_hdr->l4_protocol;
> > +       dst_hdr->l4_len         = src_hdr->l4_len;
> > +}
> > +
> >  static inline void *packet_map(odp_packet_hdr_t *pkt_hdr,
> >                                uint32_t offset, uint32_t *seglen)
> >  {
> > diff --git a/platform/linux-generic/odp_packet.c
> b/platform/linux-generic/odp_packet.c
> > index 65e6288..43a9419 100644
> > --- a/platform/linux-generic/odp_packet.c
> > +++ b/platform/linux-generic/odp_packet.c
> > @@ -396,12 +396,16 @@ odp_packet_t odp_packet_add_data(odp_packet_t pkt,
> uint32_t offset,
> >                         newpkt = ODP_PACKET_INVALID;
> >                 } else {
> >                         odp_packet_hdr_t *new_hdr =
> odp_packet_hdr(newpkt);
> > +                       new_hdr->input = pkt_hdr->input;
> >                         new_hdr->buf_hdr.buf_u64 =
> pkt_hdr->buf_hdr.buf_u64;
> >                         odp_atomic_store_u32(
> >                                 &new_hdr->buf_hdr.ref_count,
> >                                 odp_atomic_load_u32(
> >                                         &pkt_hdr->buf_hdr.ref_count));
> > -                       _odp_packet_parse(newpkt);
> > +                       if (offset < pkt_hdr->payload_offset)
> > +                               _odp_packet_parse(newpkt);
> > +                       else
> > +                               copy_packet_parser_metadata(pkt_hdr,
> new_hdr);
> >                         odp_packet_free(pkt);
> >                 }
> >         }
> > @@ -431,12 +435,16 @@ odp_packet_t odp_packet_rem_data(odp_packet_t pkt,
> uint32_t offset,
> >                         newpkt = ODP_PACKET_INVALID;
> >                 } else {
> >                         odp_packet_hdr_t *new_hdr =
> odp_packet_hdr(newpkt);
> > +                       new_hdr->input = pkt_hdr->input;
> >                         new_hdr->buf_hdr.buf_u64 =
> pkt_hdr->buf_hdr.buf_u64;
> >                         odp_atomic_store_u32(
> >                                 &new_hdr->buf_hdr.ref_count,
> >                                 odp_atomic_load_u32(
> >                                         &pkt_hdr->buf_hdr.ref_count));
> > -                       _odp_packet_parse(newpkt);
> > +                       if (offset < pkt_hdr->payload_offset)
> > +                               _odp_packet_parse(newpkt);
> > +                       else
> > +                               copy_packet_parser_metadata(pkt_hdr,
> new_hdr);
> >                         odp_packet_free(pkt);
> >                 }
> >         }
> > --
> > 1.8.3.2
> >
> >
> > _______________________________________________
> > lng-odp mailing list
> > lng-odp@lists.linaro.org
> > http://lists.linaro.org/mailman/listinfo/lng-odp
>
Ola Liljedahl Dec. 17, 2014, 10:23 a.m. UTC | #3
On 17 December 2014 at 00:34, Anders Roxell <anders.roxell@linaro.org> wrote:
> An earlier email described the a template for the short description:
> (linux-generic|api|doc|validation|example): file/func: short desc.
>
> This is the long description!
>
> Signed-off-by: ...
> "---"
>
> say whatever you like down here that shouldn't be in the commit message.
I am still not clear on what should be in the long description as
opposed to under the "---" and thus not included in the commit log.
I can assume the information on the change that will always be
interesting (e.g. in ten years time to unrelated people) should be
part of the (long) commit message while information that is only
relevant at the moment (e.g. "updated after comments from Kalle" or
"rebased") should be under the "---".

-- Ola

>
>
> Cheers,
> Anders
>
> On 16 December 2014 at 23:50, Bill Fischofer <bill.fischofer@linaro.org> wrote:
>> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
>> ---
>> v2 Ensures that parser metadata is copied if we're not reparsing
>>
>>  platform/linux-generic/include/odp_packet_internal.h | 20 ++++++++++++++++++++
>>  platform/linux-generic/odp_packet.c                  | 12 ++++++++++--
>>  2 files changed, 30 insertions(+), 2 deletions(-)
>>
>> diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h
>> index 068f969..54a12b5 100644
>> --- a/platform/linux-generic/include/odp_packet_internal.h
>> +++ b/platform/linux-generic/include/odp_packet_internal.h
>> @@ -187,6 +187,26 @@ static inline void packet_init(pool_entry_t *pool,
>>                 (pool->s.headroom + size);
>>  }
>>
>> +static inline void copy_packet_parser_metadata(odp_packet_hdr_t *src_hdr,
>> +                                              odp_packet_hdr_t *dst_hdr)
>> +{
>> +       dst_hdr->input_flags    = src_hdr->input_flags;
>> +       dst_hdr->error_flags    = src_hdr->error_flags;
>> +       dst_hdr->output_flags   = src_hdr->output_flags;
>> +
>> +       dst_hdr->l2_offset      = src_hdr->l2_offset;
>> +       dst_hdr->l3_offset      = src_hdr->l3_offset;
>> +       dst_hdr->l4_offset      = src_hdr->l4_offset;
>> +       dst_hdr->payload_offset = src_hdr->payload_offset;
>> +
>> +       dst_hdr->vlan_s_tag     = src_hdr->vlan_s_tag;
>> +       dst_hdr->vlan_c_tag     = src_hdr->vlan_c_tag;
>> +       dst_hdr->l3_protocol    = src_hdr->l3_protocol;
>> +       dst_hdr->l3_len         = src_hdr->l3_len;
>> +       dst_hdr->l4_protocol    = src_hdr->l4_protocol;
>> +       dst_hdr->l4_len         = src_hdr->l4_len;
>> +}
>> +
>>  static inline void *packet_map(odp_packet_hdr_t *pkt_hdr,
>>                                uint32_t offset, uint32_t *seglen)
>>  {
>> diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c
>> index 65e6288..43a9419 100644
>> --- a/platform/linux-generic/odp_packet.c
>> +++ b/platform/linux-generic/odp_packet.c
>> @@ -396,12 +396,16 @@ odp_packet_t odp_packet_add_data(odp_packet_t pkt, uint32_t offset,
>>                         newpkt = ODP_PACKET_INVALID;
>>                 } else {
>>                         odp_packet_hdr_t *new_hdr = odp_packet_hdr(newpkt);
>> +                       new_hdr->input = pkt_hdr->input;
>>                         new_hdr->buf_hdr.buf_u64 = pkt_hdr->buf_hdr.buf_u64;
>>                         odp_atomic_store_u32(
>>                                 &new_hdr->buf_hdr.ref_count,
>>                                 odp_atomic_load_u32(
>>                                         &pkt_hdr->buf_hdr.ref_count));
>> -                       _odp_packet_parse(newpkt);
>> +                       if (offset < pkt_hdr->payload_offset)
>> +                               _odp_packet_parse(newpkt);
>> +                       else
>> +                               copy_packet_parser_metadata(pkt_hdr, new_hdr);
>>                         odp_packet_free(pkt);
>>                 }
>>         }
>> @@ -431,12 +435,16 @@ odp_packet_t odp_packet_rem_data(odp_packet_t pkt, uint32_t offset,
>>                         newpkt = ODP_PACKET_INVALID;
>>                 } else {
>>                         odp_packet_hdr_t *new_hdr = odp_packet_hdr(newpkt);
>> +                       new_hdr->input = pkt_hdr->input;
>>                         new_hdr->buf_hdr.buf_u64 = pkt_hdr->buf_hdr.buf_u64;
>>                         odp_atomic_store_u32(
>>                                 &new_hdr->buf_hdr.ref_count,
>>                                 odp_atomic_load_u32(
>>                                         &pkt_hdr->buf_hdr.ref_count));
>> -                       _odp_packet_parse(newpkt);
>> +                       if (offset < pkt_hdr->payload_offset)
>> +                               _odp_packet_parse(newpkt);
>> +                       else
>> +                               copy_packet_parser_metadata(pkt_hdr, new_hdr);
>>                         odp_packet_free(pkt);
>>                 }
>>         }
>> --
>> 1.8.3.2
>>
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/lng-odp
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
Maxim Uvarov Dec. 17, 2014, 4:43 p.m. UTC | #4
On 12/17/2014 01:23 PM, Ola Liljedahl wrote:
> On 17 December 2014 at 00:34, Anders Roxell <anders.roxell@linaro.org> wrote:
>> An earlier email described the a template for the short description:
>> (linux-generic|api|doc|validation|example): file/func: short desc.
>>
>> This is the long description!
>>
>> Signed-off-by: ...
>> "---"
>>
>> say whatever you like down here that shouldn't be in the commit message.
> I am still not clear on what should be in the long description as
> opposed to under the "---" and thus not included in the commit log.
> I can assume the information on the change that will always be
> interesting (e.g. in ten years time to unrelated people) should be
> part of the (long) commit message while information that is only
> relevant at the moment (e.g. "updated after comments from Kalle" or
> "rebased") should be under the "---".
>
> -- Ola

Yes. Commit log goes to history (git). While everything after --- will 
be only
in mailing list.

Maxim.

>
>>
>> Cheers,
>> Anders
>>
>> On 16 December 2014 at 23:50, Bill Fischofer <bill.fischofer@linaro.org> wrote:
>>> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
>>> ---
>>> v2 Ensures that parser metadata is copied if we're not reparsing
>>>
>>>   platform/linux-generic/include/odp_packet_internal.h | 20 ++++++++++++++++++++
>>>   platform/linux-generic/odp_packet.c                  | 12 ++++++++++--
>>>   2 files changed, 30 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h
>>> index 068f969..54a12b5 100644
>>> --- a/platform/linux-generic/include/odp_packet_internal.h
>>> +++ b/platform/linux-generic/include/odp_packet_internal.h
>>> @@ -187,6 +187,26 @@ static inline void packet_init(pool_entry_t *pool,
>>>                  (pool->s.headroom + size);
>>>   }
>>>
>>> +static inline void copy_packet_parser_metadata(odp_packet_hdr_t *src_hdr,
>>> +                                              odp_packet_hdr_t *dst_hdr)
>>> +{
>>> +       dst_hdr->input_flags    = src_hdr->input_flags;
>>> +       dst_hdr->error_flags    = src_hdr->error_flags;
>>> +       dst_hdr->output_flags   = src_hdr->output_flags;
>>> +
>>> +       dst_hdr->l2_offset      = src_hdr->l2_offset;
>>> +       dst_hdr->l3_offset      = src_hdr->l3_offset;
>>> +       dst_hdr->l4_offset      = src_hdr->l4_offset;
>>> +       dst_hdr->payload_offset = src_hdr->payload_offset;
>>> +
>>> +       dst_hdr->vlan_s_tag     = src_hdr->vlan_s_tag;
>>> +       dst_hdr->vlan_c_tag     = src_hdr->vlan_c_tag;
>>> +       dst_hdr->l3_protocol    = src_hdr->l3_protocol;
>>> +       dst_hdr->l3_len         = src_hdr->l3_len;
>>> +       dst_hdr->l4_protocol    = src_hdr->l4_protocol;
>>> +       dst_hdr->l4_len         = src_hdr->l4_len;
>>> +}
>>> +
>>>   static inline void *packet_map(odp_packet_hdr_t *pkt_hdr,
>>>                                 uint32_t offset, uint32_t *seglen)
>>>   {
>>> diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c
>>> index 65e6288..43a9419 100644
>>> --- a/platform/linux-generic/odp_packet.c
>>> +++ b/platform/linux-generic/odp_packet.c
>>> @@ -396,12 +396,16 @@ odp_packet_t odp_packet_add_data(odp_packet_t pkt, uint32_t offset,
>>>                          newpkt = ODP_PACKET_INVALID;
>>>                  } else {
>>>                          odp_packet_hdr_t *new_hdr = odp_packet_hdr(newpkt);
>>> +                       new_hdr->input = pkt_hdr->input;
>>>                          new_hdr->buf_hdr.buf_u64 = pkt_hdr->buf_hdr.buf_u64;
>>>                          odp_atomic_store_u32(
>>>                                  &new_hdr->buf_hdr.ref_count,
>>>                                  odp_atomic_load_u32(
>>>                                          &pkt_hdr->buf_hdr.ref_count));
>>> -                       _odp_packet_parse(newpkt);
>>> +                       if (offset < pkt_hdr->payload_offset)
>>> +                               _odp_packet_parse(newpkt);
>>> +                       else
>>> +                               copy_packet_parser_metadata(pkt_hdr, new_hdr);
>>>                          odp_packet_free(pkt);
>>>                  }
>>>          }
>>> @@ -431,12 +435,16 @@ odp_packet_t odp_packet_rem_data(odp_packet_t pkt, uint32_t offset,
>>>                          newpkt = ODP_PACKET_INVALID;
>>>                  } else {
>>>                          odp_packet_hdr_t *new_hdr = odp_packet_hdr(newpkt);
>>> +                       new_hdr->input = pkt_hdr->input;
>>>                          new_hdr->buf_hdr.buf_u64 = pkt_hdr->buf_hdr.buf_u64;
>>>                          odp_atomic_store_u32(
>>>                                  &new_hdr->buf_hdr.ref_count,
>>>                                  odp_atomic_load_u32(
>>>                                          &pkt_hdr->buf_hdr.ref_count));
>>> -                       _odp_packet_parse(newpkt);
>>> +                       if (offset < pkt_hdr->payload_offset)
>>> +                               _odp_packet_parse(newpkt);
>>> +                       else
>>> +                               copy_packet_parser_metadata(pkt_hdr, new_hdr);
>>>                          odp_packet_free(pkt);
>>>                  }
>>>          }
>>> --
>>> 1.8.3.2
>>>
>>>
>>> _______________________________________________
>>> lng-odp mailing list
>>> lng-odp@lists.linaro.org
>>> http://lists.linaro.org/mailman/listinfo/lng-odp
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/lng-odp
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
diff mbox

Patch

diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h
index 068f969..54a12b5 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -187,6 +187,26 @@  static inline void packet_init(pool_entry_t *pool,
 		(pool->s.headroom + size);
 }
 
+static inline void copy_packet_parser_metadata(odp_packet_hdr_t *src_hdr,
+					       odp_packet_hdr_t *dst_hdr)
+{
+	dst_hdr->input_flags    = src_hdr->input_flags;
+	dst_hdr->error_flags    = src_hdr->error_flags;
+	dst_hdr->output_flags   = src_hdr->output_flags;
+
+	dst_hdr->l2_offset      = src_hdr->l2_offset;
+	dst_hdr->l3_offset      = src_hdr->l3_offset;
+	dst_hdr->l4_offset      = src_hdr->l4_offset;
+	dst_hdr->payload_offset = src_hdr->payload_offset;
+
+	dst_hdr->vlan_s_tag     = src_hdr->vlan_s_tag;
+	dst_hdr->vlan_c_tag     = src_hdr->vlan_c_tag;
+	dst_hdr->l3_protocol    = src_hdr->l3_protocol;
+	dst_hdr->l3_len         = src_hdr->l3_len;
+	dst_hdr->l4_protocol    = src_hdr->l4_protocol;
+	dst_hdr->l4_len         = src_hdr->l4_len;
+}
+
 static inline void *packet_map(odp_packet_hdr_t *pkt_hdr,
 			       uint32_t offset, uint32_t *seglen)
 {
diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c
index 65e6288..43a9419 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -396,12 +396,16 @@  odp_packet_t odp_packet_add_data(odp_packet_t pkt, uint32_t offset,
 			newpkt = ODP_PACKET_INVALID;
 		} else {
 			odp_packet_hdr_t *new_hdr = odp_packet_hdr(newpkt);
+			new_hdr->input = pkt_hdr->input;
 			new_hdr->buf_hdr.buf_u64 = pkt_hdr->buf_hdr.buf_u64;
 			odp_atomic_store_u32(
 				&new_hdr->buf_hdr.ref_count,
 				odp_atomic_load_u32(
 					&pkt_hdr->buf_hdr.ref_count));
-			_odp_packet_parse(newpkt);
+			if (offset < pkt_hdr->payload_offset)
+				_odp_packet_parse(newpkt);
+			else
+				copy_packet_parser_metadata(pkt_hdr, new_hdr);
 			odp_packet_free(pkt);
 		}
 	}
@@ -431,12 +435,16 @@  odp_packet_t odp_packet_rem_data(odp_packet_t pkt, uint32_t offset,
 			newpkt = ODP_PACKET_INVALID;
 		} else {
 			odp_packet_hdr_t *new_hdr = odp_packet_hdr(newpkt);
+			new_hdr->input = pkt_hdr->input;
 			new_hdr->buf_hdr.buf_u64 = pkt_hdr->buf_hdr.buf_u64;
 			odp_atomic_store_u32(
 				&new_hdr->buf_hdr.ref_count,
 				odp_atomic_load_u32(
 					&pkt_hdr->buf_hdr.ref_count));
-			_odp_packet_parse(newpkt);
+			if (offset < pkt_hdr->payload_offset)
+				_odp_packet_parse(newpkt);
+			else
+				copy_packet_parser_metadata(pkt_hdr, new_hdr);
 			odp_packet_free(pkt);
 		}
 	}