From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6DF8EA04E7; Wed, 4 Nov 2020 09:17:12 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DA50FC814; Wed, 4 Nov 2020 09:17:10 +0100 (CET) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by dpdk.org (Postfix) with ESMTP id 26471C810 for ; Wed, 4 Nov 2020 09:17:09 +0100 (CET) Received: by mail-wr1-f67.google.com with SMTP id w14so21003506wrs.9 for ; Wed, 04 Nov 2020 00:17:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=7bc85317CBjlMx4BdkQ/mDGt9OfHDaJFMGftzU0xrFY=; b=hn6L8cz1SvUk9QfqyLmR+NdTRnULsNvCHP7MSVIRMtouNd3WqLY9bWywrYfLphO3kH P7vckSzfNe5O+JWeuEcGNDWFriZSsUOUbRkfM/gGD83s5K+3PeHjXz/AWes8faZvkOfX /9GN0vUr0pYVnl2O8B5nHKAU4lBQbWknNhoJciyFnt4q/K+tOrZWmTrte/WDx7v04IiY s8IToeLSoYaf6/rTSOgr4KtJJoGAa2bmbbo/6IUcmWQoMSHLcY1m5KW0THKkNYnSmjAb Jl+MkTTP/nvP28iQF7pN7NAnReVPMA5zfEnaiukn33aCwgNQo66vPI2JPV69W9vLiPgr WRPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=7bc85317CBjlMx4BdkQ/mDGt9OfHDaJFMGftzU0xrFY=; b=CiaW9cOYWEZoelVb0I9SPW38YIwbaaRegSdidA6/Uvmed5s69rXLgH4YZAeXaewD0+ sdholvcbtBwsTqShghtabmHNlkTZRE5qBxVjbMIesNiF8vQcuqbkxom0F0A0zsWrhVXP E0ZiBwzQIHLbr7UaeeOsq1yELghTPz5d2DvdjpWAMeda4MQNmUFv9l7LFsiyc/c4SQfH VysEWqHVEouwrJQRumY7pOE6FuPV1UFPTT9H3ubBpH0L1HwfXK6k7dat82inNgq+IYAB 8psv92AEDOff4ECMBR5/zY8PK9p8W5GKcOZCJF7ZbMHA91JAYX35ls1tQUbEkwGoHxEv gSnA== X-Gm-Message-State: AOAM5309b1R1kJW8sZHAIQOXi+RbdyCrZ4o0i00GiOC0oZlwHbhpUkvj tn5RzmnFbOaXyAdC6uGozLXHzF/n85Fr0Q== X-Google-Smtp-Source: ABdhPJyeLAgacw1M9MFxyrqMFoeXr7S2f+wYaNB5pX3iqxZezoCdTWmlpJwJSi/jWhPOvjVhEWgBqw== X-Received: by 2002:adf:c58f:: with SMTP id m15mr31716590wrg.144.1604477827885; Wed, 04 Nov 2020 00:17:07 -0800 (PST) Received: from 6wind.com (2a01cb0c0005a600345636f7e65ed1a0.ipv6.abo.wanadoo.fr. [2a01:cb0c:5:a600:3456:36f7:e65e:d1a0]) by smtp.gmail.com with ESMTPSA id p1sm1447224wrx.3.2020.11.04.00.17.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Nov 2020 00:17:07 -0800 (PST) Date: Wed, 4 Nov 2020 09:17:06 +0100 From: Olivier Matz To: Stephen Hemminger Cc: dev@dpdk.org Message-ID: <20201104081706.GH1898@platinum> References: <20201024004331.25043-1-stephen@networkplumber.org> <20201104055310.18873-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201104055310.18873-1-stephen@networkplumber.org> User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [dpdk-dev] [PATCH v4] mbuf: allow dynamic flags to be used by secondary process X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 > --- > 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; - }