<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
span.gmail-im
        {mso-style-name:gmail-im;}
span.gmail-il
        {mso-style-name:gmail-il;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-NZ" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Hi Paul,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Does same problem occur with MBIM as well?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Amol<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> libqmi-devel <libqmi-devel-bounces@lists.freedesktop.org>
<b>On Behalf Of </b>Paul Gildea<br>
<b>Sent:</b> Tuesday, 26 May 2020 6:43 PM<br>
<b>To:</b> libqmi (development) <libqmi-devel@lists.freedesktop.org><br>
<b>Subject:</b> Re: libqmi-devel Digest, Vol 102, Issue 8<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Hi Geert,<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I am seeing this -71 EPROTO error on two occasions. The one I am currently seeing is happening with Telit LN960A18's. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">We pass traffic over the modem with iperf3 and it resets after a time period with those errors, usually within 30 minutes.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">If I force the modem to USB2.0 it seems to not happen. I'm currently trying to find out why this is happening, I am looking at the<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">kernel debug and am seeing a "do warm reset" debug message from the driver (hub.c) and have been trying to track down why.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">The second was covered in detail in another thread on here called "MTU issues", here was the finding:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal">Enabled traces for usbnet.c and xhci-ring.c file in debugfs as follows:<br>
<span class="gmail-im"><span style="font-family:"Courier New";color:#500050">mount -t debugfs none /sys/kernel/debug</span></span><span style="font-family:"Courier New";color:#500050"><br>
<span class="gmail-im">echo -n 'file usbnet.c +p' > /sys/kernel/debug/dynamic_debug/control</span><br>
</span><span style="font-family:"Courier New"">echo -n 'file xhci-ring.c +p' > /sys/kernel/debug/dynamic_debug/control</span><br>
Saw a lot of errors indicating URB with len=0 when it was expecting len=1430. This was preceded by an URB of len 1024 bytes:<br>
<span style="font-family:"Courier New"">xhci_hcd 0000:00:14.0: Babble error for slot 10 ep 12 on endpoint<br>
xhci_hcd 0000:00:14.0: Giveback URB ffff8802193be540, len = 1024, expected = 1430, status = -75<br>
xhci_hcd 0000:00:14.0: Transfer error for slot 10 ep 12 on endpoint<br>
</span>/repeated<br>
Error -75 is EOVERFLOW, which makes sense as per<i> include/uapi/asm-generic/errno.h</i><br>
<span style="font-family:"Courier New"">#define EOVERFLOW 75 /* Value too large for defined data type */</span><br>
<b>"Babble error"</b>: When a packet larger than <span class="gmail-il">MTU</span> arrives in Linux from the modem and is discarded with -EOVERFLOW error.<br>
This is seen on USB3.0 and USB2.0 busses. This is essentially because the MRU (Max Receive Size) is not a separate entity to the <span class="gmail-il">MTU</span> (Max Transmit Size) and the received packets can be larger than those transmitted.<br>
<b>"Endless input error"</b>: Following the babble error we see an endless supply of zero-length URBs which are rejected with -EPROTO (increasing the rx input error counter each time).<br>
This is only seen on USB3.0. These continue to come ad infinitum until the modem is shutdown.<br>
There appears to be a bug in the core USB handling code in Linux that doesn't deal well with network <span class="gmail-il">MTUs</span> smaller than 1500 bytes. By default the dev->hard_mtu (the "real" <span class="gmail-il">MTU</span>) is in lockstep with
 dev->rx_urb_size (essentially an MRU), and it's the latter that is causing trouble. This has nothing to do with the modems; the issue can be reproduced by getting a USB-Ethernet dongle, setting the <span class="gmail-il">MTU</span> to 1430, and pinging with
 size greater than 1406.<br>
Will submit the below patch that solves the issue, if that is acceptable?<br>
<span style="font-family:"Arial",sans-serif"><br>
+diff -Naur linux-4.14.73/drivers/net/usb/qmi_wwan.c linux-4.14.73-rx_size_fix/drivers/net/usb/qmi_wwan.c<br>
+--- linux-4.14.73/drivers/net/usb/qmi_wwan.c 2018-09-29 11:06:07.000000000 +0100<br>
++++ linux-4.14.73-rx_size_fix/drivers/net/usb/qmi_wwan.c 2020-01-31 18:05:07.709008785 +0000<br>
+@@ -740,6 +740,14 @@<br>
+ }<br>
+ dev->net->netdev_ops = &qmi_wwan_netdev_ops;<br>
+ dev->net->sysfs_groups[0] = &qmi_wwan_sysfs_attr_group;<br>
++<br>
++ /* LTE Networks don't always respect their own <span class="gmail-il">MTU</span> on receive side;
<br>
++ * e.g. AT&T pushes 1430 <span class="gmail-il">MTU</span> but still allows 1500 byte packets from
<br>
++ * far-end network. Make receive buffer large enough to accommodate<br>
++ * them, and add four bytes so <span class="gmail-il">MTU</span> does not equal MRU on network<br>
++ * with 1500 <span class="gmail-il">MTU</span> otherwise usbnet_change_mtu() will change both.<br>
++ * This is a sufficient max receive buffer as over 1500 <span class="gmail-il">
MTU</span>, <br>
++ * USB driver issues are not seen.<br>
++ */<br>
++ dev->rx_urb_size = ETH_DATA_LEN + 4;<br>
+ err:<br>
+ return status;<br>
+ }</span><o:p></o:p></p>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I submitted this fix to the kernel but you just reminded me that it was rejected due to formatting and I completely forgot to resubmit.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">--<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Paul <o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Tue, 26 May 2020 at 13:00, <<a href="mailto:libqmi-devel-request@lists.freedesktop.org" target="_blank">libqmi-devel-request@lists.freedesktop.org</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal">Send libqmi-devel mailing list submissions to<br>
        <a href="mailto:libqmi-devel@lists.freedesktop.org" target="_blank">libqmi-devel@lists.freedesktop.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="https://lists.freedesktop.org/mailman/listinfo/libqmi-devel" target="_blank">
