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.laranje...@6wind.com>
> Signed-off-by: Xueming Li <xuemi...@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.

>       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.

> 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

Reply via email to