Messages in this thread | | | Date | Thu, 2 Nov 2023 12:04:53 +0200 | From | Vladimir Oltean <> | Subject | Re: [PATCH net v2] net: dsa: tag_rtl4_a: Bump min packet size |
| |
On Wed, Nov 01, 2023 at 09:26:50PM +0100, Linus Walleij wrote: > > [ 3.967086] realtek-smi switch: set MAC: 42:E4:F5:XX:XX:XX > > Unrelated: I have seen other DSA switches "inherit" the MAC of the > conduit interface (BRCM). I wonder if we could do that too instead > of this random MAC number. Usually the conduit interface has a > properly configured MAC.
We need to know what is the MAC address from the RTL8366RB_SMAR registers used for.
What you know about is that DSA user interfaces have their own MAC address for packet termination (send/receive to/from the CPU). MAC addresses for switch ports are an abstract concept, of course (switches normally just forward packets, nothing is addressed *to* them), and so, these addresses are not programmed per se to hardware unless the prerequisites of dsa_switch_supports_uc_filtering() are implemented. If they are, the MAC addresses of user ports are programmed as host FDB entries (FDB entries towards the CPU port).
The rule for establishing the MAC address of each user port is as follows: if of_get_mac_address() finds something valid for that port's OF node - provided by the bootloader - ("address", "mac-address", "local-mac-address", a nvmem provider etc), then that value is used. Otherwise, the MAC address is inherited from the conduit interface.
Some switches also have a global MAC address register (used for all ports) of their own, but it is switch-specific what this does. We look at the functionality it offers when deciding what to program it to, since it's of course not possible to sync a single hardware register to the value of the MAC addresses of multiple user ports.
For KSZ switches - see ksz_switch_macaddr_get() - the global MAC address register is used for HSR self-address filtering and for Wake on LAN. We sync the value of this hardware register with the MAC address of the first user port on which these optional features are enabled. Then, we allow these optional features only on the other user ports which have the same MAC address as the original one which enabled that feature. On KSZ, the same switch MAC address is also used as MAC SA in generated pause frames, but to our knowledge, that MAC address could be any address (even 00:00:00:00:00:00), so we don't really care too much about that and we let it fall to whatever value it may.
| |