aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSalvatore Bonaccorso <carnil@debian.org>2021-06-05 08:48:57 +0200
committerSalvatore Bonaccorso <carnil@debian.org>2021-06-05 08:50:20 +0200
commit79a7260df594af1e629651ad095b8ed2a7a44ede (patch)
treeaff26a883649c401a696f2eba0a739afd5dc9be9
parent5c045da8e17ea2e26a2f70d5d768f4ec606a1ed0 (diff)
downloadkernel_replicant_linux-79a7260df594af1e629651ad095b8ed2a7a44ede.tar.gz
kernel_replicant_linux-79a7260df594af1e629651ad095b8ed2a7a44ede.tar.bz2
kernel_replicant_linux-79a7260df594af1e629651ad095b8ed2a7a44ede.zip
net: usb: cdc_ncm: don't spew notifications
Closes: #989451
-rw-r--r--debian/changelog1
-rw-r--r--debian/patches/bugfix/all/net-usb-cdc_ncm-don-t-spew-notifications.patch108
-rw-r--r--debian/patches/series1
3 files changed, 110 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index 0f14d5a3459a..af5267e1b058 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -227,6 +227,7 @@ linux (5.10.42-1) UNRELEASED; urgency=medium
* [rt] Refresh "net/Qdisc: use a seqlock instead seqcount"
* Ignore some ABI changes that should not affect OOT modules
* Bump ABI to 8
+ * net: usb: cdc_ncm: don't spew notifications (Closes: #989451)
-- Uwe Kleine-König <ukleinek@debian.org> Sat, 29 May 2021 09:54:27 +0200
diff --git a/debian/patches/bugfix/all/net-usb-cdc_ncm-don-t-spew-notifications.patch b/debian/patches/bugfix/all/net-usb-cdc_ncm-don-t-spew-notifications.patch
new file mode 100644
index 000000000000..fa9639076a10
--- /dev/null
+++ b/debian/patches/bugfix/all/net-usb-cdc_ncm-don-t-spew-notifications.patch
@@ -0,0 +1,108 @@
+From: Grant Grundler <grundler@chromium.org>
+Date: Tue, 19 Jan 2021 17:12:08 -0800
+Subject: net: usb: cdc_ncm: don't spew notifications
+Origin: https://git.kernel.org/linus/de658a195ee23ca6aaffe197d1d2ea040beea0a2
+Bug-Debian: https://bugs.debian.org/989451
+
+RTL8156 sends notifications about every 32ms.
+Only display/log notifications when something changes.
+
+This issue has been reported by others:
+ https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1832472
+ https://lkml.org/lkml/2020/8/27/1083
+
+...
+[785962.779840] usb 1-1: new high-speed USB device number 5 using xhci_hcd
+[785962.929944] usb 1-1: New USB device found, idVendor=0bda, idProduct=8156, bcdDevice=30.00
+[785962.929949] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=6
+[785962.929952] usb 1-1: Product: USB 10/100/1G/2.5G LAN
+[785962.929954] usb 1-1: Manufacturer: Realtek
+[785962.929956] usb 1-1: SerialNumber: 000000001
+[785962.991755] usbcore: registered new interface driver cdc_ether
+[785963.017068] cdc_ncm 1-1:2.0: MAC-Address: 00:24:27:88:08:15
+[785963.017072] cdc_ncm 1-1:2.0: setting rx_max = 16384
+[785963.017169] cdc_ncm 1-1:2.0: setting tx_max = 16384
+[785963.017682] cdc_ncm 1-1:2.0 usb0: register 'cdc_ncm' at usb-0000:00:14.0-1, CDC NCM, 00:24:27:88:08:15
+[785963.019211] usbcore: registered new interface driver cdc_ncm
+[785963.023856] usbcore: registered new interface driver cdc_wdm
+[785963.025461] usbcore: registered new interface driver cdc_mbim
+[785963.038824] cdc_ncm 1-1:2.0 enx002427880815: renamed from usb0
+[785963.089586] cdc_ncm 1-1:2.0 enx002427880815: network connection: disconnected
+[785963.121673] cdc_ncm 1-1:2.0 enx002427880815: network connection: disconnected
+[785963.153682] cdc_ncm 1-1:2.0 enx002427880815: network connection: disconnected
+...
+
+This is about 2KB per second and will overwrite all contents of a 1MB
+dmesg buffer in under 10 minutes rendering them useless for debugging
+many kernel problems.
+
+This is also an extra 180 MB/day in /var/logs (or 1GB per week) rendering
+the majority of those logs useless too.
+
+When the link is up (expected state), spew amount is >2x higher:
+...
+[786139.600992] cdc_ncm 2-1:2.0 enx002427880815: network connection: connected
+[786139.632997] cdc_ncm 2-1:2.0 enx002427880815: 2500 mbit/s downlink 2500 mbit/s uplink
+[786139.665097] cdc_ncm 2-1:2.0 enx002427880815: network connection: connected
+[786139.697100] cdc_ncm 2-1:2.0 enx002427880815: 2500 mbit/s downlink 2500 mbit/s uplink
+[786139.729094] cdc_ncm 2-1:2.0 enx002427880815: network connection: connected
+[786139.761108] cdc_ncm 2-1:2.0 enx002427880815: 2500 mbit/s downlink 2500 mbit/s uplink
+...
+
+Chrome OS cannot support RTL8156 until this is fixed.
+
+Signed-off-by: Grant Grundler <grundler@chromium.org>
+Reviewed-by: Hayes Wang <hayeswang@realtek.com>
+Link: https://lore.kernel.org/r/20210120011208.3768105-1-grundler@chromium.org
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+---
+ drivers/net/usb/cdc_ncm.c | 12 +++++++++++-
+ include/linux/usb/usbnet.h | 2 ++
+ 2 files changed, 13 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
+index 5a78848db93f..291e76d32abe 100644
+--- a/drivers/net/usb/cdc_ncm.c
++++ b/drivers/net/usb/cdc_ncm.c
+@@ -1827,6 +1827,15 @@ cdc_ncm_speed_change(struct usbnet *dev,
+ uint32_t rx_speed = le32_to_cpu(data->DLBitRRate);
+ uint32_t tx_speed = le32_to_cpu(data->ULBitRate);
+
++ /* if the speed hasn't changed, don't report it.
++ * RTL8156 shipped before 2021 sends notification about every 32ms.
++ */
++ if (dev->rx_speed == rx_speed && dev->tx_speed == tx_speed)
++ return;
++
++ dev->rx_speed = rx_speed;
++ dev->tx_speed = tx_speed;
++
+ /*
+ * Currently the USB-NET API does not support reporting the actual
+ * device speed. Do print it instead.
+@@ -1867,7 +1876,8 @@ static void cdc_ncm_status(struct usbnet *dev, struct urb *urb)
+ * USB_CDC_NOTIFY_NETWORK_CONNECTION notification shall be
+ * sent by device after USB_CDC_NOTIFY_SPEED_CHANGE.
+ */
+- usbnet_link_change(dev, !!event->wValue, 0);
++ if (netif_carrier_ok(dev->net) != !!event->wValue)
++ usbnet_link_change(dev, !!event->wValue, 0);
+ break;
+
+ case USB_CDC_NOTIFY_SPEED_CHANGE:
+diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
+index 88a7673894d5..cfbfd6fe01df 100644
+--- a/include/linux/usb/usbnet.h
++++ b/include/linux/usb/usbnet.h
+@@ -81,6 +81,8 @@ struct usbnet {
+ # define EVENT_LINK_CHANGE 11
+ # define EVENT_SET_RX_MODE 12
+ # define EVENT_NO_IP_ALIGN 13
++ u32 rx_speed; /* in bps - NOT Mbps */
++ u32 tx_speed; /* in bps - NOT Mbps */
+ };
+
+ static inline struct usb_driver *driver_of(struct usb_interface *intf)
+--
+2.32.0.rc0
+
diff --git a/debian/patches/series b/debian/patches/series
index e87179331f46..71407a56dc73 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -94,6 +94,7 @@ bugfix/all/fs-add-module_softdep-declarations-for-hard-coded-cr.patch
bugfix/all/partially-revert-usb-kconfig-using-select-for-usb_co.patch
debian/makefile-do-not-check-for-libelf-when-building-oot-module.patch
bugfix/all/partially-revert-net-socket-implement-64-bit-timestamps.patch
+bugfix/all/net-usb-cdc_ncm-don-t-spew-notifications.patch
# Miscellaneous features