Skip to contentSkip to conversation

net: usb: qmi_wwan: restore mtu min/max values after raw_ip switch

PATCH In review Daniele Palmas 3 participants 4 messages Feb 21, 2020 – Feb 24, 2020

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

PATCH 1/1 net: usb: qmi_wwan: restore mtu min/max values after raw_ip switch

usbnet creates network interfaces with min_mtu = 0 and max_mtu = ETH_MAX_MTU.

These values are not modified by qmi_wwan when the network interface is created initially, allowing, for example, to set mtu greater than 1500.

When a raw_ip switch is done (raw_ip set to 'Y', then set to 'N') the mtu values for the network interface are set through ether_setup, with min_mtu = ETH_MIN_MTU and max_mtu = ETH_DATA_LEN, not allowing anymore to set mtu greater than 1500 (error: mtu greater than device maximum).

The patch restores the original min/max mtu values set by usbnet after a raw_ip switch.

---
 drivers/net/usb/qmi_wwan.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/usb/qmi_wwan.c +3 -0
index 3b7a3b8a5e06..5754bb6ca0ee 100644
@@ -337,6 +337,9 @@ static void qmi_wwan_netdev_setup(struct net_device *net)
 		netdev_dbg(net, "mode: raw IP\n");
 	} else if (!net->header_ops) { /* don't bother if already set */
 		ether_setup(net);
+		/* Restoring min/max mtu values set originally by usbnet */
+		net->min_mtu = 0;
+		net->max_mtu = ETH_MAX_MTU;
 		clear_bit(EVENT_NO_IP_ALIGN, &dev->flags);
 		netdev_dbg(net, "mode: Ethernet\n");
 	}
Signature · 1 line
2.17.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Daniele Palmas

usbnet creates network interfaces with min_mtu = 0 and max_mtu = ETH_MAX_MTU.

These values are not modified by qmi_wwan when the network interface is created initially, allowing, for example, to set mtu greater than 1500.

When a raw_ip switch is done (raw_ip set to 'Y', then set to 'N') the mtu values for the network interface are set through ether_setup, with min_mtu = ETH_MIN_MTU and max_mtu = ETH_DATA_LEN, not allowing anymore to set mtu greater than 1500 (error: mtu greater than device maximum).

Quoted 4 lines

The patch restores the original min/max mtu values set by usbnet after a raw_ip switch.

Great! I tried to look up the origin of this bug, and it seems to be a hard-to-spot fallout from the 'centralized MTU checking'. Not easy to see the hidden connection in usbnet.c and eth.c. Thanks for finding and fixing it!

This should probably go to stable as well?

#2 lore raw

Il giorno dom 23 feb 2020 alle ore 14:41 Bjørn Mork <[email protected]> ha scritto:

Quoted 17 lines
Quoted 14 lines · Daniele Palmas

usbnet creates network interfaces with min_mtu = 0 and max_mtu = ETH_MAX_MTU.

These values are not modified by qmi_wwan when the network interface is created initially, allowing, for example, to set mtu greater than 1500.

When a raw_ip switch is done (raw_ip set to 'Y', then set to 'N') the mtu values for the network interface are set through ether_setup, with min_mtu = ETH_MIN_MTU and max_mtu = ETH_DATA_LEN, not allowing anymore to set mtu greater than 1500 (error: mtu greater than device maximum).

The patch restores the original min/max mtu values set by usbnet after a raw_ip switch.

Quoted 9 lines
Quoted 1 line

Great! I tried to look up the origin of this bug, and it seems to be a hard-to-spot fallout from the 'centralized MTU checking'. Not easy to see the hidden connection in usbnet.c and eth.c. Thanks for finding and fixing it!

This should probably go to stable as well?

Yes, I think it won't hurt.

Thanks,
Daniele

Quoted 1 line
maintainer
#3 lore raw
In reply to Daniele Palmas

From: Daniele Palmas <[email protected]>
Date: Fri, 21 Feb 2020 14:17:05 +0100

Quoted 11 lines

usbnet creates network interfaces with min_mtu = 0 and max_mtu = ETH_MAX_MTU.

These values are not modified by qmi_wwan when the network interface is created initially, allowing, for example, to set mtu greater than 1500.

When a raw_ip switch is done (raw_ip set to 'Y', then set to 'N') the mtu values for the network interface are set through ether_setup, with min_mtu = ETH_MIN_MTU and max_mtu = ETH_DATA_LEN, not allowing anymore to set mtu greater than 1500 (error: mtu greater than device maximum).

Quoted 4 lines

The patch restores the original min/max mtu values set by usbnet after a raw_ip switch.

Applied and queued up for -stable.