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.

AM1808: Enet Multicast packets are received even though MACHASHx are zero

Part Number: AM1808
Other Parts Discussed in Thread: OMAP-L138

Hi,

a customer has an issue with the AM1808 EMAC where it receives a multicast packet, even though the MACHASH1 and 2 are zeroed out:

We have found that if our test PC transmits an Ethernet frame destined to MAC address 01:80:c2:00:00:01 (note this is a multicast address) then the EMAC will generate a receive interrupt for this frame. This is happening even though the MACHASH1 and MACHASH2 registers are both set to zero. See attached am1808_emac_machash_eq_0_receive.pcapng for a capture of the frame that we are transmitting from the test PC.


We configure the EMAC to receive unicast traffic on channel 0 by setting bit 0 of RXUNICASTSET. We configure channel 1 to receive multicast traffic by setting RXMULTEN to '1' and RXMULTCH to '001' in RXMBPENABLE. We enable interrupts for receiving multicast traffic by setting bit 1 of C1RXEN. Although we enabled multicast receive on channel 1 and although we enabled the receive interrupt on channel 1, we do not expect any interrupts to be generated because the MACHASH1 and MACHASH2 registers are both set to zero.

Can you help us understand why the multicast frame in the attached Wireshark capture is generating a receive interrupt in the EMAC despite the MACHASH registers being set to zero? Are there other variations of Ethernet frames that can be received as 'multicast' despite the MACHASH registers being set to zero? Are there other fields besides the destination MAC address field in the Ethernet frame that can affect whether or not the frame is received by the EMAC?

6507.am1808_emac_machash_eq_0_receive.7z

Thanks,

