2
3
4
5
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 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 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 it to the address of the ifnet data structure for this device.
Declares a pointer to a sockaddr_in data structure called sin.
6.2Initializing the Media Address and Media Header Lengths
The el_attach( ) routine sets up the media’s address length and header length, as follows:
if
1
2
4
sizeof(struct ether_header) + 8;
1
2
3
4
Examines the value of the reprobe member of the driver’s softc data 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, 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 device to the media address length, which in this case is 6 bytes (the IEEE standard
Sets the if_hdrlen member of the ifnet data structure for this 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