Resetting The Device (Siocifreset Ioctl Command); Setting Device Characteristics (Siocifsetchar Ioctl Command) - Compaq Tru64 UNIX Installation Manual

Writing network device drivers
Table of Contents

Advertisement

SIOCSMACSPEED and SIOCIFSETCHAR ioctl commands perform some of
the same tasks.)
case SIOCSMACSPEED:
bcopy(ifr->ifr_data, (u_char *)&speed, sizeof(u_short));
if ((speed != 0) && (speed != 10)) {
status = EINVAL;
break;
}
break;
Determines whether the cmd argument is SIOCSMACSPEED.
1
If the LAN speed passed is anything other than 10 (0 means no change),
2
fails the request. (The if_el device can only operate at 10 Mb per
second.)

12.15 Resetting the Device (SIOCIFRESET ioctl Command)

The following code shows how the el_ioctl( ) routine implements
the SIOCIFRESET ioctl command to reset the device. Support for the
SIOCIFRESET command is optional. You can choose whether or not your
driver supports it.
case SIOCIFRESET:
el_reset_locked(sc, ifp, unit);
break;
Determines whether the cmd argument is SIOCIFRESET.
1
Calls the el_reset_locked( ) routine to restart the network interface.
2
12.16 Setting Device Characteristics (SIOCIFSETCHAR
ioctl Command)
The following code shows how the el_ioctl( ) routine implements the
SIOCIFSETCHAR ioctl command to set characteristics:
case SIOCIFSETCHAR:
need_reset = 0;
if ((ifc->ifc_media_speed != -1) && (ifc->ifc_media_speed != 10)) {
status = EINVAL;
break;
}
if ((ifc->ifc_auto_sense == LAN_AUTOSENSE_ENABLE) &&
(ifc->ifc_media_type != -1)) {
status = EINVAL;
break;
}
1
2
1
2
1
2
Implementing the ioctl Section 12–11
3
4

Advertisement

Table of Contents
loading

Table of Contents