diff mbox series

RDMA/ipoib: print a message if only child interface is UP

Message ID 20210408083435.13043-1-jinpu.wang@ionos.com (mailing list archive)
State Superseded
Headers show
Series RDMA/ipoib: print a message if only child interface is UP | expand

Commit Message

Jinpu Wang April 8, 2021, 8:34 a.m. UTC
When "enhanced IPoIB" enabled for CX-5 devices, it requires
the parent device to be UP, otherwise the child devices won't
work.[1]

This add a debug message to give admin a hint, if only child interface
is UP, but parent interface is not.

[1]https://lore.kernel.org/linux-rdma/CAMGffE=3YYxv9i7_qQr3-Uv-NGr-7VsnMk8DTjR0YbX1vJBzXQ@mail.gmail.com/T/#u
Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
---
 drivers/infiniband/ulp/ipoib/ipoib_main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Leon Romanovsky April 8, 2021, 9:10 a.m. UTC | #1
On Thu, Apr 08, 2021 at 10:34:35AM +0200, Jack Wang wrote:
> When "enhanced IPoIB" enabled for CX-5 devices, it requires
> the parent device to be UP, otherwise the child devices won't
> work.[1]
> 
> This add a debug message to give admin a hint, if only child interface
> is UP, but parent interface is not.
> 
> [1]https://lore.kernel.org/linux-rdma/CAMGffE=3YYxv9i7_qQr3-Uv-NGr-7VsnMk8DTjR0YbX1vJBzXQ@mail.gmail.com/T/#u
> Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
> ---
>  drivers/infiniband/ulp/ipoib/ipoib_main.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
> index e16b40c09f82..782b792985b8 100644
> --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
> +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
> @@ -164,8 +164,12 @@ int ipoib_open(struct net_device *dev)
>  			dev_change_flags(cpriv->dev, flags | IFF_UP, NULL);
>  		}
>  		up_read(&priv->vlan_rwsem);
> -	}
> +	} else if (priv->parent) {
> +		struct ipoib_dev_priv *ppriv = ipoib_priv(priv->parent);
>  
> +		if (!test_bit(IPOIB_FLAG_ADMIN_UP, &ppriv->flags))
> +			ipoib_dbg(priv, "parent deivce %s is not up, so child may be not functioning.\n", ((struct ipoib_dev_priv *) ppriv)->dev->name);

Why do you need extra casting? "ppriv" is already "struct ipoib_dev_priv *".

Thanks

> +	}
>  	netif_start_queue(dev);
>  
>  	return 0;
> -- 
> 2.25.1
>
Jinpu Wang April 8, 2021, 9:31 a.m. UTC | #2
On Thu, Apr 8, 2021 at 11:10 AM Leon Romanovsky <leon@kernel.org> wrote:
>
> On Thu, Apr 08, 2021 at 10:34:35AM +0200, Jack Wang wrote:
> > When "enhanced IPoIB" enabled for CX-5 devices, it requires
> > the parent device to be UP, otherwise the child devices won't
> > work.[1]
> >
> > This add a debug message to give admin a hint, if only child interface
> > is UP, but parent interface is not.
> >
> > [1]https://lore.kernel.org/linux-rdma/CAMGffE=3YYxv9i7_qQr3-Uv-NGr-7VsnMk8DTjR0YbX1vJBzXQ@mail.gmail.com/T/#u
> > Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
> > ---
> >  drivers/infiniband/ulp/ipoib/ipoib_main.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
> > index e16b40c09f82..782b792985b8 100644
> > --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
> > +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
> > @@ -164,8 +164,12 @@ int ipoib_open(struct net_device *dev)
> >                       dev_change_flags(cpriv->dev, flags | IFF_UP, NULL);
> >               }
> >               up_read(&priv->vlan_rwsem);
> > -     }
> > +     } else if (priv->parent) {
> > +             struct ipoib_dev_priv *ppriv = ipoib_priv(priv->parent);
> >
> > +             if (!test_bit(IPOIB_FLAG_ADMIN_UP, &ppriv->flags))
> > +                     ipoib_dbg(priv, "parent deivce %s is not up, so child may be not functioning.\n", ((struct ipoib_dev_priv *) ppriv)->dev->name);
>
> Why do you need extra casting? "ppriv" is already "struct ipoib_dev_priv *".

Indeed, will remove that.

Thanks
>
> Thanks
>
> > +     }
> >       netif_start_queue(dev);
> >
> >       return 0;
> > --
> > 2.25.1
> >
diff mbox series

Patch

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index e16b40c09f82..782b792985b8 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -164,8 +164,12 @@  int ipoib_open(struct net_device *dev)
 			dev_change_flags(cpriv->dev, flags | IFF_UP, NULL);
 		}
 		up_read(&priv->vlan_rwsem);
-	}
+	} else if (priv->parent) {
+		struct ipoib_dev_priv *ppriv = ipoib_priv(priv->parent);
 
+		if (!test_bit(IPOIB_FLAG_ADMIN_UP, &ppriv->flags))
+			ipoib_dbg(priv, "parent deivce %s is not up, so child may be not functioning.\n", ((struct ipoib_dev_priv *) ppriv)->dev->name);
+	}
 	netif_start_queue(dev);
 
 	return 0;