Printing A Success Message; Specifying The Network Driver Interfaces - Compaq Tru64 UNIX Installation Manual

Writing network device drivers
Table of Contents

Advertisement

6.5 Printing a Success Message

The following code shows how the el_attach( ) routine prints a success
message:
printf("el%d: %s, hardware address: %s\n", unit,
ifp->if_version, ether_sprintf(sc->is_addr));
Calls the printf( ) routine to display the following information
1
message on the console terminal:
The controller number that is stored in the unit variable.
The version of the network interface that is stored in the
if_version member of the ifnet data structure pointer.
The hardware address that is accessed through the is_addr
member of the el_softc data structure for this device. The if_el
device driver maps the ac_enaddr member of the arpcom data
structure to the alternate name is_addr.
The argument list that is passed to printf( ) contains a call to the
ether_sprintf( ) routine. The ether_sprintf( ) routine converts
an Ethernet address to a printable ASCII string representation.
Make sure that your driver prints a similar message during its attach( )
routine.

6.6 Specifying the Network Driver Interfaces

The following code shows how the el_attach( ) routine specifies the
network driver interfaces for the if_el driver:
ifp->if_ioctl = el_ioctl;
ifp->if_watchdog = el_watch;
ifp->if_start = (int (*)())el_start;
mb();
ifp->if_output = ether_output;
mb();
ifp->if_flags = IFF_BROADCAST|IFF_MULTICAST|
ifp->if_timer = 0;
ifp->if_sysid_type = 0;
ifp->if_version = "3Com EtherLink III";
Sets the if_ioctl member of the ifnet data structure for this device
1
to el_ioctl, which is the if_el device driver's ioctl interface.
Sets the if_watchdog member of the ifnet data structure for this
2
device to el_watch, which is the if_el device driver's watchdog
interface.
6–6 Implementing the Autoconfiguration Support Section (attach)
1
2
3
4
IFF_NOTRAILERS|IFF_SIMPLEX;
6
7
8
1
5

Advertisement

Table of Contents
loading

Table of Contents