SIOCSMACSPEED
and
SIOCIFSETCHAR ioctl
commands perform some of
the same tasks.)
case SIOCSMACSPEED:
1
bcopy(ifr->ifr_data, (u_char *)&speed, sizeof(u_short));
if ((speed != 0) && (speed != 10)) {
2
status = EINVAL;
break;
}
break;
1
Determines whether the
cmd
argument is
SIOCSMACSPEED
.
2
If the LAN speed passed is anything other than 10 (0 means no change),
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:
1
el_reset_locked(sc, ifp, unit);
2
break;
1
Determines whether the
cmd
argument is
SIOCIFRESET
.
2
Calls the
el_reset_locked( )
routine to restart the network interface.
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:
1
need_reset = 0;
2
if ((ifc->ifc_media_speed != -1) && (ifc->ifc_media_speed != 10)) {
3
status = EINVAL;
break;
}
if ((ifc->ifc_auto_sense == LAN_AUTOSENSE_ENABLE) &&
4
(ifc->ifc_media_type != -1)) {
status = EINVAL;
break;
}
Implementing the ioctl Section 12–11