Query on usage of Netlink
Subsystems (2)
Hi All,
We have a requirement where-in we want to communicate the status of modem (whether modem is online or offline) from linux driver to user-space components. So that user-space components stop sending data to linux driver for communicating with modem, in case modem goes offline.
We have decided to use the netlink mechanism to achieve this. We intend to send an integer value, defined in enum, to user-space indicating the current modem status.
For this, we want to know what Netlink message type should we use? Should we use some existing Netlink type? Will there be any risk of getting other messages (the ones not sent by our driver) if using existing Netlink message type? For e.g. if we use the existing type NETLINK_ROUTE then, user-space may un-necessary receive netlink notification for route changes.
Or should we define a custom Netlink type in include/linux/netlink.h?
Thank you for suggestions.
Best regards,
Kumar.
Quoted 5 lines · Kumar SANGHVI
We have a requirement where-in we want to communicate the status of modem (whether modem is online or offline) from linux driver to user-space components. So that user-space components stop sending data to linux driver for communicating with modem, in case modem goes offline.
Is the modem control state machine in kernel space, as for say, 802.11 devices?
Quoted 3 lines
We have decided to use the netlink mechanism to achieve this. We intend to send an integer value, defined in enum, to user-space indicating the current modem status.
(...)
Quoted 1 line
Or should we define a custom Netlink type in
include/linux/netlink.h?
Did you consider using kobject and uevents (which are internally running on top of Netlink)?
Signature · 3 lines
Rémi Denis-Courmont http://www.remlab.net http://fi.linkedin.com/in/remidenis
Hi Rémi Denis-Courmontt,
Quoted 11 lines · Rémi Denis-Courmont
Quoted 5 lines · Kumar SANGHVI
We have a requirement where-in we want to communicate the status of modem (whether modem is online or offline) from linux driver to user-space components. So that user-space components stop sending data to linux driver for communicating with modem, in case modem goes offline.
Is the modem control state machine in kernel space, as for say, 802.11 devices?
State machine to keep track of current modem state is in kernel driver. Kernel driver can know when modem goes offline or when modem is back online.
Quoted 8 lines
Quoted 3 lines
We have decided to use the netlink mechanism to achieve this. We intend to send an integer value, defined in enum, to user-space indicating the current modem status.
(...)
Quoted 1 line
Or should we define a custom Netlink type in
include/linux/netlink.h?Did you consider using kobject and uevents (which are internally running on top of Netlink)?
Yes. However, I believe kobject and uevents require some user-space daamon like udev which can dispatch the specific uevents to user-space apps. This user-space daemon then becomes something application framework specific.
Another option is that user-space app itself open up a netlink socket of type KOBJECT_UEVENT. But then, user-space will have to filter out un-necessary uevents out of it.
Best regards,
Kumar.