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)) { status = EINVAL;

break;

}

break;

2

1

2

Determines whether the cmd argument is SIOCSMACSPEED.

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); break;

2

1

2

Determines whether the cmd argument is SIOCIFRESET.

Calls the el_reset_locked( ) routine to restart the network interface.

12.16Setting 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)) { status = EINVAL;

break;

}

3

if ((ifc->ifc_auto_sense == LAN_AUTOSENSE_ENABLE) && (ifc->ifc_media_type != -1)) {

status = EINVAL; break;

}

4

Implementing the ioctl Section 12–11

Page 135
Image 135
Compaq AA-RNG2A-TE manual Resetting the Device Siocifreset ioctl Command