Re: [PATCH 2/4] can: fix IFF_ECHO example in documentation

Oliver Hartkopp <[email protected]>
Newsgroups org.kernel.vger.linux-can,org.kernel.vger.linux-kernel
Message-ID <[email protected]>

On 04.08.26 21:55, Vincent Mailhol wrote:
> The documentation suggests doing:
> 
>    dev->flags = (IFF_NOARP | IFF_ECHO);
> 
> to set the IFF_ECHO flag. This is problematic because by doing so,
> other potentially enabled flags would be overwritten. Furthermore,
> none of the drivers do it like that.
> 
> Replace the example by:
> 
>    dev->flags |= IFF_ECHO;

IFF_NOARP is important for CAN interfaces and it looks like it could be 
missed now.

Please document that IFF_NOARP is already set in can_setup().
E.g. out of tree drivers might stumble into problems when they set up 
the flags differently.

> 
> which is more robust and consistent with what all the drivers are doing.
> 
> Signed-off-by: Vincent Mailhol <[email protected]>
> ---
>   Documentation/networking/can.rst | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Documentation/networking/can.rst b/Documentation/networking/can.rst
> index 536ff411da1d..fbd0d501ea4e 100644
> --- a/Documentation/networking/can.rst
> +++ b/Documentation/networking/can.rst
> @@ -1126,7 +1126,7 @@ e.g. of tty devices. In this case the driver flag IFF_ECHO has to be
>   set to prevent the PF_CAN core from locally echoing sent frames
>   (aka loopback) as fallback solution::
>   
> -    dev->flags = (IFF_NOARP | IFF_ECHO);
> +    dev->flags |= IFF_ECHO;

Here also a documentation about IFF_NOARP is needed now.

Best regards,
Oliver
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.