I'm writing a linux kernel module that needs to be notified when a link goes up/down, now I've read that I can open a netlink socket
and listen to the RTMGRP_LINK
(network interface create/delete/up/down events) multicast groups, but this is used from user space... any one knows how to catch this interrupt from kernel space?
I'm using kernel 2.6.35
With the CPU keyword, the number of each individual interrupt received per second by the CPU or CPUs is displayed. Interrupts are those listed in /proc/interrupts file.
An interrupt is simply a signal that the hardware can send when it wants the processor's attention. Linux handles interrupts in much the same way that it handles signals in user space. For the most part, a driver need only register a handler for its device's interrupts, and handle them properly when they arrive.
However, such kernel control paths may be arbitrarily nested; an interrupt handler may be interrupted by another interrupt handler, thus giving raise to a nested execution of kernel threads.
An IRQ is an interrupt request from a device. Currently they can come in over a pin, or over a packet. Several devices may be connected to the same pin thus sharing an IRQ. An IRQ number is a kernel identifier used to talk about a hardware interrupt source.
Look in <linux/netdevice.h>
, specifically the stuff about the netdev notifier chain. You can call register_netdevice_notifier()
to register a callback that (among many other event types) will receive NETDEV_UP
and NETDEV_DOWN
events.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With