On Thu, Jan 16, 2020 at 01:04:28PM +0000, Viacheslav Ovsiienko wrote:
> The new mbuf pool type is added to testpmd. To engage the
> mbuf pool with externally attached data buffers the parameter
> "--mp-alloc=xbuf" should be specified in testpmd command line.
> 
> The objective of this patch is just to test whether mbuf pool
> with externally attached data buffers works OK. The memory for
> data buffers is allocated from DPDK memory, so this is not
> "true" external memory from some physical device (this is
> supposed the most common use case for such kind of mbuf pool).
> 
> The user should be aware that not all drivers support the mbuf
> with EXT_ATTACHED_BUF flags set in newly allocated mbuf (many
> PMDs just overwrite ol_flags field and flag value is getting
> lost).
> 
> Signed-off-by: Viacheslav Ovsiienko <viachesl...@mellanox.com>
> ---
>  app/test-pmd/config.c     |  2 ++
>  app/test-pmd/flowgen.c    |  3 +-
>  app/test-pmd/parameters.c |  2 ++
>  app/test-pmd/testpmd.c    | 81 
> +++++++++++++++++++++++++++++++++++++++++++++++
>  app/test-pmd/testpmd.h    |  4 ++-
>  app/test-pmd/txonly.c     |  3 +-
>  6 files changed, 92 insertions(+), 3 deletions(-)
> 
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index 9da1ffb..5c6fe18 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -2395,6 +2395,8 @@ struct igb_ring_desc_16_bytes {
>               return "xmem";
>       case MP_ALLOC_XMEM_HUGE:
>               return "xmemhuge";
> +     case MP_ALLOC_XBUF:
> +             return "xbuf";
>       default:
>               return "invalid";
>       }
> diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c
> index 03b72aa..ae50cdc 100644
> --- a/app/test-pmd/flowgen.c
> +++ b/app/test-pmd/flowgen.c
> @@ -199,7 +199,8 @@
>                                                          sizeof(*ip_hdr));
>               pkt->nb_segs            = 1;
>               pkt->pkt_len            = pkt_size;
> -             pkt->ol_flags           = ol_flags;
> +             pkt->ol_flags           &= EXT_ATTACHED_MBUF;
> +             pkt->ol_flags           |= ol_flags;
>               pkt->vlan_tci           = vlan_tci;
>               pkt->vlan_tci_outer     = vlan_tci_outer;
>               pkt->l2_len             = sizeof(struct rte_ether_hdr);

This shows that we have to be careful when using a mempool with
external memory pinned mbufs. Maybe that's something that should
be mentionned in the release note?

That's not the first time I'm asking myself if ol_flags shouldn't be
splitted in ol_flags and flags. Certainly something to think about for
next ABI breakage release.

Acked-by: Olivier Matz <olivier.m...@6wind.com>

Reply via email to