All of lore.kernel.org
 help / color / mirror / Atom feed
* Circular dependency between DSA switch driver and tagging protocol driver
@ 2021-09-08 22:08 Vladimir Oltean
  2021-09-08 22:14 ` Florian Fainelli
  0 siblings, 1 reply; 8+ messages in thread
From: Vladimir Oltean @ 2021-09-08 22:08 UTC (permalink / raw)
  To: Florian Fainelli, Andrew Lunn, Vivien Didelot; +Cc: netdev, linux-kernel

Hi,

Since commits 566b18c8b752 ("net: dsa: sja1105: implement TX
timestamping for SJA1110") and 994d2cbb08ca ("net: dsa: tag_sja1105: be
dsa_loop-safe"), net/dsa/tag_sja1105.ko has gained a build and insmod
time dependency on drivers/net/dsa/sja1105.ko, due to several symbols
exported by the latter and used by the former.

So first one needs to insmod sja1105.ko, then insmod tag_sja1105.ko.

But dsa_port_parse_cpu returns -EPROBE_DEFER when dsa_tag_protocol_get
returns -ENOPROTOOPT. It means, there is no DSA_TAG_PROTO_SJA1105 in the
list of tagging protocols known by DSA, try again later. There is a
runtime dependency for DSA to have the tagging protocol loaded. Combined
with the symbol dependency, this is a de facto circular dependency.

So when we first insmod sja1105.ko, nothing happens, probing is deferred.

Then when we insmod tag_sja1105.ko, we expect the DSA probing to kick
off where it left from, and probe the switch too.

However this does not happen because the deferred probing list in the
device core is reconsidered for a new attempt only if a driver is bound
to a new device. But DSA tagging protocols are drivers with no struct
device.

One can of course manually kick the driver after the two insmods:

echo spi0.1 > /sys/bus/spi/drivers/sja1105/bind

and this works, but automatic module loading based on modaliases will be
broken if both tag_sja1105.ko and sja1105.ko are modules, and sja1105 is
the last device to get a driver bound to it.

Where is the problem?

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-09-29 14:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-08 22:08 Circular dependency between DSA switch driver and tagging protocol driver Vladimir Oltean
2021-09-08 22:14 ` Florian Fainelli
2021-09-08 22:19   ` Vladimir Oltean
2021-09-08 23:36     ` Florian Fainelli
2021-09-29 14:07       ` Vladimir Oltean
2021-09-09  0:26   ` Vladimir Oltean
2021-09-09  0:49     ` Florian Fainelli
2021-09-09  1:08       ` Vladimir Oltean

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.