DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] mbuf: allow dynamic flags to be used by secondary process
@ 2020-10-15 17:20 Stephen Hemminger
  2020-10-20 12:18 ` Olivier Matz
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Stephen Hemminger @ 2020-10-15 17:20 UTC (permalink / raw)
  To: olivier.matz, anatoly.burakov; +Cc: dev, Stephen Hemminger

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 <stephen@networkplumber.org>
---
 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


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-11-04 17:41 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).