Enabling Loopback Mode (Siocenablback Ioctl Command); Disabling Loopback Mode (Siocdisablback Ioctl Command) - Compaq Tru64 UNIX Installation Manual

Writing network device drivers
Table of Contents

Advertisement

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

Advertisement

Table of Contents
loading

Table of Contents