From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
netdev@vger.kernel.org
Cc: davem@davemloft.net, linux-can@vger.kernel.org,
kernel@pengutronix.de,
Gerhard Uttenthaler <uttenthaler@ems-wuensche.com>,
linux-stable <stable@vger.kernel.org>
Subject: Re: [PATCH] can: ems_usb: Fix possible tx overflow
Date: Mon, 22 Feb 2016 13:18:38 +0100 [thread overview]
Message-ID: <56CAFC9E.7050306@pengutronix.de> (raw)
In-Reply-To: <56CAFAEE.2020602@cogentembedded.com>
[-- 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 --]
next prev parent reply other threads:[~2016-02-22 12:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2016-02-25 20:06 ` David Miller
2016-02-22 3:52 ` pull-request: can 2016-02-21 David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56CAFC9E.7050306@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=davem@davemloft.net \
--cc=kernel@pengutronix.de \
--cc=linux-can@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sergei.shtylyov@cogentembedded.com \
--cc=stable@vger.kernel.org \
--cc=uttenthaler@ems-wuensche.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).