linux/net/dsa
Vladimir Oltean 49f885b2d9 net: dsa: tag_ocelot_8021q: break circular dependency with ocelot switch lib
Michael reported that when using the "ocelot-8021q" tagging protocol,
the switch driver module must be manually loaded before the tagging
protocol can be loaded/is available.

This appears to be the same problem described here:
https://lore.kernel.org/netdev/20210908220834.d7gmtnwrorhharna@skbuf/
where due to the fact that DSA tagging protocols make use of symbols
exported by the switch drivers, circular dependencies appear and this
breaks module autoloading.

The ocelot_8021q driver needs the ocelot_can_inject() and
ocelot_port_inject_frame() functions from the switch library. Previously
the wrong approach was taken to solve that dependency: shims were
provided for the case where the ocelot switch library was compiled out,
but that turns out to be insufficient, because the dependency when the
switch lib _is_ compiled is problematic too.

We cannot declare ocelot_can_inject() and ocelot_port_inject_frame() as
static inline functions, because these access I/O functions like
__ocelot_write_ix() which is called by ocelot_write_rix(). Making those
static inline basically means exposing the whole guts of the ocelot
switch library, not ideal...

We already have one tagging protocol driver which calls into the switch
driver during xmit but not using any exported symbol: sja1105_defer_xmit.
We can do the same thing here: create a kthread worker and one work item
per skb, and let the switch driver itself do the register accesses to
send the skb, and then consume it.

Fixes: 0a6f17c6ae ("net: dsa: tag_ocelot_8021q: add support for PTP timestamping")
Reported-by: Michael Walle <michael@walle.cc>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2021-10-12 17:35:18 -07:00
..
dsa2.c net: dsa: hold rtnl_lock in dsa_switch_setup_tag_protocol 2021-10-09 13:44:05 +01:00
dsa_priv.h net: dsa: flush switchdev workqueue before tearing down CPU/DSA ports 2021-09-15 15:09:46 -07:00
dsa.c net: dsa: flush switchdev workqueue before tearing down CPU/DSA ports 2021-09-15 15:09:46 -07:00
Kconfig net: dsa: tag_ocelot_8021q: break circular dependency with ocelot switch lib 2021-10-12 17:35:18 -07:00
Makefile net: dsa: build tag_8021q.c as part of DSA core 2021-07-20 06:36:42 -07:00
master.c dev_ioctl: split out ndo_eth_ioctl 2021-07-27 20:11:45 +01:00
port.c net: dsa: don't advertise 'rx-vlan-filter' when not needed 2021-08-24 09:30:58 +01:00
slave.c net: dsa: destroy the phylink instance on any error in dsa_slave_phy_setup 2021-09-15 15:03:36 -07:00
switch.c net: dsa: fix spurious error message when unoffloaded port leaves bridge 2021-10-12 16:11:23 -07:00
tag_8021q.c net: dsa: tag_8021q: fix notifiers broadcast when they shouldn't, and vice versa 2021-08-16 11:14:18 +01:00
tag_ar9331.c net: dsa: remove the struct packet_type argument from dsa_device_ops::rcv() 2021-08-02 15:13:15 +01:00
tag_brcm.c net: dsa: create a helper for locating EtherType DSA headers on RX 2021-08-11 14:44:58 +01:00
tag_dsa.c net: dsa: mv88e6xxx: isolate the ATU databases of standalone and bridged ports 2021-10-08 15:47:46 -07:00
tag_gswip.c net: dsa: remove the struct packet_type argument from dsa_device_ops::rcv() 2021-08-02 15:13:15 +01:00
tag_hellcreek.c net: dsa: remove the struct packet_type argument from dsa_device_ops::rcv() 2021-08-02 15:13:15 +01:00
tag_ksz.c net: dsa: remove the struct packet_type argument from dsa_device_ops::rcv() 2021-08-02 15:13:15 +01:00
tag_lan9303.c net: dsa: create a helper for locating EtherType DSA headers on TX 2021-08-11 14:44:58 +01:00
tag_mtk.c net: dsa: create a helper for locating EtherType DSA headers on TX 2021-08-11 14:44:58 +01:00
tag_ocelot_8021q.c net: dsa: tag_ocelot_8021q: break circular dependency with ocelot switch lib 2021-10-12 17:35:18 -07:00
tag_ocelot.c net: dsa: tag_ocelot: break circular dependency with ocelot switch lib driver 2021-10-12 17:35:18 -07:00
tag_qca.c net: dsa: create a helper for locating EtherType DSA headers on TX 2021-08-11 14:44:58 +01:00
tag_rtl4_a.c net: dsa: tag_rtl4_a: Fix egress tags 2021-09-01 11:48:05 +01:00
tag_sja1105.c net: dsa: move sja1110_process_meta_tstamp inside the tagging protocol driver 2021-10-12 17:33:36 -07:00
tag_trailer.c net: dsa: remove the struct packet_type argument from dsa_device_ops::rcv() 2021-08-02 15:13:15 +01:00
tag_xrs700x.c net: dsa: remove the struct packet_type argument from dsa_device_ops::rcv() 2021-08-02 15:13:15 +01:00