<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/net/can/usb, branch linux-6.4.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.4.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.4.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2023-09-13T07:48:02Z</updated>
<entry>
<title>can: gs_usb: gs_usb_receive_bulk_callback(): count RX overflow errors also in case of OOM</title>
<updated>2023-09-13T07:48:02Z</updated>
<author>
<name>Marc Kleine-Budde</name>
</author>
<published>2023-07-04T09:23:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d273f36ef6be4b3fffbf5113f285c1eb82e5edfd'/>
<id>urn:sha1:d273f36ef6be4b3fffbf5113f285c1eb82e5edfd</id>
<content type='text'>
[ Upstream commit 6c8bc15f02b85bc8f47074110d8fd8caf7a1e42d ]

In case of an RX overflow error from the CAN controller and an OOM
where no skb can be allocated, the error counters are not incremented.

Fix this by first incrementing the error counters and then allocate
the skb.

Fixes: d08e973a77d1 ("can: gs_usb: Added support for the GS_USB CAN devices")
Link: https://lore.kernel.org/all/20230718-gs_usb-cleanups-v1-7-c3b9154ec605@pengutronix.de
Signed-off-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>can: gs_usb: gs_can_close(): add missing set of CAN state to CAN_STATE_STOPPED</title>
<updated>2023-08-03T08:26:03Z</updated>
<author>
<name>Marc Kleine-Budde</name>
</author>
<published>2023-07-18T09:43:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f8416e85c8c4c993a362123e18b1bf5e911b1676'/>
<id>urn:sha1:f8416e85c8c4c993a362123e18b1bf5e911b1676</id>
<content type='text'>
commit f8a2da6ec2417cca169fa85a8ab15817bccbb109 upstream.

After an initial link up the CAN device is in ERROR-ACTIVE mode. Due
to a missing CAN_STATE_STOPPED in gs_can_close() it doesn't change to
STOPPED after a link down:

| ip link set dev can0 up
| ip link set dev can0 down
| ip --details link show can0
| 13: can0: &lt;NOARP,ECHO&gt; mtu 16 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 10
|     link/can  promiscuity 0 allmulti 0 minmtu 0 maxmtu 0
|     can state ERROR-ACTIVE restart-ms 1000

Add missing assignment of CAN_STATE_STOPPED in gs_can_close().

Cc: stable@vger.kernel.org
Fixes: d08e973a77d1 ("can: gs_usb: Added support for the GS_USB CAN devices")
Link: https://lore.kernel.org/all/20230718-gs_usb-fix-can-state-v1-1-f19738ae2c23@pengutronix.de
Signed-off-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>can: gs_usb: fix time stamp counter initialization</title>
<updated>2023-07-27T06:56:37Z</updated>
<author>
<name>Marc Kleine-Budde</name>
</author>
<published>2023-07-07T16:44:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=210a8cffc9c1b044281c0a868485c870c9c11374'/>
<id>urn:sha1:210a8cffc9c1b044281c0a868485c870c9c11374</id>
<content type='text'>
commit 5886e4d5ecec3e22844efed90b2dd383ef804b3a upstream.

If the gs_usb device driver is unloaded (or unbound) before the
interface is shut down, the USB stack first calls the struct
usb_driver::disconnect and then the struct net_device_ops::ndo_stop
callback.

In gs_usb_disconnect() all pending bulk URBs are killed, i.e. no more
RX'ed CAN frames are send from the USB device to the host. Later in
gs_can_close() a reset control message is send to each CAN channel to
remove the controller from the CAN bus. In this race window the USB
device can still receive CAN frames from the bus and internally queue
them to be send to the host.

At least in the current version of the candlelight firmware, the queue
of received CAN frames is not emptied during the reset command. After
loading (or binding) the gs_usb driver, new URBs are submitted during
the struct net_device_ops::ndo_open callback and the candlelight
firmware starts sending its already queued CAN frames to the host.

However, this scenario was not considered when implementing the
hardware timestamp function. The cycle counter/time counter
infrastructure is set up (gs_usb_timestamp_init()) after the USBs are
submitted, resulting in a NULL pointer dereference if
timecounter_cyc2time() (via the call chain:
gs_usb_receive_bulk_callback() -&gt; gs_usb_set_timestamp() -&gt;
gs_usb_skb_set_timestamp()) is called too early.

Move the gs_usb_timestamp_init() function before the URBs are
submitted to fix this problem.

For a comprehensive solution, we need to consider gs_usb devices with
more than 1 channel. The cycle counter/time counter infrastructure is
setup per channel, but the RX URBs are per device. Once gs_can_open()
of _a_ channel has been called, and URBs have been submitted, the
gs_usb_receive_bulk_callback() can be called for _all_ available
channels, even for channels that are not running, yet. As cycle
counter/time counter has not set up, this will again lead to a NULL
pointer dereference.

Convert the cycle counter/time counter from a "per channel" to a "per
device" functionality. Also set it up, before submitting any URBs to
the device.

Further in gs_usb_receive_bulk_callback(), don't process any URBs for
not started CAN channels, only resubmit the URB.

