Messages in this thread | | | From | DENG Qingfang <> | Date | Tue, 2 Mar 2021 13:51:42 +0800 | Subject | dsa_master_find_slave()'s time complexity and potential performance hit |
| |
Since commit 7b9a2f4bac68 ("net: dsa: use ports list to find slave"), dsa_master_find_slave() has been iterating over a linked list instead of accessing arrays, making its time complexity O(n). The said function is called frequently in DSA RX path, so it may cause a performance hit, especially for switches that have many ports (20+) such as RTL8380/8390/9300 (There is a downstream DSA driver for it, see https://github.com/openwrt/openwrt/tree/openwrt-21.02/target/linux/realtek/files-5.4/drivers/net/dsa/rtl83xx). I don't have one of those switches, so I can't test if the performance impact is huge or not.
| |