12
Implementing the ioctl Section
The ioctl section of a network device driver contains the code that implements
a network device driver’s
ioctl
interface. The
ioctl
interface performs
miscellaneous tasks that have nothing to do with data packet transmission
and reception. Typically, it turns specific features of the hardware on or off.
The
el_ioctl( )
routine performs the following tasks:
•
Determines whether the user has removed the PCMCIA card from the
slot (Section 12.2)
•
Sets the IPL and obtains the simple lock (Section 12.3)
•
Recognizes the
ioctl
command and performs the appropriate
operations. Table 12–1 lists the
ioctl
commands that network device
drivers must recognize.
•
Releases the simple lock and resets the IPL (Section 12.17)
Table 12–1: Network ioctl Commands
ioctl Command
Required
Description
For More Information
SIOCENABLBACK
No
Enables loopback
mode.
Section 12.4
SIOCDISABLBACK
No
Disables loopback
mode.
Section 12.5
SIOCRPHYSADDR
Yes
Returns the current
and default MAC
addresses.
Section 12.6
SIOCSPHYSADDR
Yes
Sets the local MAC
address.
Section 12.7
SIOCADDMULTI
Yes
Adds the device to a
multicast group.
Section 12.8
SIOCDELMULTI
Yes
Removes the device
from a multicast
group.
Section 12.9
SIOCRDCTRS
Yes
Reads counters.
Section 12.10
SIOCRDZCTRS
Yes
Reads and zeros
counters.
Section 12.10
SIOCSIFADDR
Yes
Brings up the device.
Section 12.11
Implementing the ioctl Section 12–1