Home Home > GIT Browse > SLE15
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-06-24 12:07:35 +0200
committerTakashi Iwai <tiwai@suse.de>2019-06-24 12:07:36 +0200
commitfa7a6a103f6df42f545980fd8fc8a7678639142b (patch)
treedda2bc7d4a0da33330429112bf928c4a4ea448b8
parent3b24929a5b4ff7f9b9fbedaa9f2c2713c03a1161 (diff)
usbnet: ipheth: fix racing condition (bsc#1051510).
-rw-r--r--patches.drivers/usbnet-ipheth-fix-racing-condition.patch64
-rw-r--r--series.conf1
2 files changed, 65 insertions, 0 deletions
diff --git a/patches.drivers/usbnet-ipheth-fix-racing-condition.patch b/patches.drivers/usbnet-ipheth-fix-racing-condition.patch
new file mode 100644
index 0000000000..fb37005bc0
--- /dev/null
+++ b/patches.drivers/usbnet-ipheth-fix-racing-condition.patch
@@ -0,0 +1,64 @@
+From 94d250fae48e6f873d8362308f5c4d02cd1b1fd2 Mon Sep 17 00:00:00 2001
+From: Bernd Eckstein <3erndeckstein@gmail.com>
+Date: Mon, 20 May 2019 17:31:09 +0200
+Subject: [PATCH] usbnet: ipheth: fix racing condition
+Git-commit: 94d250fae48e6f873d8362308f5c4d02cd1b1fd2
+Patch-mainline: v5.2-rc2
+References: bsc#1051510
+
+Fix a racing condition in ipheth.c that can lead to slow performance.
+
+Bug: In ipheth_tx(), netif_wake_queue() may be called on the callback
+ipheth_sndbulk_callback(), _before_ netif_stop_queue() is called.
+When this happens, the queue is stopped longer than it needs to be,
+thus reducing network performance.
+
+Fix: Move netif_stop_queue() in front of usb_submit_urb(). Now the order
+is always correct. In case, usb_submit_urb() fails, the queue is woken up
+again as callback will not fire.
+
+Testing: This racing condition is usually not noticeable, as it has to
+occur very frequently to slowdown the network. The callback from the USB
+is usually triggered slow enough, so the situation does not appear.
+However, on a Ubuntu Linux on VMWare Workstation, running on Windows 10,
+the we loose the race quite often and the following speedup can be noticed:
+
+Without this patch: Download: 4.10 Mbit/s, Upload: 4.01 Mbit/s
+With this patch: Download: 36.23 Mbit/s, Upload: 17.61 Mbit/s
+
+Signed-off-by: Oliver Zweigle <Oliver.Zweigle@faro.com>
+Signed-off-by: Bernd Eckstein <3ernd.Eckstein@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Acked-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ drivers/net/usb/ipheth.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c
+index c247aed2dceb..8c01fbf68a89 100644
+--- a/drivers/net/usb/ipheth.c
++++ b/drivers/net/usb/ipheth.c
+@@ -383,17 +383,18 @@ static int ipheth_tx(struct sk_buff *skb, struct net_device *net)
+ dev);
+ dev->tx_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
+
++ netif_stop_queue(net);
+ retval = usb_submit_urb(dev->tx_urb, GFP_ATOMIC);
+ if (retval) {
+ dev_err(&dev->intf->dev, "%s: usb_submit_urb: %d\n",
+ __func__, retval);
+ dev->net->stats.tx_errors++;
+ dev_kfree_skb_any(skb);
++ netif_wake_queue(net);
+ } else {
+ dev->net->stats.tx_packets++;
+ dev->net->stats.tx_bytes += skb->len;
+ dev_consume_skb_any(skb);
+- netif_stop_queue(net);
+ }
+
+ return NETDEV_TX_OK;
+--
+2.16.4
+
diff --git a/series.conf b/series.conf
index 5519b0e9fe..fa29d051a6 100644
--- a/series.conf
+++ b/series.conf
@@ -22511,6 +22511,7 @@
patches.suse/btrfs-tree-checker-detect-file-extent-items-with-ove.patch
patches.fixes/crypto-vmx-CTR-always-increment-IV-as-quadword.patch
patches.arch/crypto-vmx-ghash-do-nosimd-fallback-manually.patch
+ patches.drivers/usbnet-ipheth-fix-racing-condition.patch
patches.drivers/usbnet-fix-kernel-crash-after-disconnect.patch
patches.drm/drm-vmwgfx-Don-t-send-drm-sysfs-hotplug-events-on-in.patch
patches.drm/0001-drm-vmwgfx-NULL-pointer-dereference-from-vmw_cmd_dx_.patch