[dpdk-dev] [PATCH v1 1/2] net/mlx5: change eth device reference for secondary process
Xueming(Steven) Li
xuemingl at mellanox.com
Fri Aug 25 09:15:50 CEST 2017
Nelio, thanks, comments inline.
> -----Original Message-----
> From: Nélio Laranjeiro [mailto:nelio.laranjeiro at 6wind.com]
> Sent: Friday, August 25, 2017 2:52 PM
> To: Xueming(Steven) Li <xuemingl at mellanox.com>
> Cc: dev at dpdk.org
> Subject: Re: [PATCH v1 1/2] net/mlx5: change eth device reference for
> secondary process
>
> Hi Xueming,
>
> Please see some comments below,
>
> On Thu, Aug 24, 2017 at 10:03:40PM +0800, Xueming Li wrote:
> > rte_eth_dev created by primary process were not available in secondary
> > process, it was not possible to use the primary process local memory
> > object from a secondary process.
> >
> > This patch modify the reference of primary rte_eth_dev object, use
> > local rte_eth_dev secondary process instead.
> >
> > Cc: Nelio Laranjeiro <nelio.laranjeiro at 6wind.com>
> > Signed-off-by: Xueming Li <xuemingl at mellanox.com>
> > ---
> > drivers/net/mlx5/mlx5.h | 6 ++---
> > drivers/net/mlx5/mlx5_ethdev.c | 52 ++++++++++++++++++++++-----------
> --------
> > drivers/net/mlx5/mlx5_fdir.c | 3 +++
> > drivers/net/mlx5/mlx5_rss.c | 3 +++
> > drivers/net/mlx5/mlx5_rxq.c | 2 ++
> > drivers/net/mlx5/mlx5_trigger.c | 4 ++--
> > 6 files changed, 41 insertions(+), 29 deletions(-)
> >
> > diff --git a/drivers/net/mlx5/mlx5_ethdev.c
> > b/drivers/net/mlx5/mlx5_ethdev.c index f5167e0..fce7dd5 100644
> > --- a/drivers/net/mlx5/mlx5_ethdev.c
> > +++ b/drivers/net/mlx5/mlx5_ethdev.c
> > @@ -1356,17 +1356,17 @@ struct priv *
> > * 0 on success, errno value on failure.
> > */
> > static int
> > -priv_set_link(struct priv *priv, int up)
> > +mlx5_dev_set_link(struct rte_eth_dev *dev, int up)
> > {
> > - struct rte_eth_dev *dev = priv->dev;
> > + struct priv *priv = dev->data->dev_private;
> > int err;
> >
>
> This function should lock/unclock priv.
This is a static function, caller function do the lock/unlock.
Is there naming convention here? Mlx5_* is outpost interfaces that normally require lock/unlock priv?
>
> > if (up) {
> > err = priv_set_flags(priv, ~IFF_UP, IFF_UP);
> > if (err)
> > return err;
> > - priv_select_tx_function(priv);
> > - priv_select_rx_function(priv);
> > + mlx5_dev_select_tx_function(dev);
> > + mlx5_dev_select_rx_function(dev);
>
> This also induce that those function mlx5_dev_select_rx/tx_function() should
> be renamed to:
> priv_dev_select_rx/tx_function(struct *priv, struct rte_eth_dev *dev, ...)
>
> this will avoid the multiple lock/unlocks inside the functions.
So priv_* are lock-free functions?
>
> > diff --git a/drivers/net/mlx5/mlx5_fdir.c
> > b/drivers/net/mlx5/mlx5_fdir.c index 6acc053..0f3b70a 100644
> > --- a/drivers/net/mlx5/mlx5_fdir.c
> > +++ b/drivers/net/mlx5/mlx5_fdir.c
> > @@ -1075,6 +1075,9 @@ struct mlx5_fdir_filter {
> > int ret = EINVAL;
> > struct priv *priv = dev->data->dev_private;
> >
> > + if (mlx5_is_secondary())
> > + return -E_RTE_SECONDARY;
> > +
>
> Extra empty line also in the following copy/past of this if statement.
> >[...]
>
> Thanks,
>
> --
> Nélio Laranjeiro
> 6WIND
More information about the dev
mailing list