All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH rdma-next] IB/IPoIB: Forward MTU change to driver below
@ 2017-05-23  8:42 Leon Romanovsky
       [not found] ` <20170523084252.16018-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Leon Romanovsky @ 2017-05-23  8:42 UTC (permalink / raw)
  To: Doug Ledford; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Erez Shitrit

From: Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

This patch checks if there is a driver below that
needs to be updated on the new MTU and calls it
accordingly.

Signed-off-by: Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed by: Alex Vesker <valex-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 drivers/infiniband/ulp/ipoib/ipoib_main.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 2869d1adb1de..28068140800c 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -233,6 +233,7 @@ static netdev_features_t ipoib_fix_features(struct net_device *dev, netdev_featu
 static int ipoib_change_mtu(struct net_device *dev, int new_mtu)
 {
 	struct ipoib_dev_priv *priv = ipoib_priv(dev);
+	int ret = 0;

 	/* dev->mtu > 2K ==> connected mode */
 	if (ipoib_cm_admin_enabled(dev)) {
@@ -256,9 +257,23 @@ static int ipoib_change_mtu(struct net_device *dev, int new_mtu)
 		ipoib_dbg(priv, "MTU must be smaller than the underlying "
 				"link layer MTU - 4 (%u)\n", priv->mcast_mtu);

-	dev->mtu = min(priv->mcast_mtu, priv->admin_mtu);
+	new_mtu = min(priv->mcast_mtu, priv->admin_mtu);

-	return 0;
+	if (priv->rn_ops->ndo_change_mtu) {
+		bool carrier_status = netif_carrier_ok(dev);
+
+		netif_carrier_off(dev);
+
+		/* notify lower level on the real mtu */
+		ret = priv->rn_ops->ndo_change_mtu(dev, new_mtu);
+
+		if (carrier_status)
+			netif_carrier_on(dev);
+	} else {
+		dev->mtu = new_mtu;
+	}
+
+	return ret;
 }

 /* Called with an RCU read lock taken */
--
2.12.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH rdma-next] IB/IPoIB: Forward MTU change to driver below
       [not found] ` <20170523084252.16018-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2017-05-23  8:56   ` Yuval Shaia
  2017-05-23  9:24     ` Leon Romanovsky
  2017-07-22 17:07   ` Doug Ledford
  1 sibling, 1 reply; 5+ messages in thread
From: Yuval Shaia @ 2017-05-23  8:56 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Erez Shitrit

On Tue, May 23, 2017 at 11:42:52AM +0300, Leon Romanovsky wrote:
> From: Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> This patch checks if there is a driver below that

Is it "below" or "upper" in the driver hierarchy?

> needs to be updated on the new MTU and calls it
> accordingly.
> 
> Signed-off-by: Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Reviewed by: Alex Vesker <valex-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> ---
>  drivers/infiniband/ulp/ipoib/ipoib_main.c | 19 +++++++++++++++++--
>  1 file changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
> index 2869d1adb1de..28068140800c 100644
> --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
> +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
> @@ -233,6 +233,7 @@ static netdev_features_t ipoib_fix_features(struct net_device *dev, netdev_featu
>  static int ipoib_change_mtu(struct net_device *dev, int new_mtu)
>  {
>  	struct ipoib_dev_priv *priv = ipoib_priv(dev);
> +	int ret = 0;
> 
>  	/* dev->mtu > 2K ==> connected mode */
>  	if (ipoib_cm_admin_enabled(dev)) {
> @@ -256,9 +257,23 @@ static int ipoib_change_mtu(struct net_device *dev, int new_mtu)
>  		ipoib_dbg(priv, "MTU must be smaller than the underlying "
>  				"link layer MTU - 4 (%u)\n", priv->mcast_mtu);
> 
> -	dev->mtu = min(priv->mcast_mtu, priv->admin_mtu);
> +	new_mtu = min(priv->mcast_mtu, priv->admin_mtu);
> 
> -	return 0;
> +	if (priv->rn_ops->ndo_change_mtu) {
> +		bool carrier_status = netif_carrier_ok(dev);
> +
> +		netif_carrier_off(dev);
> +
> +		/* notify lower level on the real mtu */
> +		ret = priv->rn_ops->ndo_change_mtu(dev, new_mtu);
> +
> +		if (carrier_status)
> +			netif_carrier_on(dev);
> +	} else {
> +		dev->mtu = new_mtu;
> +	}

So we don't want dev->mtu to be updated if driver was registered?

> +
> +	return ret;
>  }
> 
>  /* Called with an RCU read lock taken */
> --
> 2.12.2
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH rdma-next] IB/IPoIB: Forward MTU change to driver below
  2017-05-23  8:56   ` Yuval Shaia
