From: "Kulasek, TomaszX" <tomaszx.kulasek@intel.com>
To: Olivier Matz <olivier.matz@6wind.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH 1/4] rte_mbuf: add rte_pktmbuf_coalesce
Date: Thu, 29 Dec 2016 15:58:01 +0000 [thread overview]
Message-ID: <3042915272161B4EB253DA4D77EB373A14F6F79A@IRSMSX102.ger.corp.intel.com> (raw)
In-Reply-To: <20161216110604.7097488e@platinum>
Hi Olivier,
> -----Original Message-----
> From: Olivier Matz [mailto:olivier.matz@6wind.com]
> Sent: Friday, December 16, 2016 11:06
> To: Kulasek, TomaszX <tomaszx.kulasek@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 1/4] rte_mbuf: add rte_pktmbuf_coalesce
>
> Hi Tomasz,
>
> On Fri, 2 Dec 2016 18:07:43 +0100, Tomasz Kulasek
> <tomaszx.kulasek@intel.com> wrote:
> > This patch adds function rte_pktmbuf_coalesce to let crypto PMD
> > coalesce chained mbuf before crypto operation and extend their
> > capabilities to support segmented mbufs when device cannot handle
> > them natively.
> >
> >
> > Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
> > ---
> > lib/librte_mbuf/rte_mbuf.h | 34 ++++++++++++++++++++++++++++++++++
> > 1 file changed, 34 insertions(+)
> >
> > diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
> > index ead7c6e..f048681 100644
> > --- a/lib/librte_mbuf/rte_mbuf.h
> > +++ b/lib/librte_mbuf/rte_mbuf.h
> > @@ -1647,6 +1647,40 @@ static inline int rte_pktmbuf_chain(struct
> > rte_mbuf *head, struct rte_mbuf *tail }
> >
> > /**
> > + * Coalesce data from mbuf to the continuous buffer.
> > + *
> > + * @param mbuf_dst
> > + * Contiguous destination mbuf
> > + * @param mbuf_src
> > + * Uncontiguous source mbuf
> > + *
> > + * @return
> > + * - 0, on success
> > + * - -EINVAL, on error
> > + */
>
> I think the API should be clarified. In your case, it is expected that the
> destination mbuf is already filled with uninitialized data (i.e. that
> rte_pktmbuf_append() has been called).
>
> We could wonder if a better API wouldn't be to allocate the dst mbuf in
> the function, call append()/prepend(), and do the copy.
>
> Even better, we could have:
>
> int rte_pktmbuf_linearize(struct rte_mbuf *m)
>
> It will reuse the same mbuf (maybe moving the data).
>
>
> > +
> > +#include <rte_hexdump.h>
>
> This should be removed.
>
> > +
> > +static inline int
> > +rte_pktmbuf_coalesce(struct rte_mbuf *mbuf_dst, struct rte_mbuf
> *mbuf_src) {
>
> Source mbuf should be const.
>
> > + char *dst;
> > +
> > + if (!rte_pktmbuf_is_contiguous(mbuf_dst) ||
> > + rte_pktmbuf_data_len(mbuf_dst) >=
> > + rte_pktmbuf_pkt_len(mbuf_src))
> > + return -EINVAL;
>
> Why >= ?
>
> > +
> > + dst = rte_pktmbuf_mtod(mbuf_dst, char *);
> > +
> > + if (!__rte_pktmbuf_read(mbuf_src, 0, rte_pktmbuf_pkt_len(mbuf_src),
> > + dst))
>
> When a function returns a pointer, I think it is clearer to do:
> if (func() == NULL)
> than:
> if (!func())
>
>
> > + return -EINVAL;
> > +
> > + return 0;
> > +}
> > +
> > +/**
> > * Dump an mbuf structure to a file.
> > *
> > * Dump all fields for the given packet mbuf and all its associated
>
>
> One more question, I don't see where this function is used in your
> patchset. What is your use-case?
>
> Regards,
> Olivier
This function is needed for crypto-perf application: http://dpdk.org/dev/patchwork/patch/17492/ to compare performance of crypto operations on segmented mbufs, when scatter gather is or is not supported by crypto PMD. It will be introduced with v2.
When device doesn't support scatter-gather, we want to know an overhead of manual coalescing mbuf.
struct rte_cryptodev_info dev_info;
int linearize = 0;
/* Check if source mbufs require coalescing */
if (ctx->options->segments_nb > 1) {
rte_cryptodev_info_get(ctx->dev_id, &dev_info);
if ((dev_info.feature_flags &
RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER) == 0)
linearize = 1;
}
// ...
if (linearize) {
/* PMD doesn't support scatter-gather and source buffer
* is segmented.
* We need to linearize it before enqueuing.
*/
for (i = 0; i < burst_size; i++)
rte_pktmbuf_linearize(ops[i]->sym->m_src);
}
/* Enqueue burst of ops on crypto device */
ops_enqd = rte_cryptodev_enqueue_burst(ctx->dev_id, ctx->qp_id,
ops, burst_size);
I have checked this use case (in crypto-perf application), and you're right, using rte_pktmbuf_linearize() function here is better and more straightforward. I will change it in v2.
Thanks for suggestions
Tomasz.
next prev parent reply other threads:[~2016-12-29 15:58 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-02 17:07 [dpdk-dev] [PATCH 0/4] Chained Mbufs support in SW PMDs Tomasz Kulasek
2016-12-02 17:07 ` [dpdk-dev] [PATCH 1/4] rte_mbuf: add rte_pktmbuf_coalesce Tomasz Kulasek
2016-12-16 10:06 ` Olivier Matz
2016-12-29 15:58 ` Kulasek, TomaszX [this message]
2016-12-02 17:07 ` [dpdk-dev] [PATCH 2/4] test: add rte_pktmbuf_coalesce unit tests Tomasz Kulasek
2016-12-02 17:07 ` [dpdk-dev] [PATCH 3/4] crypto: add sgl support for sw PMDs Tomasz Kulasek
2016-12-03 8:28 ` Michał Mirosław
2016-12-12 10:01 ` Kulasek, TomaszX
2016-12-02 17:07 ` [dpdk-dev] [PATCH 4/4] test: add sgl unit tests for crypto devices Tomasz Kulasek
2016-12-29 17:12 ` [dpdk-dev] [PATCH v2 0/5] Chained Mbufs support in SW PMDs Tomasz Kulasek
2016-12-29 17:12 ` [dpdk-dev] [PATCH v2 1/5] rte_mbuf: add rte_pktmbuf_linearize Tomasz Kulasek
2016-12-29 17:12 ` [dpdk-dev] [PATCH v2 2/5] test: add rte_pktmbuf_linearize unit tests Tomasz Kulasek
2016-12-29 17:12 ` [dpdk-dev] [PATCH v2 3/5] crypto: add sgl support in sw PMDs Tomasz Kulasek
2016-12-29 17:12 ` [dpdk-dev] [PATCH v2 4/5] crypto: add sgl support in openssl PMD Tomasz Kulasek
2016-12-29 17:12 ` [dpdk-dev] [PATCH v2 5/5] test: add sgl unit tests for crypto devices Tomasz Kulasek
2017-01-05 9:12 ` [dpdk-dev] [PATCH v3 0/5] Chained Mbufs support in SW PMDs Tomasz Kulasek
2017-01-05 9:12 ` [dpdk-dev] [PATCH v3 1/5] rte_mbuf: add rte_pktmbuf_linearize Tomasz Kulasek
2017-01-05 15:37 ` De Lara Guarch, Pablo
2017-01-05 16:52 ` Kulasek, TomaszX
2017-01-05 9:12 ` [dpdk-dev] [PATCH v3 2/5] test: add rte_pktmbuf_linearize unit tests Tomasz Kulasek
2017-01-05 9:12 ` [dpdk-dev] [PATCH v3 3/5] crypto: add sgl support in sw PMDs Tomasz Kulasek
2017-01-05 9:12 ` [dpdk-dev] [PATCH v3 4/5] crypto: add sgl support in openssl PMD Tomasz Kulasek
2017-01-05 9:12 ` [dpdk-dev] [PATCH v3 5/5] test: add sgl unit tests for crypto devices Tomasz Kulasek
2017-01-05 16:44 ` [dpdk-dev] [PATCH v4] rte_mbuf: add rte_pktmbuf_linearize Tomasz Kulasek
2017-01-10 16:50 ` Olivier MATZ
2017-01-12 9:40 ` [dpdk-dev] [PATCH v5] mbuf: add a function to linearize a packet Tomasz Kulasek
2017-01-13 15:32 ` Olivier Matz
2017-01-13 15:40 ` Kulasek, TomaszX
2017-01-15 18:32 ` Thomas Monjalon
2017-01-05 16:46 ` [dpdk-dev] [PATCH v4 0/3] Chained Mbufs support in SW PMDs Tomasz Kulasek
2017-01-05 16:46 ` [dpdk-dev] [PATCH v4 1/3] crypto: add sgl support in sw PMDs Tomasz Kulasek
2017-01-05 16:46 ` [dpdk-dev] [PATCH v4 2/3] crypto: add sgl support in openssl PMD Tomasz Kulasek
2017-01-05 16:46 ` [dpdk-dev] [PATCH v4 3/3] test: add sgl unit tests for crypto devices Tomasz Kulasek
2017-01-13 15:23 ` [dpdk-dev] [PATCH v5 0/3] Chained Mbufs support in SW PMDs Tomasz Kulasek
2017-01-13 15:23 ` [dpdk-dev] [PATCH v5 1/3] crypto: add sgl support in sw PMDs Tomasz Kulasek
2017-01-16 16:08 ` Declan Doherty
2017-01-13 15:23 ` [dpdk-dev] [PATCH v5 2/3] crypto: add sgl support in openssl PMD Tomasz Kulasek
2017-01-16 16:10 ` Declan Doherty
2017-01-13 15:23 ` [dpdk-dev] [PATCH v5 3/3] test: add sgl unit tests for crypto devices Tomasz Kulasek
2017-01-16 16:11 ` Declan Doherty
2017-01-16 19:00 ` [dpdk-dev] [PATCH v5 0/3] Chained Mbufs support in SW PMDs De Lara Guarch, Pablo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3042915272161B4EB253DA4D77EB373A14F6F79A@IRSMSX102.ger.corp.intel.com \
--to=tomaszx.kulasek@intel.com \
--cc=dev@dpdk.org \
--cc=olivier.matz@6wind.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).