Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH net 0/4] Fix broken backpressure during FDB dump in DSA drivers
@ 2021-08-10 11:19 Vladimir Oltean
  2021-08-10 11:19 ` [PATCH net 1/4] net: dsa: hellcreek: fix broken backpressure in .port_fdb_dump Vladimir Oltean
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Vladimir Oltean @ 2021-08-10 11:19 UTC (permalink / raw)
  To: netdev, Jakub Kicinski, David S. Miller
  Cc: Florian Fainelli, Andrew Lunn, Vivien Didelot, Vladimir Oltean,
	Kurt Kanzenbach, Hauke Mehrtens, Egil Hjelmeland

rtnl_fdb_dump() has logic to split a dump of PF_BRIDGE neighbors into
multiple netlink skbs if the buffer provided by user space is too small
(one buffer will typically handle a few hundred FDB entries).

When the current buffer becomes full, nlmsg_put() in
dsa_slave_port_fdb_do_dump() returns -EMSGSIZE and DSA saves the index
of the last dumped FDB entry, returns to rtnl_fdb_dump() up to that
point, and then the dump resumes on the same port with a new skb, and
FDB entries up to the saved index are simply skipped.

Since dsa_slave_port_fdb_do_dump() is pointed to by the "cb" passed to
drivers, then drivers must check for the -EMSGSIZE error code returned
by it. Otherwise, when a netlink skb becomes full, DSA will no longer
save newly dumped FDB entries to it, but the driver will continue
dumping. So FDB entries will be missing from the dump.

DSA is one of the few switchdev drivers that have an .ndo_fdb_dump
implementation, because of the assumption that the hardware and software
FDBs cannot be efficiently kept in sync via SWITCHDEV_FDB_ADD_TO_BRIDGE.
Other drivers with a home-cooked .ndo_fdb_dump implementation are
ocelot and dpaa2-switch. These appear to do the correct thing, as do the
other DSA drivers, so nothing else appears to need fixing.

Vladimir Oltean (4):
  net: dsa: hellcreek: fix broken backpressure in .port_fdb_dump
  net: dsa: lan9303: fix broken backpressure in .port_fdb_dump
  net: dsa: lantiq: fix broken backpressure in .port_fdb_dump
  net: dsa: sja1105: fix broken backpressure in .port_fdb_dump

 drivers/net/dsa/hirschmann/hellcreek.c |  7 ++++--
 drivers/net/dsa/lan9303-core.c         | 34 ++++++++++++++------------
 drivers/net/dsa/lantiq_gswip.c         | 14 ++++++++---
 drivers/net/dsa/sja1105/sja1105_main.c |  4 ++-
 4 files changed, 37 insertions(+), 22 deletions(-)

-- 
2.25.1


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

end of thread, other threads:[~2021-08-10 12:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-10 11:19 [PATCH net 0/4] Fix broken backpressure during FDB dump in DSA drivers Vladimir Oltean
2021-08-10 11:19 ` [PATCH net 1/4] net: dsa: hellcreek: fix broken backpressure in .port_fdb_dump Vladimir Oltean
2021-08-10 11:39   ` Kurt Kanzenbach
2021-08-10 11:19 ` [PATCH net 2/4] net: dsa: lan9303: " Vladimir Oltean
2021-08-10 11:19 ` [PATCH net 3/4] net: dsa: lantiq: " Vladimir Oltean
2021-08-10 11:19 ` [PATCH net 4/4] net: dsa: sja1105: " Vladimir Oltean
2021-08-10 12:20 ` [PATCH net 0/4] Fix broken backpressure during FDB dump in DSA drivers patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).