2
Marks the interface as up and calls the
el_reset_locked( )
routine
to start the network interface with the current settings.
3
Sets the counter cleared time (used by DECnet, netstat, clusters, and so
forth).
12.12 Using Currently Set Flags (SIOCSIFFLAGS ioctl
Command)
The following code shows how the
el_ioctl( )
routine implements the
SIOCSIFFLAGS ioctl
command to reset the device using currently set flags:
case SIOCSIFFLAGS:
1
if (ifp->if_flags & IFF_RUNNING)
2
el_reset_locked(sc, ifp, unit);
break;
1
Determines whether the
cmd
argument is
SIOCSIFFLAGS
.
2
If the 3Com 3C5x9 device is running, calls the
el_reset_locked( )
routine to restart the network interface with the current flag settings.
12.13 Setting the IP MTU (SIOCSIPMTU ioctl Command)
The following code shows how the
el_ioctl( )
routine implements the
SIOCSIPMTU ioctl
command to set the IP MTU. You must implement this
task in your network driver to accommodate the IP layer.
case SIOCSIPMTU:
1
bcopy(ifr->ifr_data, (u_char *)&ifmtu, sizeof(u_short));
if (ifmtu > ETHERMTU || ifmtu < IP_MINMTU)
2
status = EINVAL;
else {
ifp->if_mtu = ifmtu;
lan_set_attribute(sc->ehm.current_val, NET_MTU_NDX, (void *)ifmtu);
}
break;
1
Determines whether the
cmd
argument is
SIOCSIPMTU
.
2
Compares the passed value to the media’s maximum and minimum
values. If this value is not within the range allowed, the driver
returns an error. Otherwise, it sets the
if_mtu
member of the driver’s
ifnet
data structure to the specified IP MTU value. Also, updates
the corresponding hardware attribute in the enhanced hardware
management (EHM) database.
12.14 Setting the Media Speed (SIOCSMACSPEED ioctl
Command)
The following code shows how the
el_ioctl( )
routine implements
the
SIOCSMACSPEED ioctl
command to set the media speed. (The
12–10 Implementing the ioctl Section