DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] advice to pmd maintainters: do not touch mbuf initialized fields
@ 2017-06-08  9:06 Olivier Matz
  2017-07-08 20:36 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Olivier Matz @ 2017-06-08  9:06 UTC (permalink / raw)
  To: dev; +Cc: Ferruh Yigit

Hi,

In the structure reorganization patchset [1], some work was done
to ensure that the values of the following fields are always initialized
for mbuf that are inside the mbuf pool (not yet allocated).

In other words, calling rte_mbuf_raw_alloc() or rte_mempool_get() return
mbufs that are initialized as following:

  m->next = NULL
  m->nb_segs = 1
  m->refcnt = 1

This property can be used in the Rx path of PMDs where the mbuf
structure is filled from the hardware descriptors: the initialization of
these fields can be skipped to gain few cycles per packet, and to avoid
an access to the second cache line (m->next) before it is prefetched.

It is advised to do this optimization in the PMDs for this reason, and
also because we could want to move some of these fields to the second
mbuf cache line in the future: accessing them in the Rx path would cost.

This work has already been done at several places:

  http://dpdk.org/browse/dpdk/commit/?id=ebb7bcabb
  http://dpdk.org/browse/next/dpdk-next-net/commit/?id=e211a7569
  http://dpdk.org/browse/next/dpdk-next-net/commit/?id=a37cf9005
  http://dpdk.org/browse/next/dpdk-next-net/commit/?id=fb83a23ee
  ...

Feel free to ask if you have any question.

Thanks,
Olivier

[1] http://dpdk.org/ml/archives/dev/2017-April/063081.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] advice to pmd maintainters: do not touch mbuf initialized fields
  2017-06-08  9:06 [dpdk-dev] advice to pmd maintainters: do not touch mbuf initialized fields Olivier Matz
@ 2017-07-08 20:36 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2017-07-08 20:36 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, Olivier Matz

08/06/2017 11:06, Olivier Matz:
> Hi,
> 
> In the structure reorganization patchset [1], some work was done
> to ensure that the values of the following fields are always initialized
> for mbuf that are inside the mbuf pool (not yet allocated).
> 
> In other words, calling rte_mbuf_raw_alloc() or rte_mempool_get() return
> mbufs that are initialized as following:
> 
>   m->next = NULL
>   m->nb_segs = 1
>   m->refcnt = 1
> 
> This property can be used in the Rx path of PMDs where the mbuf
> structure is filled from the hardware descriptors: the initialization of
> these fields can be skipped to gain few cycles per packet, and to avoid
> an access to the second cache line (m->next) before it is prefetched.
> 
> It is advised to do this optimization in the PMDs for this reason, and
> also because we could want to move some of these fields to the second
> mbuf cache line in the future: accessing them in the Rx path would cost.
> 
> This work has already been done at several places:
> 
>   http://dpdk.org/browse/dpdk/commit/?id=ebb7bcabb
>   http://dpdk.org/browse/next/dpdk-next-net/commit/?id=e211a7569
>   http://dpdk.org/browse/next/dpdk-next-net/commit/?id=a37cf9005
>   http://dpdk.org/browse/next/dpdk-next-net/commit/?id=fb83a23ee
>   ...
> 
> Feel free to ask if you have any question.

Please Ferruh, could you check which drivers are not yet updated
regarding this optimization?

Thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-07-08 20:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-08  9:06 [dpdk-dev] advice to pmd maintainters: do not touch mbuf initialized fields Olivier Matz
2017-07-08 20:36 ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).