linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: linux-can@vger.kernel.org
Subject: Re: [RFC PATCH v2] can: isotp: add module parameter for maximum pdu size
Date: Sun, 26 Mar 2023 14:02:42 +0200	[thread overview]
Message-ID: <38aabf68-e062-a3dc-c168-6a87d1febdb4@hartkopp.net> (raw)
In-Reply-To: <20230324172951.3zvcujiof7xnh3u7@pengutronix.de>



On 24.03.23 18:29, Marc Kleine-Budde wrote:
> On 22.03.2023 18:59:04, Oliver Hartkopp wrote:
> .> > > I've been thinking about some sendfile() implementation too. But this again
>>>> would bloat the code and would not solve the rx side.
>>>
>>> I'm not talking about sendfile. Have a look at j1939's
>>> j1939_sk_send_loop();
>>>
>>> | https://elixir.bootlin.com/linux/v6.2/source/net/can/j1939/socket.c#L1114
>>>
>>
>> This does not work for isotp like this as you have to handle different block
>> sizes in the flow control message.
> 
> Let this be a task for future us. :)

Let's see if there would be really a use-case that would justify an 
additional complexity.

So far I don't see the need for that.

>>>>> what about: ARRAY_SIZE(so->rx.sbuf)
>>>>>
>>>>
>>>> Looks good. I was just unsure which macro to use ;-)
>>>
>>> You can also use sizeof(so->rx.sbuf).
>>>
>>> ARRAY_SIZE would cause a compile error if you convert so->rx.sbuf to a
>>> pointer to dynamically allocated mem, while sizeof() still compiles.
>>
>> so->rx.sbuf is always a static buffer.
> 
> Yes, in the current code. I was showing the difference between
> ARRAY_SIZE() and sizeof(). ARRAY_SIZE has a bit of type checking, while
> sizeof() doesn't - this becomes important once you change the code.
> 

ACK

>> Only so->rx.buf can point to either so->rx.sbuf or to a dynamically
>> allocated memory.
>>
>> But when sizeof() is always safe it would take this for the v3 patch.
> 
> Use ARRAY_SIZE().

Done. Sent a V3 patch a minute ago.

Many thanks,
Oliver


      reply	other threads:[~2023-03-26 12:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-13 17:25 [RFC PATCH v2] can: isotp: add module parameter for maximum pdu size Oliver Hartkopp
2023-03-20 16:24 ` Marc Kleine-Budde
2023-03-20 21:07   ` Oliver Hartkopp
2023-03-22  8:56     ` Marc Kleine-Budde
2023-03-22 17:59       ` Oliver Hartkopp
2023-03-24 17:29         ` Marc Kleine-Budde
2023-03-26 12:02           ` Oliver Hartkopp [this message]

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=38aabf68-e062-a3dc-c168-6a87d1febdb4@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=linux-can@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;
as well as URLs for NNTP newsgroup(s).