All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olivier Matz <olivier.matz@6wind.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v4] mbuf: allow dynamic flags to be used by secondary process
Date: Wed, 4 Nov 2020 09:17:06 +0100	[thread overview]
Message-ID: <20201104081706.GH1898@platinum> (raw)
In-Reply-To: <20201104055310.18873-1-stephen@networkplumber.org>

Hi Stephen,

On Tue, Nov 03, 2020 at 09:53:10PM -0800, Stephen Hemminger wrote:
> The dynamic flag management is broken if rte_mbuf_dynflag_lookup()
> is done in a secondary process because the local pointer to
> the memzone is not ever initialized.
> 
> Fix it by using the same checks as dynfield_register().
> I.e if shared memory zone has not been looked up already,
> then discover it.
> 
> Fixes: 4958ca3a443a ("mbuf: support dynamic fields and flags")
> Cc: olivier.matz@6wind.com
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> v4 - incorporate Oliver's fix for rte_errno
> 
>  lib/librte_mbuf/rte_mbuf_dyn.c | 26 ++++++++++----------------
>  1 file changed, 10 insertions(+), 16 deletions(-)
> 
> diff --git a/lib/librte_mbuf/rte_mbuf_dyn.c b/lib/librte_mbuf/rte_mbuf_dyn.c
> index 538a43f6959f..b4c31896634c 100644
> --- a/lib/librte_mbuf/rte_mbuf_dyn.c
> +++ b/lib/librte_mbuf/rte_mbuf_dyn.c
> @@ -172,7 +172,7 @@ __mbuf_dynfield_lookup(const char *name)
>  			break;
>  	}
>  
> -	if (te == NULL) {
> +	if (te == NULL || mbuf_dynfield == NULL) {
>  		rte_errno = ENOENT;
>  		return NULL;
>  	}
> @@ -185,19 +185,15 @@ rte_mbuf_dynfield_lookup(const char *name, struct rte_mbuf_dynfield *params)
>  {
>  	struct mbuf_dynfield_elt *mbuf_dynfield;
>  
> -	if (shm == NULL) {
> -		rte_errno = ENOENT;
> -		return -1;
> -	}
> -
>  	rte_mcfg_tailq_read_lock();
> -	mbuf_dynfield = __mbuf_dynfield_lookup(name);
> +	if (shm == NULL && init_shared_mem() < 0)
> +		mbuf_dynfield = NULL;
> +	else
> +		mbuf_dynfield = __mbuf_dynfield_lookup(name);
>  	rte_mcfg_tailq_read_unlock();
>  
> -	if (mbuf_dynfield == NULL) {
> -		rte_errno = ENOENT;
> +	if (mbuf_dynfield == NULL)
>  		return -1;
> -	}
>  
>  	if (params != NULL)
>  		memcpy(params, &mbuf_dynfield->params, sizeof(*params));
> @@ -384,13 +380,11 @@ rte_mbuf_dynflag_lookup(const char *name,
>  {
>  	struct mbuf_dynflag_elt *mbuf_dynflag;
>  
> -	if (shm == NULL) {
> -		rte_errno = ENOENT;
> -		return -1;
> -	}
> -
>  	rte_mcfg_tailq_read_lock();
> -	mbuf_dynflag = __mbuf_dynflag_lookup(name);
> +	if (shm == NULL && init_shared_mem() < 0)
> +		mbuf_dynflag = NULL;
> +	else
> +		mbuf_dynflag = __mbuf_dynflag_lookup(name);
>  	rte_mcfg_tailq_read_unlock();
>  
>  	if (mbuf_dynflag == NULL) {

The v4 change is missing for flags:

  -	if (mbuf_dynflag == NULL) {
  -		rte_errno = ENOENT;
  +	if (mbuf_dynflag == NULL)
   		return -1;
  -	}


  reply	other threads:[~2020-11-04  8:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-15 17:20 [dpdk-dev] [PATCH] mbuf: allow dynamic flags to be used by secondary process Stephen Hemminger
2020-10-20 12:18 ` Olivier Matz
2020-10-20 20:58 ` [dpdk-dev] [PATCH v2] " Stephen Hemminger
2020-10-24  0:43 ` [dpdk-dev] [PATCH v3] mbuf: fix dynamic flags lookup from " Stephen Hemminger
2020-10-26 10:39   ` Olivier Matz
2020-10-26 14:49     ` Stephen Hemminger
2020-11-03 21:02       ` Thomas Monjalon
2020-11-04  5:53   ` [dpdk-dev] [PATCH v4] mbuf: allow dynamic flags to be used by " Stephen Hemminger
2020-11-04  8:17     ` Olivier Matz [this message]
2020-11-04 16:20   ` [dpdk-dev] [PATCH v5] " Stephen Hemminger
2020-11-04 16:26     ` Olivier Matz
2020-11-04 17:41       ` David Marchand

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=20201104081706.GH1898@platinum \
    --to=olivier.matz@6wind.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    /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.