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.

TDA4VM: Conflict about CPSW Mirrorring enable & GMII disable

Part Number: TDA4VM

Tool/software:

TDA4VM: SDK8.4

Hi,Ti,

We are planning to use the port mirroring feature of cpsw9g. But since there are no examples, I can only try to configure the feature using the Enet_ioctl (CPSW_ALE_IOCTL_SRT_PORT_MIRROR_CFG) reserved by the SDK. We were pleasantly surprised to find that port mirroring feature can be achieved.

However, we still encountered a problem: when the receiving macport of the image is linkdown (or if there are no devices receiving the traffic), TDA4 will soon be unable to send out packets through any mac_port port (≈ 3s). If we connect the collecting device  cable properly at this point, not only can the collection device receive the mirrored traffic, but the network functions of other macports of TDA4 will also immediately return to normal. Then if we disconnect the collecting device cable this time, the network function of TDA4 will be abnormal again. It has strong real-time performance...

Here is our network topology:

We want to mirror the traffic “”entering mac_port 3 + entering  mac_port 6 + emitted by mac_port 6 ” to mac_port 5. So my mirror config is:

CpswAle_PortMirroringCfg portMirrorInArgs;
portMirrorInArgs.matchEn        = false;
portMirrorInArgs.toPortNum      = Macport5;

portMirrorInArgs.srcEn          = true;
portMirrorInArgs.srcPortNumMask = Macport3Mask|Macport6Mask

portMirrorInArgs.dstEnEn        = true;
portMirrorInArgs.dstPortNum     = Macport6;
Enet_ioctl(hEnet,coreId,CPSW_ALE_IOCTL_SRT_PORT_MIRROR_CFG, portMirrorInArgs);

After powering on,if the collecting device is link up, then device(192.168.3.71) can ping A72 success; If the collecting device is link down, then device(192.168.3.71) whil ping A72 failed. 

When collecting statistical data of cpsw, I found that the three arp requests I sent  directly caused the param "rx_top_of_fifo_drop" of Macport3  increase by three. But at the same time on A72, i get all the three arp requests by tcpdump, but i dont get any arp response by tcpdump, which was very strange.

Furthermore, since the link up/down status of mac_port5&phy will affect the network performance when the MIrroring is turn on, I have examined which registers will be changed by phy link down. Finally I found that the GMII_EN (bit5) of the register CPSW_PN_MAC_CONTROL_REG_k played a decisive role.

In the above Mirroring enabled situation, if the collecting device is link up, the register CPSW_PN_MAC_CONTROL_REG_k will  be set to 0x000200A1 by driver, then if i write it to 0x00020081 manually , the fault will occur.

On the contrary, even if the collecting device is link down. As long as I configure the register to  GMII_EN Enable, the network will be restored.

So maybe you can explain this phenomenon.

Since GMII_EN is control by driver, it reflects the connection status of GMII, we'd better not proactively modify it.  But in the case of GMII disabled, Mirroring  will cause malfunctions, so should we have to open/close MIrroring when macport5 got_link or lost_link?

