Skip to contentSkip to conversation

IB/IPoIB: Forward MTU change to driver below

PATCH In review Leon Romanovsky 3 participants 5 messages May 23, 2017 – Jul 22, 2017 2 messages not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IB/IPoIB: Forward MTU change to driver below

From: Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/[email protected]>

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

Reviewed by: Alex Vesker <valex-VPRAkNaXOzVWk0Htik3J/[email protected]>

---
 drivers/infiniband/ulp/ipoib/ipoib_main.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib_main.c +17 -2
index 2869d1adb1de..28068140800c 100644
@@ -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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20170523084252.16018-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

#2 lore raw
Quoted 3 lines · Leon Romanovsky

From: Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/[email protected]>

This patch checks if there is a driver below that

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

Quoted 33 lines

needs to be updated on the new MTU and calls it
accordingly.

Reviewed by: Alex Vesker <valex-VPRAkNaXOzVWk0Htik3J/[email protected]>

---
 drivers/infiniband/ulp/ipoib/ipoib_main.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib_main.c +5 -2
index 2869d1adb1de..28068140800c 100644
@@ -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);
+

drivers/infiniband/ulp/ipoib/ipoib_main.c static int ipoib_change_mtu(struct net_device *dev, int new_mtu) · line 274

Quoted 10 lines
drivers/infiniband/ulp/ipoib/ipoib_main.c +10 -0
+		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?

Quoted 8 lines
drivers/infiniband/ulp/ipoib/ipoib_main.c +2 -1
+
+	return ret;
 }
 
 /* Called with an RCU read lock taken */
--

2.12.2

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] 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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 6 lines · Yuval Shaia
Quoted 3 lines · Leon Romanovsky

From: Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/[email protected]>

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

Quoted 30 lines
Quoted 30 lines

needs to be updated on the new MTU and calls it
accordingly.

Reviewed by: Alex Vesker <valex-VPRAkNaXOzVWk0Htik3J/[email protected]>

---
 drivers/infiniband/ulp/ipoib/ipoib_main.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib_main.c +2 -1
index 2869d1adb1de..28068140800c 100644
@@ -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);
 
Quoted 16 lines
Quoted 4 lines
drivers/infiniband/ulp/ipoib/ipoib_main.c +3 -1
-	return 0;
+	if (priv->rn_ops->ndo_change_mtu) {
+		bool carrier_status = netif_carrier_ok(dev);
+

drivers/infiniband/ulp/ipoib/ipoib_main.c static int ipoib_change_mtu(struct net_device *dev, int new_mtu) · line 274

Quoted 10 lines
drivers/infiniband/ulp/ipoib/ipoib_main.c +10 -0
+		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.

Quoted 13 lines
Quoted 13 lines
drivers/infiniband/ulp/ipoib/ipoib_main.c +2 -1
+
+	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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20170523092428.GK17751-U/[email protected]

Reviewed-by
#5 lore raw
Quoted 57 lines · Leon Romanovsky
Quoted 6 lines · Yuval Shaia
Quoted 3 lines · Leon Romanovsky

From: Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/[email protected]>

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

Quoted 30 lines
Quoted 30 lines

needs to be updated on the new MTU and calls it
accordingly.

Reviewed by: Alex Vesker <valex-VPRAkNaXOzVWk0Htik3J/[email protected]>

---
 drivers/infiniband/ulp/ipoib/ipoib_main.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib_main.c +2 -1
index 2869d1adb1de..28068140800c 100644
@@ -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);
 
Quoted 16 lines
Quoted 4 lines
drivers/infiniband/ulp/ipoib/ipoib_main.c +3 -1
-	return 0;
+	if (priv->rn_ops->ndo_change_mtu) {
+		bool carrier_status = netif_carrier_ok(dev);
+

drivers/infiniband/ulp/ipoib/ipoib_main.c static int ipoib_change_mtu(struct net_device *dev, int new_mtu) · line 274

Quoted 10 lines
drivers/infiniband/ulp/ipoib/ipoib_main.c +10 -0
+		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?

Quoted 7 lines

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

Quoted 4 lines

drivers/infiniband/ulp/ipoib/ipoib_main.c static int ipoib_change_mtu(struct net_device *dev, int new_mtu) · line 277

Quoted 4 lines
drivers/infiniband/ulp/ipoib/ipoib_main.c +2 -0
+
+	return ret;
 }
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/infiniband/ulp/ipoib/ipoib_main.c +0 -1
 /* 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 [email protected] 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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
In reply to a message not in the archive
Quoted 9 lines · Leon Romanovsky

From: Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/[email protected]>

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

Reviewed by: Alex Vesker <valex-VPRAkNaXOzVWk0Htik3J/[email protected]>

This has been accepted into 4.13-rc, thanks.

Signature · 3 lines
Doug Ledford <[email protected]>
    GPG Key ID: B826A3330E572FDD
    Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD