Skip to contentSkip to conversation

net: ethernet: aquantia: set net_device mtu when mtu is changed

PATCH In review David Arcari 4 participants 7 messages Mar 9, 2017 – Mar 13, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net: ethernet: aquantia: set net_device mtu when mtu is changed

When the aquantia device mtu is changed the net_device structure is not updated. As a result the ip command does not properly reflect the mtu change.

Commit 5513e16421cb incorrectly assumed that __dev_set_mtu() was making the assignment ndev->mtu = new_mtu; This is not true in the case where the driver has a ndo_change_mtu routine.

Fixes 5513e16421cb ("net: ethernet: aquantia: Fixes for aq_ndev_change_mtu")

v2: no longer close/open net-device after mtu change

---
 drivers/net/ethernet/aquantia/atlantic/aq_main.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_main.c +2 -8
index dad6362..bba5ebd 100644
@@ -96,15 +96,9 @@ static int aq_ndev_change_mtu(struct net_device *ndev, int new_mtu)
 	struct aq_nic_s *aq_nic = netdev_priv(ndev);
 	int err = aq_nic_set_mtu(aq_nic, new_mtu + ETH_HLEN);
 
-	if (err < 0)
-		goto err_exit;
+	if (!err)
+		ndev->mtu = new_mtu;
 
-	if (netif_running(ndev)) {
-		aq_ndev_close(ndev);
-		aq_ndev_open(ndev);
-	}
-
-err_exit:
 	return err;
 }
 
Signature · 1 line
1.8.3.1
Tested-by on v2 1/1
#1 lore raw
Quoted 30 lines · David Arcari

When the aquantia device mtu is changed the net_device structure is not updated. As a result the ip command does not properly reflect the mtu change.

Commit 5513e16421cb incorrectly assumed that __dev_set_mtu() was making the assignment ndev->mtu = new_mtu; This is not true in the case where the driver has a ndo_change_mtu routine.

Fixes 5513e16421cb ("net: ethernet: aquantia: Fixes for aq_ndev_change_mtu")

v2: no longer close/open net-device after mtu change

---
 drivers/net/ethernet/aquantia/atlantic/aq_main.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_main.c +2 -2
index dad6362..bba5ebd 100644
@@ -96,15 +96,9 @@ static int aq_ndev_change_mtu(struct net_device *ndev, int new_mtu)
 	struct aq_nic_s *aq_nic = netdev_priv(ndev);
 	int err = aq_nic_set_mtu(aq_nic, new_mtu + ETH_HLEN);
 
-	if (err < 0)
-		goto err_exit;
+	if (!err)
+		ndev->mtu = new_mtu;

drivers/net/ethernet/aquantia/atlantic/aq_main.c static int aq_ndev_change_mtu(struct net_device *ndev, int new_mtu) · line 104

Quoted 10 lines
drivers/net/ethernet/aquantia/atlantic/aq_main.c +0 -6
 
-	if (netif_running(ndev)) {
-		aq_ndev_close(ndev);
-		aq_ndev_open(ndev);
-	}
-
-err_exit:
 	return err;
 }
 
#2 lore raw
In reply to David Arcari

Hi,

Quoted 26 lines · David Arcari

When the aquantia device mtu is changed the net_device structure is not updated. As a result the ip command does not properly reflect the mtu change.

Commit 5513e16421cb incorrectly assumed that __dev_set_mtu() was making the assignment ndev->mtu = new_mtu; This is not true in the case where the driver has a ndo_change_mtu routine.

Fixes 5513e16421cb ("net: ethernet: aquantia: Fixes for aq_ndev_change_mtu")

v2: no longer close/open net-device after mtu change

---
 drivers/net/ethernet/aquantia/atlantic/aq_main.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_main.c +0 -1
index dad6362..bba5ebd 100644
@@ -96,15 +96,9 @@ static int aq_ndev_change_mtu(struct net_device *ndev, int new_mtu)
 	struct aq_nic_s *aq_nic = netdev_priv(ndev);
 	int err = aq_nic_set_mtu(aq_nic, new_mtu + ETH_HLEN);
 
-	if (err < 0)

drivers/net/ethernet/aquantia/atlantic/aq_main.c static int aq_ndev_change_mtu(struct net_device *ndev, int new_mtu) · line 107

Quoted 10 lines
drivers/net/ethernet/aquantia/atlantic/aq_main.c +2 -7
-		goto err_exit;
+	if (!err)
+		ndev->mtu = new_mtu;
 
-	if (netif_running(ndev)) {
-		aq_ndev_close(ndev);
-		aq_ndev_open(ndev);
-	}
-
-err_exit:

Removing the restart has nothing to do with the bug you want to fix here, has it? I suggest to send a separate patch for this.

Regards,
Lino

#3 lore raw

Hi,

Quoted 43 lines · Lino Sanfilippo

Hi,

Quoted 26 lines · David Arcari

When the aquantia device mtu is changed the net_device structure is not updated. As a result the ip command does not properly reflect the mtu change.

Commit 5513e16421cb incorrectly assumed that __dev_set_mtu() was making the assignment ndev->mtu = new_mtu; This is not true in the case where the driver has a ndo_change_mtu routine.

Fixes 5513e16421cb ("net: ethernet: aquantia: Fixes for aq_ndev_change_mtu")

v2: no longer close/open net-device after mtu change

---
 drivers/net/ethernet/aquantia/atlantic/aq_main.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_main.c +0 -1
index dad6362..bba5ebd 100644
@@ -96,15 +96,9 @@ static int aq_ndev_change_mtu(struct net_device *ndev, int new_mtu)
 	struct aq_nic_s *aq_nic = netdev_priv(ndev);
 	int err = aq_nic_set_mtu(aq_nic, new_mtu + ETH_HLEN);
 
-	if (err < 0)

drivers/net/ethernet/aquantia/atlantic/aq_main.c static int aq_ndev_change_mtu(struct net_device *ndev, int new_mtu) · line 107

Quoted 10 lines
drivers/net/ethernet/aquantia/atlantic/aq_main.c +2 -7
-		goto err_exit;
+	if (!err)
+		ndev->mtu = new_mtu;
 
-	if (netif_running(ndev)) {
-		aq_ndev_close(ndev);
-		aq_ndev_open(ndev);
-	}
-
-err_exit:

Removing the restart has nothing to do with the bug you want to fix here, has it? I suggest to send a separate patch for this.

Quoted 3 lines

Regards,
Lino

I'm fine with that. Pavel does that work for you?

It would mean that the original version of this patch should be applied and either you or I could send the follow-up patch.

Best,

-Dave

#4 lore raw
Quoted 50 lines · David Arcari

Hi,

Quoted 43 lines · Lino Sanfilippo

Hi,

Quoted 26 lines · David Arcari

When the aquantia device mtu is changed the net_device structure is not updated. As a result the ip command does not properly reflect the mtu change.

Commit 5513e16421cb incorrectly assumed that __dev_set_mtu() was making the assignment ndev->mtu = new_mtu; This is not true in the case where the driver has a ndo_change_mtu routine.

Fixes 5513e16421cb ("net: ethernet: aquantia: Fixes for aq_ndev_change_mtu")

v2: no longer close/open net-device after mtu change

---
 drivers/net/ethernet/aquantia/atlantic/aq_main.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_main.c +0 -1
index dad6362..bba5ebd 100644
@@ -96,15 +96,9 @@ static int aq_ndev_change_mtu(struct net_device *ndev, int new_mtu)
 	struct aq_nic_s *aq_nic = netdev_priv(ndev);
 	int err = aq_nic_set_mtu(aq_nic, new_mtu + ETH_HLEN);
 
-	if (err < 0)

drivers/net/ethernet/aquantia/atlantic/aq_main.c static int aq_ndev_change_mtu(struct net_device *ndev, int new_mtu) · line 107

Quoted 10 lines
drivers/net/ethernet/aquantia/atlantic/aq_main.c +2 -7
-		goto err_exit;
+	if (!err)
+		ndev->mtu = new_mtu;
 
-	if (netif_running(ndev)) {
-		aq_ndev_close(ndev);
-		aq_ndev_open(ndev);
-	}
-
-err_exit:

Removing the restart has nothing to do with the bug you want to fix here, has it? I suggest to send a separate patch for this.

Quoted 3 lines

Regards,
Lino

Quoted 9 lines

I'm fine with that. Pavel does that work for you?

It would mean that the original version of this patch should be applied and either you or I could send the follow-up patch.

Best,

-Dave

David,

Yes, I think for this it is better to make separate patch. I can prepare a patch for "close/open netdev" myself.

Probably you need send the original version of this patch as "v3" (I'm no sure what it is possible to discard v2 and apply v1 instead.)

Thank you,
Pavel

#5 lore raw
Quoted 68 lines · Pavel Belous
Quoted 53 lines · David Arcari

Hi,

Quoted 46 lines · Lino Sanfilippo

Hi,

Quoted 28 lines · David Arcari

When the aquantia device mtu is changed the net_device structure is not updated. As a result the ip command does not properly reflect the mtu change.

Commit 5513e16421cb incorrectly assumed that __dev_set_mtu() was making the assignment ndev->mtu = new_mtu; This is not true in the case where the driver has a ndo_change_mtu routine.

Fixes 5513e16421cb ("net: ethernet: aquantia: Fixes for aq_ndev_change_mtu")

v2: no longer close/open net-device after mtu change

---
 drivers/net/ethernet/aquantia/atlantic/aq_main.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_main.c +0 -1
index dad6362..bba5ebd 100644
@@ -96,15 +96,9 @@ static int aq_ndev_change_mtu(struct net_device *ndev,
 int new_mtu)
     struct aq_nic_s *aq_nic = netdev_priv(ndev);
     int err = aq_nic_set_mtu(aq_nic, new_mtu + ETH_HLEN);
 
-    if (err < 0)

drivers/net/ethernet/aquantia/atlantic/aq_main.c static int aq_ndev_change_mtu(struct net_device *ndev, · line 108

Quoted 10 lines
drivers/net/ethernet/aquantia/atlantic/aq_main.c +2 -7
-        goto err_exit;
+    if (!err)
+        ndev->mtu = new_mtu;
 
-    if (netif_running(ndev)) {
-        aq_ndev_close(ndev);
-        aq_ndev_open(ndev);
-    }
-
-err_exit:

Removing the restart has nothing to do with the bug you want to fix here, has it?
I suggest to send a separate patch for this.

Quoted 3 lines

Regards,
Lino

Quoted 9 lines

I'm fine with that. Pavel does that work for you?

It would mean that the original version of this patch should be applied and either you or I could send the follow-up patch.

Best,

-Dave

David,

Quoted 8 lines

Yes, I think for this it is better to make separate patch. I can prepare a patch for "close/open netdev" myself.

Probably you need send the original version of this patch as "v3" (I'm no sure what it is possible to discard v2 and apply v1 instead.)

Thank you,
Pavel

Please drop v2 of this patch. We would like to have v1 applied.

Thanks,

-Dave

maintainer
#6 lore raw

From: David Arcari <[email protected]>
Date: Mon, 13 Mar 2017 16:30:52 -0400

Quoted 1 line

Please drop v2 of this patch. We would like to have v1 applied.

Resubmit v1 again if you want me to do this.