netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pull-request: can 2013-10-31
@ 2013-10-31 19:24 Marc Kleine-Budde
  2013-10-31 19:24 ` [PATCH 1/2] can: c_can: Fix RX message handling, handle lost message before EOB Marc Kleine-Budde
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2013-10-31 19:24 UTC (permalink / raw)
  To: netdev; +Cc: davem, linux-can, kernel

Hello David,

I have two late fixes for the v3.12 release:

The first patch fixes a problem in the c_can's RX message handling, which can
lead to an endless interrupt loop under heavy load if messages are lost. The
second patch is by Olivier Sobrie and fixes the endpoint detection of the
kvaser_usb driver, which is needed for some devices.

regards,
Marc

---


The following changes since commit c17cb8b55b104c549aa20a72fa44141ad2c65ec2:

  doc:net: Fix typo in Documentation/networking (2013-10-30 17:10:20 -0400)

are available in the git repository at:

  git://gitorious.org/linux-can/linux-can.git fixes-for-3.12

for you to fetch changes up to 896e23bd04ea50a146dffd342e2f96180f0812a5:

  can: kvaser_usb: fix usb endpoints detection (2013-10-31 20:20:23 +0100)

----------------------------------------------------------------
Markus Pargmann (1):
      can: c_can: Fix RX message handling, handle lost message before EOB

Olivier Sobrie (1):
      can: kvaser_usb: fix usb endpoints detection

 drivers/net/can/c_can/c_can.c    |  6 +++---
 drivers/net/can/usb/kvaser_usb.c | 20 +++++++++++++-------
 2 files changed, 16 insertions(+), 10 deletions(-)

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

* [PATCH 1/2] can: c_can: Fix RX message handling, handle lost message before EOB
  2013-10-31 19:24 pull-request: can 2013-10-31 Marc Kleine-Budde
@ 2013-10-31 19:24 ` Marc Kleine-Budde
  2013-10-31 19:24 ` [PATCH 2/2] can: kvaser_usb: fix usb endpoints detection Marc Kleine-Budde
  2013-11-04  5:48 ` pull-request: can 2013-10-31 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2013-10-31 19:24 UTC (permalink / raw)
  To: netdev
  Cc: davem, linux-can, kernel, Markus Pargmann, linux-stable,
	Marc Kleine-Budde

From: Markus Pargmann <mpa@pengutronix.de>

If we handle end of block messages with higher priority than a lost message,
we can run into an endless interrupt loop.

This is reproducable with a am335x processor and "cansequence -r" at 1Mbit.
As soon as we loose a packet we can't escape from an interrupt loop.

This patch fixes the problem by handling lost packets before EOB packets.

Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/c_can/c_can.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c
index a668cd4..e3fc07c 100644
--- a/drivers/net/can/c_can/c_can.c
+++ b/drivers/net/can/c_can/c_can.c
@@ -814,9 +814,6 @@ static int c_can_do_rx_poll(struct net_device *dev, int quota)
 			msg_ctrl_save = priv->read_reg(priv,
 					C_CAN_IFACE(MSGCTRL_REG, 0));
 
-			if (msg_ctrl_save & IF_MCONT_EOB)
-				return num_rx_pkts;
-
 			if (msg_ctrl_save & IF_MCONT_MSGLST) {
 				c_can_handle_lost_msg_obj(dev, 0, msg_obj);
 				num_rx_pkts++;
@@ -824,6 +821,9 @@ static int c_can_do_rx_poll(struct net_device *dev, int quota)
 				continue;
 			}
 
+			if (msg_ctrl_save & IF_MCONT_EOB)
+				return num_rx_pkts;
+
 			if (!(msg_ctrl_save & IF_MCONT_NEWDAT))
 				continue;
 
-- 
1.8.4.rc3

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

