* pull-request: can 2016-02-21
@ 2016-02-21 15:27 Marc Kleine-Budde
2016-02-21 15:27 ` [PATCH] can: ems_usb: Fix possible tx overflow Marc Kleine-Budde
2016-02-22 3:52 ` pull-request: can 2016-02-21 David Miller
0 siblings, 2 replies; 6+ messages in thread
From: Marc Kleine-Budde @ 2016-02-21 15:27 UTC (permalink / raw)
To: netdev; +Cc: davem, linux-can, kernel
Hello David,
this is a pull reqeust of one patch for net/master.
The patch is by Gerhard Uttenthaler and fixes a potential tx overflow in the
ems_usb driver.
regards,
Marc
---
The following changes since commit d07c0278da1f4cfc91c3d46d0d07a0d13a949892:
net: bcmgenet: Fix internal PHY link state (2016-02-19 23:51:40 -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.5-20160221
for you to fetch changes up to 90cfde46586d2286488d8ed636929e936c0c9ab2:
can: ems_usb: Fix possible tx overflow (2016-02-21 15:09:12 +0100)
----------------------------------------------------------------
linux-can-fixes-for-4.5-20160221
----------------------------------------------------------------
Gerhard Uttenthaler (1):
can: ems_usb: Fix possible tx overflow
drivers/net/can/usb/ems_usb.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] can: ems_usb: Fix possible tx overflow
2016-02-21 15:27 pull-request: can 2016-02-21 Marc Kleine-Budde
@ 2016-02-21 15:27 ` Marc Kleine-Budde
2016-02-22 12:11 ` Sergei Shtylyov
2016-02-22 3:52 ` pull-request: can 2016-02-21 David Miller
1 sibling, 1 reply; 6+ messages in thread
From: Marc Kleine-Budde @ 2016-02-21 15:27 UTC (permalink / raw)
To: netdev
Cc: davem, linux-can, kernel, Gerhard Uttenthaler, linux-stable,
Marc Kleine-Budde
From: Gerhard Uttenthaler <uttenthaler@ems-wuensche.com>
This patch fixes the problem that more CAN messages could be sent to the
interface as could be send on the CAN bus. This was more likely for slow baud
rates. The sleeping _start_xmit was woken up in the _write_bulk_callback. Under
heavy TX load this produced another bulk transfer without checking the
free_slots variable and hence caused the overflow in the interface.
Signed-off-by: Gerhard Uttenthaler <uttenthaler@ems-wuensche.com>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/usb/ems_usb.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c
index fc5b75675cd8..eb7192fab593 100644
--- a/drivers/net/can/usb/ems_usb.c
+++ b/drivers/net/can/usb/ems_usb.c
@@ -117,6 +117,9 @@ MODULE_LICENSE("GPL v2");
*/
#define EMS_USB_ARM7_CLOCK 8000000
+#define CPC_TX_QUEUE_TRIGGER_LOW 25
+#define CPC_TX_QUEUE_TRIGGER_HIGH 35
+
/*
* CAN-Message representation in a CPC_MSG. Message object type is
* CPC_MSG_TYPE_CAN_FRAME or CPC_MSG_TYPE_RTR_FRAME or
@@ -278,6 +281,11 @@ static void ems_usb_read_interrupt_callback(struct urb *urb)
switch (urb->status) {
case 0:
dev->free_slots = dev->intr_in_buffer[1];
+ if(dev->free_slots > CPC_TX_QUEUE_TRIGGER_HIGH){
+ if (netif_queue_stopped(netdev)){
+ netif_wake_queue(netdev);
+ }
+ }
break;
case -ECONNRESET: /* unlink */
@@ -526,8 +534,6 @@ static void ems_usb_write_bulk_callback(struct urb *urb)
/* Release context */
context->echo_index = MAX_TX_URBS;
- if (netif_queue_stopped(netdev))
- netif_wake_queue(netdev);
}
/*
@@ -587,7 +593,7 @@ static int ems_usb_start(struct ems_usb *dev)
int err, i;
dev->intr_in_buffer[0] = 0;
- dev->free_slots = 15; /* initial size */
+ dev->free_slots = 50; /* initial size */
for (i = 0; i < MAX_RX_URBS; i++) {
struct urb *urb = NULL;
@@ -835,7 +841,7 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne
/* Slow down tx path */
if (atomic_read(&dev->active_tx_urbs) >= MAX_TX_URBS ||
- dev->free_slots < 5) {
+ dev->free_slots < CPC_TX_QUEUE_TRIGGER_LOW) {
netif_stop_queue(netdev);
}
}
--
2.7.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: pull-request: can 2016-02-21
2016-02-21 15:27 pull-request: can 2016-02-21 Marc Kleine-Budde
2016-02-21 15:27 ` [PATCH] can: ems_usb: Fix possible tx overflow Marc Kleine-Budde
@ 2016-02-22 3:52 ` David Miller
1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2016-02-22 3:52 UTC (permalink / raw)
To: mkl; +Cc: netdev, linux-can, kernel
From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Sun, 21 Feb 2016 16:27:37 +0100
> this is a pull reqeust of one patch for net/master.
>
> The patch is by Gerhard Uttenthaler and fixes a potential tx overflow in the
> ems_usb driver.
Pulled, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] can: ems_usb: Fix possible tx overflow
2016-02-21 15:27 ` [PATCH] can: ems_usb: Fix possible tx overflow Marc Kleine-Budde
@ 2016-02-22 12:11 ` Sergei Shtylyov
2016-02-22 12:18 ` Marc Kleine-Budde
0 siblings, 1 reply; 6+ messages in thread
From: Sergei Shtylyov @ 2016-02-22 12:11 UTC (permalink / raw)
To: Marc Kleine-Budde, netdev
Cc: davem, linux-can, kernel, Gerhard Uttenthaler, linux-stable
Hello.
On 2/21/2016 6:27 PM, Marc Kleine-Budde wrote:
> From: Gerhard Uttenthaler <uttenthaler@ems-wuensche.com>
>
> This patch fixes the problem that more CAN messages could be sent to the
> interface as could be send on the CAN bus. This was more likely for slow baud
> rates. The sleeping _start_xmit was woken up in the _write_bulk_callback. Under
> heavy TX load this produced another bulk transfer without checking the
> free_slots variable and hence caused the overflow in the interface.
>
> Signed-off-by: Gerhard Uttenthaler <uttenthaler@ems-wuensche.com>
> Cc: linux-stable <stable@vger.kernel.org>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> ---
> drivers/net/can/usb/ems_usb.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c
> index fc5b75675cd8..eb7192fab593 100644
> --- a/drivers/net/can/usb/ems_usb.c
> +++ b/drivers/net/can/usb/ems_usb.c
> @@ -117,6 +117,9 @@ MODULE_LICENSE("GPL v2");
> */
> #define EMS_USB_ARM7_CLOCK 8000000
>
> +#define CPC_TX_QUEUE_TRIGGER_LOW 25
> +#define CPC_TX_QUEUE_TRIGGER_HIGH 35
> +
> /*
> * CAN-Message representation in a CPC_MSG. Message object type is
> * CPC_MSG_TYPE_CAN_FRAME or CPC_MSG_TYPE_RTR_FRAME or
> @@ -278,6 +281,11 @@ static void ems_usb_read_interrupt_callback(struct urb *urb)
> switch (urb->status) {
> case 0:
> dev->free_slots = dev->intr_in_buffer[1];
> + if(dev->free_slots > CPC_TX_QUEUE_TRIGGER_HIGH){
> + if (netif_queue_stopped(netdev)){
> + netif_wake_queue(netdev);
> + }
> + }
Hm, did anyone run scripts/checkpatch.pl on this patch?
[...]
MBR, Sergei
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] can: ems_usb: Fix possible tx overflow
2016-02-22 12:11 ` Sergei Shtylyov
@ 2016-02-22 12:18 ` Marc Kleine-Budde
2016-02-25 20:06 ` David Miller
0 siblings, 1 reply; 6+ messages in thread
From: Marc Kleine-Budde @ 2016-02-22 12:18 UTC (permalink / raw)
To: Sergei Shtylyov, netdev
Cc: davem, linux-can, kernel, Gerhard Uttenthaler, linux-stable
[-- Attachment #1: Type: text/plain, Size: 2216 bytes --]
On 02/22/2016 01:11 PM, Sergei Shtylyov wrote:
> Hello.
>
> On 2/21/2016 6:27 PM, Marc Kleine-Budde wrote:
>
>> From: Gerhard Uttenthaler <uttenthaler@ems-wuensche.com>
>>
>> This patch fixes the problem that more CAN messages could be sent to the
>> interface as could be send on the CAN bus. This was more likely for slow baud
>> rates. The sleeping _start_xmit was woken up in the _write_bulk_callback. Under
>> heavy TX load this produced another bulk transfer without checking the
>> free_slots variable and hence caused the overflow in the interface.
>>
>> Signed-off-by: Gerhard Uttenthaler <uttenthaler@ems-wuensche.com>
>> Cc: linux-stable <stable@vger.kernel.org>
>> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
>> ---
>> drivers/net/can/usb/ems_usb.c | 14 ++++++++++----
>> 1 file changed, 10 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c
>> index fc5b75675cd8..eb7192fab593 100644
>> --- a/drivers/net/can/usb/ems_usb.c
>> +++ b/drivers/net/can/usb/ems_usb.c
>> @@ -117,6 +117,9 @@ MODULE_LICENSE("GPL v2");
>> */
>> #define EMS_USB_ARM7_CLOCK 8000000
>>
>> +#define CPC_TX_QUEUE_TRIGGER_LOW 25
>> +#define CPC_TX_QUEUE_TRIGGER_HIGH 35
>> +
>> /*
>> * CAN-Message representation in a CPC_MSG. Message object type is
>> * CPC_MSG_TYPE_CAN_FRAME or CPC_MSG_TYPE_RTR_FRAME or
>> @@ -278,6 +281,11 @@ static void ems_usb_read_interrupt_callback(struct urb *urb)
>> switch (urb->status) {
>> case 0:
>> dev->free_slots = dev->intr_in_buffer[1];
>> + if(dev->free_slots > CPC_TX_QUEUE_TRIGGER_HIGH){
>> + if (netif_queue_stopped(netdev)){
>> + netif_wake_queue(netdev);
>> + }
>> + }
>
> Hm, did anyone run scripts/checkpatch.pl on this patch?
Obviously not. :(
David, I can send a patch to clean up the coding style. Do you want it
for net or via net-next?
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] can: ems_usb: Fix possible tx overflow
2016-02-22 12:18 ` Marc Kleine-Budde
@ 2016-02-25 20:06 ` David Miller
0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2016-02-25 20:06 UTC (permalink / raw)
To: mkl; +Cc: sergei.shtylyov, netdev, linux-can, kernel, uttenthaler, stable
From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Mon, 22 Feb 2016 13:18:38 +0100
> David, I can send a patch to clean up the coding style. Do you want it
> for net or via net-next?
net-next is fine.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-02-25 20:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-21 15:27 pull-request: can 2016-02-21 Marc Kleine-Budde
2016-02-21 15:27 ` [PATCH] can: ems_usb: Fix possible tx overflow Marc Kleine-Budde
2016-02-22 12:11 ` Sergei Shtylyov
2016-02-22 12:18 ` Marc Kleine-Budde
2016-02-25 20:06 ` David Miller
2016-02-22 3:52 ` pull-request: can 2016-02-21 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).