--Gunter

  • Hi Gunter,

    I've forwarded this to the EMAC experts. Their feedback should be posted here.

    BR
    Tsvetolin Shulev
  • All,

    we have not seen any responses to our questions. Has an expert looked at this problem with the EMAC?

    Thanks,

    --Gunter

  • There are three ways the specified address could be received<BR>

    Setting the Copy-All-Frames (CAF) bit <BR>

    Setting the Copy-All-Mac-Frames (CAM) bit<BR>

    Setting a hash bit.

  • Gunter
    In addition to the clarifications provided above by the Ip team, here are some more debug suggestions

    1. Clear all statistics registers (either IP reset or manually write-clear)
    2. Reproduce the erroneous multicast receive with as little Ethernet activity as possible
    3. Dump all statistics and configuration registers

    The statics should provide a lot of clues as to how the IP interpreted the packets. The configuration registers should confirm root cause (assuming it’s a software configuration error rather than IP hardware error).
  • Thanks, Mukul.

    We are going to clear/reproduce issue/dump all Network Statistics Registers between offset 0x200 and 0x28C, and get back to you as soon as possible.

    Please let us know if any additional registers should be dumped.

    Thanks,

    --Gunter

  • See attached zero_machash_multicast_rx_stat_regs.xlsx for a dump of the EMAC registers.

    I used the following steps to collect the register data:

    1. Download code to target, halting at main()
    2. Set a breakpoint in the EMAC init logic immediately prior to writing '1' to the C1RXEN bit corresponding to the channel that is configured to receive multicast traffic (channel 2)
    3. Set a breakpoint in the receive ISR for the channel that is configured to receive multicast traffic
    4. Run target run (still halted at main)
    5. When the breakpoint in #2 is reached, run the target and immediately issue the offending multicast traffic from my PC

    In #5 I use scapy to send the multicast traffic from my PC:

    sendp(Dot3(dst='01:80:c2:00:00:01', src='ff:ff:ff:ff:ff:ff', len=3)/LLC(dsap=0, ssap=1, ctrl=2)/Padding('\x00'*43), iface=IFACES.dev_from_index(6))

    I unplugged the Ethernet cable from the device and I captured the register information from the debugger 'Registers' window when the device halts at the breakpoint in the receive ISR (#3). See attached zero_machash_multicast_rx_stat_regs.xlsx.

    I can see in RXMBPENABLE that RXCMFEN and RXCAFEN are zero and I also see the MACHASH registers are zero, so the multicast message should not have been received by the EMAC.

  • The CPGMAC you have contains a type 2 Address mapping table.<BR>

    That is, there is a 32 entry table of addresses that can contain any address. Can you dump this table as well?<BR><BR>

    2.3.1.2 TYPE 2 Address Matching and Filtering Logic<BR>

    The second type of address matching logic contains a 32 by 53-bit two-port ram and provides the

    capability to perform address matching and address filtering based on the incoming packet’s destination

    address. The ram contains 32 address locations that each contain a single 48-bit receive address plus

    valid, channel, and match/filter bits. The host must initialize all ram locations (including locations to be

    unused) at system startup and the host is responsible for adding and removing addresses from the ram.

    The 53-bits of each address location are written with three consecutive 32-bit VBUS accesses. The host

    must write the index into the ram in the MacIndex(4:0) register, followed by the upper 32-bits of address

    (which are stored in a holding register), followed by the lower 16-bits of address (with control bits). The

    53-bit indexed ram location is written when the low location is written.<BR><BR>

    Multicast packet addresses may be contained in the ram, but the associated channel must have the

    unicast enable bit set (even though it is a multicast address). The unicast enables and not the multicast

    hash enable bit are used with multicast addresses in the ram. Therefore, hash matches can be disabled

    and yet specific multicast addresses can be matched (or filtered) in the ram. If a multicast packet hash

    matches, the packet may still be filtered in the ram. Each packet can be sent to only a single channel.

  • Dennis

    Thanks for the detailed reply. Here is our code that initializes the MAC addresses:

      get_mac_address(mac_address);
    
      EMAC->MACINDEX = 0;
    
      EMAC->MACADDRHI = (*(UINT32 *)mac_address);
    
      EMAC->MACADDRLO = (*(UINT16 *)&mac_address[4]) | MACADDRLO_VALID | MACADDRLO_MATCHFILT;
    
      for(i = 1; i < 8; i++)
    
      {
    
         EMAC->MACINDEX = i;
    
         EMAC->MACADDRLO = *((UINT16 *)&mac_address[4]);
    
      }

    You mentioned that there are 32 addresses to configure, but EMAC documentation (sprufu9a) says there are only 8. Also, the documentation only mentions bits 2:0 of MACINDEX.  

    I tried revising the code to initialize indexes 1-31 to zero, but I still see an interrupt for the same multicast frame despite the MACHASH registers being set to zero.

  • Which spec are you refering too?
    Your code seem to be configured for Type 1 addresses, but the device register dump indicates a type 2 addresses supported.
  • Denis
    the EMAC userguide for the family is
    http://www.ti.com/lit/ug/spruh82c/spruh82c.pdf

  • Hi Denis,

    is there a discrepancy in the spec you are looking at vs the spec Gabriel is using, which is the UG Mukul mentions above?

    Can you comment on the difference of MACINDEX where you say there are 32 addresses, while the UG shows only 8 addresses?

    Thanks,
    --Gunter
  • Gabriel,

    Please try using a different multicast address. The one you are currently using is reserved for bridges.

  • Gunter
    Let me see if i am able to sort the internal design spec vs TRM discrepancy, that might be outside Denis's domain.
    Another suggestion from Denis is to try another multicast address as the one that is currently being used seemed to be reserved for bridges.

  • -DK-,

    In response to:

    -DK- said:

    Gabriel,

    Please try using a different multicast address. The one you are currently using is reserved for bridges.

    We don't have any control over the data that is present on the network. If another device transmits to the given MAC address (01:80:c2:00:00:01) then the EMAC will receive the frame despite the MACHASH registers being set to zero. We are seeking answers to the following questions:

    1. Why does the EMAC receive multicast traffic while the MACHASH registers are zero?
    2. Are there other cases where the EMAC will receive frames? (besides broadcast traffic and besides unicast traffic destined to the MAC address configured in the EMAC and besides multicast traffic that matches a hash set in the MACHASH registers)

  • Hi Gabriel,

    the team is looking into the details. There is a need for the following information:

    [] Can you confirm the value of the register RXMBPENABLE? We would need you to confirm the value of the RXCMFEN bit as well as the other bits including RXCAFEN.

    [] Could you send the buffer descriptor words (all four 32-bit words) that came with the undesired multicast packet?

    Thanks,

    --Gunter

  • Gunter

    RXMBPENABLE is 0x10002022.

    The four buffer descriptor words are (in order):

    0x01E20610

    0xC1558020

    0x0000003C

    0xC000003C

    The undesired multicast packet is the only packet that was received by the EMAC channel since boot.

  • To expand on my previous answers:

    Although the September 2016 revision of the OMAP-L138 TRM (spruh77c) as well as the September 2016 revision of the AM1808 TRM (spruh82.c) say that the MACINDEX bit field of the MACINDEX register is 2:0, I observed the following behavior when writing to the MACINDEX register:

    Value written Value read
    0x07 0x07
    0x0F 0x0F
    0x1F 0x1F
    0x3F 0x1F

    Therefore the MACINDEX bit field appears to be 4:0 rather than 2:0.

  • Hmm, this matches what I had mentioned back on Aug-18. The table of addresses is 32 entries long.

    Can we dump the address table to see what is in there?

  • Dennis

    Below is a dump of the table. I created this dump by setting the MACINDEX register, then reading the MACADDRLO and MACADDRHI registers. The MACADDRHI register should not be affected by the MACINDEX register, but I see that its value changes for MACINDEX 8-31, which makes me wonder if the TRM was correct about the MACINDEX being 2:0

    Index MACADDRLO MACADDRHI
    0 0x0018ED51 0x12A73000
    1 0x0000ED51 0x12A73000
    2 0x0000ED51 0x12A73000
    3 0x0000ED51 0x12A73000
    4 0x0000ED51 0x12A73000
    5 0x0000ED51 0x12A73000
    6 0x0000ED51 0x12A73000
    7 0x0000ED51 0x12A73000
    8 0x001F1B73 0xB0A4C70F
    9 0x0019B14C 0x6B6F821B
    10 0x00108A6B 0x479443E8
    11 0x001A638F 0x4B20891C
    12 0x0002B454 0x051D2AC9
    13 0x00011100 0x40BD8C9B
    14 0x00077310 0xE6C284E1
    15 0x00015FB1 0x151D98AE
    16 0x001F2918 0xDA4B989E
    17 0x000FBD1A 0x055DC1A6
    18 0x0010FFC2 0x73347247
    19 0x0009B573 0x62F58F1A
    20 0x001D219C 0x62C4224F
    21 0x000430AA 0xBB52993C
    22 0x0004BD0E 0xC9307D9F
    23 0x001EA853 0x09B1CEF8
    24 0x001B0820 0x90B75F0E
    25 0x000E29D2 0x1AB7CE36
    26 0x001004AB 0x62064A64
    27 0x0018C2B5 0xF11C968F
    28 0x001CA7EC 0xD1572359
    29 0x00174244 0x00870960
    30 0x000B9BF1 0x265EB063
    31 0x000BB053 0x57206BBD

  • Hi Gabriel,

    assuming there are 32 addresses, can you now write all 32 addresses with the following writing rule (Type2 rule)

    The 53-bits of each address location are written with three consecutive 32-bit VBUS accesses.  The host must write the index into the ram in the MacIndex(4:0) register, followed by the upper 32-bits of address (which are stored in a holding register), followed by the lower 16-bits of address (with control bits).  The 53-bit indexed ram location is written when the low location is written.

    So writing of each of the 32 MAC addresses has these steps

    [] Write the MACINDEX

    [] Write the 32bit high part of the MAC address into MACADDRHI

    [] Write the 16bit low part of MAC address and control bits into MACADDRLO

    For Type2 addresses, there is NO sharing of the MACADDRHI, so they can be unique.

    Then if you could retest again, that would be great.

    Regards,

    --Gunter

  • Gunter

    I think we've found the problem. If I set both MACADDRHI and MACADDRLO for all 32 indexes (instead of 8) using the Type2 rule then I no longer receive unwanted multicast traffic. Since the EMAC documentation incorrectly described the MACINDEX behavior, when can we expect to see a corrected copy of the EMAC documentation?

    Thanks for all of the help and persistence,

    Gabriel