* [PATCH 2/2] can: kvaser_usb: fix usb endpoints detection
  2013-10-31 19:24 pull-request: can 2013-10-31 Marc Kleine-Budde
  2013-10-31 19:24 ` [PATCH 1/2] can: c_can: Fix RX message handling, handle lost message before EOB Marc Kleine-Budde
@ 2013-10-31 19:24 ` Marc Kleine-Budde
  2013-11-04  5:48 ` pull-request: can 2013-10-31 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2013-10-31 19:24 UTC (permalink / raw)
  To: netdev
  Cc: davem, linux-can, kernel, Olivier Sobrie, linux-stable,
	Marc Kleine-Budde

From: Olivier Sobrie <olivier@sobrie.be>

Some devices, like the Kvaser Memorator Professional, have several bulk in
endpoints. Only the first one found must be used by the driver. The same holds
for the bulk out endpoint. The official Kvaser driver (leaf) was used as
reference for this patch.

Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Olivier Sobrie <olivier@sobrie.be>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/usb/kvaser_usb.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
index 3b95465..4b2d5ed 100644
--- a/drivers/net/can/usb/kvaser_usb.c
+++ b/drivers/net/can/usb/kvaser_usb.c
@@ -1544,9 +1544,9 @@ static int kvaser_usb_init_one(struct usb_interface *intf,
 	return 0;
 }
 
-static void kvaser_usb_get_endpoints(const struct usb_interface *intf,
-				     struct usb_endpoint_descriptor **in,
-				     struct usb_endpoint_descriptor **out)
+static int kvaser_usb_get_endpoints(const struct usb_interface *intf,
+				    struct usb_endpoint_descriptor **in,
+				    struct usb_endpoint_descriptor **out)
 {
 	const struct usb_host_interface *iface_desc;
 	struct usb_endpoint_descriptor *endpoint;
@@ -1557,12 +1557,18 @@ static void kvaser_usb_get_endpoints(const struct usb_interface *intf,
 	for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
 		endpoint = &iface_desc->endpoint[i].desc;
 
-		if (usb_endpoint_is_bulk_in(endpoint))
+		if (!*in && usb_endpoint_is_bulk_in(endpoint))
 			*in = endpoint;
 
-		if (usb_endpoint_is_bulk_out(endpoint))
+		if (!*out && usb_endpoint_is_bulk_out(endpoint))
 			*out = endpoint;
+
+		/* use first bulk endpoint for in and out */
+		if (*in && *out)
+			return 0;
 	}
+
+	return -ENODEV;
 }
 
 static int kvaser_usb_probe(struct usb_interface *intf,
@@ -1576,8 +1582,8 @@ static int kvaser_usb_probe(struct usb_interface *intf,
 	if (!dev)
 		return -ENOMEM;
 
-	kvaser_usb_get_endpoints(intf, &dev->bulk_in, &dev->bulk_out);
-	if (!dev->bulk_in || !dev->bulk_out) {
+	err = kvaser_usb_get_endpoints(intf, &dev->bulk_in, &dev->bulk_out);
+	if (err) {
 		dev_err(&intf->dev, "Cannot get usb endpoint(s)");
 		return err;
 	}
-- 
1.8.4.rc3

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

* Re: pull-request: can 2013-10-31
  2013-10-31 19:24 pull-request: can 2013-10-31 Marc Kleine-Budde
  2013-10-31 19:24 ` [PATCH 1/2] can: c_can: Fix RX message handling, handle lost message before EOB Marc Kleine-Budde
  2013-10-31 19:24 ` [PATCH 2/2] can: kvaser_usb: fix usb endpoints detection Marc Kleine-Budde
@ 2013-11-04  5:48 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2013-11-04  5:48 UTC (permalink / raw)
  To: mkl; +Cc: netdev, linux-can, kernel

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Thu, 31 Oct 2013 20:24:48 +0100

> The first patch fixes a problem in the c_can's RX message handling, which can
> lead to an endless interrupt loop under heavy load if messages are lost. The
> second patch is by Olivier Sobrie and fixes the endpoint detection of the
> kvaser_usb driver, which is needed for some devices.

Pulled, thanks Marc.

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

end of thread, other threads:[~2013-11-04  5:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-31 19:24 pull-request: can 2013-10-31 Marc Kleine-Budde
2013-10-31 19:24 ` [PATCH 1/2] can: c_can: Fix RX message handling, handle lost message before EOB Marc Kleine-Budde
2013-10-31 19:24 ` [PATCH 2/2] can: kvaser_usb: fix usb endpoints detection Marc Kleine-Budde
2013-11-04  5:48 ` pull-request: can 2013-10-31 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).