From: Vincent Mailhol <mailhol@kernel.org>
To: Celeste Liu <uwu@coelacanthus.name>
Cc: Maximilian Schneider <max@schneidersoft.net>,
Henrik Brix Andersen <henrik@brixandersen.dk>,
Wolfgang Grandegger <wg@grandegger.com>,
Kees Cook <kees@kernel.org>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
linux-can@vger.kernel.org, linux-kernel@vger.kernel.org,
Runcheng Lu <runcheng.lu@hpmicro.com>,
stable@vger.kernel.org, Marc Kleine-Budde <mkl@pengutronix.de>
Subject: Re: [PATCH v3] net/can/gs_usb: increase max interface to U8_MAX
Date: Tue, 30 Sep 2025 14:44:55 +0900 [thread overview]
Message-ID: <7d35d8ca-f711-41b2-b058-08a19a207160@kernel.org> (raw)
In-Reply-To: <20250930-gs-usb-max-if-v3-1-21d97d7f1c34@coelacanthus.name>
On 9/30/25 12:06 PM, Celeste Liu wrote:
> This issue was found by Runcheng Lu when develop HSCanT USB to CAN FD
> converter[1]. The original developers may have only 3 intefaces device to
^^^^^^^^^
interfaces (missing "r")
> test so they write 3 here and wait for future change.
>
> During the HSCanT development, we actually used 4 interfaces, so the
> limitation of 3 is not enough now. But just increase one is not
> future-proofed. Since the channel type in gs_host_frame is u8, just
> increase interface number limit to max size of u8 safely.
>
> [1]: https://github.com/cherry-embedded/HSCanT-hardware
>
> Fixes: d08e973a77d1 ("can: gs_usb: Added support for the GS_USB CAN devices")
> Reported-by: Runcheng Lu <runcheng.lu@hpmicro.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Celeste Liu <uwu@coelacanthus.name>
Reviewed-by: Vincent Mailhol <mailhol@kernel.org>
The patch is good as-is. However, speaking of the interface numbers, there is
another issue in this gs_usb driver: net_device->dev_port is not populated, and
according to the documentation, this is a bug.
See the description here:
https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-net
What: /sys/class/net/<iface>/dev_port
Date: February 2014
KernelVersion: 3.15
Contact: netdev@vger.kernel.org
Description:
Indicates the port number of this network device, formatted
as a decimal value. Some NICs have multiple independent ports
on the same PCI bus, device and function. This attribute allows
userspace to distinguish the respective interfaces.
Note: some device drivers started to use 'dev_id' for this
purpose since long before 3.15 and have not adopted the new
attribute ever since. To query the port number, some tools look
exclusively at 'dev_port', while others only consult 'dev_id'.
If a network device has multiple client adapter ports as
described in the previous paragraph and does not set this
attribute to its port number, it's a kernel bug.
Would you mind sending a separate patch (with a Fixes: tag) to resolve this?
Yours sincerely,
Vincent Mailhol
next prev parent reply other threads:[~2025-09-30 5:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-30 3:06 [PATCH v3] net/can/gs_usb: increase max interface to U8_MAX Celeste Liu
2025-09-30 5:44 ` Vincent Mailhol [this message]
2025-09-30 6:19 ` Celeste Liu
2025-09-30 5:57 ` Vincent Mailhol
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=7d35d8ca-f711-41b2-b058-08a19a207160@kernel.org \
--to=mailhol@kernel.org \
--cc=gustavoars@kernel.org \
--cc=henrik@brixandersen.dk \
--cc=kees@kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=max@schneidersoft.net \
--cc=mkl@pengutronix.de \
--cc=runcheng.lu@hpmicro.com \
--cc=stable@vger.kernel.org \
--cc=uwu@coelacanthus.name \
--cc=wg@grandegger.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).