The netlink sample application for the virtual loopback driver that we are developing is provided at this place. We will analyze the code with respect to the various aspects of how a generic netlink connection would work in this case. The first thing that we achieve is to open a netlink socket and connect to […]
Sample generic Netlink application for virtual network loop back driver
We added the generic netlink functionality to our loopback network driver. The code for the same can be found in this article_link. Now, we develop a sample application and analyze as to what is being performed by the sample application to send a command to the kernel module handling the netlink command. The sample code […]
Understanding the Netlink code for the loopback driver
Let us understand the new netlink code that was added to the loopback network driver we are developing in the previous article. We will look at specific snippets and understand what they mean. The name of the netlink family we are attempting to create is “vnet_nl“. The version of the NETLINK family is 1 which […]
Adding Generic Netlink interface to loopback driver
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 […]