we are currently developing an embedded linux based board with an integrated KSZ8775 switch. Linux Kernel: v5.15
The switch setup is the following:
Port 1: User 1
Port 2: User 2
Port 3: User 3
Port 4: External PHY - User 4
Port 5: CPU-Host Interface (Linux system)
The CPU interface is configured as RMII and for control SPI is used. I enabled the kernel drivers and added the device to my device tree. I also adjusted the ksz8795 driver to accept the ksz8775.
So far so good, on boot I get all the switch user interfaces (lan1, lan2, lan3, lan4, as named in devicetree). I then create a bridge interface and add lan1, lan2,... to it. As described here: https://www.kernel.org/doc/html/v5.15/networking/dsa/configuration.html
With this configuration the user ports can ping each other, e.g. user 2 can ping user 1 and vice versa. Unfortunately the master interface (host cpu) cannot ping any user and no user can ping the master.
When I try to ping the master from a user port, I see the ARP packets coming in and I also see that it replies. For example, here I use tcpdump to see all traffic on eth0 (connected to port 5 of switch):
root@picocoremx6ull100-de-dp-eval:~/tools# ./tcpdump -i eth0
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on eth0, link-type NULL (BSD loopback), snapshot length 262144 bytes
23:21:38.691465 AF Unknown (4294967295), length 61:
0x0000: ffff 0005 5107 5584 0806 0001 0800 0604 ....Q.U.........
0x0010: 0001 0005 5107 5584 c0a8 0214 0000 0000 ....Q.U.........
0x0020: 0000 c0a8 0201 0000 0000 0000 0000 0000 ................
0x0030: 0000 0000 0000 0000 02 .........
23:21:38.691786 AF Unknown (348423), length 61:
0x0000: 5584 46e2 4a3e 7493 0806 0001 0800 0604 U.F.J>t.........
0x0010: 0002 46e2 4a3e 7493 c0a8 0201 0005 5107 ..F.J>t.......Q.
0x0020: 5584 c0a8 0214 0000 0000 0000 0000 0000 U...............
0x0030: 0000 0000 0000 0000 04 .........
23:21:39.709613 AF Unknown (4294967295), length 61:
0x0000: ffff 0005 5107 5584 0806 0001 0800 0604 ....Q.U.........
0x0010: 0001 0005 5107 5584 c0a8 0214 0000 0000 ....Q.U.........
0x0020: 0000 c0a8 0201 0000 0000 0000 0000 0000 ................
0x0030: 0000 0000 0000 0000 02 .........
23:21:39.709862 AF Unknown (348423), length 61:
0x0000: 5584 46e2 4a3e 7493 0806 0001 0800 0604 U.F.J>t.........
0x0010: 0002 46e2 4a3e 7493 c0a8 0201 0005 5107 ..F.J>t.......Q.
0x0020: 5584 c0a8 0214 0000 0000 0000 0000 0000 U...............
0x0030: 0000 0000 0000 0000 04 .........
I see the ARP request "who has 192.168.2.1" coming from 192.168.2.20 connected to user port 3. Right after the request comes the ARP response "192.168.2.1 is at 46:e2:4a:3e:74:93".
Also the tail tagging seems to be correct. "02" for packets from switch to cpu and "04" for packets from cpu to switch. This is exactly how it is described in the kernel driver in tag_ksz.c.
Here is some additional information:
root@picocoremx6ull100-de-dp-eval:~/tools# bridge vlan show
port vlan-id
lan1 1 PVID Egress Untagged
lan2 1 PVID Egress Untagged
lan3 1 PVID Egress Untagged
br0 1 PVID Egress Untagged
root@picocoremx6ull100-de-dp-eval:~/tools# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1501 qdisc pfifo_fast state UP group default qlen 1000
link/ether 46:e2:4a:3e:74:93 brd ff:ff:ff:ff:ff:ff
inet6 fe80::44e2:4aff:fe3e:7493/64 scope link
valid_lft forever preferred_lft forever
3: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000
link/sit 0.0.0.0 brd 0.0.0.0
4: lan1@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br0 state UP group default qlen 1000
link/ether 46:e2:4a:3e:74:93 brd ff:ff:ff:ff:ff:ff
inet6 fe80::44e2:4aff:fe3e:7493/64 scope link
valid_lft forever preferred_lft forever
5: lan2@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br0 state LOWERLAYERDOWN group default qlen 1000
link/ether 46:e2:4a:3e:74:93 brd ff:ff:ff:ff:ff:ff
inet6 fe80::44e2:4aff:fe3e:7493/64 scope link
valid_lft forever preferred_lft forever
6: lan3@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br0 state LOWERLAYERDOWN group default qlen 1000
link/ether 46:e2:4a:3e:74:93 brd ff:ff:ff:ff:ff:ff
inet6 fe80::44e2:4aff:fe3e:7493/64 scope link
valid_lft forever preferred_lft forever
7: spe@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 46:e2:4a:3e:74:93 brd ff:ff:ff:ff:ff:ff
8: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 46:e2:4a:3e:74:93 brd ff:ff:ff:ff:ff:ff
inet 192.168.2.1/24 scope global br0
valid_lft forever preferred_lft forever
inet6 fe80::44e2:4aff:fe3e:7493/64 scope link
valid_lft forever preferred_lft forever
root@picocoremx6ull100-de-dp-eval:~/tools#
same tcpdump of incoming ping, but on bridge interface br0:
root@picocoremx6ull100-de-dp-eval:~/tools# ./tcpdump -i br0
device br0 entered promiscuous mode
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on br0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
23:58:05.658830 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 00:05:51:07:55:84 (oui Unknown), length 300
23:58:08.482775 ARP, Request who-has 192.168.2.1 tell 192.168.2.20, length 46
23:58:08.482877 ARP, Reply 192.168.2.1 is-at 46:e2:4a:3e:74:93 (oui Unknown), length 28
23:58:09.558810 ARP, Request who-has 192.168.2.1 tell 192.168.2.20, length 46
23:58:09.558910 ARP, Reply 192.168.2.1 is-at 46:e2:4a:3e:74:93 (oui Unknown), length 28
23:58:10.598784 ARP, Request who-has 192.168.2.1 tell 192.168.2.20, length 46
23:58:10.598886 ARP, Reply 192.168.2.1 is-at 46:e2:4a:3e:74:93 (oui Unknown), length 28
But it seems like the switch does not forward the reply outside to the user port that sent the request. Is there anything I am missing in my bridge setup? I basically want every port (user and cpu) to be able to communicate with each other. Do I need to add a seperate interface to the bridge to communicate with the user ports or should this setup work?
Unfortunately I am not that well versed when it comes to networking... Let me know if you need any more information.
I hope this is an appropriate place to ask for help on that matter.
Thank you!