Instead of registering its entry points in a
dsent
data structure, a network
driver registers its entry points with the upper layers of the Tru64 UNIX
operating system in an
ifnet
data structure. For example, a network driver
registers entry points for queueing data for transmission and for starting
data transmission.
In addition to storing the entry points for a network driver’s associated
interfaces, the
ifnet
data structure stores parameter-related information
such as the transmission medium and statistics to track the performance of
the interface and network.
The
ifnet
data structure also contains a queue of data packets that the
network driver sends to the network device. These packets are linked lists
of
mbuf
data structures. Each such linked list represents one data packet.
Depending on how a network driver fills in certain members of the
ifnet
data structure, the upper-level network code fragments the data to be sent
out over a network. In the case of the Ethernet network interface, the
upper-level code never hands off to the driver a single packet that exceeds
1514 bytes.
1.1 Include Files Section for a Network Driver
A network device driver includes header files that define data structures
and constant values that the driver references. A network device driver
includes some of the same files as a block or character device driver, such as
errno.h
. It can also include the header files that are specific to network
device drivers. For example:
#include <net/net_globals.h>
#include <sys/socket.h>
#include <net/if.h>
#include <net/if_types.h>
The following code shows the include files section for the
if_el
device driver:
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
#include <sys/buf.h>
#include <sys/protosw.h>
#include <sys/socket.h>
#include <sys/vmmac.h>
#include <vm/vm_kern.h>
#include <sys/ioctl.h>
1
#include <sys/errno.h>
#include <sys/time.h>
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/sysconfig.h>
2
#include <net/if.h>
#include <net/netisr.h>
#include <net/route.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/in_var.h>
Network Device Driver Environment 1–3