mbuf: fix dynamic fields and flags with multiprocess
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: stable@dpdk.org Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Olivier Matz <olivier.matz@6wind.com>
This commit is contained in:
parent
082ac00826
commit
0429a2e1a4
@ -174,7 +174,7 @@ __mbuf_dynfield_lookup(const char *name)
|
||||
break;
|
||||
}
|
||||
|
||||
if (te == NULL) {
|
||||
if (te == NULL || mbuf_dynfield == NULL) {
|
||||
rte_errno = ENOENT;
|
||||
return NULL;
|
||||
}
|
||||
@ -187,19 +187,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));
|
||||
@ -386,19 +382,15 @@ 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) {
|
||||
rte_errno = ENOENT;
|
||||
if (mbuf_dynflag == NULL)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (params != NULL)
|
||||
memcpy(params, &mbuf_dynflag->params, sizeof(*params));
|
||||
|
Loading…
x
Reference in New Issue
Block a user