[dpdk-dev,v2] net/mlx5: fix link status initialization

Message ID 20180410061336.49844-1-shahafs@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Shahaf Shuler
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Shahaf Shuler April 10, 2018, 6:13 a.m. UTC
  Following commit 7ba5320baa32 ("net/mlx5: fix link status behavior")
The initial link status is no longer set as part of the port start.

When LSC interrupts are enabled, ethdev layer reads the link status
directly from the device data instead of using the PMD callback.
This may cause application to query the link as down while in fact it was
already up before the DPDK application start (and no interrupt to fix
it).

Fixes: 7ba5320baa32 ("net/mlx5: fix link status behavior")
Cc: nelio.laranjeiro@6wind.com

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
---

On v2:
 - Reworded commit log.
 - Cleared the wait_to_complete on the link update call.

---
 drivers/net/mlx5/mlx5.c | 6 ++++++
 1 file changed, 6 insertions(+)
  

Comments

Nélio Laranjeiro April 10, 2018, 8:17 a.m. UTC | #1
On Tue, Apr 10, 2018 at 09:13:36AM +0300, Shahaf Shuler wrote:
> Following commit 7ba5320baa32 ("net/mlx5: fix link status behavior")
> The initial link status is no longer set as part of the port start.
> 
> When LSC interrupts are enabled, ethdev layer reads the link status
> directly from the device data instead of using the PMD callback.
> This may cause application to query the link as down while in fact it was
> already up before the DPDK application start (and no interrupt to fix
> it).
> 
> Fixes: 7ba5320baa32 ("net/mlx5: fix link status behavior")
> Cc: nelio.laranjeiro@6wind.com
> 
> Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
> Acked-by: Yongseok Koh <yskoh@mellanox.com>
> ---
> 
> On v2:
>  - Reworded commit log.
>  - Cleared the wait_to_complete on the link update call.
> 
> ---
>  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 cfab558979..3d222df707 100644
> --- a/drivers/net/mlx5/mlx5.c
> +++ b/drivers/net/mlx5/mlx5.c
> @@ -991,6 +991,12 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
>  		DRV_LOG(DEBUG, "port %u forcing Ethernet interface up",
>  			eth_dev->data->port_id);
>  		mlx5_set_link_up(eth_dev);
> +		/*
> +		 * Even though the interrupt handler is not installed yet,
> +		 * interrupts will still trigger on the asyn_fd from
> +		 * Verbs context returned by ibv_open_device().
> +		 */
> +		mlx5_link_update(eth_dev, 0);
>  		/* Store device configuration on private structure. */
>  		priv->config = config;
>  		continue;
> -- 
> 2.12.0

You should have linked this patch with the ethdev one[1], if the ethdev is
refused, this patch won't solve anything.

With a reserves of acceptance of [1]: 
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>

Thanks,

[1] https://dpdk.org/ml/archives/dev/2018-April/096387.html
  
Shahaf Shuler April 11, 2018, 9:05 a.m. UTC | #2
Tuesday, April 10, 2018 11:18 AM, Nélio Laranjeiro:
> Subject: Re: [PATCH v2] net/mlx5: fix link status initialization
> 
> On Tue, Apr 10, 2018 at 09:13:36AM +0300, Shahaf Shuler wrote:
> > Following commit 7ba5320baa32 ("net/mlx5: fix link status behavior")
> > The initial link status is no longer set as part of the port start.
> >
> > When LSC interrupts are enabled, ethdev layer reads the link status
> > directly from the device data instead of using the PMD callback.
> > This may cause application to query the link as down while in fact it
> > was already up before the DPDK application start (and no interrupt to
> > fix it).
> >
> > Fixes: 7ba5320baa32 ("net/mlx5: fix link status behavior")
> > Cc: nelio.laranjeiro@6wind.com
> >
> > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
> > Acked-by: Yongseok Koh <yskoh@mellanox.com>
> > ---
> >
> > On v2:
> >  - Reworded commit log.
> >  - Cleared the wait_to_complete on the link update call.
> >
> > ---
> >  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
> > cfab558979..3d222df707 100644
> > --- a/drivers/net/mlx5/mlx5.c
> > +++ b/drivers/net/mlx5/mlx5.c
> > @@ -991,6 +991,12 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv
> __rte_unused,
> >  		DRV_LOG(DEBUG, "port %u forcing Ethernet interface up",
> >  			eth_dev->data->port_id);
> >  		mlx5_set_link_up(eth_dev);
> > +		/*
> > +		 * Even though the interrupt handler is not installed yet,
> > +		 * interrupts will still trigger on the asyn_fd from
> > +		 * Verbs context returned by ibv_open_device().
> > +		 */
> > +		mlx5_link_update(eth_dev, 0);
> >  		/* Store device configuration on private structure. */
> >  		priv->config = config;
> >  		continue;
> > --
> > 2.12.0
> 
> You should have linked this patch with the ethdev one[1], if the ethdev is
> refused, this patch won't solve anything.
> 
> With a reserves of acceptance of [1]:
> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>

As the ethdev pathc applied -> Applied to next-net-mlx, thanks
  

Patch

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index cfab558979..3d222df707 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -991,6 +991,12 @@  mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 		DRV_LOG(DEBUG, "port %u forcing Ethernet interface up",
 			eth_dev->data->port_id);
 		mlx5_set_link_up(eth_dev);
+		/*
+		 * Even though the interrupt handler is not installed yet,
+		 * interrupts will still trigger on the asyn_fd from
+		 * Verbs context returned by ibv_open_device().
+		 */
+		mlx5_link_update(eth_dev, 0);
 		/* Store device configuration on private structure. */
 		priv->config = config;
 		continue;