patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/mlx5: fix device reference in secondary process
@ 2018-05-02  6:13 Yongseok Koh
  2018-05-02  6:53 ` Nélio Laranjeiro
  0 siblings, 1 reply; 3+ messages in thread
From: Yongseok Koh @ 2018-05-02  6:13 UTC (permalink / raw)
  To: adrien.mazarguil, nelio.laranjeiro; +Cc: dev, Yongseok Koh, stable

rte_eth_devices[] is not shared between primary and secondary process, but
a static array to each process. The backward pointer of device (priv->dev)
must be reset when a secondary process attaches to a device.

Fixes: f8b9a3bad467 ("net/mlx5: install a socket to exchange a file descriptor")
Cc: stable@dpdk.org

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
---
 drivers/net/mlx5/mlx5.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 8f983061a..f606e3dd4 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -799,6 +799,12 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 			}
 			eth_dev->device = &pci_dev->device;
 			eth_dev->dev_ops = &mlx5_dev_sec_ops;
+			/*
+			 * rte_eth_devices[] is not shared but static to each
+			 * process. The backward pointer should be reset.
+			 */
+			priv = eth_dev->data->dev_private;
+			priv->dev = eth_dev;
 			err = mlx5_uar_init_secondary(eth_dev);
 			if (err)
 				goto error;
-- 
2.11.0

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

* Re: [dpdk-stable] [PATCH] net/mlx5: fix device reference in secondary process
  2018-05-02  6:13 [dpdk-stable] [PATCH] net/mlx5: fix device reference in secondary process Yongseok Koh
@ 2018-05-02  6:53 ` Nélio Laranjeiro
  2018-05-02  7:12   ` Yongseok Koh
  0 siblings, 1 reply; 3+ messages in thread
From: Nélio Laranjeiro @ 2018-05-02  6:53 UTC (permalink / raw)
  To: Yongseok Koh; +Cc: adrien.mazarguil, dev, stable

On Tue, May 01, 2018 at 11:13:20PM -0700, Yongseok Koh wrote:
> rte_eth_devices[] is not shared between primary and secondary process, but
> a static array to each process. The backward pointer of device (priv->dev)
> must be reset when a secondary process attaches to a device.
> 
> Fixes: f8b9a3bad467 ("net/mlx5: install a socket to exchange a file descriptor")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> ---
>  drivers/net/mlx5/mlx5.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
> index 8f983061a..f606e3dd4 100644
> --- a/drivers/net/mlx5/mlx5.c
> +++ b/drivers/net/mlx5/mlx5.c
> @@ -799,6 +799,12 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
>  			}
>  			eth_dev->device = &pci_dev->device;
>  			eth_dev->dev_ops = &mlx5_dev_sec_ops;
> +			/*
> +			 * rte_eth_devices[] is not shared but static to each
> +			 * process. The backward pointer should be reset.
> +			 */
> +			priv = eth_dev->data->dev_private;
> +			priv->dev = eth_dev;
>  			err = mlx5_uar_init_secondary(eth_dev);
>  			if (err)
>  				goto error;
> -- 
> 2.11.0
> 

-- 
Nélio Laranjeiro
6WIND

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

* Re: [dpdk-stable] [PATCH] net/mlx5: fix device reference in secondary process
  2018-05-02  6:53 ` Nélio Laranjeiro
@ 2018-05-02  7:12   ` Yongseok Koh
  0 siblings, 0 replies; 3+ messages in thread
From: Yongseok Koh @ 2018-05-02  7:12 UTC (permalink / raw)
  To: Nélio Laranjeiro; +Cc: Adrien Mazarguil, dev, stable

> On May 1, 2018, at 11:53 PM, Nélio Laranjeiro <nelio.laranjeiro@6wind.com> wrote:
> 
> On Tue, May 01, 2018 at 11:13:20PM -0700, Yongseok Koh wrote:
>> rte_eth_devices[] is not shared between primary and secondary process, but
>> a static array to each process. The backward pointer of device (priv->dev)
>> must be reset when a secondary process attaches to a device.
>> 
>> Fixes: f8b9a3bad467 ("net/mlx5: install a socket to exchange a file descriptor")
>> Cc: stable@dpdk.org
>> 
>> Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>

Sorry, self NACK.
priv->dev is shared, so if it is changed by secondary process, primary will get
affected. Will come up with a different idea...

Thanks,
Yongseok


>> ---
>> drivers/net/mlx5/mlx5.c | 6 ++++++
>> 1 file changed, 6 insertions(+)
>> 
>> diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
>> index 8f983061a..f606e3dd4 100644
>> --- a/drivers/net/mlx5/mlx5.c
>> +++ b/drivers/net/mlx5/mlx5.c
>> @@ -799,6 +799,12 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
>> 			}
>> 			eth_dev->device = &pci_dev->device;
>> 			eth_dev->dev_ops = &mlx5_dev_sec_ops;
>> +			/*
>> +			 * rte_eth_devices[] is not shared but static to each
>> +			 * process. The backward pointer should be reset.
>> +			 */
>> +			priv = eth_dev->data->dev_private;
>> +			priv->dev = eth_dev;
>> 			err = mlx5_uar_init_secondary(eth_dev);
>> 			if (err)
>> 				goto error;
>> -- 
>> 2.11.0
>> 
> 
> -- 
> Nélio Laranjeiro
> 6WIND


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

end of thread, other threads:[~2018-05-02  7:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-02  6:13 [dpdk-stable] [PATCH] net/mlx5: fix device reference in secondary process Yongseok Koh
2018-05-02  6:53 ` Nélio Laranjeiro
2018-05-02  7:12   ` Yongseok Koh

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