Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by Frank Li
Tue, 24 Nov 2026 21:01
Re: [PATCH v3 3/3] net: mctp i3c: clamp transfer lengths to the controller limits
Author: Frank Li
Date: Tue, 24 Nov 2026 21:01
Date: Tue, 24 Nov 2026 21:01
58 lines
19196 bytes
19196 bytes
On Tue, Nov 24, 2026 at 11:36:51AM +0530, Shubham Patil wrote:
> mctp_i3c_setup() takes the maximum read and write lengths straight from
> GETMRL and GETMWL. Those describe the endpoint alone, so on a controller
> with a smaller limit every read can be built too large and rejected.
> Transmit packets can similarly reach the controller even when they are
> larger than its transmit buffer. The receive path also allocates an skb
> for data the hardware can never deliver.
>
> Use i3c_device_get_max_read_xfer_bytes() and
> i3c_device_get_max_write_xfer_bytes() instead, which return the smaller
> of the endpoint and controller limits.
>
> Behaviour is unchanged when neither reports a limit, as the helpers
> return 0 exactly as the GETMRL and GETMWL fields do today.
>
> Signed-off-by: Shubham Patil <shubhamsanjay.patil@amd.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Changes in v3:
> - Change the subject prefix to "net: mctp i3c:".
> - No code changes.
>
> drivers/net/mctp/mctp-i3c.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/mctp/mctp-i3c.c b/drivers/net/mctp/mctp-i3c.c
> index 88d9e36cd4a2..6d08898e1d21 100644
> --- a/drivers/net/mctp/mctp-i3c.c
> +++ b/drivers/net/mctp/mctp-i3c.c
> @@ -81,9 +81,9 @@ struct mctp_i3c_device {
> bool have_mdb;
> /* I3C dynamic address */
> u8 addr;
> - /* Maximum read length */
> + /* Maximum read length, limited by the device MRL and the controller */
> u16 mrl;
> - /* Maximum write length */
> + /* Maximum write length, limited by the device MWL and the controller */
> u16 mwl;
> /* Provisioned ID */
> u64 pid;
> @@ -214,8 +214,8 @@ static int mctp_i3c_setup(struct mctp_i3c_device *mi)
> i3c_device_get_info(mi->i3c, &info);
> mi->have_mdb = info.bcr & BIT(2);
> mi->addr = info.dyn_addr;
> - mi->mwl = info.max_write_len;
> - mi->mrl = info.max_read_len;
> + mi->mwl = i3c_device_get_max_write_xfer_bytes(mi->i3c);
> + mi->mrl = i3c_device_get_max_read_xfer_bytes(mi->i3c);
> mi->pid = info.pid;
>
> rc = i3c_device_request_ibi(mi->i3c, &ibi);
> --
> 2.34.1
>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads