Re: [PATCH v5 0/7] can: refactoring of can-dev module and of Kbuild

From: Oliver Hartkopp
Date: Tue Jun 07 2022 - 22:04:43 EST


Hi Vincent,

On 07.06.22 04:49, Vincent MAILHOL wrote:
On Tue. 7 Jun. 2022 at 04:43, Oliver Hartkopp <socketcan@xxxxxxxxxxxx> wrote:


|
+-> All other CAN devices not relying on RX offload
|
+-> CAN rx offload
symbol: CONFIG_CAN_RX_OFFLOAD

Is this still true in patch series 5?

If I understood it correctly CONFIG_CAN_BITTIMING and
CONFIG_CAN_RX_OFFLOAD can be enabled by the user and
(alternatively/additionally) the selection of "flexcan, m_can, mcp251xfd
and ti_hecc" enables CONFIG_CAN_RX_OFFLOAD too.

Right?

Yes, this is correct. Maybe what troubles you is the meaning of the
"x --> y" arrow in the graph. I said it denotes that "y depends on x".
Here "depends on" has a loose meaning. It translates to either:
* Feature Y is encapsulated in Kbuild by some "if X/endif" and won't
show up unless X is selected.
* Feature Y has a "selects X" tag and will forcibly enable X if selected.

CONFIG_CAN_*CALC*_BITTIMING is on the left side of an arrow starting
from CONFIG_CAN_NETLINK so it "depends" on CONFIG_CAN_NETLINK. On the
other hand, CONFIG_CAN_*CALC*_BITTIMING does not have any arrow
starting from it so indeed, it can be enabled by the user
independently of the other features as long as CONFIG_CAN_NETLINK is
selected.

Ok.

CONFIG_CAN_RX_OFFLOAD is also on the left side of an arrow starting
from CONFIG_CAN_NETLINK. Furthermore, there is an arrow starting from
CONFIG_CAN_RX_OFFLOAD going to the "rx offload drivers". So those
drivers need CONFIG_CAN_RX_OFFLOAD (which is implemented using the
"selects CONFIG_CAN_RX_OFFLOAD"). However, CONFIG_CAN_RX_OFFLOAD can
be selected independently of the "rx offload drivers" as long as its
CONFIG_CAN_NETLINK dependency is met.

So I think that the diagram is correct. Maybe rephrasing the cover
letter as below would address your concerns?
I applied your series and played with the options and it works like charm - and as expected.

But the point remains that from your figure I would still assume that the M_CAN driver would only show up when CONFIG_CAN_RX_OFFLOAD was selected by the user.

But the current (good) implementation shows *all* drivers and selects CONFIG_CAN_RX_OFFLOAD when e.g. M_CAN is selected.

So what about:

symbol: CONFIG_NETDEVICES
|
+-> CAN Device Drivers
symbol: CONFIG_CAN_DEV
|
+-> software/virtual CAN device drivers
| (at time of writing: slcan, vcan, vxcan)
|
+-> hardware CAN device drivers with Netlink support
symbol: CONFIG_CAN_NETLINK (matches previous CONFIG_CAN_DEV)
|
+-> CAN bit-timing calculation (optional for all drivers)
| symbol: CONFIG_CAN_BITTIMING
|
+-> CAN rx offload (optional but selected by some drivers)
| symbol: CONFIG_CAN_RX_OFFLOAD
|
+-> CAN devices drivers
(some may select CONFIG_CAN_RX_OFFLOAD)

(I also added 'hardware' to CAN device drivers with Netlink support) to have a distinction to 'software/virtual' CAN device drivers)

At least this would help me to understand the new configuration setup.

Best regards,
Oliver