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 35BDFA04DB; Thu, 15 Oct 2020 19:20:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1B2671DCE8; Thu, 15 Oct 2020 19:20:33 +0200 (CEST) Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by dpdk.org (Postfix) with ESMTP id 33F331DB33 for ; Thu, 15 Oct 2020 19:20:30 +0200 (CEST) Received: by mail-pl1-f196.google.com with SMTP id t18so1984673plo.1 for ; Thu, 15 Oct 2020 10:20:30 -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:mime-version :content-transfer-encoding; bh=+bVVEI0dfEnMvn8farpOn3kTcHHebI9nqbt+IEw/Kqw=; b=nNGrJ37Qk4PviOxEWigc41ZKxaNhNAnH+MAVd+ETnEo10VsHjxwgTFa2l/cynFb0R/ CpFCMM8obW5frsn3ApmK7Av4zFqePtus8/hUPYJqQ4yxDsspz0/CQTv7ATgLzHHCAH61 vk2MdK5GrqNMBQriVtDgCK6S3qFqq7ZvToVPxHKyL4/oE3I39b6G9uA1NI154jDy4/0O iHg2h2M1SI/uIMtaisD7HBz47ua351d19o8gRCt5PMSXpch0h0VhlHPAJhYygjQL+5+F A9ujtt5EUirPkNKwHz41j4vqjD/9EzRxbK+ODleOvRJ2+Wn2quxDSko2tS+Q2SxVSUqd WsVQ== 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:mime-version :content-transfer-encoding; bh=+bVVEI0dfEnMvn8farpOn3kTcHHebI9nqbt+IEw/Kqw=; b=Tj+0NIfnX0J4MjmE8wPYRoTqeRv6Y+K49KWxceP2RgDS6GgzpVq4MsB2uG9NUbPKwg HSUaXiLUlUzZGfUOK9QwdA2HQDvsXJc1r0FeGcIyYPq8rExWv4sOVnhPgmVtozBN/cFI 9J0rgDrvMPuQTtHZjktho1aEVhrYuNFC/MS8K7umDWBxXysiUVTFdrmChzS1xPCOxkRi td0x4bgeORi4ak3zRyv8TzdTr8LMjBb/rsR8vDI39myq2o7fFfQrZZ/LSt0YbPX9mtdR B+Ag/isGlA8H0OawlN2E9tiMWru5uPcdBYYp15tbv9Jya23dWTSpnyFgoV9CYrh29t3j l67A== X-Gm-Message-State: AOAM532FSDgFIK/lC9vc6C5sOOhPG5sBV0AA/6JcuDPOHtd0+kyavt9F DAxQLaF5k69CHGAh5R1aF066Bw== X-Google-Smtp-Source: ABdhPJwdLxjFvj5t4cJiZyRxqb67MYYsn1FcEIjU4OyA7qL42XC0I6LelqXA/OB9+g/xIR/BsyhpXQ== X-Received: by 2002:a17:902:be0d:b029:d2:8084:cb19 with SMTP id r13-20020a170902be0db02900d28084cb19mr4809424pls.45.1602782428309; Thu, 15 Oct 2020 10:20:28 -0700 (PDT) Received: from hermes.local (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id p12sm3681855pgm.29.2020.10.15.10.20.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2020 10:20:26 -0700 (PDT) From: Stephen Hemminger To: olivier.matz@6wind.com, anatoly.burakov@intel.com Cc: dev@dpdk.org, Stephen Hemminger Date: Thu, 15 Oct 2020 10:20:19 -0700 Message-Id: <20201015172019.3181-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] 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" The dynamic flag management is broken for multi-process environment. All calls to lookup dynamic flags or fields will fail in secondary process. This is 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 --- lib/librte_mbuf/rte_mbuf_dyn.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_mbuf/rte_mbuf_dyn.c b/lib/librte_mbuf/rte_mbuf_dyn.c index 538a43f6959f..ac4801b4d770 100644 --- a/lib/librte_mbuf/rte_mbuf_dyn.c +++ b/lib/librte_mbuf/rte_mbuf_dyn.c @@ -185,7 +185,7 @@ rte_mbuf_dynfield_lookup(const char *name, struct rte_mbuf_dynfield *params) { struct mbuf_dynfield_elt *mbuf_dynfield; - if (shm == NULL) { + if (shm == NULL && init_shared_mem() < 0) { rte_errno = ENOENT; return -1; } @@ -384,7 +384,7 @@ rte_mbuf_dynflag_lookup(const char *name, { struct mbuf_dynflag_elt *mbuf_dynflag; - if (shm == NULL) { + if (shm == NULL && init_shared_mem() < 0) { rte_errno = ENOENT; return -1; } -- 2.27.0