netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/1] pull-request: can 2025-07-25
@ 2025-07-25 10:13 Marc Kleine-Budde
  2025-07-25 10:13 ` [PATCH net] can: peak_usb: fix USB FD devices potential malfunction Marc Kleine-Budde
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Kleine-Budde @ 2025-07-25 10:13 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuba, linux-can, kernel

Hello netdev-team,

this is a pull request of 1 patch for net/main.

The patch is by Stephane Grosjean and adds support the recent firmware
of USB CAN FD interfaces to the peak_usb driver.

regards,
Marc

---

The following changes since commit c8f13134349b4385ae739f1efe403d5d3949ef92:

  Merge branch 'selftests-drv-net-tso-fix-issues-with-tso-selftest' (2025-07-24 18:55:29 -0700)

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-6.16-20250725

for you to fetch changes up to 788199b73b6efe4ee2ade4d7457b50bb45493488:

  can: peak_usb: fix USB FD devices potential malfunction (2025-07-25 12:09:19 +0200)

----------------------------------------------------------------
linux-can-fixes-for-6.16-20250725

----------------------------------------------------------------
Stephane Grosjean (1):
      can: peak_usb: fix USB FD devices potential malfunction

 drivers/net/can/usb/peak_usb/pcan_usb_fd.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)


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

* [PATCH net] can: peak_usb: fix USB FD devices potential malfunction
  2025-07-25 10:13 [PATCH net 0/1] pull-request: can 2025-07-25 Marc Kleine-Budde
@ 2025-07-25 10:13 ` Marc Kleine-Budde
  2025-07-26  0:10   ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Kleine-Budde @ 2025-07-25 10:13 UTC (permalink / raw)
  To: netdev
  Cc: davem, kuba, linux-can, kernel, Stephane Grosjean,
	Vincent Mailhol, Marc Kleine-Budde

From: Stephane Grosjean <stephane.grosjean@hms-networks.com>

The latest firmware versions of USB CAN FD interfaces export the EP numbers
to be used to dialog with the device via the "type" field of a response to
a vendor request structure, particularly when its value is greater than or
equal to 2.

Correct the driver's test of this field.

Fixes: 4f232482467a ("can: peak_usb: include support for a new MCU")
Signed-off-by: Stephane Grosjean <stephane.grosjean@hms-networks.com>
Link: https://patch.msgid.link/20250724081550.11694-1-stephane.grosjean@free.fr
Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
[mkl: rephrase commit message]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/usb/peak_usb/pcan_usb_fd.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
index 4d85b29a17b7..ebefc274b50a 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
@@ -49,7 +49,7 @@ struct __packed pcan_ufd_fw_info {
 	__le32	ser_no;		/* S/N */
 	__le32	flags;		/* special functions */
 
-	/* extended data when type == PCAN_USBFD_TYPE_EXT */
+	/* extended data when type >= PCAN_USBFD_TYPE_EXT */
 	u8	cmd_out_ep;	/* ep for cmd */
 	u8	cmd_in_ep;	/* ep for replies */
 	u8	data_out_ep[2];	/* ep for CANx TX */
@@ -982,10 +982,11 @@ static int pcan_usb_fd_init(struct peak_usb_device *dev)
 			dev->can.ctrlmode |= CAN_CTRLMODE_FD_NON_ISO;
 		}
 
-		/* if vendor rsp is of type 2, then it contains EP numbers to
-		 * use for cmds pipes. If not, then default EP should be used.
+		/* if vendor rsp type is greater than or equal to 2, then it
+		 * contains EP numbers to use for cmds pipes. If not, then
+		 * default EP should be used.
 		 */
-		if (fw_info->type != cpu_to_le16(PCAN_USBFD_TYPE_EXT)) {
+		if (le16_to_cpu(fw_info->type) < PCAN_USBFD_TYPE_EXT) {
 			fw_info->cmd_out_ep = PCAN_USBPRO_EP_CMDOUT;
 			fw_info->cmd_in_ep = PCAN_USBPRO_EP_CMDIN;
 		}
@@ -1018,11 +1019,11 @@ static int pcan_usb_fd_init(struct peak_usb_device *dev)
 	dev->can_channel_id =
 		le32_to_cpu(pdev->usb_if->fw_info.dev_id[dev->ctrl_idx]);
 
-	/* if vendor rsp is of type 2, then it contains EP numbers to
-	 * use for data pipes. If not, then statically defined EP are used
-	 * (see peak_usb_create_dev()).
+	/* if vendor rsp type is greater than or equal to 2, then it contains EP
+	 * numbers to use for data pipes. If not, then statically defined EP are
+	 * used (see peak_usb_create_dev()).
 	 */
-	if (fw_info->type == cpu_to_le16(PCAN_USBFD_TYPE_EXT)) {
+	if (le16_to_cpu(fw_info->type) >= PCAN_USBFD_TYPE_EXT) {
 		dev->ep_msg_in = fw_info->data_in_ep;
 		dev->ep_msg_out = fw_info->data_out_ep[dev->ctrl_idx];
 	}

base-commit: c8f13134349b4385ae739f1efe403d5d3949ef92
-- 
2.47.2



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

* Re: [PATCH net] can: peak_usb: fix USB FD devices potential malfunction
  2025-07-25 10:13 ` [PATCH net] can: peak_usb: fix USB FD devices potential malfunction Marc Kleine-Budde
@ 2025-07-26  0:10   ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-07-26  0:10 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: netdev, davem, kuba, linux-can, kernel, stephane.grosjean,
	mailhol.vincent

Hello:

This patch was applied to netdev/net.git (main)
by Marc Kleine-Budde <mkl@pengutronix.de>:

On Fri, 25 Jul 2025 12:13:49 +0200 you wrote:
> From: Stephane Grosjean <stephane.grosjean@hms-networks.com>
> 
> The latest firmware versions of USB CAN FD interfaces export the EP numbers
> to be used to dialog with the device via the "type" field of a response to
> a vendor request structure, particularly when its value is greater than or
> equal to 2.
> 
> [...]

Here is the summary with links:
  - [net] can: peak_usb: fix USB FD devices potential malfunction
    https://git.kernel.org/netdev/net/c/788199b73b6e

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2025-07-26  0:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-25 10:13 [PATCH net 0/1] pull-request: can 2025-07-25 Marc Kleine-Budde
2025-07-25 10:13 ` [PATCH net] can: peak_usb: fix USB FD devices potential malfunction Marc Kleine-Budde
2025-07-26  0:10   ` patchwork-bot+netdevbpf

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).