Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieving irq number of a NIC

Tags:

c

linux

I need to retrieve an interrupt number of interface by its' name as appears in ifconfig.

Is there some standard API to do it?

like image 337
dimba Avatar asked Oct 28 '25 05:10

dimba


2 Answers

The interrupt number lives in sysfs. Look for the file /sys/class/net/[ethname]/device/irq. For example:

more /sys/class/net/*/device/irq
::::::::::::::
/sys/class/net/eth0/device/irq
::::::::::::::
30
::::::::::::::
/sys/class/net/eth1/device/irq
::::::::::::::
29
like image 152
Adrian Cox Avatar answered Oct 30 '25 21:10

Adrian Cox


/sys/class/net/[ethname]/device/irq should legacy irq number, device may not be using legacy irq, it may be using msix.

check

$ ls /sys/class/net/eth0/device/msi_irqs/

or

$ grep eth0 /proc/interrupts
like image 29
Govindarajulu Varadarajan Avatar answered Oct 30 '25 22:10

Govindarajulu Varadarajan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!