netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pull-request: can 2017-12-08
@ 2017-12-08 15:58 Marc Kleine-Budde
  2017-12-08 15:58 ` [PATCH 1/6] can: mcba_usb: cancel urb on -EPROTO Marc Kleine-Budde
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Marc Kleine-Budde @ 2017-12-08 15:58 UTC (permalink / raw)
  To: netdev; +Cc: davem, linux-can, kernel

Hello David,

this is a pull request of 6 patches for net/master.

Martin Kelly provides 5 patches for various USB based CAN drivers, that
properly cancel the URBs on adapter unplug, so that the driver doesn't
end up in an endless loop. Stephane Grosjean provides a patch to restart
the tx queue if zero length packages are transmitted.

regards,
Marc

---

The following changes since commit 195bd525d5f6e338b948d9a6b25bfaae86291353:

  Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf (2017-12-07 16:22:51 -0500)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git tags/linux-can-fixes-for-4.15-20171208

for you to fetch changes up to 91785de6f94b58c3fb6664609e3682f011bd28d2:

  can: peak/pcie_fd: fix potential bug in restarting tx queue (2017-12-08 10:51:53 +0100)

----------------------------------------------------------------
linux-can-fixes-for-4.15-20171208

----------------------------------------------------------------
Martin Kelly (5):
      can: mcba_usb: cancel urb on -EPROTO
      can: ems_usb: cancel urb on -EPIPE and -EPROTO
      can: esd_usb2: cancel urb on -EPIPE and -EPROTO
      can: kvaser_usb: cancel urb on -EPIPE and -EPROTO
      can: usb_8dev: cancel urb on -EPIPE and -EPROTO

Stephane Grosjean (1):
      can: peak/pcie_fd: fix potential bug in restarting tx queue

 drivers/net/can/peak_canfd/peak_canfd.c | 9 +++------
 drivers/net/can/usb/ems_usb.c           | 2 ++
 drivers/net/can/usb/esd_usb2.c          | 2 ++
 drivers/net/can/usb/kvaser_usb.c        | 2 ++
 drivers/net/can/usb/mcba_usb.c          | 1 +
 drivers/net/can/usb/usb_8dev.c          | 2 ++
 6 files changed, 12 insertions(+), 6 deletions(-)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/6] can: mcba_usb: cancel urb on -EPROTO
  2017-12-08 15:58 pull-request: can 2017-12-08 Marc Kleine-Budde
@ 2017-12-08 15:58 ` Marc Kleine-Budde
  2017-12-08 15:58 ` [PATCH 2/6] can: ems_usb: cancel urb on -EPIPE and -EPROTO Marc Kleine-Budde
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Marc Kleine-Budde @ 2017-12-08 15:58 UTC (permalink / raw)
  To: netdev
  Cc: davem, linux-can, kernel, Martin Kelly, linux-stable, Marc Kleine-Budde

From: Martin Kelly <mkelly@xevo.com>

When we unplug the device, we can see both -EPIPE and -EPROTO depending
on exact timing and what system we run on. If we continue to resubmit
URBs, they will immediately fail, and they can cause stalls, especially
on slower CPUs.

Fix this by not resubmitting on -EPROTO, as we already do on -EPIPE.

Signed-off-by: Martin Kelly <mkelly@xevo.com>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/usb/mcba_usb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/can/usb/mcba_usb.c b/drivers/net/can/usb/mcba_usb.c
index ef417dcddbf7..8d8c2086424d 100644
--- a/drivers/net/can/usb/mcba_usb.c
+++ b/drivers/net/can/usb/mcba_usb.c
@@ -593,6 +593,7 @@ static void mcba_usb_read_bulk_callback(struct urb *urb)
 
 	case -ENOENT:
 	case -EPIPE:
+	case -EPROTO:
 	case -ESHUTDOWN:
 		return;
 
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/6] can: ems_usb: cancel urb on -EPIPE and -EPROTO
  2017-12-08 15:58 pull-request: can 2017-12-08 Marc Kleine-Budde
  2017-12-08 15:58 ` [PATCH 1/6] can: mcba_usb: cancel urb on -EPROTO Marc Kleine-Budde
@ 2017-12-08 15:58 ` Marc Kleine-Budde
  2017-12-08 15:58 ` [PATCH 3/6] can: esd_usb2: " Marc Kleine-Budde
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Marc Kleine-Budde @ 2017-12-08 15:58 UTC (permalink / raw)
  To: netdev
  Cc: davem, linux-can, kernel, Martin Kelly, linux-stable, Marc Kleine-Budde

From: Martin Kelly <mkelly@xevo.com>

In mcba_usb, we have observed that when you unplug the device, the driver will
endlessly resubmit failing URBs, which can cause CPU stalls. This issue
is fixed in mcba_usb by catching the codes seen on device disconnect
(-EPIPE and -EPROTO).

This driver also resubmits in the case of -EPIPE and -EPROTO, so fix it
in the same way.

