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 list of fields in the device
and sk_buff structures, however, are not repeated here.
-
#include <linux/netdevice.h> This header hosts the definition of
struct deviceand includes a few other headers that are needed by network drivers.-
void netif_rx(struct sk_buff *skb); This function can be called at interrupt time to notify the kernel that a packet has been received and encapsulated into a socket buffer.
-
#include <linux/if.h> Included by
netdevice.h, this file declares the interface flags (IFF_macros) andstruct ifmap, which has a major role in the ioctl implementation for network drivers.-
#include <linux/if_ether.h>,ETH_ALEN,ETH_P_IP,struct ethhdr;,struct enet_statistics; Included by
netdevice.h,if_ether.hdefines all theETH_macros used to represent octet lengths (like the address length) and network protocols (like IP). It also defines the structuresethhdrandenet_statistics. Note thatenet_statistics, despite its name and the header in which it is defined, is used by all interfaces, not just Ethernet ones.-
#include <linux/skbuff.h> The definition of
struct sk_buffand related structures, as well as several inline functions to act on the buffers. This header is included bynetdevice.h.-
#include <linux/etherdevice.h>,void ether_setup(struct device *dev); This function sets most device ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access