From: Anssi Hannula <anssi.hannula@bitwise.fi>
To: Jimmy Assarsson <extja@kvaser.com>
Cc: linux-can@vger.kernel.org, Marc Kleine-Budde <mkl@pengutronix.de>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 09/12] can: kvaser_usb_leaf: Fix silently failing bus params setup
Date: Mon, 30 May 2022 13:55:41 +0300 [thread overview]
Message-ID: <7ec86c10-3cef-d806-2e27-c99a12704288@bitwise.fi> (raw)
In-Reply-To: <39946f68-ac16-9412-fd5e-47e10b84ffbf@kvaser.com>
On 28.5.2022 10.37, Jimmy Assarsson wrote:
> On 5/16/22 15:47, Anssi Hannula wrote:
>> The device may reject bus params with cmd 45, which is an unhandled
>> error event that does not contain any channel reference.
>>
>> In such cases set_bittiming() callback returns 0 so upper levels will
>> think setting bitrate succeeded and proceed with starting the interface
>> with wrong parameters, causing bus errors (the kernel log will have
>> "Unhandled command (45)", though).
>>
>> Fix that by verifying the bus params took hold by reading them back.
>>
>> Also, add a handler for cmd 45 that simply prints out the error.
>>
>> This condition can be triggered on 0bfd:0124 Kvaser Mini PCI Express
>> 2xHS FW 4.18.778 by trying to set bitrate 1300000 and on 0bfd:0124
>> Kvaser Mini PCI Express 2xHS FW 4.18.778 by trying to set bitrate
>> 1000000.
> The device will send cmd CMD_ERROR_EVENT (45) when invalid data is
> received from the driver and should never occur. CMD_ERROR_EVENT
> indicates a misbehaving driver.
>
> For the Kvaser Mini PCI Express 2xHS case, the problem is settings
> resulting in prescaler equal to 1 are not accepted. This is a bug in the
> firmware and will be fixed in our next release.
>
> And for Kvaser Memorator Professional HS/HS, the can_bittiming_const
> limits are not correct.
> I'll have to look into this a bit more. I'm pretty sure we endup with
> three different can_bittiming_const in kvaser_usb_leaf, depedning on
> firmware/microcontroller.
>
> I created new patches for the CMD_ERROR_EVENT, based on your patch.
> See at end of this mail.
>
> I prefere if we can avoid the paramter readback and
> kvaser_usb_setup_rx_urbs() in kvaser_usb_leaf_set_bittiming().
> With correct can_bittiming_const limits this should not be an issue.
> On the otherhand, since there are existing devices with a bug that will
> reject parameters that are within the correct limits, and the result
> silently failing calls, I cannot see any alternative...
>
> If it ok with you I'll create a new patch based on your readback fix,
> and also implement this in kvaser_usb_hydra?
All OK for me.
--
Anssi Hannula / Bitwise Oy
+358 503803997
next prev parent reply other threads:[~2022-05-30 10:55 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-16 13:47 [PATCH 00/12] can: kvaser_usb: Various fixes Anssi Hannula
2022-05-16 13:47 ` [PATCH 01/12] can: kvaser_usb_leaf: Fix overread with an invalid command Anssi Hannula
2022-05-28 7:34 ` Jimmy Assarsson
2022-05-16 13:47 ` [PATCH 02/12] can: kvaser_usb: Fix use of uninitialized completion Anssi Hannula
2022-05-28 7:34 ` Jimmy Assarsson
2022-05-16 13:47 ` [PATCH 03/12] can: kvaser_usb: Fix possible completions during init_completion Anssi Hannula
2022-05-28 7:34 ` Jimmy Assarsson
2022-05-16 13:47 ` [PATCH 04/12] can: kvaser_usb: Mark Mini PCIe 2xHS as supporting error counters Anssi Hannula
2022-05-28 7:37 ` Jimmy Assarsson
2022-05-30 10:55 ` Anssi Hannula
2022-05-16 13:47 ` [PATCH 05/12] can: kvaser_usb_leaf: Set Warning state even without bus errors Anssi Hannula
2022-05-28 7:35 ` Jimmy Assarsson
2022-05-16 13:47 ` [PATCH 06/12] can: kvaser_usb_leaf: Fix TX queue out of sync after restart Anssi Hannula
2022-05-28 7:35 ` Jimmy Assarsson
2022-05-16 13:47 ` [PATCH 07/12] can: kvaser_usb_leaf: Fix CAN state " Anssi Hannula
2022-06-06 15:31 ` Jimmy Assarsson
2022-05-16 13:47 ` [PATCH 08/12] can: kvaser_usb_leaf: Fix improved state not being reported Anssi Hannula
2022-06-06 15:32 ` Jimmy Assarsson
2022-05-16 13:47 ` [PATCH 09/12] can: kvaser_usb_leaf: Fix silently failing bus params setup Anssi Hannula
2022-05-28 7:37 ` Jimmy Assarsson
2022-05-30 10:55 ` Anssi Hannula [this message]
2022-05-16 13:47 ` [PATCH 10/12] can: kvaser_usb_leaf: Fix wrong CAN state after stopping Anssi Hannula
2022-05-28 7:35 ` Jimmy Assarsson
2022-05-16 13:47 ` [PATCH 11/12] can: kvaser_usb_leaf: Ignore stale bus-off after start Anssi Hannula
2022-06-06 15:32 ` Jimmy Assarsson
2022-05-16 13:47 ` [PATCH 12/12] can: kvaser_usb_leaf: Fix bogus restart events Anssi Hannula
2022-05-28 7:35 ` Jimmy Assarsson
2022-05-17 8:41 ` [PATCH 00/12] can: kvaser_usb: Various fixes Jimmy Assarsson
2022-05-28 7:42 ` Jimmy Assarsson
2022-05-30 10:56 ` Anssi Hannula
2022-06-06 15:33 ` Jimmy Assarsson
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=7ec86c10-3cef-d806-2e27-c99a12704288@bitwise.fi \
--to=anssi.hannula@bitwise.fi \
--cc=extja@kvaser.com \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mkl@pengutronix.de \
/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
all inboxes | Powered by JetHome®