Signed-off-by: Martin Kelly <mkelly@xevo.com>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/usb/ems_usb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c
index b3d02759c226..b00358297424 100644
--- a/drivers/net/can/usb/ems_usb.c
+++ b/drivers/net/can/usb/ems_usb.c
@@ -288,6 +288,8 @@ static void ems_usb_read_interrupt_callback(struct urb *urb)
 
 	case -ECONNRESET: /* unlink */
 	case -ENOENT:
+	case -EPIPE:
+	case -EPROTO:
 	case -ESHUTDOWN:
 		return;
 
-- 
2.15.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/6] can: esd_usb2: cancel urb on -EPIPE and -EPROTO
  2017-12-08 15:58 pull-request: can 2017-12-08 Marc Kleine-Budde
  2017-12-08 15:58 ` [PATCH 1/6] can: mcba_usb: cancel urb on -EPROTO Marc Kleine-Budde
  2017-12-08 15:58 ` [PATCH 2/6] can: ems_usb: cancel urb on -EPIPE and -EPROTO Marc Kleine-Budde
@ 2017-12-08 15:58 ` Marc Kleine-Budde
  2017-12-08 15:58 ` [PATCH 4/6] can: kvaser_usb: " Marc Kleine-Budde
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Marc Kleine-Budde @ 2017-12-08 15:58 UTC (permalink / raw)
  To: netdev
  Cc: davem, linux-can, kernel, Martin Kelly, linux-stable, Marc Kleine-Budde

From: Martin Kelly <mkelly@xevo.com>

In mcba_usb, we have observed that when you unplug the device, the driver will
endlessly resubmit failing URBs, which can cause CPU stalls. This issue
is fixed in mcba_usb by catching the codes seen on device disconnect
(-EPIPE and -EPROTO).

This driver also resubmits in the case of -EPIPE and -EPROTO, so fix it
in the same way.

Signed-off-by: Martin Kelly <mkelly@xevo.com>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/usb/esd_usb2.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c
index 9fdb0f0bfa06..c6dcf93675c0 100644
--- a/drivers/net/can/usb/esd_usb2.c
+++ b/drivers/net/can/usb/esd_usb2.c
@@ -393,6 +393,8 @@ static void esd_usb2_read_bulk_callback(struct urb *urb)
 		break;
 
 	case -ENOENT:
+	case -EPIPE:
+	case -EPROTO:
 	case -ESHUTDOWN:
 		return;
 
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/6] can: kvaser_usb: cancel urb on -EPIPE and -EPROTO
  2017-12-08 15:58 pull-request: can 2017-12-08 Marc Kleine-Budde
                   ` (2 preceding siblings ...)
  2017-12-08 15:58 ` [PATCH 3/6] can: esd_usb2: " Marc Kleine-Budde
@ 2017-12-08 15:58 ` Marc Kleine-Budde
  2017-12-08 15:58 ` [PATCH 5/6] can: usb_8dev: " Marc Kleine-Budde
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Marc Kleine-Budde @ 2017-12-08 15:58 UTC (permalink / raw)
  To: netdev
  Cc: davem, linux-can, kernel, Martin Kelly, linux-stable, Marc Kleine-Budde

From: Martin Kelly <mkelly@xevo.com>

In mcba_usb, we have observed that when you unplug the device, the driver will
endlessly resubmit failing URBs, which can cause CPU stalls. This issue
is fixed in mcba_usb by catching the codes seen on device disconnect
(-EPIPE and -EPROTO).

This driver also resubmits in the case of -EPIPE and -EPROTO, so fix it
in the same way.

Signed-off-by: Martin Kelly <mkelly@xevo.com>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/usb/kvaser_usb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
index f95945915d20..63587b8e6825 100644
--- a/drivers/net/can/usb/kvaser_usb.c
+++ b/drivers/net/can/usb/kvaser_usb.c
@@ -1326,6 +1326,8 @@ static void kvaser_usb_read_bulk_callback(struct urb *urb)
 	case 0:
 		break;
 	case -ENOENT:
+	case -EPIPE:
+	case -EPROTO:
 	case -ESHUTDOWN:
 		return;
 	default:
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 5/6] can: usb_8dev: cancel urb on -EPIPE and -EPROTO
  2017-12-08 15:58 pull-request: can 2017-12-08 Marc Kleine-Budde
                   ` (3 preceding siblings ...)
  2017-12-08 15:58 ` [PATCH 4/6] can: kvaser_usb: " Marc Kleine-Budde