@ 2017-05-23  9:24     ` Leon Romanovsky
       [not found]       ` <20170523092428.GK17751-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Leon Romanovsky @ 2017-05-23  9:24 UTC (permalink / raw)
  To: Yuval Shaia; +Cc: Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Erez Shitrit

[-- Attachment #1: Type: text/plain, Size: 2611 bytes --]

On Tue, May 23, 2017 at 11:56:45AM +0300, Yuval Shaia wrote:
> On Tue, May 23, 2017 at 11:42:52AM +0300, Leon Romanovsky wrote:
> > From: Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> >
> > This patch checks if there is a driver below that
>
> Is it "below" or "upper" in the driver hierarchy?

The part which  close to the HW. I called it "below".

>
> > needs to be updated on the new MTU and calls it
> > accordingly.
> >
> > Signed-off-by: Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> > Reviewed by: Alex Vesker <valex-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> > Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> > ---
> >  drivers/infiniband/ulp/ipoib/ipoib_main.c | 19 +++++++++++++++++--
> >  1 file changed, 17 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
> > index 2869d1adb1de..28068140800c 100644
> > --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
> > +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
> > @@ -233,6 +233,7 @@ static netdev_features_t ipoib_fix_features(struct net_device *dev, netdev_featu
> >  static int ipoib_change_mtu(struct net_device *dev, int new_mtu)
> >  {
> >  	struct ipoib_dev_priv *priv = ipoib_priv(dev);
> > +	int ret = 0;
> >
> >  	/* dev->mtu > 2K ==> connected mode */
> >  	if (ipoib_cm_admin_enabled(dev)) {
> > @@ -256,9 +257,23 @@ static int ipoib_change_mtu(struct net_device *dev, int new_mtu)
> >  		ipoib_dbg(priv, "MTU must be smaller than the underlying "
> >  				"link layer MTU - 4 (%u)\n", priv->mcast_mtu);
> >
> > -	dev->mtu = min(priv->mcast_mtu, priv->admin_mtu);
> > +	new_mtu = min(priv->mcast_mtu, priv->admin_mtu);
> >
> > -	return 0;
> > +	if (priv->rn_ops->ndo_change_mtu) {
> > +		bool carrier_status = netif_carrier_ok(dev);
> > +
> > +		netif_carrier_off(dev);
> > +
> > +		/* notify lower level on the real mtu */
> > +		ret = priv->rn_ops->ndo_change_mtu(dev, new_mtu);
> > +
> > +		if (carrier_status)
> > +			netif_carrier_on(dev);
> > +	} else {
> > +		dev->mtu = new_mtu;
> > +	}
>
> So we don't want dev->mtu to be updated if driver was registered?

It is updated in ndo_change_mtu call. See nes. cxgb3/4 and mlx4/5 as an
example.

>
> > +
> > +	return ret;
> >  }
> >
> >  /* Called with an RCU read lock taken */
> > --
> > 2.12.2
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH rdma-next] IB/IPoIB: Forward MTU change to driver below
       [not found]       ` <20170523092428.GK17751-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
@ 2017-05-23 11:13         ` Yuval Shaia
  0 siblings, 0 replies; 5+ messages in thread
From: Yuval Shaia @ 2017-05-23 11:13 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Erez Shitrit

On Tue, May 23, 2017 at 12:24:28PM +0300, Leon Romanovsky wrote:
> On Tue, May 23, 2017 at 11:56:45AM +0300, Yuval Shaia wrote:
> > On Tue, May 23, 2017 at 11:42:52AM +0300, Leon Romanovsky wrote:
> > > From: Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> > >
> > > This patch checks if there is a driver below that
> >
> > Is it "below" or "upper" in the driver hierarchy?
> 
> The part which  close to the HW. I called it "below".
> 
> >
> > > needs to be updated on the new MTU and calls it
> > > accordingly.
> > >
> > > Signed-off-by: Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> > > Reviewed by: Alex Vesker <valex-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> > > Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> > > ---
> > >  drivers/infiniband/ulp/ipoib/ipoib_main.c | 19 +++++++++++++++++--
> > >  1 file changed, 17 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
> > > index 2869d1adb1de..28068140800c 100644
> > > --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
> > > +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
> > > @@ -233,6 +233,7 @@ static netdev_features_t ipoib_fix_features(struct net_device *dev, netdev_featu
> > >  static int ipoib_change_mtu(struct net_device *dev, int new_mtu)
> > >  {
> > >  	struct ipoib_dev_priv *priv = ipoib_priv(dev);
> > > +	int ret = 0;
> > >
> > >  	/* dev->mtu > 2K ==> connected mode */
> > >  	if (ipoib_cm_admin_enabled(dev)) {
> > > @@ -256,9 +257,23 @@ static int ipoib_change_mtu(struct net_device *dev, int new_mtu)
> > >  		ipoib_dbg(priv, "MTU must be smaller than the underlying "
> > >  				"link layer MTU - 4 (%u)\n", priv->mcast_mtu);
> > >
> > > -	dev->mtu = min(priv->mcast_mtu, priv->admin_mtu);
> > > +	new_mtu = min(priv->mcast_mtu, priv->admin_mtu);
> > >
> > > -	return 0;
> > > +	if (priv->rn_ops->ndo_change_mtu) {
> > > +		bool carrier_status = netif_carrier_ok(dev);
> > > +
> > > +		netif_carrier_off(dev);
> > > +
> > > +		/* notify lower level on the real mtu */
> > > +		ret = priv->rn_ops->ndo_change_mtu(dev, new_mtu);
> > > +
> > > +		if (carrier_status)
> > > +			netif_carrier_on(dev);
> > > +	} else {
> > > +		dev->mtu = new_mtu;
> > > +	}
> >
> > So we don't want dev->mtu to be updated if driver was registered?
> 
> It is updated in ndo_change_mtu call. See nes. cxgb3/4 and mlx4/5 as an
> example.
> 
> >
> > > +
> > > +	return ret;
> > >  }

Reviewed-by: Yuval Shaia <yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>

> > >
> > >  /* Called with an RCU read lock taken */
> > > --
> > > 2.12.2
> > >
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> > > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> > > More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH rdma-next] IB/IPoIB: Forward MTU change to driver below
       [not found] ` <20170523084252.16018-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  2017-05-23  8:56   ` Yuval Shaia
@ 2017-07-22 17:07   ` Doug Ledford
  1 sibling, 0 replies; 5+ messages in thread
From: Doug Ledford @ 2017-07-22 17:07 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Erez Shitrit


[-- Attachment #1.1: Type: text/plain, Size: 712 bytes --]

On 5/23/2017 4:42 AM, Leon Romanovsky wrote:
> From: Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> This patch checks if there is a driver below that
> needs to be updated on the new MTU and calls it
> accordingly.
> 
> Signed-off-by: Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Reviewed by: Alex Vesker <valex-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

This has been accepted into 4.13-rc, thanks.

-- 
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
    GPG Key ID: B826A3330E572FDD
    Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]

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

end of thread, other threads:[~2017-07-22 17:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-23  8:42 [PATCH rdma-next] IB/IPoIB: Forward MTU change to driver below Leon Romanovsky
     [not found] ` <20170523084252.16018-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-05-23  8:56   ` Yuval Shaia
2017-05-23  9:24     ` Leon Romanovsky
     [not found]       ` <20170523092428.GK17751-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-05-23 11:13         ` Yuval Shaia
2017-07-22 17:07   ` Doug Ledford

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.