Fixes: 45dfa45f52e6 ("can: gs_usb: add RX and TX hardware timestamp support")
Closes: https://github.com/candle-usb/candleLight_fw/issues/137#issuecomment-1623532076
Cc: stable@vger.kernel.org
Cc: John Whittington &lt;git@jbrengineering.co.uk&gt;
Link: https://lore.kernel.org/all/20230716-gs_usb-fix-time-stamp-counter-v1-2-9017cefcd9d5@pengutronix.de
Signed-off-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>can: gs_usb: gs_can_open(): improve error handling</title>
<updated>2023-07-27T06:56:37Z</updated>
<author>
<name>Marc Kleine-Budde</name>
</author>
<published>2023-07-07T11:43:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f3083a981487cb28e08490e2f6d691311ca67bf2'/>
<id>urn:sha1:f3083a981487cb28e08490e2f6d691311ca67bf2</id>
<content type='text'>
commit 2603be9e8167ddc7bea95dcfab9ffc33414215aa upstream.

The gs_usb driver handles USB devices with more than 1 CAN channel.
The RX path for all channels share the same bulk endpoint (the
transmitted bulk data encodes the channel number). These per-device
resources are allocated and submitted by the first opened channel.

During this allocation, the resources are either released immediately
in case of a failure or the URBs are anchored. All anchored URBs are
finally killed with gs_usb_disconnect().

Currently, gs_can_open() returns with an error if the allocation of a
URB or a buffer fails. However, if usb_submit_urb() fails, the driver
continues with the URBs submitted so far, even if no URBs were
successfully submitted.

Treat every error as fatal and free all allocated resources
immediately.

Switch to goto-style error handling, to prepare the driver for more
per-device resource allocation.

Cc: stable@vger.kernel.org
Cc: John Whittington &lt;git@jbrengineering.co.uk&gt;
Link: https://lore.kernel.org/all/20230716-gs_usb-fix-time-stamp-counter-v1-1-9017cefcd9d5@pengutronix.de
Signed-off-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>kvaser_usb: convert USB IDs to hexadecimal values</title>
<updated>2023-04-04T14:48:45Z</updated>
<author>
<name>Oliver Hartkopp</name>
</author>
<published>2023-03-29T09:09:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1afae605e0b2da606d5fff4a8a5849da207128b3'/>
<id>urn:sha1:1afae605e0b2da606d5fff4a8a5849da207128b3</id>
<content type='text'>
USB IDs are usually represented in 16 bit hexadecimal values. To match
the common representation in lsusb and for searching USB IDs in the
internet convert the decimal values to lowercase hexadecimal.

changes since v1: https://lore.kernel.org/all/20230327175344.4668-1-socketcan@hartkopp.net
- drop the aligned block indentation (suggested by Jimmy)
- use lowercase hex values (suggested by Alex)

Signed-off-by: Oliver Hartkopp &lt;socketcan@hartkopp.net&gt;
Acked-by: Jimmy Assarsson &lt;extja@kvaser.com&gt;
Reviewed-by: Alexander Dahl &lt;ada@thorsis.com&gt;
Link: https://lore.kernel.org/all/20230329090915.3127-1-socketcan@hartkopp.net
Signed-off-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt;
</content>
</entry>
<entry>
<title>can: esd_usb: Add support for CAN_CTRLMODE_BERR_REPORTING</title>
<updated>2023-04-04T14:48:45Z</updated>
<author>
<name>Frank Jungclaus</name>
</author>
<published>2023-03-30T18:44:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c42fc36949234bc8f8b5afe734acf6b49377f37a'/>
<id>urn:sha1:c42fc36949234bc8f8b5afe734acf6b49377f37a</id>
<content type='text'>
Announce that the driver supports CAN_CTRLMODE_BERR_REPORTING by means
of priv-&gt;can.ctrlmode_supported. Until now berr reporting always has
been active without taking care of the berr-reporting parameter given
to an "ip link set ..." command.

Additionally apply some changes to function esd_usb_rx_event():
- If berr reporting is off and it is also no state change, then
immediately return.
- Unconditionally (even in case of the above "immediate return") store
tx- and rx-error counters, so directly use priv-&gt;bec.txerr and
priv-&gt;bec.rxerr instead of intermediate variables.
- Not directly related, but to better point out the linkage between a
failed alloc_can_err_skb() and stats-&gt;rx_dropped++:
Move the increment of the rx_dropped statistic counter (back) to
directly behind the err_skb allocation.

Signed-off-by: Frank Jungclaus &lt;frank.jungclaus@esd.eu&gt;
Link: https://lore.kernel.org/all/20230330184446.2802135-1-frank.jungclaus@esd.eu
Signed-off-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt;
</content>
</entry>
<entry>
<title>can: esd_usb: Improve code readability by means of replacing struct esd_usb_msg with a union</title>
<updated>2023-03-24T18:12:38Z</updated>
<author>
<name>Frank Jungclaus</name>
</author>
<published>2023-02-22T16:37:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a57915aee31596d2380a875964c78f743162383c'/>
<id>urn:sha1:a57915aee31596d2380a875964c78f743162383c</id>
<content type='text'>
As suggested by Vincent Mailhol, declare struct esd_usb_msg as a union
instead of a struct. Then replace all msg-&gt;msg.something constructs,
that make use of esd_usb_msg, with simpler and prettier looking
msg-&gt;something variants.