https://lists.freedesktop.org/mailman/listinfo/libqmi-devel</a><br>
or, via email, send a message with subject or body 'help' to<br>
        <a href="mailto:libqmi-devel-request@lists.freedesktop.org" target="_blank">
libqmi-devel-request@lists.freedesktop.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:libqmi-devel-owner@lists.freedesktop.org" target="_blank">
libqmi-devel-owner@lists.freedesktop.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of libqmi-devel digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
   1. USB errors with qmi-wwan (Geert Lens)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Mon, 25 May 2020 15:42:56 +0200<br>
From: Geert Lens <<a href="mailto:g.lens@livetech-systems.com" target="_blank">g.lens@livetech-systems.com</a>><br>
To: <a href="mailto:libqmi-devel@lists.freedesktop.org" target="_blank">libqmi-devel@lists.freedesktop.org</a><br>
Subject: USB errors with qmi-wwan<br>
Message-ID:<br>
        <CAOCF0GO7xCyfRyTJmJnT=<a href="mailto:iZ9MoDCo6XL1Fa0YrOZz5GWm-%2Bd3g@mail.gmail.com" target="_blank">iZ9MoDCo6XL1Fa0YrOZz5GWm-+d3g@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hi,<br>
<br>
We are using the QMI interface on the Quectel BG96 modem and everything<br>
works fine, but after a few hours the connection is suddenly disconnected<br>
and the qmi_proxy starts hogging CPU.<br>
<br>
During this time the USB interfaces of the modem are not responding and<br>
will only work again after the modem is physically turned off and on.<br>
<br>
Output from dmesg:<br>
<br>
*qmi_wwan 1-1:1.4: nonzero urb status received: -71*<br>
*qmi_wwan 1-1:1.4: wdm_int_callback - 0 bytes*<br>
*qmi_wwan 1-1:1.4: nonzero urb status received: -71*<br>
*qmi_wwan 1-1:1.4: wdm_int_callback - 0 bytes*<br>
*qmi_wwan 1-1:1.4: nonzero urb status received: -71*<br>
*qmi_wwan 1-1:1.4: wdm_int_callback - 0 bytes*<br>
*qmi_wwan 1-1:1.4: nonzero urb status received: -71*<br>
*qmi_wwan 1-1:1.4: wdm_int_callback - 0 bytes*<br>
<br>
I have read that the -71 (EPROTO) is mostly caused by hardware or firmware<br>
issues and that it can cause the kernel to disable the device, is<br>
this correct? Or could it be something else?<br>
<br>
Version used:<br>
- Linux kernel: v4.14.78<br>
- ModemManager: v1.12.10<br>
- libqmi: v1.24.10<br>
<br>
*Geert*<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="https://lists.freedesktop.org/archives/libqmi-devel/attachments/20200525/c827d211/attachment-0001.htm" target="_blank">https://lists.freedesktop.org/archives/libqmi-devel/attachments/20200525/c827d211/attachment-0001.htm</a>><br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
_______________________________________________<br>
libqmi-devel mailing list<br>
<a href="mailto:libqmi-devel@lists.freedesktop.org" target="_blank">libqmi-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/libqmi-devel" target="_blank">https://lists.freedesktop.org/mailman/listinfo/libqmi-devel</a><br>
<br>
<br>
------------------------------<br>
<br>
End of libqmi-devel Digest, Vol 102, Issue 8<br>
********************************************<o:p></o:p></p>
</blockquote>
</div>
</div>
<font color="#9a9a9a"><font style="FONT-SIZE: 8pt" face="Arial">
<hr style="FONT-SIZE: 8pt; FONT-FAMILY: Arial">
The information in this email communication (inclusive of attachments) is confidential to 4RF Limited and the intended recipient(s). If you are not the intended recipient(s), please note that any use, disclosure, distribution or copying of this information
 or any part thereof is strictly prohibited and that the author accepts no liability for the consequences of any action taken on the basis of the information provided. If you have received this email in error, please notify the sender immediately by return
 email and then delete all instances of this email from your system. 4RF Limited will not accept responsibility for any consequences associated with the use of this email (including, but not limited to, damages sustained as a result of any viruses and/or any
 action or lack of action taken in reliance on it).</font> </font>
</body>
</html>