What is the most reliable way to programmatically determine the IRQs associated with a network interface, given the name of the interface (e.g. eth0)?

I'm okay with a best-effort approach, but I'd like it to work across a wide variety of drivers/configurations (i.e. without special handling for each driver), and I'd like to avoid false positives. I'd also like to avoid violating the rules for interacting with sysfs outlined here, but I'm okay with breaking them if necessary. I'll break them in the examples below.

Parsing /proc/interrupts is not ideal because the the names associated with the IRQs are driver-specific, and not reliable because there's nothing preventing two devices from having IRQs with the same name.

It would be nice if I could just do something like the following:

$ ls /sys/class/net/eth2/device/msi_irqs | cat /sys/class/net/eth2/device/irq
61  62  63

I've verified that these are the IRQs I'm looking for in this case using /proc/interrupts.

But this doesn't work for all drivers. The IRQ files of interest are at different places, or nowhere to be found.

vmxnet3 interface:

$ readlink -e /sys/class/net/eth2

$ ls $(readlink -e /sys/class/net/eth2)/../../msi_irqs
61  62  63

The msi_irqs of interest are two directories up from the /sys/class/net/eth2 symlink. The msi_irqs three directories up are not relevant to me.

virtio interface:

$ readlink -e /sys/class/net/eth1

ls $(readlink -e /sys/class/net/eth1)/../../../msi_irqs
26  27  28

The msi_irqs of interest are three directories up from the /sys/class/net/eth1 symlink. There are no other msi_irqs files in this hierarchy.

hv_netvsc interface:

$ readlink -e /sys/class/net/eth0

The IRQ info doesn't seem to be in sysfs. I have to resort to grepping /proc/interrupts for the one and only "hyperv" IRQ.

The method I've resorted to using is searching from the directory at $(readlink -e /sys/class/net/eth0) up to but not including /sys/devices/pci<domain>:<bus>/ for the msi_irqs or irq file . My concern is that I could get the wrong IRQs by doing this. Maybe there is some reason the IRQs associated with the interface won't be published to msi_irqs or irq, but an ancestor device's IRQs will be published. I'll end up with the ancestor device's IRQs, which may not be what I want.

Is there a better way to reliably determine the IRQs associated with a network interface? If not, can the method described above return IRQs not associated with the interface?

1 Answer 1


Have you tried dstat ?

in case of my enp025 Ethernet interface for example :

dstat -i -N enp0s25 ----interrupts--- 33 34 35

5     0     0 
6     0     0 
8     0    26 
9     0     0 
7     0     0 
10     0     0 

for doing more stuff , read the man page:


NAME dstat - versatile tool for generating system resource statistics

SYNOPSIS dstat [-afv] [options..] [delay [count]]

DESCRIPTION Dstat is a versatile replacement for vmstat, iostat and ifstat. Dstat overcomes some of the limitations and adds some extra features.

   Dstat allows you to view all of your system resources instantly, you can eg. compare disk usage in combination with interrupts from
   your IDE controller, or compare the network bandwidth numbers directly with the disk throughput (in the same interval).

   Dstat also cleverly gives you the most detailed information in columns and clearly indicates in what magnitude and unit the output is
   displayed. Less confusion, less mistakes, more efficient.

   Dstat is unique in letting you aggregate block device throughput for a certain diskset or network bandwidth for a group of interfaces,
   ie. you can see the throughput for all the block devices that make up a single filesystem or storage system.

   Dstat allows its data to be directly written to a CSV file to be imported and used by OpenOffice, Gnumeric or Excel to create graphs.

   Users of Sleuthkit might find Sleuthkit’s dstat being renamed to datastat to avoid a name conflict. See Debian bug #283709 for more

OPTIONS -c, --cpu enable cpu stats (system, user, idle, wait, hardware interrupt, software interrupt)

   -C 0,3,total
          include cpu0, cpu3 and total (when using -c/--cpu)

   -d, --disk
          enable disk stats (read, write)

   -D total,hda
          include total and hda (when using -d/--disk)

   -g, --page
          enable page stats (page in, page out)

   -i, --int
          enable interrupt stats

   -I 5,10
          include interrupt 5 and 10 (when using -i/--int)

   -l, --load
          enable load average stats (1 min, 5 mins, 15mins)

   -m, --mem
          enable memory stats (used, buffers, cache, free)

   -n, --net
          enable network stats (receive, send)
   -N eth1,total
          include eth1 and total (when using -n/--net)

   -p, --proc
          enable process stats (runnable, uninterruptible, new)

   -r, --io
          enable I/O request stats (read, write requests)

   -s, --swap
          enable swap stats (used, free)

   -S swap1,total
          include swap1 and total (when using -s/--swap)

   -t, --time
          enable time/date output

   -T, --epoch
          enable time counter (seconds since epoch)

   -y, --sys
          enable system stats (interrupts, context switches)

   --aio  enable aio stats (asynchronous I/O)

   --fs, --filesystem
          enable filesystem stats (open files, inodes)

   --ipc  enable ipc stats (message queue, semaphores, shared memory)


and a lot of other options.

see also : lspci -v -x

  • Unfortunately, dstat -i (-n) -N <ifname> doesn't seem to show the IRQs associated with the interface. I don't see a way of getting that info from dstat. Apr 8, 2016 at 20:39
  • use dstat -i -N <interfacename>
    – Ijaz Ahmad
    Apr 9, 2016 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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