Messages in this thread | | | From | Willem de Bruijn <> | Date | Mon, 29 Apr 2019 12:15:52 -0400 | Subject | Re: [PATCH] net-sysfs: expose IRQ number |
| |
On Mon, Apr 29, 2019 at 2:01 AM Rafał Miłecki <zajec5@gmail.com> wrote: > > From: Rafał Miłecki <rafal@milecki.pl> > > Knowing IRQ number makes e.g. reading /proc/interrupts much simpler. > It's more reliable than guessing device name used by a driver when > calling request_irq(). > > Signed-off-by: Rafał Miłecki <rafal@milecki.pl> > --- > I found a script parsing /proc/interrupts for a given interface name. It wasn't > working for me as it assumed request_irq() was called with a device name. It's > not a case for all drivers. > > I also found some other people looking for a proper solution for that: > https://unix.stackexchange.com/questions/275075/programmatically-determine-the-irqs-associated-with-a-network-interface > https://stackoverflow.com/questions/7516984/retrieving-irq-number-of-a-nic > > Let me know if this solution makes sense. I can say it works for me ;)
If parsing /proc/interrupts is problematic, also see the /sys/kernel/irq interface added in commit ecb3f394c5db ("genirq: Expose interrupt information through sysfs"). Does that address your use-case as well? Though it does the inverse mapping from IRQ to name.
Another practical issue is that many network devices register more than one interrupt. Perhaps one control interrupt, plus one per receive queue and possibly one per transmit queue. Unfortunately those cannot be identified in a driver-independent manner. Because an interface /sys/class/net/$DEV/queues/rx-$i/irq would be useful.
| |