Best Regards.

  • Hi,

    Please refer to FAQ for enabling of Port Mirroring options.

    Best Regards.
    Sudheer

  • "If some one want to enable both Source port mirroring and Destination port mirroring, have to enable configuration of both destination and source port mirroring for both Ingress and Egress mirroring of one port to other Port.

    I'm sorry for that I don't quite understand what useful information can be obtained from the FAQ you provided. I think I have configured 'Destination port mirroring' and 'Source port mirroring' in the correct way (see the pseudocode I provided for details). What confuses me now is the conflicting relationship  between MIrroring and GMII_EN  (bit5) that I described above.

  • Hi,

    GMII_EN  (bit5) that I described above.

    GMII_EN is to enable Gigabit MII interface, it should be set for all Gigabit interface mode.

    If you make GMII_EN as 0, then Tx & Rx will not happen.

    The configuration of IOCTL request as below, as toport is common for port mirroring need to enable both in same request.”

    Yes.

    what useful information can be obtained from the FAQ you provided. I think I have configured 'Destination port mirroring' and 'Source port mirroring' in the correct way (see the pseudocode I provided for details).

    I have pointed to make sure your port mirroring same as in FAQ.

    Best Regards,
    Sudheer

  • Thanks,

    but this is cpsw.c of pdk0900. We can see that GMII_EN will be set 0 when PHY lose link...   

    if our MIrroring is still on  this time....TDA4 will not be able to communicate with the outside world. 

    if the quality of the network depends on an unstable PHY connector. Isn't this a bit too dangerous?

    i mean. just the phy link for macport5 (mirror toport) has gone down, but all other cpsw macports are unable to send messages externally,
    It's a bit too excessive......

  • Hi,

    We can see that GMII_EN will be set 0 when PHY lose link...   

    If Link is Down, It supposed to stop the port and keep port in blocked state. so, data will not flood to that port for Tx.

    i mean. just the phy link for macport5 (mirror toport) has gone down, but all other cpsw macports are unable to send messages externally,
    It's a bit excessive......

    GMII_EN is per port specific, Whichever the Port is Link down only that particular port will be disabled.



    Best Regards,
    Sudheer

  • GMII_EN is per port specific, Whichever the Port is Link down only that particular port will be disabled.

    In generaly, this does not affect other ports. But if the 'particular port' is  (mirror toport),you will see network failures for all ports....

  • Hi,

    In generaly, this does not affect other ports. But if the 'particular port' is  (mirror toport),you will see network failures for all ports....

    If it is a mirror Port then switch may decide to drop any mirror traffic based on switch buffer thresholds as to prevent required traffic from becoming congested.

    So, it may not affect other ports.

    Best Regards.
    Sudheer

  • If it is a mirror Port then switch may decide to drop any mirror traffic based on switch buffer thresholds as to prevent required traffic from becoming congested.

    yeah,how can I config that~

  • Hi,

    yeah,how can I config that~

    There is no configuration for that.
    It was mentioned in TRM. Please refer to below from TRM.


    Best Regards,
    Sudheer

  • Thank you for your patient answer.Then i decide to close Mirroring when toPort is GMII_En is disable.

  • Hi,

    Thank you for your patient answer.Then i decide to close Mirroring when toPort is GMII_En is disable.

    Sure.

    Best Regards,
    Sudheer

  • Hi,

    Now we are thinking about  using the “table entry mirroring”. But I found that currently it seems that this feature can only support mirroring for one table entry. (Because i can only fill one entry idex in MIRROR_MIDX(bit 9:0)  of CPSW_ALE_CTRL2 at one time) ,which a little insufficient, for I want to mirror the messages about two table entries at the same time,
    Do you have any suggestions?

  • By the way. I also tried configuring IPV4 Mirror.  My goal is to mirror the pkgs related to 192.168.3.121. (to macport5)

    Then i config it,  here is the register value:

        devmem2 0x0c03e008(CPSW_ALE_CONTROL  ) = 0x800510C4  ( means:MIRROR_MEN=1; MIRROR_DEN=0; MIRROR_SEN=0; MIRROR_TOP=5 ; ENABLE_BYPASS=0)

        devmem2 0x0c03e00c( CPSW_ALE_CTRL2 ) = 0x0010001B    (means:DEFLMTNXTHDR =1; MIRROR_MIDX=27)

    and the Ale Entry is 

       "27: IPv4: Address: 192:168:03:121, IGNBITS:0
              RAW:[1 a00000#015
             00 c0a80379] #015"

    But then when i run the program, it seems useless;

    I think my configuration is fine,so is the functionality of IPv4 based mirroring effective? Will this feature not work?

    Best Regards.

      

  • Hi,

    Now we are thinking about  using the “table entry mirroring”. But I found that currently it seems that this feature can only support mirroring for one table entry. (Because i can only fill one entry idex in MIRROR_MIDX(bit 9:0)  of CPSW_ALE_CTRL2 at one time) ,which a little insufficient, for I want to mirror the messages about two table entries at the same time,

    Only entry is supported for mirror.

    But then when i run the program, it seems useless;

    I think my configuration is fine,so is the functionality of IPv4 based mirroring effective? Will this feature not work?

    No. Mirroring of ALE Index related to VLAN or OUI or MAC address with or without can only be selected.



    Best Regards,
    Sudheer

  • Only entry is supported for mirror.

    you mean, only one entry is supported for mirror?    Isn't it possible to set multiple entries at the same time like Policer?It seems that my requirement for two mac mirror in the mirror cannot be met....

  • Hi,

    you mean, only one entry is supported for mirror?    Isn't it possible to set multiple entries at the same time like Policer?

    Yes, only one entry is supported for mirroring.

    t seems that my requirement for two mac mirror in the mirror cannot be met....

    Yes, two entries can't be made.

    If you want to mirror Multicast MAC with two MAC's if they are differ by 1 bit (i.e. LSB bit differ) then you can add ALE entry with Ignore bits and Ignore bit value is 1 i.e. 0th bit in MAC will ignore for match.

    Ex: 10:11:12:13:14:15, 10:11:12:13:14:14 these MAC differ by 1 bit if we ALE entry with Ignore bits 1 then both MAC will be accepted. 

    Note:
    If you enable ignore bit with higher values there will be possibility that multiple MAC address will be accepted.


    For more details please refer to TRM.


    Best Regards,
    Sudheer