[PATCHv2] linux-gen: improve conversion between buf_hdr_t and packet_t

Message ID 1496819948-118631-1-git-send-email-joyce.kong@arm.com
State New
Headers show

Commit Message

Joyce Kong June 7, 2017, 7:19 a.m.
Signed-off-by: Joyce Kong <joyce.kong@arm.com>

---
 platform/linux-generic/include/odp_packet_internal.h | 10 ++++++++++
 platform/linux-generic/odp_packet_io.c               |  8 +++-----
 platform/linux-generic/pktio/loop.c                  |  4 ++--
 3 files changed, 15 insertions(+), 7 deletions(-)

-- 
2.7.4

Comments

Bill Fischofer June 7, 2017, 12:14 p.m. | #1
On Wed, Jun 7, 2017 at 2:19 AM, Joyce Kong <joyce.kong@arm.com> wrote:
> Signed-off-by: Joyce Kong <joyce.kong@arm.com>


Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org>

> ---

>  platform/linux-generic/include/odp_packet_internal.h | 10 ++++++++++

>  platform/linux-generic/odp_packet_io.c               |  8 +++-----

>  platform/linux-generic/pktio/loop.c                  |  4 ++--

>  3 files changed, 15 insertions(+), 7 deletions(-)

>

> diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h

> index 0a9f177..6edacec 100644

> --- a/platform/linux-generic/include/odp_packet_internal.h

> +++ b/platform/linux-generic/include/odp_packet_internal.h

> @@ -168,6 +168,16 @@ static inline odp_packet_t packet_handle(odp_packet_hdr_t *pkt_hdr)

>         return (odp_packet_t)pkt_hdr;

>  }

>

> +static inline odp_buffer_hdr_t *packet_to_buf_hdr(odp_packet_t pkt)

> +{

> +       return &odp_packet_hdr(pkt)->buf_hdr;

> +}

> +

> +static inline odp_packet_t packet_from_buf_hdr(odp_buffer_hdr_t *buf_hdr)

> +{

> +       return (odp_packet_t)(odp_packet_hdr_t *)buf_hdr;

> +}

> +

>  static inline void copy_packet_parser_metadata(odp_packet_hdr_t *src_hdr,

>                                                odp_packet_hdr_t *dst_hdr)

