This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM335X Dual MAC问题

我现在AM335x的板子,linux内核使用4.1.18. 两个网口设置为dual mac工作模式的时候,如果将两个网口都配置在同一个网段。

比如:

# ifconfig
eth0 Link encap:Ethernet HWaddr 84:EB:18:E2:33:B4
inet addr:192.168.1.3 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:48744 errors:0 dropped:0 overruns:0 frame:0
TX packets:376 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3142331 (2.9 MiB) TX bytes:28928 (28.2 KiB)
Interrupt:177

eth1 Link encap:Ethernet HWaddr 84:EB:18:E2:33:B6
inet addr:192.168.1.5 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::86eb:18ff:fee2:33b6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:36 errors:0 dropped:0 overruns:0 frame:0
TX packets:50 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2580 (2.5 KiB) TX bytes:3728 (3.6 KiB)

板子上只连一个网口,另外一个网口不插网线,同一个子网内的PC机(IP:192.168.1.2)却可以ping通板上两个IP地址。

这个现象是什么原因呢?

* 板子和PC连在一个独立的交换机上,不存在IP地址重复的情况。

*内核启动的时候有一段提示:

[ 1.234348] davinci_mdio 4a101000.mdio: phy[4]: device 4a101000.mdio:04, driver A theros 8035 ethernet
[ 1.244052] davinci_mdio 4a101000.mdio: phy[6]: device 4a101000.mdio:06, driver A theros 8035 ethernet
[ 1.254385] cpsw 4a100000.ethernet: Missing dual_emac_res_vlan in DT.
[ 1.261285] cpsw 4a100000.ethernet: Using 1 as Reserved VLAN for 0 slave
[ 1.268457] cpsw 4a100000.ethernet: Missing dual_emac_res_vlan in DT.
[ 1.275184] cpsw 4a100000.ethernet: Using 2 as Reserved VLAN for 1 slave
[ 1.282249] cpsw 4a100000.ethernet: Detected MACID = 84:eb:18:e2:33:b4
[ 1.289946] cpsw 4a100000.ethernet: cpsw: Detected MACID = 84:eb:18:e2:33:b6

*设备树如下:

&mac {
slaves = <2>;
pinctrl-names = "default", "sleep";
pinctrl-0 = <&cpsw_default>;
pinctrl-1 = <&cpsw_sleep>;
dual_emac = <1>;
// active_slave = <1>;
status = "okay";
};

&davinci_mdio {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&davinci_mdio_default>;
pinctrl-1 = <&davinci_mdio_sleep>;
status = "okay";
};

&cpsw_emac0 {
phy_id = <&davinci_mdio>, <4>;
phy-mode = "rgmii-txid";
// dual_emac_res_vlan=<0>;
};

&cpsw_emac1 {
phy_id = <&davinci_mdio>, <6>;
phy-mode = "rgmii-txid";
// dual_emac_res_vlan=<1>;
};