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.

Linux/AM5728: Dual EMAC mode questions

Part Number: AM5728
Other Parts Discussed in Thread: AM5716

Tool/software: Linux

Hello,

are there more Informations about the Dual EMAC mode than this link?

My purpose is to use 2 Ports (100 MB as eth1, 1GB Port as eth0) in a separat way, so lets say 2 different applications and no switching interactions between them.

I know that there are the reserved VLANs for dual emac, but I actually do I have to work with VLAN stuff? When I was working with the AM5716 with only a 100MB port, I didnt want to work with VLAN stuff and thats why I deactivated the VLAN aware mode, because I didnt like the way all incoming and outgoing packets were handle by adding all oder removing all VLAN tags. I just wanted to leave the packets as they are (i.e. if there is a vlan tag, leave it and if there is no vlan tag dont add one). I want to keep it that way, but could that be a problem for my purpose? Or  how does it actually work with the dual emal reserved VLAN?

&mac {
    pinctrl-names = "default";//, "sleep";
    pinctrl-0 = <&cpsw_default>;
    ...
    dual_emac;
};

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

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

How can I be sure if this is working? I really would need some more informations and examples to understand the whole concept of this.

Thank you!

  • Hi,

    The short answer is that you do not have to work with the VLAN for implementing a dual MAC configuration.

    The diagram is talking about the internals used to a create a dual mac using the cpsw switch. For the use case you are describing you do not to be concerned with VLANs and should be transparent to you other than what you are showing in the DTS snippet. The VLANs are used internal to the switch and are used to indicate to the driver which external port the packet came from or goes to.

    Your comment leaving the packets as they are, if I am following you, is correct. The VLANs are tagged in the driver on egress to indicate which port to go out, on egress from the port the VLAN tag is stripped. The process is reverse on ingress, the external port tags the packet and the driver strips it before pushing up the network stack.

    The two ports you are describing are they planned to the CPSW ports?

    If you have a AM57x class GPEVM or IDK board you can experiment with the pre-built binaries from the Linux SDK, the default is dual mac mode. You can setup two independent sub-nets and perform a ping or iperf test with a link partner such as a Linux PC that is running wireshark, these packets should not have VLAN tagging in them.

    Best Regards,
    Schuyler
  • Yes, the 2 ports are CPSW ports.

    I tried the Ping case already and its working. But how can my applications differ between these 2 ports? Do you have any examples for that case? I dont know which part of the kernel my application has to ask for the right port. Since it is transparent, how can I use this separation?

  • Hi,

    We don't have any example applications to provide, but I found this link that might help. It is a example of a connection, it is showing how to fill out structures for connecting to an ip address and how to direct traffic out of a port.

    Please note that per your point about transparency each interface eth0 and eth1 must be on unique subnets, for example eth0 could be 192.168.10.1 and eth1 would need to be other than a .10 subnet, i.e. eth1 192.168.20.1. The kernel filters by subnet when determining which interface to respond to ARP queries for example.

    I did not try the code so please treat this as un-verified.

    stackoverflow.com/.../how-to-give-to-a-client-specific-ip-address-in-c


    Best Regards,
    Schuyler