Link: https://lore.kernel.org/all/CAMZ6RqKRzJwmMShVT9QKwiQ5LJaQupYqkPkKjhRBsP=12QYpfA@mail.gmail.com/
Suggested-by: Vincent MAILHOL &lt;mailhol.vincent@wanadoo.fr&gt;
Signed-off-by: Frank Jungclaus &lt;frank.jungclaus@esd.eu&gt;
Reviewed-by: Vincent Mailhol &lt;mailhol.vincent@wanadoo.fr&gt;
Link: https://lore.kernel.org/all/20230222163754.3711766-1-frank.jungclaus@esd.eu
Signed-off-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt;
</content>
</entry>
<entry>
<title>can: esd_usb: Improve readability on decoding ESD_EV_CAN_ERROR_EXT messages</title>
<updated>2023-02-16T19:59:48Z</updated>
<author>
<name>Frank Jungclaus</name>
</author>
<published>2023-02-16T19:04:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=07c3f9224713c1b5f82c4583a456a6abc28f9d73'/>
<id>urn:sha1:07c3f9224713c1b5f82c4583a456a6abc28f9d73</id>
<content type='text'>
As suggested by Marc introduce a union plus a struct ev_can_err_ext
for easier decoding of an ESD_EV_CAN_ERROR_EXT event message (which
simply is a rx_msg with some dedicated data).

Suggested-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt;
Link: https://lore.kernel.org/linux-can/20220621071152.ggyhrr5sbzvwpkpx@pengutronix.de/
Signed-off-by: Frank Jungclaus &lt;frank.jungclaus@esd.eu&gt;
Link: https://lore.kernel.org/all/20230216190450.3901254-4-frank.jungclaus@esd.eu
Signed-off-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt;
</content>
</entry>
<entry>
<title>can: esd_usb: Make use of can_change_state() and relocate checking skb for NULL</title>
<updated>2023-02-16T19:59:48Z</updated>
<author>
<name>Frank Jungclaus</name>
</author>
<published>2023-02-16T19:04:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9684b000a86299b5968fef8ffbf1484def37452a'/>
<id>urn:sha1:9684b000a86299b5968fef8ffbf1484def37452a</id>
<content type='text'>
Start a rework initiated by Vincents remarks "You should not report
the greatest of txerr and rxerr but the one which actually increased."
[1] and "As far as I understand, those flags should be set only when
the threshold is reached" [2] .

Therefore make use of can_change_state() to (among others) set the
flags CAN_ERR_CRTL_[RT]X_WARNING and CAN_ERR_CRTL_[RT]X_PASSIVE,
maintain CAN statistic counters for error_warning, error_passive and
bus_off.

Relocate testing alloc_can_err_skb() for NULL to the end of
esd_usb_rx_event(), to have things like can_bus_off(),
can_change_state() working even in out of memory conditions.

Fixes: 96d8e90382dc ("can: Add driver for esd CAN-USB/2 device")
Signed-off-by: Frank Jungclaus &lt;frank.jungclaus@esd.eu&gt;
Link: [1] https://lore.kernel.org/all/CAMZ6RqKGBWe15aMkf8-QLf-cOQg99GQBebSm+1wEzTqHgvmNuw@mail.gmail.com/
Link: [2] https://lore.kernel.org/all/CAMZ6Rq+QBO1yTX_o6GV0yhdBj-RzZSRGWDZBS0fs7zbSTy4hmA@mail.gmail.com/
Link: https://lore.kernel.org/all/20230216190450.3901254-3-frank.jungclaus@esd.eu
Signed-off-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt;
</content>
</entry>
<entry>
<title>can: esd_usb: Move mislocated storage of SJA1000_ECC_SEG bits in case of a bus error</title>
<updated>2023-02-16T19:59:47Z</updated>
<author>
<name>Frank Jungclaus</name>
</author>
<published>2023-02-16T19:04:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=118469f88180438ef43dee93d71f77c00e7b425d'/>
<id>urn:sha1:118469f88180438ef43dee93d71f77c00e7b425d</id>
<content type='text'>
Move the supply for cf-&gt;data[3] (bit stream position of CAN error), in
case of a bus- or protocol-error, outside of the "switch (ecc &amp;
SJA1000_ECC_MASK){}"-statement, because this bit stream position is
independent of the error type.

Fixes: 96d8e90382dc ("can: Add driver for esd CAN-USB/2 device")
Signed-off-by: Frank Jungclaus &lt;frank.jungclaus@esd.eu&gt;
Link: https://lore.kernel.org/all/20230216190450.3901254-2-frank.jungclaus@esd.eu
Signed-off-by: Marc Kleine-Budde &lt;mkl@pengutronix.de&gt;
</content>
</entry>
</feed>
