I'm conducting Electromagnetic Interference (EMI) testing on Ethernet setups running Windows and Linux. My primary objective is to identify specific system components affected by interference and develop a method for ongoing monitoring. I've identified three primary types of failures:

  1. Corrupted Ethernet Frames: Interference corrupts Ethernet frames, causing the hardware to discard them. This isn't directly observable, but effects are indirectly visible in Wireshark through missing ACK flags and TCP retransmissions.

  2. Link Pulse Errors: In addition to corrupting ethernet frames, the interference distorts link pulses, leading to a loss of Ethernet link. This is replicable by short-circuiting an RX/TX pair, resulting in a complete halt in communication. Wireshark shows no TCP retransmissions, and the only indication is the loss of Ethernet-dependent functionality in applications.

  3. Ethernet Adapter Failure: The Ethernet adapter IC becomes non-responsive due to interference. This suggests that the adapter itself is susceptible and stops communicating with the host system. This causes wireshark to show error pop-up window and stop recording.

The motivation is that I want to be able to identify the weakest part of the system. For instance, if Ethernet frames are corrupted but the link remains active, it might not be a device issue. Conversely, if the Ethernet adapter ceases communication with the host, it suggests the need for improved EMI immunity in the device. Therefore, I have two key questions:

  • Is my categorization of potential issues reasonable? Are there any additional categories or nuances that I might be overlooking?

  • How could I write a script to monitor the status of the Ethernet link and adapter? The problem is that I do not know how to get their statuses programmatically. I prefer python but everything goes.

For reference, Monitoring system components affected by interference in EMI testing of wired ethernet is the question which was first asked on the Network Engineering site but was closed as off topic for that site.

  • \$\begingroup\$ FYI, this might be more on-topic at Super User or Stack Exchange. \$\endgroup\$ Commented Dec 3, 2023 at 16:16
  • \$\begingroup\$ Yeah I was contemplating on where to put this for a while. My first try was network engineering stack exchange but they refused it since programming questions are not allowed. Then again the way stack exchange forces you to format your questions makes it feel like it is intended just for bugs. I guess this doesn't really fit anywhere since so many disciplines are involved. \$\endgroup\$
    – Trafi
    Commented Dec 3, 2023 at 17:35
  • \$\begingroup\$ The question contains The Ethernet adapter (ASIC/IC). Is that a custom design, or an off the shelf part? \$\endgroup\$ Commented Dec 3, 2023 at 18:16
  • \$\begingroup\$ No custom parts. It was silly of me to use the term ASIC where IC would have sufficed. I have now edited it. \$\endgroup\$
    – Trafi
    Commented Dec 3, 2023 at 19:57
  • \$\begingroup\$ What Ethernet uses Link Pulses? Are you using 10 Mbps? Coax, AUI or TP? Anything faster than that does not use link pulses after link is detected up and autonegotiated what parameters to use. As there's dozens of things called Ethernet, you might want to specify which of them you mean. How do you inject EMI? \$\endgroup\$
    – Justme
    Commented Dec 3, 2023 at 19:59

1 Answer 1


The following is a partial answer to your question, around collecting diagnostics.

How could I write a script to monitor the status of the Ethernet link and adapter?

Under Linux the ethtool command line program can be used to get the state for a network Interface, which in the following examples is eno1:

  1. Check that the physical link is up and get it's speed and duplex:
    $ ethtool eno1 | egrep "(Speed|Duplex)"
    netlink error: Operation not permitted
        Speed: 1000Mb/s
        Duplex: Full
    The above may detect Link Pulse Errors leading to the loss of the Ethernet link.
  2. Obtain the list of statistics counters for a network interface. The names of the counters can vary between adapters, but in this example searched for counters with errors in their name:
     $ ethtool -S eno1 | grep errors
          rx_errors: 0
          tx_errors: 0
          rx_length_errors: 0
          rx_over_errors: 0
          rx_crc_errors: 0
          rx_frame_errors: 0
          rx_missed_errors: 0
          tx_aborted_errors: 0
          tx_carrier_errors: 0
          tx_fifo_errors: 0
          tx_heartbeat_errors: 0
          tx_window_errors: 0
          rx_long_length_errors: 0
          rx_short_length_errors: 0
          rx_align_errors: 0
          rx_csum_offload_errors: 0
          uncorr_ecc_errors: 0
          corr_ecc_errors: 0
    The above could detect Corrupted Ethernet Frames by an incrementing count of CRC errors.

The problem is that I do not know how to get their statuses programmatically.

The above was using the ethtool command line program, which you could potentially run under python and parse the textual output. In C udp_broadcast.c is an example where I used the SIOCETHTOOL ioctl to programmatically obtain the statistics counters for a network interface under Linux.

The motivation is that I want to be able to identify the weakest part of the system.

Are you achieving (near to) 100% bandwidth on the Ethernet link during the test?

In the past when looking for errors in Ethernet in embedded systems, having test application which just exchanged data as quickly as possible over TCP sockets helped to identify failures more quickly. To achieve full link bandwidth using TCP the test programs need to use sufficient buffer sizes in the sockets.

Edit 1:

I'm conducting Electromagnetic Interference (EMI) testing on Ethernet setups running Windows and Linux.

As for Windows, I haven't yet attempted to obtain statistics. On a quick search found:

  1. Any Windows alternative to Unix utility Ethtool for autonegotiation of ethernet? answer on stack overflow which shows an example of Windows PowerShell to obtain the speed/duplex/autonegotiation of a single interface.
  2. Get-NetAdapterStatistics in the Windows PowerShell documentation which is described as:

    The Get-NetAdapterStatistics cmdlet gets networking statistics from a network adapter. The statistics include broadcast, multicast, discards, and errors.

  • \$\begingroup\$ I have not tried to test the bandwidth so far but the idea about debug application that is sending data with full bandwidth is nice. However, I feel that it would not really take me closer to my goal in this case. The information you provided about ethtool and udp_broadcast.c is just what I was looking for. If you could find similiar information for Windows, I could accept your answer. \$\endgroup\$
    – Trafi
    Commented Dec 3, 2023 at 17:29
  • \$\begingroup\$ @Trafi I have edited the answer to include similar information for Windows. Albeit (a) haven't tried it myself (b) only describes using PowerShell. Getting network statistics in C using the Netapi32 library suggests the NetStatisticsGet function might allow access to the interface statistics from C code. \$\endgroup\$ Commented Dec 3, 2023 at 18:02
  • \$\begingroup\$ Thanks for the suggestions. It is not yet clear to me how to get the adapter status vs. the link status using these tools but they seem promising. \$\endgroup\$
    – Trafi
    Commented Dec 3, 2023 at 19:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.