From: Vincent Mailhol <mailhol@kernel.org>
To: Marc Kleine-Budde <mkl@pengutronix.de>,
Oliver Hartkopp <socketcan@hartkopp.net>
Cc: linux-can@vger.kernel.org, linux-kernel@vger.kernel.org,
Vincent Mailhol <mailhol@kernel.org>
Subject: [PATCH 0/4] can: automate IFF_ECHO flag for generic echo skbs
Date: Tue, 04 Aug 2026 21:55:23 +0200 [thread overview]
Message-ID: <20260804-automate_iff_echo_flag-v1-0-26f06ff0f8bc@kernel.org> (raw)
Most CAN drivers allocate echo skb slots through alloc_candev() or
alloc_candev_mqs(), but still have to manually set IFF_ECHO to tell
PF_CAN that the driver handles local echo itself. This creates
boilerplate and makes it easy for drivers to forget one half of the
setup.
A recent example is commit c77bfbdd6aac ("can: dummy_can:
dummy_can_init(): fix packet statistics"), where dummy_can was already
using the generic echo skb helpers but needed an explicit IFF_ECHO
assignment to make tx_bytes accounting work.
Patch #1 cleans up slcan, which does not use the generic echo skb
helpers and therefore should not allocate echo slots. Patch #2 fixes a
small inaccuracy in the can.rst documentation in regard to the IFF_ECHO
flag. Patch #3 sets IFF_ECHO automatically when echo skb slots are
requested. And Patch #4, the final one, removes the now redundant
IFF_ECHO assignments from drivers which are covered by alloc_candev()
with a non-zero echo_skb_max.
The remaining explicit IFF_ECHO assignments are special cases with
custom or virtual echo handling.
Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
---
Vincent Mailhol (4):
can: slcan: do not allocate unused echo skb
can: fix IFF_ECHO example in documentation
can: dev: set IFF_ECHO when allocating echo skbs
can: treewide: remove redundant IFF_ECHO assignments
Documentation/networking/can.rst | 7 +++++--
drivers/net/can/at91_can.c | 1 -
drivers/net/can/bxcan.c | 1 -
drivers/net/can/c_can/c_can_main.c | 1 -
drivers/net/can/cc770/cc770.c | 2 --
drivers/net/can/ctucanfd/ctucanfd_base.c | 1 -
drivers/net/can/dev/dev.c | 1 +
drivers/net/can/dummy_can.c | 1 -
drivers/net/can/esd/esd_402_pci-core.c | 1 -
drivers/net/can/flexcan/flexcan-core.c | 1 -
drivers/net/can/ifi_canfd/ifi_canfd.c | 1 -
drivers/net/can/kvaser_pciefd/kvaser_pciefd_core.c | 1 -
drivers/net/can/m_can/m_can.c | 1 -
drivers/net/can/mscan/mscan.c | 2 --
drivers/net/can/peak_canfd/peak_canfd.c | 1 -
drivers/net/can/rcar/rcar_can.c | 1 -
drivers/net/can/rcar/rcar_canfd.c | 1 -
drivers/net/can/rockchip/rockchip_canfd-core.c | 1 -
drivers/net/can/sja1000/sja1000.c | 1 -
drivers/net/can/slcan/slcan-core.c | 2 +-
drivers/net/can/softing/softing_main.c | 1 -
drivers/net/can/spi/hi311x.c | 1 -
drivers/net/can/spi/mcp251x.c | 1 -
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 1 -
drivers/net/can/sun4i_can.c | 1 -
drivers/net/can/ti_hecc.c | 1 -
drivers/net/can/usb/ems_usb.c | 2 --
drivers/net/can/usb/esd_usb.c | 2 --
drivers/net/can/usb/etas_es58x/es58x_core.c | 1 -
drivers/net/can/usb/f81604.c | 1 -
drivers/net/can/usb/gs_usb.c | 1 -
drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c | 2 --
drivers/net/can/usb/mcba_usb.c | 2 --
drivers/net/can/usb/nct6694_canfd.c | 1 -
drivers/net/can/usb/peak_usb/pcan_usb_core.c | 2 --
drivers/net/can/usb/usb_8dev.c | 2 --
drivers/net/can/virtio_can.c | 1 -
drivers/net/can/xilinx_can.c | 2 --
38 files changed, 7 insertions(+), 47 deletions(-)
---
base-commit: 828c4a5a9518117f9f7bdc445a7eeca85fc91bf8
change-id: 20260804-automate_iff_echo_flag-6ddd7f4def7a
Best regards,
--
Vincent Mailhol <mailhol@kernel.org>
next reply other threads:[~2026-08-04 19:56 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 19:55 Vincent Mailhol [this message]
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
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=20260804-automate_iff_echo_flag-v1-0-26f06ff0f8bc@kernel.org \
--to=mailhol@kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=socketcan@hartkopp.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.