linux/net/dsa
Vladimir Oltean 88faba20e2 net: dsa: targeted MTU notifiers should only match on one port
dsa_slave_change_mtu() calls dsa_port_mtu_change() twice:
- it sends a cross-chip notifier with the MTU of the CPU port which is
  used to update the DSA links.
- it sends one targeted MTU notifier which is supposed to only match the
  user port on which we are changing the MTU. The "propagate_upstream"
  variable is used here to bypass the cross-chip notifier system from
  switch.c

But due to a mistake, the second, targeted notifier matches not only on
the user port, but also on the DSA link which is a member of the same
switch, if that exists.

And because the DSA links of the entire dst were programmed in a
previous round to the largest_mtu via a "propagate_upstream == true"
notification, then the dsa_port_mtu_change(propagate_upstream == false)
call that is immediately upcoming will break the MTU on the one DSA link
which is chip-wise local to the dp whose MTU is changing right now.

Example given this daisy chain topology:

   sw0p0     sw0p1     sw0p2     sw0p3     sw0p4
[  cpu  ] [  user ] [  user ] [  dsa  ] [  user ]
[   x   ] [       ] [       ] [   x   ] [       ]
                                  |
                                  +---------+
                                            |
   sw1p0     sw1p1     sw1p2     sw1p3     sw1p4
[  user ] [  user ] [  user ] [  dsa  ] [  dsa  ]
[       ] [       ] [       ] [       ] [   x   ]

ip link set sw0p1 mtu 9000
ip link set sw1p1 mtu 9000 # at this stage, sw0p1 and sw1p1 can talk
                           # to one another using jumbo frames
ip link set sw0p2 mtu 1500 # this programs the sw0p3 DSA link first to
                           # the largest_mtu of 9000, then reprograms it to
                           # 1500 with the "propagate_upstream == false"
                           # notifier, breaking communication between
                           # sw0p1 and sw1p1

To escape from this situation, make the targeted match really match on a
single port - the user port, and rename the "propagate_upstream"
variable to "targeted_match" to clarify the intention and avoid future
issues.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-06-21 12:50:20 -07:00
..
dsa2.c net: dsa: export the dsa_port_is_{user,cpu,dsa} helpers 2021-06-21 12:50:20 -07:00
dsa_priv.h net: dsa: targeted MTU notifiers should only match on one port 2021-06-21 12:50:20 -07:00
dsa.c net: dsa: allow changing the tag protocol via the "tagging" device attribute 2021-01-29 21:24:39 -08:00
Kconfig net: selftest: fix build issue if INET is disabled 2021-04-28 14:06:45 -07:00
Makefile net: dsa: add a second tagger for Ocelot switches based on tag_8021q 2021-01-29 21:25:27 -08:00
master.c net: dsa: generalize overhead for taggers that use both headers and trailers 2021-06-11 12:45:38 -07:00
port.c net: dsa: targeted MTU notifiers should only match on one port 2021-06-21 12:50:20 -07:00
slave.c net: dsa: targeted MTU notifiers should only match on one port 2021-06-21 12:50:20 -07:00
switch.c net: dsa: targeted MTU notifiers should only match on one port 2021-06-21 12:50:20 -07:00
tag_8021q.c net: dsa: tag_8021q: refactor RX VLAN parsing into a dedicated function 2021-06-11 12:45:38 -07:00
tag_ar9331.c net: dsa: generalize overhead for taggers that use both headers and trailers 2021-06-11 12:45:38 -07:00
tag_brcm.c net: dsa: generalize overhead for taggers that use both headers and trailers 2021-06-11 12:45:38 -07:00
tag_dsa.c net: dsa: generalize overhead for taggers that use both headers and trailers 2021-06-11 12:45:38 -07:00
tag_gswip.c net: dsa: generalize overhead for taggers that use both headers and trailers 2021-06-11 12:45:38 -07:00
tag_hellcreek.c net: dsa: generalize overhead for taggers that use both headers and trailers 2021-06-11 12:45:38 -07:00
tag_ksz.c net: dsa: generalize overhead for taggers that use both headers and trailers 2021-06-11 12:45:38 -07:00
tag_lan9303.c net: dsa: generalize overhead for taggers that use both headers and trailers 2021-06-11 12:45:38 -07:00
tag_mtk.c net: dsa: generalize overhead for taggers that use both headers and trailers 2021-06-11 12:45:38 -07:00
tag_ocelot_8021q.c net: dsa: tag_8021q: refactor RX VLAN parsing into a dedicated function 2021-06-11 12:45:38 -07:00
tag_ocelot.c net: dsa: generalize overhead for taggers that use both headers and trailers 2021-06-11 12:45:38 -07:00
tag_qca.c net: dsa: generalize overhead for taggers that use both headers and trailers 2021-06-11 12:45:38 -07:00
tag_rtl4_a.c net: dsa: generalize overhead for taggers that use both headers and trailers 2021-06-11 12:45:38 -07:00
tag_sja1105.c net: dsa: sja1105: implement TX timestamping for SJA1110 2021-06-11 12:45:38 -07:00
tag_trailer.c net: dsa: generalize overhead for taggers that use both headers and trailers 2021-06-11 12:45:38 -07:00
tag_xrs700x.c net: dsa: generalize overhead for taggers that use both headers and trailers 2021-06-11 12:45:38 -07:00