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 59D7BA04B0; Sat, 24 Oct 2020 02:43:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3223C6CCB; Sat, 24 Oct 2020 02:43:43 +0200 (CEST) Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by dpdk.org (Postfix) with ESMTP id 446216CAA for ; Sat, 24 Oct 2020 02:43:42 +0200 (CEST) Received: by mail-pl1-f195.google.com with SMTP id bf6so1905941plb.4 for ; Fri, 23 Oct 2020 17:43:42 -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=GwIRAmh8l2MaVySCGvV3KTnZC8uwaC5+AEFUOWCnSHo=; b=dflZ/Ugu9kEBgqO+ywJOMHyvK3ISC2m01FFo7OfXHWlqQ7UpGiXuVm9/sMrhWh6Gsh aQ4GXMseRoAvfGluqw6lwLuR4aLJat+vAiMCy6l57w7W+1lDLtvTlsbWJQ5qdOmV5i6I aoC69nMIU8TH8ZC7ipkr25mcro3b4d4JOmJQNBpgVLuJBof6mtkRVR+oa/bpS0SiQRQY /61sA/X1vZQ6t0WRbTSWZQ9Dwftl/RIXrfbJkZATyAmCdDjITTzkHEAWhS18TPy/f2dW /nI+7l3F+MwWixSUFD0ytlJVz7JGxlnKLXoh5FwsCJXTHK+hvW6uqkRgDvOUGwnSoewh XOBg== 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=GwIRAmh8l2MaVySCGvV3KTnZC8uwaC5+AEFUOWCnSHo=; b=X5ni34Msae1DSQfbH0kxJuOR2vI3Fhba2AdgBKTWwISb/g0EHAcRyS2+sWXN3FzgAF oYqTGTLfuDvRhqVpF21iDKrZ7AQ6tiq4nNDTtL4AufJHNyppsDLvugGPxqdmSJ+0ywZ9 SS4VswJ8jsncKD7BUiNLyPagoN8NI6yrC1epHOW/+dXV0LwiSwtn8jCMe7OuMVZw/hbA VjVnrfKJ402yfUlgeBR6JrAVsw0n3Jw6yKctIjvbwLG1EyI1mqY4I0Wwc/6uD1kb00Iy 4WKsm/IJHSkWA2OVb/Wm3GbZ/woYjfiHEHExiIolNTD0YLuNLjHHfI3Q3WHl8b71DIb5 ceng== X-Gm-Message-State: AOAM531x4XdmXAgEt9/IJr58lv5yGGU0U4UBMRshMtq9dMsXevHPgnOQ 8aOlN+IztufllBPg1iP8HiYR0KgGqU6seXlS X-Google-Smtp-Source: ABdhPJxbft/26+/9s35X4BtROVCeTcKaT5+QT7J1TE50Qpgm1E+LlD7bDO/8zsSzf/LCevjzMbP8EA== X-Received: by 2002:a17:902:cb05:b029:d5:e8de:fb62 with SMTP id c5-20020a170902cb05b02900d5e8defb62mr1499513ply.62.1603500219927; Fri, 23 Oct 2020 17:43:39 -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 u7sm3386224pfn.37.2020.10.23.17.43.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Oct 2020 17:43:38 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: stable@dpdk.org, Stephen Hemminger , olivier.matz@6wind.com Date: Fri, 23 Oct 2020 17:43:31 -0700 Message-Id: <20201024004331.25043-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-dev] [PATCH v3] mbuf: fix dynamic flags lookup from 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 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 --- v3 - change title, fix one extra whitespace 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..554ec5a1ca4f 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