Linux CAN drivers development
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Vincent Mailhol <mailhol@kernel.org>,
	Marc Kleine-Budde <mkl@pengutronix.de>
Cc: linux-can@vger.kernel.org
Subject: Re: [PATCH 0/4] can: automate IFF_ECHO flag for generic echo skbs
Date: Fri, 14 Aug 2026 15:27:10 +0200	[thread overview]
Message-ID: <5c08e210-9982-4f0e-a213-058739da0134@hartkopp.net> (raw)
In-Reply-To: <5ff4d3ca-0c28-4c8b-8122-f7f6c782fb62@kernel.org>



On 12.08.26 22:23, Vincent Mailhol wrote:
> On 10/08/2026 at 20:07, Oliver Hartkopp wrote:

> 
> I am still not convinced. If the goal is transparency, I would rather do
> it through explicit comments.
> 
> In can327 and slcan:
> 
>    /* No echo skb: the device has no TX completion handler. Rely on the
>     * PF_CAN core for the echo */
>    alloc_candev(sizeof(..), 0);
> 
> In grcan and janz-ican3:
> 
>    /* The device has it own echo skb mechanism, don't use the framework
>     * echo skb. */
>    alloc_candev(sizeof(..), 0);
>    dev->flags |= IFF_ECHO;
> 
> And that is what I would call transparent.

No. This is modifying bit values where you don't know where any why they 
have been set. We need some top level function naming that makes 
transparent what's going on.

> The IFF_ECHO works in pair with the echo skb. Drivers should either take
> the full set or nothing.
> 
> Having a alloc_candev(sizeof(..), 0) share a different semantic than
> alloc_candev_no_echo(sizeof(..)) is the opposite of transparency. Where
> is it hinted in the name that one would set IFF_ECHO and not the other?
> 

What about:

#define NO_ECHO_SKB_ALLOC 0

alloc_candev_echo(sizeof(..), 4) // usual case

alloc_candev_echo(sizeof(..), NO_ECHO_SKB_ALLOC) // janz/grcan case

alloc_candev_no_echo(sizeof(..)) // slcan/can327 case

where

alloc_candev_no_echo(unsigned int privsize) {
    struct netdevice dev;

    dev = alloc_candev_echo(privsize, NO_ECHO_SKB_ALLOC)
    if (dev)
        dev->flags &= ~IFF_ECHO;

    return dev;
}

>> Btw. although v(x)can are different I would be interested in some
>> can_setup() function that sets the some common CAN device specific
>> values (like IFF_NOARP, default MTUs, etc) that are shared between all
>> kinds of CAN interfaces.
> 
> But that goes back to the previous problem: this increases the
> boilerplate for most of the drivers. I don't mind having some setup
> functions shared between the v(x)can, but adding one more call to
> can_setup() to the existing drivers is IMHO a step backward.
> 

Ok. v(x)can can stay completely open coded then.

Best regards,
Oliver


  reply	other threads:[~2026-08-14 13:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-04 19:55 [PATCH 0/4] can: automate IFF_ECHO flag for generic echo skbs Vincent Mailhol
2026-08-04 19:55 ` [PATCH 1/4] can: slcan: do not allocate unused echo skb Vincent Mailhol
2026-08-04 19:55 ` [PATCH 2/4] can: fix IFF_ECHO example in documentation Vincent Mailhol
2026-08-05  6:08   ` Oliver Hartkopp
2026-08-04 19:55 ` [PATCH 3/4] can: dev: set IFF_ECHO when allocating echo skbs Vincent Mailhol
2026-08-04 19:55 ` [PATCH 4/4] can: treewide: remove redundant IFF_ECHO assignments Vincent Mailhol
2026-08-05  6:29 ` [PATCH 0/4] can: automate IFF_ECHO flag for generic echo skbs Oliver Hartkopp
2026-08-05  7:25   ` Vincent Mailhol
2026-08-05 16:17     ` Oliver Hartkopp
2026-08-05 21:06       ` Vincent Mailhol
2026-08-06 12:01         ` Oliver Hartkopp
2026-08-06 20:55           ` Vincent Mailhol
2026-08-07 10:56             ` Oliver Hartkopp
2026-08-07 11:52               ` Vincent Mailhol
2026-08-10 18:07                 ` Oliver Hartkopp
2026-08-12 20:23                   ` Vincent Mailhol
2026-08-14 13:27                     ` Oliver Hartkopp [this message]
2026-08-28  9:22                       ` Vincent Mailhol
2026-08-28 12:56                         ` Oliver Hartkopp
2026-08-28 14:04                           ` Vincent Mailhol
2026-08-28 17:57                             ` Oliver Hartkopp

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=5c08e210-9982-4f0e-a213-058739da0134@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=linux-can@vger.kernel.org \
    --cc=mailhol@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