Initializing The Media Address And Media Header Lengths - Compaq Tru64 UNIX Installation Manual

Writing network device drivers
Table of Contents

Advertisement

of the controller. The bus configuration code passes this initialized
controller data structure to the driver's probe and attach
interfaces.
Declares a unit variable and initializes it to the controller number for
2
this controller. This controller number identifies the specific 3Com
3C5x9 controller that is being attached. The controller number is
contained in the ctlr_num member of the controller data structure
for this device.
Declares a pointer to the el_softc data structure called sc and
3
initializes it to the el_softc data structure for this device. The
controller number (which is stored in the unit variable) is used as an
index into the array of el_softc data structures to determine which
el_softc data structure is associated with this device.
Declares a pointer to an ifnet data structure called ifp and initializes
4
it to the address of the ifnet data structure for this device.
Declares a pointer to a sockaddr_in data structure called sin.
5
6.2 Initializing the Media Address and Media Header
Lengths
The el_attach( ) routine sets up the media's address length and header
length, as follows:
if (!sc->reprobe) {
ctlr->alive |= ALV_STATIC;
ifp->if_addrlen = 6;
ifp->if_hdrlen =
sizeof(struct ether_header) + 8;
Examines the value of the reprobe member of the driver's softc data
1
structure to determine whether the user has reinserted the PCMCIA
card. If the card has been reinserted, the driver skips to the code in
Section 6.10.
Because the if_el device driver must always be linked into the kernel,
2
sets the ALV_STATIC bit. If your driver can be dynamically loaded, set
the ALV_NOSIZER bit instead.
Sets the if_addrlen member of the ifnet data structure for this
3
device to the media address length, which in this case is 6 bytes (the
IEEE standard 48-bit address).
Sets the if_hdrlen member of the ifnet data structure for this
4
device to the media header length. The el_attach( ) routine uses the
sizeof operator to return the size of the data structure because it can
differ from one network type to another. In this example, the media
6–2 Implementing the Autoconfiguration Support Section (attach)
1
2
3
4

Advertisement

Table of Contents
loading

Table of Contents