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 11E1FA04DD for ; Tue, 20 Oct 2020 22:58:18 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E2FE2A8F0; Tue, 20 Oct 2020 22:58:16 +0200 (CEST) Received: from mail-pj1-f67.google.com (mail-pj1-f67.google.com [209.85.216.67]) by dpdk.org (Postfix) with ESMTP id 3EE87A8F0 for ; Tue, 20 Oct 2020 22:58:16 +0200 (CEST) Received: by mail-pj1-f67.google.com with SMTP id az3so1509973pjb.4 for ; Tue, 20 Oct 2020 13:58:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tWtiScIgxhH1qyZaztNxzWoi9kWBm9p4bxI426lhqHQ=; b=DGyN7Q2r2mfmKLPkQQtEv7RtgLDeUQNcoLa/k96T5Zo0zeYfzparTac7Icx5VUVfYi YwCqbFIsUZ+gShhaiuYwzauVPwH76GZWcheq5N6SMIKC3MA45409ERlQmoZLvyxQbheL IqMeGXPGunctInDRv9iHWkwoMRWy6/n7GinevHpc4YD2Ee4LE7J66LKd9o56kv6zcsz/ 6EroYbogAnf684Gg1pciJpkr2dEHcb1KjEnC2AGzIbrVQPog6G+cnFeA1oJ0uHsGT4fI ei5rZr0MvhEVT6cnBJsbrsexT1Uq6iuPEt98SbhtmHMpVrxsGS4vdAUz4g/FrtMK0wXP byHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tWtiScIgxhH1qyZaztNxzWoi9kWBm9p4bxI426lhqHQ=; b=EzQASWziU2fbBjbZOMNVydW63bhHzMpeRFCOlQOnIdVekmunY1dzqSoySM0Ux7YLDg ZzKgzqxSbZ5AAi1rCwxj+5DSER2HbhslPipY6+qEG9XbLrO51vfIWS5h9qRRGbYs4MA+ gf49oOp+e8oTTHPpdLMk2G3gmLHmxOF+/jj7xDLhzrjJysglIL7QZQD/9HL10msmeetU e6oC9k1w7W1oIx8s5Y/76FyPXYU2PO+9iOgJcyKJLT9Qd5ew0sCNAzaxKHdElQBK+LfP TvMyFBtH/5OyWwSTl49aIb/i38vREFWWcdLs82kOaoVH0wzx8QdTSPgY4mX0bLl21pCL ol9A== X-Gm-Message-State: AOAM531c1k1OId5+glEY86ZvKpxyzVad+tc+AcxPUntyuAUPRMXDf+DS zMjSqcanE33WGrAX2tSjMmVtQQ== X-Google-Smtp-Source: ABdhPJwgHv6nV3K5yP8KViMwe8p8bHBFzWIXJSqvrtHRWmM2DubUxcb5NKmu03X+4GaBXmVeUG7ZwA== X-Received: by 2002:a17:90b:3314:: with SMTP id kf20mr95686pjb.19.1603227494295; Tue, 20 Oct 2020 13:58:14 -0700 (PDT) Received: from hermes.corp.microsoft.com (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id l82sm3268262pfd.102.2020.10.20.13.58.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Oct 2020 13:58:13 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: stable@dpdk.org, Stephen Hemminger , olivier.matz@6wind.com Date: Tue, 20 Oct 2020 13:58:05 -0700 Message-Id: <20201020205805.24311-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201015172019.3181-1-stephen@networkplumber.org> References: <20201015172019.3181-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH v2] mbuf: allow dynamic flags to be used by secondary process X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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 --- v2 - move check to inside locked region lib/librte_mbuf/rte_mbuf_dyn.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/lib/librte_mbuf/rte_mbuf_dyn.c b/lib/librte_mbuf/rte_mbuf_dyn.c index 538a43f6959f..717898c0df02 100644 --- a/lib/librte_mbuf/rte_mbuf_dyn.c +++ b/lib/librte_mbuf/rte_mbuf_dyn.c @@ -185,13 +185,11 @@ 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) { @@ -384,13 +382,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) { -- 2.27.0