@ 2017-12-08 15:58 ` Marc Kleine-Budde
  2017-12-08 15:58 ` [PATCH 6/6] can: peak/pcie_fd: fix potential bug in restarting tx queue Marc Kleine-Budde
  2017-12-08 19:54 ` pull-request: can 2017-12-08 David Miller
  6 siblings, 0 replies; 8+ messages in thread
From: Marc Kleine-Budde @ 2017-12-08 15:58 UTC (permalink / raw)
  To: netdev
  Cc: davem, linux-can, kernel, Martin Kelly, linux-stable, Marc Kleine-Budde

From: Martin Kelly <mkelly@xevo.com>

In mcba_usb, we have observed that when you unplug the device, the driver will
endlessly resubmit failing URBs, which can cause CPU stalls. This issue
is fixed in mcba_usb by catching the codes seen on device disconnect
(-EPIPE and -EPROTO).

This driver also resubmits in the case of -EPIPE and -EPROTO, so fix it
in the same way.

Signed-off-by: Martin Kelly <mkelly@xevo.com>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/usb/usb_8dev.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/can/usb/usb_8dev.c b/drivers/net/can/usb/usb_8dev.c
index d000cb62d6ae..27861c417c94 100644
--- a/drivers/net/can/usb/usb_8dev.c
+++ b/drivers/net/can/usb/usb_8dev.c
@@ -524,6 +524,8 @@ static void usb_8dev_read_bulk_callback(struct urb *urb)
 		break;
 
 	case -ENOENT:
+	case -EPIPE:
+	case -EPROTO:
 	case -ESHUTDOWN:
 		return;
 
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 6/6] can: peak/pcie_fd: fix potential bug in restarting tx queue
  2017-12-08 15:58 pull-request: can 2017-12-08 Marc Kleine-Budde
                   ` (4 preceding siblings ...)
  2017-12-08 15:58 ` [PATCH 5/6] can: usb_8dev: " Marc Kleine-Budde
@ 2017-12-08 15:58 ` Marc Kleine-Budde
  2017-12-08 19:54 ` pull-request: can 2017-12-08 David Miller
  6 siblings, 0 replies; 8+ messages in thread
From: Marc Kleine-Budde @ 2017-12-08 15:58 UTC (permalink / raw)
  To: netdev
  Cc: davem, linux-can, kernel, Stephane Grosjean, linux-stable,
	Marc Kleine-Budde

From: Stephane Grosjean <s.grosjean@peak-system.com>

Don't rely on can_get_echo_skb() return value to wake the network tx
queue up: can_get_echo_skb() returns 0 if the echo array slot was not
occupied, but also when the DLC of the released echo frame was 0.

Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/peak_canfd/peak_canfd.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/net/can/peak_canfd/peak_canfd.c b/drivers/net/can/peak_canfd/peak_canfd.c
index 85268be0c913..55513411a82e 100644
--- a/drivers/net/can/peak_canfd/peak_canfd.c
+++ b/drivers/net/can/peak_canfd/peak_canfd.c
@@ -258,21 +258,18 @@ static int pucan_handle_can_rx(struct peak_canfd_priv *priv,
 	/* if this frame is an echo, */
 	if ((rx_msg_flags & PUCAN_MSG_LOOPED_BACK) &&
 	    !(rx_msg_flags & PUCAN_MSG_SELF_RECEIVE)) {
-		int n;
 		unsigned long flags;
 
 		spin_lock_irqsave(&priv->echo_lock, flags);
-		n = can_get_echo_skb(priv->ndev, msg->client);
+		can_get_echo_skb(priv->ndev, msg->client);
 		spin_unlock_irqrestore(&priv->echo_lock, flags);
 
 		/* count bytes of the echo instead of skb */
 		stats->tx_bytes += cf_len;
 		stats->tx_packets++;
 
-		if (n) {
-			/* restart tx queue only if a slot is free */
-			netif_wake_queue(priv->ndev);
-		}
+		/* restart tx queue (a slot is free) */
+		netif_wake_queue(priv->ndev);
 
 		return 0;
 	}
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: pull-request: can 2017-12-08
  2017-12-08 15:58 pull-request: can 2017-12-08 Marc Kleine-Budde
                   ` (5 preceding siblings ...)
  2017-12-08 15:58 ` [PATCH 6/6] can: peak/pcie_fd: fix potential bug in restarting tx queue Marc Kleine-Budde
@ 2017-12-08 19:54 ` David Miller
  6 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2017-12-08 19:54 UTC (permalink / raw)
  To: mkl; +Cc: netdev, linux-can, kernel

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Fri,  8 Dec 2017 16:58:11 +0100

> this is a pull request of 6 patches for net/master.
> 
> Martin Kelly provides 5 patches for various USB based CAN drivers, that
> properly cancel the URBs on adapter unplug, so that the driver doesn't
> end up in an endless loop. Stephane Grosjean provides a patch to restart
> the tx queue if zero length packages are transmitted.

Pulled, thanks Marc.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-12-08 19:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-08 15:58 pull-request: can 2017-12-08 Marc Kleine-Budde
2017-12-08 15:58 ` [PATCH 1/6] can: mcba_usb: cancel urb on -EPROTO Marc Kleine-Budde
2017-12-08 15:58 ` [PATCH 2/6] can: ems_usb: cancel urb on -EPIPE and -EPROTO Marc Kleine-Budde
2017-12-08 15:58 ` [PATCH 3/6] can: esd_usb2: " Marc Kleine-Budde
2017-12-08 15:58 ` [PATCH 4/6] can: kvaser_usb: " Marc Kleine-Budde
2017-12-08 15:58 ` [PATCH 5/6] can: usb_8dev: " Marc Kleine-Budde
2017-12-08 15:58 ` [PATCH 6/6] can: peak/pcie_fd: fix potential bug in restarting tx queue Marc Kleine-Budde
2017-12-08 19:54 ` pull-request: can 2017-12-08 David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).