diff options
author | Serhii Kostiuk <serhii.o.kostiuk@globallogic.com> | 2024-02-01 12:42:21 +0200 |
---|---|---|
committer | Serhii Kostiuk <serhii.o.kostiuk@globallogic.com> | 2024-02-01 13:02:57 +0200 |
commit | e4d5366bc2173eab010a6e65359f7e76066d4f81 (patch) | |
tree | 326bc881c2aa5ef1c928b31deb0c84a5e0ff2a92 | |
parent | 5c95df306c396e27953ee3f765c69d2e9cfafcda (diff) | |
download | meta-multitech-atmel-e4d5366bc2173eab010a6e65359f7e76066d4f81.tar.gz meta-multitech-atmel-e4d5366bc2173eab010a6e65359f7e76066d4f81.tar.bz2 meta-multitech-atmel-e4d5366bc2173eab010a6e65359f7e76066d4f81.zip |
GP-2221 Prevent receive errors on wwan0 when MTU is less than 1500
Changing the MTU for wwan affects the "rx_urb_size" value. When
"rx_urb_size" (effectively an MRU) is too low, the host rejects
packets from the radio, causing a packet loss, connection issues,
increasing interface error counters, and (potentially) high load on
the host CPU to the point when the host effectively stops
responding to user input (reproduced on MTCDT-L4E1 with Atmel).
Decouple MTU and "MRU" by setting "rx_usb_size" to a relatively
high value that is different from MTU.
NOTE: The target kernel in 6.3.x is linux-at91_5.4.199 as of the
time of writing.
Assumptions:
- Cellular networks never send packets bigger than 1500 bytes;
- the radio may send a packet bigger than the MTU size
reported in wds-get-current-settings;
- mLinux and mPower do not use packet aggreggation (like qmap),
hence no need in MTU/MRU sizes bigger than 1500.
-rw-r--r-- | recipes-kernel/linux/linux-at91-5.4.199/linux-5.4-usb-qmi-wwan-prevent-babble.patch | 70 | ||||
-rw-r--r-- | recipes-kernel/linux/linux-at91_5.4.199.bb | 1 |
2 files changed, 71 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-at91-5.4.199/linux-5.4-usb-qmi-wwan-prevent-babble.patch b/recipes-kernel/linux/linux-at91-5.4.199/linux-5.4-usb-qmi-wwan-prevent-babble.patch new file mode 100644 index 0000000..0d24f81 --- /dev/null +++ b/recipes-kernel/linux/linux-at91-5.4.199/linux-5.4-usb-qmi-wwan-prevent-babble.patch @@ -0,0 +1,70 @@ +From: "Seija K." <doremylover123@gmail.com> +Date: Tue, 13 Dec 2022 12:40:52 -0500 +Subject: [PATCH] net: Fix for packets being rejected in the xHCI controller's + ring buffer + +When a packet larger than MTU arrives in Linux from the modem, it is +discarded with -EOVERFLOW error (Babble error). + +This is seen on USB3.0 and USB2.0 buses. + +This is because the MRU (Max Receive Size) is not a separate entity +from the MTU (Max Transmit Size), and the received packets can be +larger than those transmitted. + +Following the babble error, there was an endless supply of zero-length +URBs that were rejected with -EPROTO (increasing the rx input error +counter each time). + +This is only seen on USB3.0. These continue to come ad infinitum until +the modem is shut down. + +There appears to be a bug in the core USB handling code in Linux that +doesn't deal with network MTUs smaller than 1500 bytes well. + +By default, the dev->hard_mtu (the real MTU) is in lockstep with +dev->rx_urb_size (essentially an MRU), and the latter is causing +trouble. + +This has nothing to do with the modems; the issue can be reproduced by +getting a USB-Ethernet dongle, setting the MTU to 1430, and pinging +with size greater than 1406. + +Signed-off-by: Seija Kijin <doremylover123@gmail.com> + +Co-Authored-By: TarAldarion <gildeap@tcd.ie> + +Upstream-Status: Inappropriate [other] + Workaround for the babble issue, breaks qmap link aggregation that uses + datagram sizes bigger than 1504. qmap link aggregation requires datagram + sizes of 4096, 16384 bytes and so on, depending on the radio. + mPower and mLinux do not use qmap link aggregation, but set the MTU based + on the value reported by the radio (provider-specific). This patch sets + "almost-MRU" to a high and fixed value, and should be enough for our needs. + See GP-2221 for details. + +--- + drivers/net/usb/qmi_wwan.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c +index 554d4e2a84a4..39db53a74b5a 100644 +--- a/drivers/net/usb/qmi_wwan.c ++++ b/drivers/net/usb/qmi_wwan.c +@@ -842,6 +842,13 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf) + } + dev->net->netdev_ops = &qmi_wwan_netdev_ops; + dev->net->sysfs_groups[0] = &qmi_wwan_sysfs_attr_group; ++ /* LTE Networks don't always respect their own MTU on the receiving side; ++ * e.g. AT&T pushes 1430 MTU but still allows 1500 byte packets from ++ * far-end networks. Make the receive buffer large enough to accommodate ++ * them, and add four bytes so MTU does not equal MRU on network ++ * with 1500 MTU. Otherwise, usbnet_change_mtu() will change both. ++ */ ++ dev->rx_urb_size = ETH_DATA_LEN + 4; + err: + return status; + } +-- +2.38.2 + diff --git a/recipes-kernel/linux/linux-at91_5.4.199.bb b/recipes-kernel/linux/linux-at91_5.4.199.bb index bcd58bb..64ab072 100644 --- a/recipes-kernel/linux/linux-at91_5.4.199.bb +++ b/recipes-kernel/linux/linux-at91_5.4.199.bb @@ -54,6 +54,7 @@ COMMON_PATCHES = " \ file://linux-5.4-revert-net-macb-Properly-handle-phylink-on-at91rm9200.patch \ file://linux-5.4-bring-back-PAE-bit-and-fix-NCFGR-values-applicable-f.patch \ file://linux-5.4-quiet-overlay.patch \ + file://linux-5.4-usb-qmi-wwan-prevent-babble.patch \ file://mt-at91.h \ " |