Re: [PATCH v3 4/6] net/nfb: use process private variable for internal data

Martin Spinler
2026-01-20T14:14:01Z

On Mon, 2026-01-19 at 16:13 -0800, Stephen Hemminger wrote:
> > Internal structures of libnfb can't be shared between processes.
> > Move these structures from dev_private to process_private, which allows
> > secondary process to correctly initialize and uninitialize the eth_dev.
> >
> >
> > diff --git a/drivers/net/nfb/nfb.h b/drivers/net/nfb/nfb.h
> > index 917b830283..09d4b7da5f 100644
> > --- a/drivers/net/nfb/nfb.h
> > +++ b/drivers/net/nfb/nfb.h
> > @@ -48,7 +48,9 @@ struct pmd_internals {
> > struct nc_rxmac *rxmac[RTE_MAX_NC_RXMAC];
> > struct nc_txmac *txmac[RTE_MAX_NC_TXMAC];
> > struct nfb_device *nfb;
> > +};
> >
> > +struct pmd_priv {
> > uint16_t max_rx_queues;
> > uint16_t max_tx_queues;
> > };
>
> Where does max_rx_queues get populated in the secondary process?
> What if either process calls configure to change number of queues?
>
> Don't see other drivers splitting structure here.

The NFB PMD must use separate handles for each process (each process
has its own FILE* and mmap handles from libnfb). However, some data,
such as max_rx_queues, is constant and can still be stored in shared
memory (and inited by RTE_PROC_PRIMARY).

The pmd_priv is stored in data->dev_private, so it is shared between
processes. However, your comment pointed at the opposite issue, that
the nfb_eth_dev_init() assigns to the (pmd_)priv->max_rx_queues in both
process types (duplicate assignment).
I will fix this by moving those assignments to the RTE_PROC_PRIMARY-
only block.

By the way, this partial diff shows the struct pmd_internals being
split into the new struct pmd_priv. Semantically, however, the struct
pmd_internals is the new one, is newly alocated and holds the
process_private data.

Does that make it better sense now?