>  {

> diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c

> index 50a000e..5451967 100644

> --- a/platform/linux-generic/odp_packet_io.c

> +++ b/platform/linux-generic/odp_packet_io.c

> @@ -552,7 +552,6 @@ static inline int pktin_recv_buf(odp_pktin_queue_t queue,

>         odp_packet_t packets[num];

>         odp_packet_hdr_t *pkt_hdr;

>         odp_buffer_hdr_t *buf_hdr;

> -       odp_buffer_t buf;

>         int i;

>         int pkts;

>         int num_rx = 0;

> @@ -562,8 +561,7 @@ static inline int pktin_recv_buf(odp_pktin_queue_t queue,

>         for (i = 0; i < pkts; i++) {

>                 pkt = packets[i];

>                 pkt_hdr = odp_packet_hdr(pkt);

> -               buf = _odp_packet_to_buffer(pkt);

> -               buf_hdr = buf_hdl_to_hdr(buf);

> +               buf_hdr = packet_to_buf_hdr(pkt);

>

>                 if (pkt_hdr->p.input_flags.dst_queue) {

>                         queue_entry_t *dst_queue;

> @@ -582,7 +580,7 @@ static inline int pktin_recv_buf(odp_pktin_queue_t queue,

>

>  int pktout_enqueue(queue_entry_t *qentry, odp_buffer_hdr_t *buf_hdr)

>  {

> -       odp_packet_t pkt = _odp_packet_from_buffer(buf_hdr->handle.handle);

> +       odp_packet_t pkt = packet_from_buf_hdr(buf_hdr);

>         int len = 1;

>         int nbr;

>

> @@ -612,7 +610,7 @@ int pktout_enq_multi(queue_entry_t *qentry, odp_buffer_hdr_t *buf_hdr[],

>                 return nbr;

>

>         for (i = 0; i < num; ++i)

> -               pkt_tbl[i] = _odp_packet_from_buffer(buf_hdr[i]->handle.handle);

> +               pkt_tbl[i] = packet_from_buf_hdr(buf_hdr[i]);

>

>         nbr = odp_pktout_send(qentry->s.pktout, pkt_tbl, num);

>         return nbr;

> diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c

> index 61e98ad..c956f48 100644

> --- a/platform/linux-generic/pktio/loop.c

> +++ b/platform/linux-generic/pktio/loop.c

> @@ -81,7 +81,7 @@ static int loopback_recv(pktio_entry_t *pktio_entry, int index ODP_UNUSED,

>         for (i = 0; i < nbr; i++) {

>                 uint32_t pkt_len;

>

> -               pkt = _odp_packet_from_buffer(odp_hdr_to_buf(hdr_tbl[i]));

> +               pkt = packet_from_buf_hdr(hdr_tbl[i]);

>                 pkt_len = odp_packet_len(pkt);

>

>

> @@ -162,7 +162,7 @@ static int loopback_send(pktio_entry_t *pktio_entry, int index ODP_UNUSED,

>                 len = QUEUE_MULTI_MAX;

>

>         for (i = 0; i < len; ++i) {

> -               hdr_tbl[i] = buf_hdl_to_hdr(_odp_packet_to_buffer(pkt_tbl[i]));

> +               hdr_tbl[i] = packet_to_buf_hdr(pkt_tbl[i]);

>                 bytes += odp_packet_len(pkt_tbl[i]);

>         }

>

> --

> 2.7.4

>

>
Brian Brooks June 7, 2017, 5:05 p.m. | #2
On 06/07 15:19:08, Joyce Kong wrote:
> Signed-off-by: Joyce Kong <joyce.kong@arm.com>


Reviewed-by: Brian Brooks <brian.brooks@arm.com>


> ---

>  platform/linux-generic/include/odp_packet_internal.h | 10 ++++++++++

>  platform/linux-generic/odp_packet_io.c               |  8 +++-----

>  platform/linux-generic/pktio/loop.c                  |  4 ++--

>  3 files changed, 15 insertions(+), 7 deletions(-)

> 

> diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h

> index 0a9f177..6edacec 100644

> --- a/platform/linux-generic/include/odp_packet_internal.h

> +++ b/platform/linux-generic/include/odp_packet_internal.h

> @@ -168,6 +168,16 @@ static inline odp_packet_t packet_handle(odp_packet_hdr_t *pkt_hdr)

>  	return (odp_packet_t)pkt_hdr;

>  }

>  

> +static inline odp_buffer_hdr_t *packet_to_buf_hdr(odp_packet_t pkt)

> +{

> +	return &odp_packet_hdr(pkt)->buf_hdr;

> +}

> +

> +static inline odp_packet_t packet_from_buf_hdr(odp_buffer_hdr_t *buf_hdr)

> +{

> +	return (odp_packet_t)(odp_packet_hdr_t *)buf_hdr;

> +}

> +

>  static inline void copy_packet_parser_metadata(odp_packet_hdr_t *src_hdr,

>  					       odp_packet_hdr_t *dst_hdr)

>  {

> diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c

> index 50a000e..5451967 100644

> --- a/platform/linux-generic/odp_packet_io.c

> +++ b/platform/linux-generic/odp_packet_io.c

> @@ -552,7 +552,6 @@ static inline int pktin_recv_buf(odp_pktin_queue_t queue,

>  	odp_packet_t packets[num];

>  	odp_packet_hdr_t *pkt_hdr;

>  	odp_buffer_hdr_t *buf_hdr;

> -	odp_buffer_t buf;

>  	int i;

>  	int pkts;

>  	int num_rx = 0;

> @@ -562,8 +561,7 @@ static inline int pktin_recv_buf(odp_pktin_queue_t queue,

>  	for (i = 0; i < pkts; i++) {

>  		pkt = packets[i];

>  		pkt_hdr = odp_packet_hdr(pkt);

> -		buf = _odp_packet_to_buffer(pkt);

> -		buf_hdr = buf_hdl_to_hdr(buf);

> +		buf_hdr = packet_to_buf_hdr(pkt);

>  

>  		if (pkt_hdr->p.input_flags.dst_queue) {

>  			queue_entry_t *dst_queue;

> @@ -582,7 +580,7 @@ static inline int pktin_recv_buf(odp_pktin_queue_t queue,

>  

>  int pktout_enqueue(queue_entry_t *qentry, odp_buffer_hdr_t *buf_hdr)

>  {

> -	odp_packet_t pkt = _odp_packet_from_buffer(buf_hdr->handle.handle);

> +	odp_packet_t pkt = packet_from_buf_hdr(buf_hdr);

>  	int len = 1;

>  	int nbr;

>  

> @@ -612,7 +610,7 @@ int pktout_enq_multi(queue_entry_t *qentry, odp_buffer_hdr_t *buf_hdr[],

>  		return nbr;

>  

>  	for (i = 0; i < num; ++i)

> -		pkt_tbl[i] = _odp_packet_from_buffer(buf_hdr[i]->handle.handle);

> +		pkt_tbl[i] = packet_from_buf_hdr(buf_hdr[i]);

>  

>  	nbr = odp_pktout_send(qentry->s.pktout, pkt_tbl, num);

>  	return nbr;

> diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c

> index 61e98ad..c956f48 100644

> --- a/platform/linux-generic/pktio/loop.c

> +++ b/platform/linux-generic/pktio/loop.c

> @@ -81,7 +81,7 @@ static int loopback_recv(pktio_entry_t *pktio_entry, int index ODP_UNUSED,

>  	for (i = 0; i < nbr; i++) {

>  		uint32_t pkt_len;

>  

> -		pkt = _odp_packet_from_buffer(odp_hdr_to_buf(hdr_tbl[i]));

> +		pkt = packet_from_buf_hdr(hdr_tbl[i]);

>  		pkt_len = odp_packet_len(pkt);

>  

>  

> @@ -162,7 +162,7 @@ static int loopback_send(pktio_entry_t *pktio_entry, int index ODP_UNUSED,

>  		len = QUEUE_MULTI_MAX;

>  

>  	for (i = 0; i < len; ++i) {

> -		hdr_tbl[i] = buf_hdl_to_hdr(_odp_packet_to_buffer(pkt_tbl[i]));

> +		hdr_tbl[i] = packet_to_buf_hdr(pkt_tbl[i]);

>  		bytes += odp_packet_len(pkt_tbl[i]);

>  	}

>  

> -- 

> 2.7.4

> 

>
Joyce Kong June 19, 2017, 3:22 a.m. | #3
Hi Maxim,

Bill and Brian have reviewed the patch.
I see that there are not new comments recently. Could you please merge it to master branch soon?
              Thank you so much!

Best Regards,
Joyce

-----Original Message-----
From: Bill Fischofer [mailto:bill.fischofer@linaro.org]

Sent: Wednesday, June 7, 2017 8:15 PM
To: Joyce Kong <Joyce.Kong@arm.com>
Cc: lng-odp-forward <lng-odp@lists.linaro.org>
Subject: Re: [lng-odp] [PATCHv2] linux-gen: improve conversion between buf_hdr_t and packet_t

On Wed, Jun 7, 2017 at 2:19 AM, Joyce Kong <joyce.kong@arm.com> wrote:
> Signed-off-by: Joyce Kong <joyce.kong@arm.com>


Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org>

> ---

>  platform/linux-generic/include/odp_packet_internal.h | 10 ++++++++++

>  platform/linux-generic/odp_packet_io.c               |  8 +++-----

>  platform/linux-generic/pktio/loop.c                  |  4 ++--

>  3 files changed, 15 insertions(+), 7 deletions(-)

>

> diff --git a/platform/linux-generic/include/odp_packet_internal.h

> b/platform/linux-generic/include/odp_packet_internal.h

> index 0a9f177..6edacec 100644

> --- a/platform/linux-generic/include/odp_packet_internal.h

> +++ b/platform/linux-generic/include/odp_packet_internal.h

> @@ -168,6 +168,16 @@ static inline odp_packet_t packet_handle(odp_packet_hdr_t *pkt_hdr)

>         return (odp_packet_t)pkt_hdr;

>  }

>

> +static inline odp_buffer_hdr_t *packet_to_buf_hdr(odp_packet_t pkt) {

> +       return &odp_packet_hdr(pkt)->buf_hdr; }

> +

> +static inline odp_packet_t packet_from_buf_hdr(odp_buffer_hdr_t

> +*buf_hdr) {

> +       return (odp_packet_t)(odp_packet_hdr_t *)buf_hdr; }

> +

>  static inline void copy_packet_parser_metadata(odp_packet_hdr_t *src_hdr,

>                                                odp_packet_hdr_t

> *dst_hdr)  { diff --git a/platform/linux-generic/odp_packet_io.c

> b/platform/linux-generic/odp_packet_io.c

> index 50a000e..5451967 100644

> --- a/platform/linux-generic/odp_packet_io.c

> +++ b/platform/linux-generic/odp_packet_io.c

> @@ -552,7 +552,6 @@ static inline int pktin_recv_buf(odp_pktin_queue_t queue,

>         odp_packet_t packets[num];

>         odp_packet_hdr_t *pkt_hdr;

>         odp_buffer_hdr_t *buf_hdr;

> -       odp_buffer_t buf;

>         int i;

>         int pkts;

>         int num_rx = 0;

> @@ -562,8 +561,7 @@ static inline int pktin_recv_buf(odp_pktin_queue_t queue,

>         for (i = 0; i < pkts; i++) {

>                 pkt = packets[i];

>                 pkt_hdr = odp_packet_hdr(pkt);

> -               buf = _odp_packet_to_buffer(pkt);

> -               buf_hdr = buf_hdl_to_hdr(buf);

> +               buf_hdr = packet_to_buf_hdr(pkt);

>

>                 if (pkt_hdr->p.input_flags.dst_queue) {

>                         queue_entry_t *dst_queue; @@ -582,7 +580,7 @@

> static inline int pktin_recv_buf(odp_pktin_queue_t queue,

>

>  int pktout_enqueue(queue_entry_t *qentry, odp_buffer_hdr_t *buf_hdr)

> {

> -       odp_packet_t pkt = _odp_packet_from_buffer(buf_hdr->handle.handle);

> +       odp_packet_t pkt = packet_from_buf_hdr(buf_hdr);

>         int len = 1;

>         int nbr;

>

> @@ -612,7 +610,7 @@ int pktout_enq_multi(queue_entry_t *qentry, odp_buffer_hdr_t *buf_hdr[],

>                 return nbr;

>

>         for (i = 0; i < num; ++i)

> -               pkt_tbl[i] = _odp_packet_from_buffer(buf_hdr[i]->handle.handle);

> +               pkt_tbl[i] = packet_from_buf_hdr(buf_hdr[i]);

>

>         nbr = odp_pktout_send(qentry->s.pktout, pkt_tbl, num);

>         return nbr;

> diff --git a/platform/linux-generic/pktio/loop.c

> b/platform/linux-generic/pktio/loop.c

> index 61e98ad..c956f48 100644

> --- a/platform/linux-generic/pktio/loop.c

> +++ b/platform/linux-generic/pktio/loop.c

> @@ -81,7 +81,7 @@ static int loopback_recv(pktio_entry_t *pktio_entry, int index ODP_UNUSED,

>         for (i = 0; i < nbr; i++) {

>                 uint32_t pkt_len;

>

> -               pkt = _odp_packet_from_buffer(odp_hdr_to_buf(hdr_tbl[i]));

> +               pkt = packet_from_buf_hdr(hdr_tbl[i]);

>                 pkt_len = odp_packet_len(pkt);

>

>

> @@ -162,7 +162,7 @@ static int loopback_send(pktio_entry_t *pktio_entry, int index ODP_UNUSED,

>                 len = QUEUE_MULTI_MAX;

>

>         for (i = 0; i < len; ++i) {

> -               hdr_tbl[i] = buf_hdl_to_hdr(_odp_packet_to_buffer(pkt_tbl[i]));

> +               hdr_tbl[i] = packet_to_buf_hdr(pkt_tbl[i]);

>                 bytes += odp_packet_len(pkt_tbl[i]);

>         }

>

> --

> 2.7.4

>

>

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Bill Fischofer June 19, 2017, 10:55 a.m. | #4
This is an update to master, which is currently frozen pending the
release of ODP v1.15, which should be very soon. As soon as that is
done this can be merged.

On Sun, Jun 18, 2017 at 10:22 PM, Joyce Kong <Joyce.Kong@arm.com> wrote:
> Hi Maxim,

>

> Bill and Brian have reviewed the patch.

> I see that there are not new comments recently. Could you please merge it to master branch soon?

>               Thank you so much!

>

> Best Regards,

> Joyce

>

> -----Original Message-----

> From: Bill Fischofer [mailto:bill.fischofer@linaro.org]

> Sent: Wednesday, June 7, 2017 8:15 PM

> To: Joyce Kong <Joyce.Kong@arm.com>

> Cc: lng-odp-forward <lng-odp@lists.linaro.org>

> Subject: Re: [lng-odp] [PATCHv2] linux-gen: improve conversion between buf_hdr_t and packet_t

>

> On Wed, Jun 7, 2017 at 2:19 AM, Joyce Kong <joyce.kong@arm.com> wrote:

>> Signed-off-by: Joyce Kong <joyce.kong@arm.com>

>

> Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org>

>

>> ---

>>  platform/linux-generic/include/odp_packet_internal.h | 10 ++++++++++

>>  platform/linux-generic/odp_packet_io.c               |  8 +++-----

>>  platform/linux-generic/pktio/loop.c                  |  4 ++--

>>  3 files changed, 15 insertions(+), 7 deletions(-)

>>

>> diff --git a/platform/linux-generic/include/odp_packet_internal.h

>> b/platform/linux-generic/include/odp_packet_internal.h

>> index 0a9f177..6edacec 100644

>> --- a/platform/linux-generic/include/odp_packet_internal.h

>> +++ b/platform/linux-generic/include/odp_packet_internal.h

>> @@ -168,6 +168,16 @@ static inline odp_packet_t packet_handle(odp_packet_hdr_t *pkt_hdr)

>>         return (odp_packet_t)pkt_hdr;

>>  }

>>

>> +static inline odp_buffer_hdr_t *packet_to_buf_hdr(odp_packet_t pkt) {

>> +       return &odp_packet_hdr(pkt)->buf_hdr; }

>> +

>> +static inline odp_packet_t packet_from_buf_hdr(odp_buffer_hdr_t

>> +*buf_hdr) {

>> +       return (odp_packet_t)(odp_packet_hdr_t *)buf_hdr; }

>> +

>>  static inline void copy_packet_parser_metadata(odp_packet_hdr_t *src_hdr,

>>                                                odp_packet_hdr_t

>> *dst_hdr)  { diff --git a/platform/linux-generic/odp_packet_io.c

>> b/platform/linux-generic/odp_packet_io.c

>> index 50a000e..5451967 100644

>> --- a/platform/linux-generic/odp_packet_io.c

>> +++ b/platform/linux-generic/odp_packet_io.c

>> @@ -552,7 +552,6 @@ static inline int pktin_recv_buf(odp_pktin_queue_t queue,

>>         odp_packet_t packets[num];

>>         odp_packet_hdr_t *pkt_hdr;

>>         odp_buffer_hdr_t *buf_hdr;

>> -       odp_buffer_t buf;

>>         int i;

>>         int pkts;

>>         int num_rx = 0;

>> @@ -562,8 +561,7 @@ static inline int pktin_recv_buf(odp_pktin_queue_t queue,

>>         for (i = 0; i < pkts; i++) {

>>                 pkt = packets[i];

>>                 pkt_hdr = odp_packet_hdr(pkt);

>> -               buf = _odp_packet_to_buffer(pkt);

>> -               buf_hdr = buf_hdl_to_hdr(buf);

>> +               buf_hdr = packet_to_buf_hdr(pkt);

>>

>>                 if (pkt_hdr->p.input_flags.dst_queue) {

>>                         queue_entry_t *dst_queue; @@ -582,7 +580,7 @@

>> static inline int pktin_recv_buf(odp_pktin_queue_t queue,

>>

>>  int pktout_enqueue(queue_entry_t *qentry, odp_buffer_hdr_t *buf_hdr)

>> {

>> -       odp_packet_t pkt = _odp_packet_from_buffer(buf_hdr->handle.handle);

>> +       odp_packet_t pkt = packet_from_buf_hdr(buf_hdr);

>>         int len = 1;

>>         int nbr;

>>

>> @@ -612,7 +610,7 @@ int pktout_enq_multi(queue_entry_t *qentry, odp_buffer_hdr_t *buf_hdr[],

>>                 return nbr;

>>

>>         for (i = 0; i < num; ++i)

>> -               pkt_tbl[i] = _odp_packet_from_buffer(buf_hdr[i]->handle.handle);

>> +               pkt_tbl[i] = packet_from_buf_hdr(buf_hdr[i]);

>>

>>         nbr = odp_pktout_send(qentry->s.pktout, pkt_tbl, num);

>>         return nbr;

>> diff --git a/platform/linux-generic/pktio/loop.c

>> b/platform/linux-generic/pktio/loop.c

>> index 61e98ad..c956f48 100644

>> --- a/platform/linux-generic/pktio/loop.c

>> +++ b/platform/linux-generic/pktio/loop.c

>> @@ -81,7 +81,7 @@ static int loopback_recv(pktio_entry_t *pktio_entry, int index ODP_UNUSED,

>>         for (i = 0; i < nbr; i++) {

>>                 uint32_t pkt_len;

>>

>> -               pkt = _odp_packet_from_buffer(odp_hdr_to_buf(hdr_tbl[i]));

>> +               pkt = packet_from_buf_hdr(hdr_tbl[i]);

>>                 pkt_len = odp_packet_len(pkt);

>>

>>

>> @@ -162,7 +162,7 @@ static int loopback_send(pktio_entry_t *pktio_entry, int index ODP_UNUSED,

>>                 len = QUEUE_MULTI_MAX;

>>

>>         for (i = 0; i < len; ++i) {

>> -               hdr_tbl[i] = buf_hdl_to_hdr(_odp_packet_to_buffer(pkt_tbl[i]));

>> +               hdr_tbl[i] = packet_to_buf_hdr(pkt_tbl[i]);

>>                 bytes += odp_packet_len(pkt_tbl[i]);

>>         }

>>

>> --

>> 2.7.4

>>

>>

> IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

Patch hide | download patch | download mbox

diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h
index 0a9f177..6edacec 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -168,6 +168,16 @@  static inline odp_packet_t packet_handle(odp_packet_hdr_t *pkt_hdr)
 	return (odp_packet_t)pkt_hdr;
 }
 
+static inline odp_buffer_hdr_t *packet_to_buf_hdr(odp_packet_t pkt)
+{
+	return &odp_packet_hdr(pkt)->buf_hdr;
+}
+
+static inline odp_packet_t packet_from_buf_hdr(odp_buffer_hdr_t *buf_hdr)
+{
+	return (odp_packet_t)(odp_packet_hdr_t *)buf_hdr;
+}
+
 static inline void copy_packet_parser_metadata(odp_packet_hdr_t *src_hdr,
 					       odp_packet_hdr_t *dst_hdr)
 {
diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c
index 50a000e..5451967 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -552,7 +552,6 @@  static inline int pktin_recv_buf(odp_pktin_queue_t queue,
 	odp_packet_t packets[num];
 	odp_packet_hdr_t *pkt_hdr;
 	odp_buffer_hdr_t *buf_hdr;
-	odp_buffer_t buf;
 	int i;
 	int pkts;
 	int num_rx = 0;
@@ -562,8 +561,7 @@  static inline int pktin_recv_buf(odp_pktin_queue_t queue,
 	for (i = 0; i < pkts; i++) {
 		pkt = packets[i];
 		pkt_hdr = odp_packet_hdr(pkt);
-		buf = _odp_packet_to_buffer(pkt);
-		buf_hdr = buf_hdl_to_hdr(buf);
+		buf_hdr = packet_to_buf_hdr(pkt);
 
 		if (pkt_hdr->p.input_flags.dst_queue) {
 			queue_entry_t *dst_queue;
@@ -582,7 +580,7 @@  static inline int pktin_recv_buf(odp_pktin_queue_t queue,
 
 int pktout_enqueue(queue_entry_t *qentry, odp_buffer_hdr_t *buf_hdr)
 {
-	odp_packet_t pkt = _odp_packet_from_buffer(buf_hdr->handle.handle);
+	odp_packet_t pkt = packet_from_buf_hdr(buf_hdr);
 	int len = 1;
 	int nbr;
 
@@ -612,7 +610,7 @@  int pktout_enq_multi(queue_entry_t *qentry, odp_buffer_hdr_t *buf_hdr[],
 		return nbr;
 
 	for (i = 0; i < num; ++i)
-		pkt_tbl[i] = _odp_packet_from_buffer(buf_hdr[i]->handle.handle);
+		pkt_tbl[i] = packet_from_buf_hdr(buf_hdr[i]);
 
 	nbr = odp_pktout_send(qentry->s.pktout, pkt_tbl, num);
 	return nbr;
diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c
index 61e98ad..c956f48 100644
--- a/platform/linux-generic/pktio/loop.c
+++ b/platform/linux-generic/pktio/loop.c
@@ -81,7 +81,7 @@  static int loopback_recv(pktio_entry_t *pktio_entry, int index ODP_UNUSED,
 	for (i = 0; i < nbr; i++) {
 		uint32_t pkt_len;
 
-		pkt = _odp_packet_from_buffer(odp_hdr_to_buf(hdr_tbl[i]));
+		pkt = packet_from_buf_hdr(hdr_tbl[i]);
 		pkt_len = odp_packet_len(pkt);
 
 
@@ -162,7 +162,7 @@  static int loopback_send(pktio_entry_t *pktio_entry, int index ODP_UNUSED,
 		len = QUEUE_MULTI_MAX;
 
 	for (i = 0; i < len; ++i) {
-		hdr_tbl[i] = buf_hdl_to_hdr(_odp_packet_to_buffer(pkt_tbl[i]));
+		hdr_tbl[i] = packet_to_buf_hdr(pkt_tbl[i]);
 		bytes += odp_packet_len(pkt_tbl[i]);
 	}