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.

MAC based switching

Hello,

From the datasheet, there seems to be no MAC address register (P0_SA_LO/P0_SA_HI) for the host port (port0).

1. If I use my device in single MAC mode, how do i configure the MAC address of my device? Should it be the same MAC for ports 1 and 2? 

2. If a packet meant for my device (MAC) enters Port1, how is it transferred to Port0? Is some ALE entry required to transfer the packet to Port0?

The scenario is that my device has a single MAC address. The intention is that if any packet having my MAC as its destination MAC enters either Port1 or Port2, it should be sent to Port0.

  • Hi Jacob,

    You are correct; there is no MAC address for the host port as it is not exposed to the outside world. Typically MAC_ADRESS = IP_ADDRESS and the host port of the switch has no need for an IP address.

    1) The exposed Ethernet ports on AM335x (Port1/Port2) are programmed with a MAC address from the TI MAC address pool prior to shipping. These MAC addresses can be over-ridden if a customer wishes to use a MAC address from their own pool, but this is typically not required. There is no port affinity...in other words whichever port is first connected becomes ETH0 regardless of physical port number.

    2) Yes.  ALE processes all received packets to determine which port(s) the packet should be forwarded to (TRM 14.3.2.7). In Switch mode, the ALE will route packets in a peer-to-peer fashion (Port2 to Port1 or vice-versa) bypassing Port0 if required. In ALE_BYPASS mode, all received packets are forwarded only to the host port (Port0) for processing by the host.

  • Jacob

    If you are configuring in switch mode here are the steps to be followed

    1. 1. You can use same MAC on both the ports
    2. 2. Have two entries in ALE
    • Unicast MAC entry with Host MAC id with port 0 as member
    • Multicast entry with broadcast MAC id with all ports as member

    Also take care that both ports are not connected to the same subnet/switch which will lead to create a loop in the network and the result would be unpredictable.

    Regards
    Mugunthan V N

  • Mugunthan,

    Thanks for your response. I did the configuration you mentioned.

    Basically, I expect to ping computer 1 from computer 2 which are connected to ports 1 and 2 respectively of my AM335x board.

    PC1 is configured with a static IP (192.168.2.110) and PC2 with 192.168.2.100. As you can see, there is no loop in the network.

    Once the DUT (The TI board) comes up with an IP Address, I do the following:
    Ping DUT from PC1 -- works
    Ping PC2 from PC1 -- works
    Ping PC1 from PC2 -- works
    Ping DUT from PC2 -- Does not work

    I have enabled Leaning on all ports and all ports are in forwarding state.

    One strange thing that I see is that when PC2 tries to ping DUT, I see the broadcast ARP request on wireshark of PC1 -- correct

    DUT sends the ARP reply on the Port connected to PC1 instead of sending to PC2 -- incorrect!

    Am I missing something in the configuration? If PC1 is able to ping PC2, then learning is proper since the switch is able to route the packet correctly. Then why is the ARP reply being sent on Port 1 instead of Port2?

    Regards,

    Jacob

  • Jacob

    Can you share the ale_table entry at the time of arp request from PC2?

    Regards
    Mugunthan V N

  • Hi Mugunthan,

    I have only the following 2 entries from ALE (which I had configured statically)

    Index0:
    CPSW_ALE_TBLW2: 0x00000000
    CPSW_ALE_TBLW1: 0xD0000000
    CPSW_ALE_TBLW0: 0x5410EF01 // My local MAC Address for DUT

    Index1:
    CPSW_ALE_TBLW2: 0x0000001C
    CPSW_ALE_TBLW1: 0xD000FFFF
    CPSW_ALE_TBLW0: 0xFFFFFFFF

    All other Indexes seem to be empty which means the switch has not learnt the address?

  • Jacob

    If other entries are not learnt, please verify the ALE learn bit of the ports. Until ALE learns PC MAC id, packet forwarding will not be predictable.
    Also why not having unicast address type as 0b00 - not ageable address and same for multicast address?

    Regards
    Mugunthan V N

  • The ALE learn bit is enabled for all ports by default. I also changed the unicast address type as non-ageable.
    It still does not work.

    Regards,
    Jacob

  • Jacob

    If ALE is not learning from incoming ethernet packets, then there should be some init code missing in your init sequence. Can you take the init sequence from the following cpsw driver in linux.

    http://arago-project.org/git/projects/?p=linux-am33x.git;a=blob;f=drivers/net/ethernet/ti/cpsw.c;h=8ddb749960aa033dd39341e93fce1cf8536447be;hb=refs/heads/v3.2-staging
    http://arago-project.org/git/projects/?p=linux-am33x.git;a=blob;f=drivers/net/ethernet/ti/cpsw_ale.c;h=4ef40ddec357b53edc67642d11484795349af3bb;hb=refs/heads/v3.2-staging
    http://arago-project.org/git/projects/?p=linux-am33x.git;a=blob;f=drivers/net/ethernet/ti/cpsw_ale.h;h=4856530b25c010b56bb392b2610cd151442d217a;hb=refs/heads/v3.2-staging

    Regards
    Mugunthan V N