Compaq AA-RNG2A-TE Network Card User Manual


 
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.4 Enabling 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
ifp->if_flags |= IFF_LOOPBACK; 3
if (ifp->if_flags & IFF_RUNNING) 4
el_reset_locked(sc, ifp, unit);
break;
1 Evaluates the value passed in through the cmd argument to determine
which ioctl command the caller has requested.
2 Determines whether the cmd argument is SIOCENABLBACK.
3 Sets the IFF_LOOPBACK bit in the if_flags member of the ifnet data
structure for this device.
4 If the device is running, calls the el_reset_locked( ) routine to
restart the network interface in loopback mode.
12.5 Disabling 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
ifp->if_flags &= ~IFF_LOOPBACK; 2
if (ifp->if_flags & IFF_RUNNING) 3
el_reset_locked(sc, ifp, unit);
break;
1 Determines whether the cmd argument is SIOCDISABLBACK.
2 Clears the IFF_LOOPBACK bit in the if_flags member of the ifnet
data structure for this device.
3 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.
124 Implementing the ioctl Section