All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olivier Matz <olivier.matz@6wind.com>
To: Hemant Agrawal <hemant.agrawal@nxp.com>
Cc: <dev@dpdk.org>, <shreyansh.jain@nxp.com>
Subject: Re: [PATCH] mempool: introduce flag to indicate hw mempool
Date: Mon, 3 Apr 2017 17:19:58 +0200	[thread overview]
Message-ID: <20170403171958.5ff2f3ab@platinum> (raw)
In-Reply-To: <1491210729-9755-1-git-send-email-hemant.agrawal@nxp.com>

Hi Hemant,

On Mon, 3 Apr 2017 14:42:09 +0530, Hemant Agrawal <hemant.agrawal@nxp.com> wrote:
> Hardware pools need to distinguish between buffers allocated using
> software or hardware backed pools.
> 
> Some HW NICs may choose to autonomously free the pickets during
> transmit if the packet is from HW pool. While they should not do
> it for software backed pools.
> 
> Such flag would also help when multiple pools are being handled by
> a PMD, saving costly compare operations for any internal marker.
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
>  lib/librte_mempool/rte_mempool.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h
> index 991feaa..91dbd21 100644
> --- a/lib/librte_mempool/rte_mempool.h
> +++ b/lib/librte_mempool/rte_mempool.h
> @@ -263,6 +263,11 @@ struct rte_mempool {
>  #define MEMPOOL_F_SC_GET         0x0008 /**< Default get is "single-consumer".*/
>  #define MEMPOOL_F_POOL_CREATED   0x0010 /**< Internal: pool is created. */
>  #define MEMPOOL_F_NO_PHYS_CONTIG 0x0020 /**< Don't need physically contiguous objs. */
> +#define MEMPOOL_F_HW_POOL        (1 << ((sizeof(int) * 8) - 1)) /**< Internal:
> +	* Hardware offloaded pool. This information may be used by the
> +	* NIC or other hw. Some NICs autonomously free the HW backed pool packets. */
> +
> +/**< Don't need physically contiguous objs. */
>  
>  /**
>   * @internal When debug is enabled, store some statistics.


One thing is still not clear to me: in your driver, you check this flag:
- if it is unset, you reallocate a packet from your hw pool, you copy
  some metadata, and you send it to the hw.
- if it is set, you assume that you can call mempool_to_bpid(mp) and directly
  send it to the hw.

I think this is not correct. The test you want to do in your driver is:
"is it the pool that I registered for my hardware"?
It is not:
"is it a hardware managed pool?".

I think what you are doing here prevents to use 2 hardware mempools
at the same time, because they would all have this flag, and mempool_to_bpid()
would probably crash.

Instead, can't you just compare the mempool pointer to a value stored internally
in the driver?

Olivier

  reply	other threads:[~2017-04-03 15:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-03  9:12 [PATCH] mempool: introduce flag to indicate hw mempool Hemant Agrawal
2017-04-03 15:19 ` Olivier Matz [this message]
2017-04-04  5:35   ` Hemant Agrawal
2017-04-04  6:58     ` Thomas Monjalon
2017-04-04  7:29       ` Hemant Agrawal
2017-04-04  9:13         ` Olivier MATZ
2017-04-04  7:48       ` Olivier MATZ

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=20170403171958.5ff2f3ab@platinum \
    --to=olivier.matz@6wind.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=shreyansh.jain@nxp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.