In the previous article (placed here), we incorporated multiple networking transmit and receive queues for the loopback networking device driver that we are developing. In this article, we will introduce the Netlink interface to the driver. We will incorporate a Generic Netlink family and register it with the Generic Netlink sub-system. The interested reader can […]
Use alloc_netdev_mqs to incorporate multiple TX/RX networking queues
In the previous article (expained here), we described the alloc_netdev_mqs API and how it allows the networking device to create multiple transmit and receive queues for itself which leads to better network resource usage. In our current series of articles, where we are adding functionality to a simple networking loopback driver, having multiple transmit and […]
A brief understanding of alloc_netdev_mqs
In the previous articles, we used alloc_netdev to allocate and initialize a netdevice structure. The usage of alloc_netdev creates a network device with a single transmit and receive queue. This can be seen by its MACRO definition in netdevice.h. If the network device supports multiple hardware transmit and receive queues, It is better to map […]
Adding multiple TX/RX queues to loopback device driver
Now that we have added an IOCTL mechanism to the loopback driver (article here), we will update the loopback device driver to support multiple device driver queues for transmit and receive. The device driver still processes the packet in one go. No locking mechanisms are placed in code to protect data at present. The queues […]
Sample application to send IOCTL to virtual loopback networking driver
The IOCTL loopback driver can be found in this article (here). The sample application is provided below The above code performs the following after the device driver is loaded. The output of the application is shown below. The output of the dmesg logs for the driver is shown below We have steadily added more functionality […]
Adding IOCTL interface to networking loopback device driver
The loopback driver was introduced to readers in this article (here). We will now add an IOCTL interface to the loopback network device driver. The netdevice operations structure net_device_ops provides a function registration for IOCTLs. In earlier versions of the Linux kernel, the OP callback in the net_device_ops structure was ndo_do_ioctl. However, this callback is […]
Understanding Input-Output Control (IOCTLs) in Linux
Input/Output controls (IOCTLs) are system calls that are used in the Linux operating system for device specific configuration as noted below If a specific setting or operation cannot be performed via any other means, then the IOCTL is the “goto” means to achieve that operation. There are various discussions on whether IOCTLs are good to […]
Sample application for Loopback network driver
For the loopback driver provided in the previous article, we write a simple RAW socket program to send a packet directly to the virtual network driver. The code is provided below for reference. The above code is pretty much self explanatory. However, a short description is provided below The loopback driver load and application output […]
Creating a loopback virtual network driver in Linux
In the previous article (provided here), we looked a t a skeleton network Linux device driver module. In the current article, we will add some more substance to the skeleton device driver by providing a path back up the stack. That is, a packet sent to the virtual network device driver will be sent up […]
Understanding GENERIC_NETLINK interface
The number of netlink families are 32. The netlink families which are presently available as of Kernel 6.13.2 are provided in the article here (Netlink Protocol Families). The number of protocol families were seen to be limited and needed a mechanism that would allow different independently defined Netlink families to be defined. To address this […]