Quick Reference
This section provides a reference for the concepts introduced in this
chapter. It also explains the role of each header file that a driver
needs to include. The lists of fields in the
net_device and sk_buff
structures, however, are not repeated here.
-
#include <linux/netdevice.h> This header hosts the definitions of
struct net_deviceandstruct net_device_stats, and includes a few other headers that are needed by network drivers.-
int register_netdev(struct net_device *dev);,void unregister_netdev(struct net_device *dev); Register and unregister a network device.
-
SET_MODULE_OWNER(struct net_device *dev); This macro will store a pointer to the current module in the device structure (or in any structure with an
ownerfield, actually); it is used to enable the networking subsystem to manage the module’s use count.-
netif_start_queue(struct net_device *dev);,netif_stop_queue(struct net_device *dev);,netif_wake_queue(struct net_device *dev); These functions control the passing of packets to the driver for transmission. No packets will be transmitted until netif_start_queue has been called. netif_stop_queue suspends transmission, and netif_wake_queue restarts the queue and pokes the network layer to restart transmitting packets.
-
void netif_rx(struct sk_buff *skb); This function can be called (including at interrupt time) to notify the kernel that a packet has been received and encapsulated into a socket buffer.
-
#include <linux/if.h> Included ...