
you call simple_unlock( ) to release it. Because simple locks are spin locks, simple_lock( ) does not return until the lock has been obtained.
12.4Enabling Loopback Mode (SIOCENABLBACK ioctl Command)
The following code shows how the el_ioctl( ) routine implements the SIOCENABLBACK ioctl command to enable loopback mode when an application requests it. Support for the SIOCENABLBACK command is optional. You can choose whether or not your driver supports it.
switch (cmd) {
1
case SIOCENABLBACK: 2
el_reset_locked(sc, ifp, unit); break;
4
1
2
3
4
Evaluates the value passed in through the cmd argument to determine which ioctl command the caller has requested.
Determines whether the cmd argument is SIOCENABLBACK.
Sets the IFF_LOOPBACK bit in the if_flags member of the ifnet data structure for this device.
If the device is running, calls the el_reset_locked( ) routine to restart the network interface in loopback mode.
12.5Disabling Loopback Mode (SIOCDISABLBACK ioctl Command)
The following code shows how the el_ioctl( ) routine implements the SIOCDISABLBACK ioctl command to disable loopback mode when an application requests it. Support for the SIOCDISABLBACK command is optional. However, if your driver supports SIOCENABLBACK, it must support
SIOCDISABLBACK.
case SIOCDISABLBACK: 1
break;
2
3
1
2
3
Determines whether the cmd argument is SIOCDISABLBACK.
Clears the IFF_LOOPBACK bit in the if_flags member of the ifnet data structure for this device.
If the device is running, calls the el_reset_locked( ) routine. The el_reset_locked( ) routine calls el_init_locked( ), which restarts the network interface in normal mode.